X Tutup
Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public AndroidSystemServices() {
registeredServices.put("android.appwidget.AppWidgetManager", "android.content.Context.APPWIDGET_SERVICE");
registeredServices.put("android.media.AudioManager", "android.content.Context.AUDIO_SERVICE");
registeredServices.put("android.app.backup.IBackupManager", "android.content.Context.BACKUP_SERVICE");
registeredServices.put("android.os.BatteryManager", "android.content.Context.BATTERY_SERVICE");
registeredServices.put("android.bluetooth.BluetoothManager", "android.content.Context.BLUETOOTH_SERVICE");
registeredServices.put("android.hardware.camera2.CameraManager", "android.content.Context.CAMERA_SERVICE");
registeredServices.put("android.view.accessibility.CaptioningManager", "android.content.Context.CAPTIONING_SERVICE");
Expand All @@ -50,36 +51,51 @@ public AndroidSystemServices() {
registeredServices.put("android.hardware.display.DisplayManager", "android.content.Context.DISPLAY_SERVICE");
registeredServices.put("android.app.DownloadManager", "android.content.Context.DOWNLOAD_SERVICE");
registeredServices.put("android.os.DropBoxManager", "android.content.Context.DROPBOX_SERVICE");
registeredServices.put("android.net.EthernetManager", "android.content.Context.ETHERNET_SERVICE");
registeredServices.put("android.service.fingerprint.FingerprintManager", "android.content.Context.FINGERPRINT_SERVICE");
registeredServices.put("android.hardware.hdmi.HdmiControlManager", "android.content.Context.HDMI_CONTROL_SERVICE");
registeredServices.put("android.hardware.input.InputManager", "android.content.Context.INPUT_SERVICE");
registeredServices.put("android.view.inputmethod.InputMethodManager", "android.content.Context.INPUT_METHOD_SERVICE");
registeredServices.put("android.app.job.JobScheduler", "android.content.Context.JOB_SCHEDULER_SERVICE");
registeredServices.put("android.app.KeyguardManager", "android.content.Context.KEYGUARD_SERVICE");
registeredServices.put("android.content.pm.LauncherApps", "android.content.Context.LAUNCHER_APPS_SERVICE");
registeredServices.put("android.view.LayoutInflater", "android.content.Context.LAYOUT_INFLATER_SERVICE");
registeredServices.put("android.location.LocationManager", "android.content.Context.LOCATION_SERVICE");
registeredServices.put("android.media.projection.MediaProjectionManager", "android.content.Context.MEDIA_PROJECTION_SERVICE");
registeredServices.put("android.media.MediaRouter", "android.content.Context.MEDIA_ROUTER_SERVICE");
registeredServices.put("android.media.session.MediaSessionManager", "android.content.Context.MEDIA_SESSION_SERVICE");
registeredServices.put("android.net.NetworkScoreManager", "android.content.Context.NETWORK_SCORE_SERVICE");
registeredServices.put("android.net.NetworkManagementService", "android.content.Context.NETWORKMANAGEMENT_SERVICE");
registeredServices.put("android.net.NetworkPolicyManager", "android.content.Context.NETWORK_POLICY_SERVICE");
registeredServices.put("android.net.NetworkStatsService", "android.content.Context.NETWORK_STATS_SERVICE");
registeredServices.put("android.nfc.NfcManager", "android.content.Context.NFC_SERVICE");
registeredServices.put("android.app.NotificationManager", "android.content.Context.NOTIFICATION_SERVICE");
registeredServices.put("android.net.nsd.NsdManager", "android.content.Context.NSD_SERVICE");
registeredServices.put("android.service.persistentdata.PersistentDataBlockManager", "android.content.Context.PERSISTENT_DATA_BLOCK_SERVICE");
registeredServices.put("android.print.PrintManager", "android.content.Context.PRINT_SERVICE");
registeredServices.put("android.os.PowerManager", "android.content.Context.POWER_SERVICE");
registeredServices.put("android.content.RestrictionsManager", "android.content.Context.RESTRICTIONS_SERVICE");
registeredServices.put("android.app.SearchManager", "android.content.Context.SEARCH_SERVICE");
registeredServices.put("android.hardware.SerialManager", "android.content.Context.SERIAL_SERVICE");
registeredServices.put("android.hardware.SensorManager", "android.content.Context.SENSOR_SERVICE");
registeredServices.put("android.net.sip.SipManager", "android.content.Context.SIP_SERVICE");
registeredServices.put("android.app.StatusBarManager", "android.content.Context.STATUS_BAR_SERVICE");
registeredServices.put("android.os.storage.StorageManager", "android.content.Context.STORAGE_SERVICE");
registeredServices.put("android.telephony.SubscriptionManager", "android.content.Context.TELEPHONY_SUBSCRIPTION_SERVICE");
registeredServices.put("android.telecom.TelecomManager", "android.content.Context.TELECOM_SERVICE");
registeredServices.put("android.telephony.TelephonyManager", "android.content.Context.TELEPHONY_SERVICE");
registeredServices.put("android.view.textservice.TextServicesManager", "android.content.Context.TEXT_SERVICES_MANAGER_SERVICE");
registeredServices.put("android.net.ThrottleManager", "android.content.Context.THROTTLE_SERVICE");
registeredServices.put("android.media.tv.TvInputManager", "android.content.Context.TV_INPUT_SERVICE");
registeredServices.put("android.app.UiModeManager", "android.content.Context.UI_MODE_SERVICE");
registeredServices.put("android.os.IUpdateLock", "android.content.Context.UPDATE_LOCK_SERVICE");
registeredServices.put("android.app.usage.UsageStatsManager", "android.content.Context.USAGE_STATS_SERVICE");
registeredServices.put("android.hardware.usb.UsbManager", "android.content.Context.USB_SERVICE");
registeredServices.put("android.os.UserManager", "android.content.Context.USER_SERVICE");
registeredServices.put("android.os.Vibrator", "android.content.Context.VIBRATOR_SERVICE");
registeredServices.put("android.app.WallpaperManager", "android.content.Context.WALLPAPER_SERVICE");
registeredServices.put("android.net.wifi.WifiManager", "android.content.Context.WIFI_SERVICE");
registeredServices.put("android.net.wifi.passpoint.WifiPasspointManager", "android.content.Context.WIFI_PASSPOINT_SERVICE");
registeredServices.put("android.net.wifi.p2p.WifiP2pManager", "android.content.Context.WIFI_P2P_SERVICE");
registeredServices.put("android.view.WindowManager", "android.content.Context.WINDOW_SERVICE");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public class ActivityWithServices extends Activity {
// @SystemService
// IBackupManager backupManager; // hidden API

// TODO API 21
// @SystemService
// BatteryManager natteryManager;

// TODO API 18
// @SystemService
// BluetoothManager bluetoothManager;
Expand Down Expand Up @@ -121,25 +125,53 @@ public class ActivityWithServices extends Activity {
@SystemService
DropBoxManager dropBoxManager;

// @SystemService
// EthernetManager ethernetManager; // hidden API
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hidden API?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no issue. just saw that and wonderd what it means. i'm ok with it if it works. have you tested to use that to inject a field? i once played with an hidden api and had to use reflection to use it as the android.jar that is used for compilation did not contain the method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these services are intended for custom Android builds. See the release notes:

and even hidden system services (useful for custom Android builds)

Actually these Services classes are not available in the normal android.jar at compile time, so this only works if you are building against the AOSP tree or you create a custom internal jar.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually i just noticed that i missed some of the new hidden services. I will add them later today.


// @SystemService
// FingerprintManager fingerprintManager; // hidden API

// @SystemService
// HdmiControlManager hdmiControlManager; // hidden API

// TODO no support yet in Robolectric
// @SystemService
// InputManager inputManager;

@SystemService
InputMethodManager inputMethodManager;

// TODO API 21
// @SystemService
// JobScheduler jobScheduler;

@SystemService
KeyguardManager keyguardManager;

// TODO API 21
// @SystemService
// LauncherApps launcherApps;

@SystemService
LayoutInflater layoutInflater;

@SystemService
LocationManager locationManager;

// TODO API 21
// @SystemService
// MediaProjectionManager mediaProjectionManager;

@SystemService
MediaRouter mediaRouter;

// TODO API 21
// @SystemService
// MediaSessionManager mediaSessionManager;

// @SystemService
// NetworkScoreManager networkScoreManager; // hidden API

// @SystemService
// NetworkManagementService networkManagementService; // hidden API

Expand All @@ -157,14 +189,21 @@ public class ActivityWithServices extends Activity {

@SystemService
NsdManager nsdManager;


// @SystemService
// PersistentDataBlockManager ersistentDataBlockManager; // hidden API

// TODO API 19
// @SystemService
// PrintManager printManager;

@SystemService
PowerManager powerManager;

// TODO API 21
// @SystemService
// RestrictionsManager restrictionsManager;

@SystemService
SearchManager searchManager;

Expand All @@ -183,6 +222,14 @@ public class ActivityWithServices extends Activity {
@SystemService
StorageManager storageManager;

// TODO API 22
// @SystemService
// SubscriptionManager subscriptionManager;

// TODO API 21
// @SystemService
// TelecomManager telecomManager;

@SystemService
TelephonyManager telephonyManager;

Expand All @@ -192,12 +239,20 @@ public class ActivityWithServices extends Activity {
// @SystemService
// ThrottleManager throttleManager; // hidden API

// TODO API 21
// @SystemService
// TvInputManager tvInputManager;

@SystemService
UiModeManager uiModeManager;

// @SystemService
// IUpdateLock updateLock; // hidden API

// TODO API 21
// @SystemService
// UsageStatsManager usageStatsManager;

@SystemService
UsbManager usbManager;

Expand All @@ -213,7 +268,10 @@ public class ActivityWithServices extends Activity {

@SystemService
WifiManager wifiManager;


// @SystemService
// WifiPasspointManager wifiPasspointManager; // hidden API

@SystemService
WifiP2pManager wifiP2pManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void servicesAreInjected() {
// assertThat(activity.appWidgetManager).isNotNull(); // hidden API
assertThat(activity.audioManager).isNotNull();
// assertThat(activity.backupManager).isNotNull(); // hidden API
// assertThat(activity.batteryManager).isNotNull(); // TODO API 21
// assertThat(activity.bluetoothManager).isNotNull(); // TODO API 18
// assertThat(activity.cameraManager).isNotNull(); // hidden API
// assertThat(activity.captioningManager).isNotNull(); // TODO API 19
Expand All @@ -51,36 +52,51 @@ public void servicesAreInjected() {
// assertThat(activity.displayManager).isNotNull(); // TODO API 17
assertThat(activity.downloadManager).isNotNull();
assertThat(activity.dropBoxManager).isNotNull();
// assertThat(activity.ethernetManager).isNotNull(); // hidden API
// assertThat(activity.fingerprintManager).isNotNull(); // hidden API
// assertThat(activity.hdmiControlManager).isNotNull(); // hidden API
// assertThat(activity.inputManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.inputMethodManager).isNotNull();
// assertThat(activity.jobScheduler).isNotNull(); // TODO API 21
assertThat(activity.keyguardManager).isNotNull();
// assertThat(activity.launcherApps).isNotNull(); // TODO API 21
assertThat(activity.layoutInflater).isNotNull();
assertThat(activity.locationManager).isNotNull();
// assertThat(activity.mediaProjectionManager).isNotNull(); // TODO API 21
assertThat(activity.mediaRouter).isNotNull();
// assertThat(activity.mediaSessionManager).isNotNull(); // TODO API 21
// assertThat(activity.networkScoreManager).isNotNull(); // hidden API
// assertThat(activity.networkManagementService).isNotNull(); // hidden API
// assertThat(activity.networkPolicyManager).isNotNull(); // hidden API
// assertThat(activity.networkStatsService).isNotNull(); // hidden API
// assertThat(activity.nfcManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.notificationManager).isNotNull();
// assertThat(activity.nsdManager).isNotNull(); // TODO no support yet in Robolectric
// assertThat(activity.persistentDataBlockManager).isNotNull(); // hidden API
// assertThat(activity.printManager).isNotNull(); // TODO API 19
assertThat(activity.powerManager).isNotNull();
// assertThat(activity.restrictionsManager).isNotNull(); // TODO API 21
assertThat(activity.searchManager).isNotNull();
assertThat(activity.sensorManager).isNotNull();
// assertThat(activity.serialManager).isNotNull(); // hidden API
// assertThat(activity.sipManager).isNotNull(); // hidden API
// assertThat(activity.statusBarManager).isNotNull(); // hidden API
assertThat(activity.storageManager).isNotNull();
// assertThat(activity.subscriptionManager).isNotNull(); // TODO API 22
// assertThat(activity.telecomManager).isNotNull(); // TODO API 21
assertThat(activity.telephonyManager).isNotNull();
assertThat(activity.textServicesManager).isNotNull();
// assertThat(activity.throttleManager).isNotNull(); // hidden API
// assertThat(activity.tvInputManager).isNotNull(); // TODO API 21
assertThat(activity.uiModeManager).isNotNull();
// assertThat(activity.updateLock).isNotNull(); // hidden API
// assertThat(activity.usageStatsManager).isNotNull(); // TODO API 21
// assertThat(activity.usbManager).isNotNull(); // TODO no support yet in Robolectric
// assertThat(activity.userManager).isNotNull(); // TODO API 19
assertThat(activity.vibrator).isNotNull();
// assertThat(activity.wallpaperManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.wifiManager).isNotNull();
// assertThat(activity.wifiPasspointManager).isNotNull(); // hidden API
// assertThat(activity.wifiP2pManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.windowManager).isNotNull();
}
Expand Down
X Tutup