summaryrefslogtreecommitdiffstats
path: root/services/core/java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-02-11 08:18:34 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-11 08:18:34 +0000
commit25df673b849de374cf1de40250dfd8a48b7ac28b (patch)
treebcd207313c36f123e2ccd2230e3ee31e5089e38f /services/core/java
parent2d6b55aaa9dd03f7d934f7a192989513b1087357 (diff)
parent1b51c9cb96fe2a0818289857a016521eed1ec183 (diff)
downloadframeworks_base-25df673b849de374cf1de40250dfd8a48b7ac28b.zip
frameworks_base-25df673b849de374cf1de40250dfd8a48b7ac28b.tar.gz
frameworks_base-25df673b849de374cf1de40250dfd8a48b7ac28b.tar.bz2
am 1b51c9cb: Merge "Make SystemService constructor take a Context." into klp-modular-dev
* commit '1b51c9cb96fe2a0818289857a016521eed1ec183': Make SystemService constructor take a Context.
Diffstat (limited to 'services/core/java')
-rw-r--r--services/core/java/com/android/server/AlarmManagerService.java4
-rw-r--r--services/core/java/com/android/server/UiModeManagerService.java4
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java8
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java11
-rw-r--r--services/core/java/com/android/server/lights/LightsService.java6
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java4
-rw-r--r--services/core/java/com/android/server/pm/Installer.java5
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java11
-rw-r--r--services/core/java/com/android/server/storage/DeviceStorageMonitorService.java32
-rw-r--r--services/core/java/com/android/server/twilight/TwilightService.java4
10 files changed, 53 insertions, 36 deletions
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 3cdf170..96063d5 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -319,6 +319,10 @@ class AlarmManagerService extends SystemService {
static final BatchTimeOrder sBatchOrder = new BatchTimeOrder();
final ArrayList<Batch> mAlarmBatches = new ArrayList<Batch>();
+ public AlarmManagerService(Context context) {
+ super(context);
+ }
+
static long convertToElapsed(long when, int type) {
final boolean isRtc = (type == RTC || type == RTC_WAKEUP);
if (isRtc) {
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index de912dc..ad693d0 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -88,6 +88,10 @@ final class UiModeManagerService extends SystemService {
private PowerManager.WakeLock mWakeLock;
+ public UiModeManagerService(Context context) {
+ super(context);
+ }
+
private static Intent buildHomeIntent(String category) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(category);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 74e18c0..46891f5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1866,11 +1866,11 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
- public static class Lifecycle extends SystemService {
- private ActivityManagerService mService;
+ public static final class Lifecycle extends SystemService {
+ private final ActivityManagerService mService;
- @Override
- public void onCreate(Context context) {
+ public Lifecycle(Context context) {
+ super(context);
mService = new ActivityManagerService(context);
}
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index d5ee838..6be6405 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -124,7 +124,7 @@ public final class DisplayManagerService extends SystemService {
private static final int DISPLAY_BLANK_STATE_BLANKED = 1;
private static final int DISPLAY_BLANK_STATE_UNBLANKED = 2;
- private Context mContext;
+ private final Context mContext;
private final DisplayManagerHandler mHandler;
private final Handler mUiHandler;
private final DisplayAdapterListener mDisplayAdapterListener;
@@ -208,7 +208,9 @@ public final class DisplayManagerService extends SystemService {
private final DisplayViewport mTempDefaultViewport = new DisplayViewport();
private final DisplayViewport mTempExternalTouchViewport = new DisplayViewport();
- public DisplayManagerService() {
+ public DisplayManagerService(Context context) {
+ super(context);
+ mContext = context;
mHandler = new DisplayManagerHandler(DisplayThread.get().getLooper());
mUiHandler = UiThread.getHandler();
mDisplayAdapterListener = new DisplayAdapterListener();
@@ -216,11 +218,6 @@ public final class DisplayManagerService extends SystemService {
}
@Override
- public void onCreate(Context context) {
- mContext = context;
- }
-
- @Override
public void onStart() {
mHandler.sendEmptyMessage(MSG_REGISTER_DEFAULT_DISPLAY_ADAPTER);
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 3d22370..94cf668 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -157,8 +157,9 @@ public class LightsService extends SystemService {
}
};
- @Override
- public void onCreate(Context context) {
+ public LightsService(Context context) {
+ super(context);
+
mNativePointer = init_native();
for (int i = 0; i < LightsManager.LIGHT_ID_COUNT; i++) {
@@ -183,6 +184,7 @@ public class LightsService extends SystemService {
}
};
+ @Override
protected void finalize() throws Throwable {
finalize_native(mNativePointer);
super.finalize();
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index db4cf31d..6ee8989 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1118,6 +1118,10 @@ public class NotificationManagerService extends SystemService {
return out;
}
+ public NotificationManagerService(Context context) {
+ super(context);
+ }
+
@Override
public void onStart() {
mAm = ActivityManagerNative.getDefault();
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java
index e2ff146..6185e50 100644
--- a/services/core/java/com/android/server/pm/Installer.java
+++ b/services/core/java/com/android/server/pm/Installer.java
@@ -18,6 +18,7 @@ package com.android.server.pm;
import com.android.server.SystemService;
+import android.content.Context;
import android.content.pm.PackageStats;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
@@ -39,6 +40,10 @@ public final class Installer extends SystemService {
byte buf[] = new byte[1024];
int buflen = 0;
+ public Installer(Context context) {
+ super(context);
+ }
+
@Override
public void onStart() {
Slog.i(TAG, "Waiting for installd to be ready.");
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 94876bb..9606baa 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -168,7 +168,7 @@ public final class PowerManagerService extends com.android.server.SystemService
// effectively and terminate the dream.
private static final int DREAM_BATTERY_LEVEL_DRAIN_CUTOFF = 5;
- private Context mContext;
+ private final Context mContext;
private LightsManager mLightsManager;
private BatteryService mBatteryService;
private DisplayManagerInternal mDisplayManagerInternal;
@@ -374,7 +374,9 @@ public final class PowerManagerService extends com.android.server.SystemService
private static native void nativeSetInteractive(boolean enable);
private static native void nativeSetAutoSuspend(boolean enable);
- public PowerManagerService() {
+ public PowerManagerService(Context context) {
+ super(context);
+ mContext = context;
synchronized (mLock) {
mWakeLockSuspendBlocker = createSuspendBlockerLocked("PowerManagerService.WakeLocks");
mDisplaySuspendBlocker = createSuspendBlockerLocked("PowerManagerService.Display");
@@ -391,11 +393,6 @@ public final class PowerManagerService extends com.android.server.SystemService
}
@Override
- public void onCreate(Context context) {
- mContext = context;
- }
-
- @Override
public void onStart() {
publishBinderService(Context.POWER_SERVICE, new BinderService());
publishLocalService(PowerManagerInternal.class, new LocalService());
diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
index 8805084..43a99e0 100644
--- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
+++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
@@ -89,11 +89,11 @@ public class DeviceStorageMonitorService extends SystemService {
private long mLastReportedFreeMemTime;
boolean mLowMemFlag=false;
private boolean mMemFullFlag=false;
- private ContentResolver mResolver;
- private long mTotalMemory; // on /data
- private StatFs mDataFileStats;
- private StatFs mSystemFileStats;
- private StatFs mCacheFileStats;
+ private final ContentResolver mResolver;
+ private final long mTotalMemory; // on /data
+ private final StatFs mDataFileStats;
+ private final StatFs mSystemFileStats;
+ private final StatFs mCacheFileStats;
private static final File DATA_PATH = Environment.getDataDirectory();
private static final File SYSTEM_PATH = Environment.getRootDirectory();
@@ -102,10 +102,10 @@ public class DeviceStorageMonitorService extends SystemService {
private long mThreadStartTime = -1;
boolean mClearSucceeded = false;
boolean mClearingCache;
- private Intent mStorageLowIntent;
- private Intent mStorageOkIntent;
- private Intent mStorageFullIntent;
- private Intent mStorageNotFullIntent;
+ private final Intent mStorageLowIntent;
+ private final Intent mStorageOkIntent;
+ private final Intent mStorageFullIntent;
+ private final Intent mStorageNotFullIntent;
private CachePackageDataObserver mClearCacheObserver;
private CacheFileDeletedObserver mCacheFileDeletedObserver;
private static final int _TRUE = 1;
@@ -134,7 +134,7 @@ public class DeviceStorageMonitorService extends SystemService {
* Handler that checks the amount of disk space on the device and sends a
* notification if the device runs low on disk space
*/
- private Handler mHandler = new Handler() {
+ private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
//don't handle an invalid message
@@ -310,12 +310,8 @@ public class DeviceStorageMonitorService extends SystemService {
delay);
}
- /**
- * Constructor to run service. initializes the disk space threshold value
- * and posts an empty message to kickstart the process.
- */
- @Override
- public void onCreate(Context context) {
+ public DeviceStorageMonitorService(Context context) {
+ super(context);
mLastReportedFreeMemTime = 0;
mResolver = context.getContentResolver();
//create StatFs object
@@ -335,6 +331,10 @@ public class DeviceStorageMonitorService extends SystemService {
mStorageNotFullIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
}
+ /**
+ * Initializes the disk space threshold value and posts an empty message to
+ * kickstart the process.
+ */
@Override
public void onStart() {
// cache storage thresholds
diff --git a/services/core/java/com/android/server/twilight/TwilightService.java b/services/core/java/com/android/server/twilight/TwilightService.java
index 8feb97b..a71961c 100644
--- a/services/core/java/com/android/server/twilight/TwilightService.java
+++ b/services/core/java/com/android/server/twilight/TwilightService.java
@@ -65,6 +65,10 @@ public final class TwilightService extends SystemService {
TwilightState mTwilightState;
+ public TwilightService(Context context) {
+ super(context);
+ }
+
@Override
public void onStart() {
mAlarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);