diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-06-13 19:00:36 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2014-06-17 18:20:42 -0700 |
commit | 2139276ce8b54aba5faa858ca69ed5f01445c269 (patch) | |
tree | b7016d3863d000b731f2ef9b15b4633157ab7d30 /services/core/java/com/android/server/power | |
parent | 2c43c339de5aaf4fef58aa9b5ac3af48609263a8 (diff) | |
download | frameworks_base-2139276ce8b54aba5faa858ca69ed5f01445c269.zip frameworks_base-2139276ce8b54aba5faa858ca69ed5f01445c269.tar.gz frameworks_base-2139276ce8b54aba5faa858ca69ed5f01445c269.tar.bz2 |
Refactor BatteryService to new pattern.
Apply SystemService pattern to BatteryService.
Change-Id: I4971b2da8d2aed4d14440fb65863a8b916bab03c
Diffstat (limited to 'services/core/java/com/android/server/power')
-rw-r--r-- | services/core/java/com/android/server/power/PowerManagerService.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index b25012f..bd80b54 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -19,7 +19,6 @@ package com.android.server.power; import com.android.internal.app.IAppOpsService; import com.android.internal.app.IBatteryStats; import com.android.internal.os.BackgroundThread; -import com.android.server.BatteryService; import com.android.server.EventLogTags; import com.android.server.LocalServices; import com.android.server.ServiceThread; @@ -43,6 +42,7 @@ import android.hardware.display.DisplayManagerInternal; import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest; import android.net.Uri; import android.os.BatteryManager; +import android.os.BatteryManagerInternal; import android.os.Binder; import android.os.Handler; import android.os.IBinder; @@ -168,7 +168,7 @@ public final class PowerManagerService extends com.android.server.SystemService private final PowerManagerHandler mHandler; private LightsManager mLightsManager; - private BatteryService mBatteryService; + private BatteryManagerInternal mBatteryManagerInternal; private DisplayManagerInternal mDisplayManagerInternal; private IBatteryStats mBatteryStats; private IAppOpsService mAppOps; @@ -463,14 +463,14 @@ public final class PowerManagerService extends com.android.server.SystemService Watchdog.getInstance().addThread(mHandler); } - public void systemReady(BatteryService batteryService, IAppOpsService appOps) { + public void systemReady(IAppOpsService appOps) { synchronized (mLock) { mSystemReady = true; - mBatteryService = batteryService; mAppOps = appOps; mDreamManager = getLocalService(DreamManagerInternal.class); mDisplayManagerInternal = getLocalService(DisplayManagerInternal.class); mPolicy = getLocalService(WindowManagerPolicy.class); + mBatteryManagerInternal = getLocalService(BatteryManagerInternal.class); PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mScreenBrightnessSettingMinimum = pm.getMinimumScreenBrightnessSetting(); @@ -1158,10 +1158,10 @@ public final class PowerManagerService extends com.android.server.SystemService final boolean wasPowered = mIsPowered; final int oldPlugType = mPlugType; final boolean oldLevelLow = mBatteryLevelLow; - mIsPowered = mBatteryService.isPowered(BatteryManager.BATTERY_PLUGGED_ANY); - mPlugType = mBatteryService.getPlugType(); - mBatteryLevel = mBatteryService.getBatteryLevel(); - mBatteryLevelLow = mBatteryService.getBatteryLevelLow(); + mIsPowered = mBatteryManagerInternal.isPowered(BatteryManager.BATTERY_PLUGGED_ANY); + mPlugType = mBatteryManagerInternal.getPlugType(); + mBatteryLevel = mBatteryManagerInternal.getBatteryLevel(); + mBatteryLevelLow = mBatteryManagerInternal.getBatteryLevelLow(); if (DEBUG_SPEW) { Slog.d(TAG, "updateIsPoweredLocked: wasPowered=" + wasPowered @@ -1244,7 +1244,7 @@ public final class PowerManagerService extends com.android.server.SystemService final boolean wasStayOn = mStayOn; if (mStayOnWhilePluggedInSetting != 0 && !isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) { - mStayOn = mBatteryService.isPowered(mStayOnWhilePluggedInSetting); + mStayOn = mBatteryManagerInternal.isPowered(mStayOnWhilePluggedInSetting); } else { mStayOn = false; } |