Maybe fix issue #17700474: manta: high occurrence of device booted...
...but dev.bootcomplete flag is not set
Rework things to address a few issues I found:
- When the activity goes idle, the way we were handling finishing the
boot there was calling finishBooting() with the lock held, but it
shouldn't. We now dispatch that and turning on the screen together
in a separate message.
- Make sure we don't try to start the home activity until we have
reached the point of the system being ready and mBooting being set.
This ensures we don't do any work prematurely.
Change-Id: If30c1f287af73bc2164e7aadbe98022ae42cc5e7
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 0646cce..c7b9d96 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1482,6 +1482,11 @@
final boolean resumeTopActivityInnerLocked(ActivityRecord prev, Bundle options) {
if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen("");
+ if (!mService.mBooting && !mService.mBooted) {
+ // Not ready yet!
+ return false;
+ }
+
ActivityRecord parent = mActivityContainer.mParentActivity;
if ((parent != null && parent.state != ActivityState.RESUMED) ||
!mActivityContainer.isAttachedLocked()) {
@@ -3606,6 +3611,10 @@
final TaskRecord task = mResumedActivity != null ? mResumedActivity.task : null;
if (task == tr && tr.isOverHomeStack() || numTasks <= 1 && isOnHomeDisplay()) {
+ if (!mService.mBooting && !mService.mBooted) {
+ // Not ready yet!
+ return false;
+ }
final int taskToReturnTo = tr.getTaskToReturnTo();
tr.setTaskToReturnTo(APPLICATION_ACTIVITY_TYPE);
return mStackSupervisor.resumeHomeStackTask(taskToReturnTo, null);