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 @@ -29,37 +29,54 @@ public class AndroidSystemServices {
private Map<String, String> registeredServices = new HashMap<String, String>();

public AndroidSystemServices() {
// in alphabetical order
registeredServices.put("android.view.accessibility.AccessibilityManager", "android.content.Context.ACCESSIBILITY_SERVICE");
registeredServices.put("android.accounts.AccountManager", "android.content.Context.ACCOUNT_SERVICE");
registeredServices.put("android.app.ActivityManager", "android.content.Context.ACTIVITY_SERVICE");
registeredServices.put("android.app.AlarmManager", "android.content.Context.ALARM_SERVICE");
registeredServices.put("android.app.AppOpsManager", "android.content.Context.APP_OPS_SERVICE");
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.bluetooth.BluetoothAdapter", "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");
registeredServices.put("android.content.ClipboardManager", "android.content.Context.CLIPBOARD_SERVICE");
registeredServices.put("android.text.ClipboardManager", "android.content.Context.CLIPBOARD_SERVICE");
registeredServices.put("android.net.ConnectivityManager", "android.content.Context.CONNECTIVITY_SERVICE");
registeredServices.put("android.hardware.ConsumerIrManager", "android.content.Context.CONSUMER_IR_SERVICE");
registeredServices.put("android.location.CountryDetector", "android.content.Context.COUNTRY_DETECTOR");
registeredServices.put("android.app.admin.DevicePolicyManager", "android.content.Context.DEVICE_POLICY_SERVICE");
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.hardware.input.InputManager", "android.content.Context.INPUT_SERVICE");
registeredServices.put("android.view.inputmethod.InputMethodManager", "android.content.Context.INPUT_METHOD_SERVICE");
registeredServices.put("android.app.KeyguardManager", "android.content.Context.KEYGUARD_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.MediaRouter", "android.content.Context.MEDIA_ROUTER_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.print.PrintManager", "android.content.Context.PRINT_SERVICE");
registeredServices.put("android.os.PowerManager", "android.content.Context.POWER_SERVICE");
registeredServices.put("android.app.SearchManager", "android.content.Context.SEARCH_SERVICE");
registeredServices.put("android.appwidget.AppWidgetManager", "android.content.Context.APPWIDGET_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.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.app.UiModeManager", "android.content.Context.UI_MODE_SERVICE");
registeredServices.put("android.os.IUpdateLock", "android.content.Context.UPDATE_LOCK_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");
Expand Down
2 changes: 1 addition & 1 deletion AndroidAnnotations/functional-test-1-5-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.0.1.2</version>
<version>4.1.1.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,60 @@ public class ServiceInjectionTest {
public void servicesAreInjected() {
ActivityWithServices_ activity = Robolectric.buildActivity(ActivityWithServices_.class).create().get();

assertThat(activity.windowManager).isNotNull();
assertThat(activity.layoutInflater).isNotNull();
// in alphabetical order

// assertThat(activity.accessibilityManager).isNotNull(); // TODO Robolectric 2.4
// assertThat(activity.accountManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.activityManager).isNotNull();
assertThat(activity.powerManager).isNotNull();
assertThat(activity.alarmManager).isNotNull();
assertThat(activity.notificationManager).isNotNull();
// assertThat(activity.appOpsManager).isNotNull(); // TODO API 19
// assertThat(activity.appWidgetManager).isNotNull(); // hidden API
assertThat(activity.audioManager).isNotNull();
// assertThat(activity.backupManager).isNotNull(); // hidden API
// assertThat(activity.bluetoothAdapter).isNotNull(); // TODO API 18
// assertThat(activity.cameraManager).isNotNull(); // hidden API
// assertThat(activity.captioningManager).isNotNull(); // TODO API 19
assertThat(activity.contentClipboardManager).isNotNull();
assertThat(activity.textClipboardManager).isNotNull();
assertThat(activity.connectivityManager).isNotNull();
// assertThat(activity.consumerIrManager).isNotNull(); // TODO API 19
// assertThat(activity.countryDetector).isNotNull(); // hidden API
assertThat(activity.devicePolicyManager).isNotNull();
// assertThat(activity.displayManager).isNotNull(); // TODO API 17
assertThat(activity.downloadManager).isNotNull();
assertThat(activity.dropBoxManager).isNotNull();
// assertThat(activity.inputManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.inputMethodManager).isNotNull();
assertThat(activity.keyguardManager).isNotNull();
assertThat(activity.layoutInflater).isNotNull();
assertThat(activity.locationManager).isNotNull();
// assertThat(activity.mediaRouter).isNotNull(); // TODO Robolectric 2.4
// 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.printManager).isNotNull(); // TODO API 19
assertThat(activity.powerManager).isNotNull();
assertThat(activity.searchManager).isNotNull();
assertThat(activity.vibrator).isNotNull();
assertThat(activity.connectivityManager).isNotNull();
assertThat(activity.wifiManager).isNotNull();
assertThat(activity.inputMethodManager).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.telephonyManager).isNotNull();
assertThat(activity.audioManager).isNotNull();
assertThat(activity.textClipboardManager).isNotNull();
assertThat(activity.contentClipboardManager).isNotNull();
assertThat(activity.textServicesManager).isNotNull();
// assertThat(activity.throttleManager).isNotNull(); // hidden API
assertThat(activity.uiModeManager).isNotNull();
// assertThat(activity.updateLock).isNotNull(); // hidden API
// 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.wifiP2pManager).isNotNull(); // TODO no support yet in Robolectric
assertThat(activity.windowManager).isNotNull();
}

}
Loading