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

Commit 0c5fdaa7 authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am c449613e: Merge "Revert behavior to perform onResume." into klp-dev

* commit 'c449613e':
  Revert behavior to perform onResume.
parents 8d860332 c449613e
Loading
Loading
Loading
Loading
+15 −38
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    static final boolean DEBUG_USER_LEAVING = localLOGV || false;
    static final boolean DEBUG_VISBILITY = localLOGV || false;
    static final boolean DEBUG_PSS = localLOGV || false;
    static final boolean DEBUG_LOCKSCREEN = localLOGV || true;
    static final boolean VALIDATE_TOKENS = true;
    static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -829,11 +830,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    /**
     * State of external call telling us if the lock screen is shown.
     */
    static final int LOCK_SCREEN_NEVER_SHOWN = 0;
    static final int LOCK_SCREEN_FIRST_SHOWN = 1;
    static final int LOCK_SCREEN_HIDDEN = 2;
    static final int LOCK_SCREEN_SHOWING = 3;
    int mLockScreenState = LOCK_SCREEN_NEVER_SHOWN;
    boolean mLockScreenShown = false;
    /**
     * Set if we are shutting down the system, similar to sleeping.
@@ -4965,8 +4962,9 @@ public final class ActivityManagerService extends ActivityManagerNative
        final long token = Binder.clearCallingIdentity();
        try {
            synchronized (this) {
                if (lockScreenShowing()) {
                    mLockScreenState = LOCK_SCREEN_HIDDEN;
                if (DEBUG_LOCKSCREEN) logLockScreen("");
                if (mLockScreenShown) {
                    mLockScreenShown = false;
                    comeOutOfSleepIfNeededLocked();
                }
                mStackSupervisor.setDismissKeyguard(true);
@@ -8091,22 +8089,15 @@ public final class ActivityManagerService extends ActivityManagerNative
        Binder.restoreCallingIdentity(origId);
    }
    boolean lockScreenShowing() {
        switch (mLockScreenState) {
            case LOCK_SCREEN_NEVER_SHOWN:
            case LOCK_SCREEN_HIDDEN:
                return false;
            case LOCK_SCREEN_FIRST_SHOWN:
            case LOCK_SCREEN_SHOWING:
                return true;
            default:
                Slog.e(TAG, "lockScreenShowing: illegal state");
                throw new IllegalStateException("mLockScreenState=" + mLockScreenState);
        }
    void logLockScreen(String msg) {
        if (DEBUG_LOCKSCREEN) Slog.d(TAG, Debug.getCallers(2) + ":" + msg +
                " mLockScreenShown=" + mLockScreenShown + " mWentToSleep=" +
                mWentToSleep + " mSleeping=" + mSleeping + " mDismissKeyguardOnNextActivity=" +
                mStackSupervisor.mDismissKeyguardOnNextActivity);
    }
    private void comeOutOfSleepIfNeededLocked() {
        if (!mWentToSleep && !lockScreenShowing()) {
        if (!mWentToSleep && !mLockScreenShown) {
            if (mSleeping) {
                mSleeping = false;
                mStackSupervisor.comeOutOfSleepIfNeededLocked();
@@ -8142,12 +8133,8 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized(this) {
            long ident = Binder.clearCallingIdentity();
            try {
                if (shown && mLockScreenState == LOCK_SCREEN_NEVER_SHOWN) {
                    mStackSupervisor.pauseStacks(false, true);
                    mLockScreenState = LOCK_SCREEN_FIRST_SHOWN;
                } else {
                    mLockScreenState = shown ? LOCK_SCREEN_SHOWING : LOCK_SCREEN_HIDDEN;
                }
                if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
                mLockScreenShown = shown;
                comeOutOfSleepIfNeededLocked();
            } finally {
                Binder.restoreCallingIdentity(ident);
@@ -10680,9 +10667,9 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
        }
        if (dumpPackage == null) {
            if (mSleeping || mWentToSleep || lockScreenShowing()) {
            if (mSleeping || mWentToSleep || mLockScreenShown) {
                pw.println("  mSleeping=" + mSleeping + " mWentToSleep=" + mWentToSleep
                        + " mLockScreenState=" + lockScreenStateToString());
                        + " mLockScreenShown " + mLockScreenShown);
            }
            if (mShuttingDown) {
                pw.println("  mShuttingDown=" + mShuttingDown);
@@ -16305,14 +16292,4 @@ public final class ActivityManagerService extends ActivityManagerNative
        info.applicationInfo = getAppInfoForUser(info.applicationInfo, userId);
        return info;
    }
    private String lockScreenStateToString() {
        switch (mLockScreenState) {
            case LOCK_SCREEN_NEVER_SHOWN: return "LOCK_SCREEN_NEVER_SHOWN";
            case LOCK_SCREEN_FIRST_SHOWN: return "LOCK_SCREEN_FIRST_SHOWN";
            case LOCK_SCREEN_HIDDEN: return "LOCK_SCREEN_HIDDEN";
            case LOCK_SCREEN_SHOWING: return "LOCK_SCREEN_SHOWING";
            default: return "unknown (" + mLockScreenState + ")";
        }
    }
}
+5 −4
Original line number Diff line number Diff line
@@ -1190,6 +1190,8 @@ final class ActivityStack {
    }

    final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
        if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen("");

        // Find the first activity that is not finishing.
        ActivityRecord next = topRunningActivityLocked(null);

@@ -1251,10 +1253,9 @@ final class ActivityStack {

        // If we are sleeping, and there is no resumed activity, and the top
        // activity is paused, well that is the state we want.
        if (mService.mLockScreenState == ActivityManagerService.LOCK_SCREEN_FIRST_SHOWN ||
                (mService.isSleepingOrShuttingDown()
        if (mService.isSleepingOrShuttingDown()
                && mLastPausedActivity == next
                && mStackSupervisor.allPausedActivitiesComplete())) {
                && mStackSupervisor.allPausedActivitiesComplete()) {
            // Make sure we have executed any pending transitions, since there
            // should be nothing left to do at this point.
            mWindowManager.executeAppTransition();
@@ -1326,7 +1327,7 @@ final class ActivityStack {

        // We need to start pausing the current activity so the top one
        // can be resumed...
        boolean pausing = mStackSupervisor.pauseStacks(userLeaving, false);
        boolean pausing = mStackSupervisor.pauseBackStacks(userLeaving);
        if (mResumedActivity != null) {
            pausing = true;
            startPausingLocked(userLeaving, false);
+9 −5
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public final class ActivityStackSupervisor {
    WindowManagerService mWindowManager;

    /** Dismiss the keyguard after the next activity is displayed? */
    private boolean mDismissKeyguardOnNextActivity = false;
    boolean mDismissKeyguardOnNextActivity = false;

    /** Identifier counter for all ActivityStacks */
    private int mLastStackId = HOME_STACK_ID;
@@ -232,6 +232,7 @@ public final class ActivityStackSupervisor {
    }

    void dismissKeyguard() {
        if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen("");
        if (mDismissKeyguardOnNextActivity) {
            mDismissKeyguardOnNextActivity = false;
            mWindowManager.dismissKeyguard();
@@ -310,6 +311,7 @@ public final class ActivityStackSupervisor {
    }

    void setDismissKeyguard(boolean dismiss) {
        if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen(" dismiss=" + dismiss);
        mDismissKeyguardOnNextActivity = dismiss;
    }

@@ -468,15 +470,14 @@ public final class ActivityStackSupervisor {
    /**
     * Pause all activities in either all of the stacks or just the back stacks.
     * @param userLeaving Passed to pauseActivity() to indicate whether to call onUserLeaving().
     * @param allStacks Whether to pause all the stacks (true), or just the back stacks (false).
     * @return true if any activity was paused as a result of this call.
     */
    boolean pauseStacks(boolean userLeaving, boolean allStacks) {
    boolean pauseBackStacks(boolean userLeaving) {
        boolean someActivityPaused = false;
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            final ActivityStack stack = mStacks.get(stackNdx);
            if ((allStacks || !isFrontStack(stack)) && stack.mResumedActivity != null) {
                if (DEBUG_STATES) Slog.d(TAG, "pauseStacks: stack=" + stack +
            if (!isFrontStack(stack) && stack.mResumedActivity != null) {
                if (DEBUG_STATES) Slog.d(TAG, "pauseBackStacks: stack=" + stack +
                        " mResumedActivity=" + stack.mResumedActivity);
                stack.startPausingLocked(userLeaving, false);
                someActivityPaused = true;
@@ -2157,6 +2158,9 @@ public final class ActivityStackSupervisor {
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            final ActivityStack stack = mStacks.get(stackNdx);
            stack.awakeFromSleepingLocked();
            if (isFrontStack(stack)) {
                resumeTopActivitiesLocked();
            }
        }
        mGoingToSleepActivities.clear();
    }