diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-08-07 19:06:49 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2014-08-11 17:13:03 -0700 |
commit | 6d2a9492e2b19421165f0cd918d9f28595bfb770 (patch) | |
tree | 61aec347859424bcaa3a8b8f2e10d97874efef82 /services/core/java/com/android/server/power | |
parent | 77437731a70c74d24a3a63d5d1cb899ffae34eb1 (diff) | |
download | frameworks_base-6d2a9492e2b19421165f0cd918d9f28595bfb770.zip frameworks_base-6d2a9492e2b19421165f0cd918d9f28595bfb770.tar.gz frameworks_base-6d2a9492e2b19421165f0cd918d9f28595bfb770.tar.bz2 |
Eliminate power manager latency for boot completed.
The power manager disables the power button until boot completed
occurs. If there are many pending broadcasts in the queue, it
may be possible for BOOT_COMPLETED to be delayed for several
seconds after boot.
To avoid the delay, introduced a new boot phase which is
sent to system services immediately when boot completed happens.
Bug: 13398280
Change-Id: I1833d2ffb20305009dd76363b43e534034f1d0a2
Diffstat (limited to 'services/core/java/com/android/server/power')
-rw-r--r-- | services/core/java/com/android/server/power/PowerManagerService.java | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index d1182e9..14cbd66 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -474,6 +474,19 @@ public final class PowerManagerService extends com.android.server.SystemService Watchdog.getInstance().addThread(mHandler); } + @Override + public void onBootPhase(int phase) { + if (phase == PHASE_BOOT_COMPLETED) { + // This is our early signal that the system thinks it has finished booting. + // However, the boot animation may still be running for a few more seconds + // since it is ultimately in charge of when it terminates. + // Defer transitioning into the boot completed state until the animation exits. + // We do this so that the screen does not start to dim prematurely before + // the user has actually had a chance to interact with the device. + startWatchingForBootAnimationFinished(); + } + } + public void systemReady(IAppOpsService appOps) { synchronized (mLock) { mSystemReady = true; @@ -516,11 +529,6 @@ public final class PowerManagerService extends com.android.server.SystemService mContext.registerReceiver(new BatteryReceiver(), filter, null, mHandler); filter = new IntentFilter(); - filter.addAction(Intent.ACTION_BOOT_COMPLETED); - filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); - mContext.registerReceiver(new BootCompletedReceiver(), filter, null, mHandler); - - filter = new IntentFilter(); filter.addAction(Intent.ACTION_DREAMING_STARTED); filter.addAction(Intent.ACTION_DREAMING_STOPPED); mContext.registerReceiver(new DreamReceiver(), filter, null, mHandler); @@ -2404,19 +2412,6 @@ public final class PowerManagerService extends com.android.server.SystemService } } - private final class BootCompletedReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - // This is our early signal that the system thinks it has finished booting. - // However, the boot animation may still be running for a few more seconds - // since it is ultimately in charge of when it terminates. - // Defer transitioning into the boot completed state until the animation exits. - // We do this so that the screen does not start to dim prematurely before - // the user has actually had a chance to interact with the device. - startWatchingForBootAnimationFinished(); - } - } - private final class DreamReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { |