Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea002666 authored by Craig Mautner's avatar Craig Mautner Committed by android-build-merger
Browse files

am ef04ae79: Merge "Complete booting when frontmost activity is idle" into...

am ef04ae79: Merge "Complete booting when frontmost activity is idle" into lmp-mr1-dev automerge: 82da2ee9
automerge: 1549346a

* commit '1549346a':
  Complete booting when frontmost activity is idle
parents 6245afc8 1549346a
Loading
Loading
Loading
Loading
+27 −11
Original line number Original line Diff line number Diff line
@@ -417,6 +417,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
            if (DEBUG_STACK) Slog.d(TAG, "moveHomeTask: topStack old=" + topStack + " new="
            if (DEBUG_STACK) Slog.d(TAG, "moveHomeTask: topStack old=" + topStack + " new="
                    + mFocusedStack);
                    + mFocusedStack);
        }
        }
        if (mService.mBooting || !mService.mBooted) {
            final ActivityRecord r = topRunningActivityLocked();
            if (r != null && r.idle) {
                checkFinishBootingLocked();
            }
        }
    }
    }


    void moveHomeStackTaskToTop(int homeStackTaskType) {
    void moveHomeStackTaskToTop(int homeStackTaskType) {
@@ -2238,6 +2244,24 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }
        }
    }
    }


    /**
     * Called when the frontmost task is idle.
     * @return the state of mService.mBooting before this was called.
     */
    private boolean checkFinishBootingLocked() {
        final boolean booting = mService.mBooting;
        boolean enableScreen = false;
        mService.mBooting = false;
        if (!mService.mBooted) {
            mService.mBooted = true;
            enableScreen = true;
        }
        if (booting || enableScreen) {
            mService.postFinishBooting(booting, enableScreen);
        }
        return booting;
    }

    // Checked.
    // Checked.
    final ActivityRecord activityIdleInternalLocked(final IBinder token, boolean fromTimeout,
    final ActivityRecord activityIdleInternalLocked(final IBinder token, boolean fromTimeout,
            Configuration config) {
            Configuration config) {
@@ -2249,7 +2273,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
        int NS = 0;
        int NS = 0;
        int NF = 0;
        int NF = 0;
        boolean booting = false;
        boolean booting = false;
        boolean enableScreen = false;
        boolean activityRemoved = false;
        boolean activityRemoved = false;


        ActivityRecord r = ActivityRecord.forToken(token);
        ActivityRecord r = ActivityRecord.forToken(token);
@@ -2277,12 +2300,7 @@ public final class ActivityStackSupervisor implements DisplayListener {


            //Slog.i(TAG, "IDLE: mBooted=" + mBooted + ", fromTimeout=" + fromTimeout);
            //Slog.i(TAG, "IDLE: mBooted=" + mBooted + ", fromTimeout=" + fromTimeout);
            if (isFrontStack(r.task.stack) || fromTimeout) {
            if (isFrontStack(r.task.stack) || fromTimeout) {
                booting = mService.mBooting;
                booting = checkFinishBootingLocked();
                mService.mBooting = false;
                if (!mService.mBooted) {
                    mService.mBooted = true;
                    enableScreen = true;
                }
            }
            }
        }
        }


@@ -2355,10 +2373,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
        //dump();
        //dump();
        //mWindowManager.dump();
        //mWindowManager.dump();


        if (booting || enableScreen) {
            mService.postFinishBooting(booting, enableScreen);
        }

        if (activityRemoved) {
        if (activityRemoved) {
            resumeTopActivitiesLocked();
            resumeTopActivitiesLocked();
        }
        }
@@ -2627,6 +2641,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
            // before an application stack is created...Go ahead and create one on the default
            // before an application stack is created...Go ahead and create one on the default
            // display.
            // display.
            stack = getStack(createStackOnDisplay(getNextStackId(), Display.DEFAULT_DISPLAY));
            stack = getStack(createStackOnDisplay(getNextStackId(), Display.DEFAULT_DISPLAY));
            // Restore home stack to top.
            moveHomeStack(true);
            if (DEBUG_RECENTS)
            if (DEBUG_RECENTS)
                Slog.v(TAG, "Created stack=" + stack + " for recents restoration.");
                Slog.v(TAG, "Created stack=" + stack + " for recents restoration.");
        }
        }