import static com.android.internal.util.XmlUtils.writeIntAttribute;
import static com.android.internal.util.XmlUtils.writeLongAttribute;
import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
+import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;
import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
static final int SYSTEM_USER_START_MSG = 42;
static final int SYSTEM_USER_CURRENT_MSG = 43;
static final int ENTER_ANIMATION_COMPLETE_MSG = 44;
- static final int ENABLE_SCREEN_AFTER_BOOT_MSG = 45;
+ static final int FINISH_BOOTING_MSG = 45;
static final int START_USER_SWITCH_MSG = 46;
static final int SEND_LOCALE_TO_MOUNT_DAEMON_MSG = 47;
}
break;
}
- case ENABLE_SCREEN_AFTER_BOOT_MSG: {
- enableScreenAfterBoot();
+ case FINISH_BOOTING_MSG: {
+ if (msg.arg1 != 0) {
+ finishBooting();
+ }
+ if (msg.arg2 != 0) {
+ enableScreenAfterBoot();
+ }
break;
}
case SEND_LOCALE_TO_MOUNT_DAEMON_MSG: {
Binder.restoreCallingIdentity(origId);
}
- void postEnableScreenAfterBootLocked() {
- mHandler.sendEmptyMessage(ENABLE_SCREEN_AFTER_BOOT_MSG);
+ void postFinishBooting(boolean finishBooting, boolean enableScreen) {
+ mHandler.sendMessage(mHandler.obtainMessage(FINISH_BOOTING_MSG,
+ finishBooting? 1 : 0, enableScreen ? 1 : 0));
}
void enableScreenAfterBoot() {
// Start up initial activity.
mBooting = true;
+ startHomeActivityLocked(mCurrentUserId);
try {
if (AppGlobals.getPackageManager().hasSystemUidErrors()) {
boolean printedAnything = false;
- if (mRecentTasks.size() > 0) {
+ if (mRecentTasks != null && mRecentTasks.size() > 0) {
boolean printedHeader = false;
final int N = mRecentTasks.size();
if (dumpAll) {
pw.println(" Total persistent processes: " + numPers);
pw.println(" mProcessesReady=" + mProcessesReady
- + " mSystemReady=" + mSystemReady);
- pw.println(" mBooting=" + mBooting
+ + " mSystemReady=" + mSystemReady
+ " mBooted=" + mBooted
+ " mFactoryTest=" + mFactoryTest);
+ pw.println(" mBooting=" + mBooting
+ + " mCallFinishBooting=" + mCallFinishBooting
+ + " mBootAnimationComplete=" + mBootAnimationComplete);
pw.print(" mLastPowerCheckRealtime=");
TimeUtils.formatDuration(mLastPowerCheckRealtime, pw);
pw.println("");
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()) {
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);
}
boolean resumeHomeStackTask(int homeStackTaskType, ActivityRecord prev) {
+ if (!mService.mBooting && !mService.mBooted) {
+ // Not ready yet!
+ return false;
+ }
+
if (homeStackTaskType == RECENTS_ACTIVITY_TYPE) {
mWindowManager.showRecentApps();
return false;
activityRemoved |= r.task.stack.destroyActivityLocked(r, true, "finish-idle");
}
- if (booting) {
- mService.finishBooting();
- } else {
+ if (!booting) {
// Complete user switch
if (startingUsers != null) {
for (int i = 0; i < startingUsers.size(); i++) {
//dump();
//mWindowManager.dump();
- if (enableScreen) {
- mService.postEnableScreenAfterBootLocked();
+ if (booting || enableScreen) {
+ mService.postFinishBooting(booting, enableScreen);
}
if (activityRemoved) {
r.mLaunchTaskBehind);
}
}
- resumeHomeStackTask(HOME_ACTIVITY_TYPE, null);
}
void moveTaskToStack(int taskId, int stackId, boolean toTop) {