summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-10-26 03:07:26 -0700
committerSteve Kondik <steve@cyngn.com>2015-10-26 03:07:26 -0700
commit296b5eb1f0183fc95f243ee99cf34a152696313c (patch)
tree215f731835ea4996d1d9e1aa595f0df9ad4e1a2c
parent1ef046f09658f632a461e31dd90b1e34e7fb3ea3 (diff)
downloadframeworks_base-296b5eb1f0183fc95f243ee99cf34a152696313c.zip
frameworks_base-296b5eb1f0183fc95f243ee99cf34a152696313c.tar.gz
frameworks_base-296b5eb1f0183fc95f243ee99cf34a152696313c.tar.bz2
powermanager: Initialize SensorManager in systemReady()
* Service startup ordering is different on M and the sensor service is not ready during construction of the PowerManager. This was causing a hang on boot. Move it to systemReady instead. Change-Id: I9e0293484e1aaaf9f82f9c75680bec558607c54d
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index bf85f7f..10503fd 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -514,8 +514,6 @@ public final class PowerManagerService extends SystemService
Process.THREAD_PRIORITY_DISPLAY, false /*allowIo*/);
mHandlerThread.start();
mHandler = new PowerManagerHandler(mHandlerThread.getLooper());
- mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
- mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
synchronized (mLock) {
mWakeLockSuspendBlocker = createSuspendBlockerLocked("PowerManagerService.WakeLocks");
@@ -598,6 +596,10 @@ public final class PowerManagerService extends SystemService
mDisplayManagerInternal.initPowerManagement(
mDisplayPowerCallbacks, mHandler, sensorManager);
+ // Initialize proximity sensor
+ mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
+ mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+
// Register for broadcasts from other components of the system.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);