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

Commit 2372c8da authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/21729388',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/21729388', 'googleplex-android-review.googlesource.com/21756419'] into sparse-9683226-L22200000958935452.
SPARSE_CHANGE: Ie72872b91e97b3456a5cf20db92bc79b1b467676
SPARSE_CHANGE: Iae586f9a2b86f19502f3d66165b633b1c9fc5f7f

Change-Id: I081e64c3a1028225e99e68041d2654568b1af3b4
parents 38388021 1edefa04
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -1920,20 +1920,24 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,

        // If the keyguard is already showing, see if we don't need to bother re-showing it. Check
        // flags in both files to account for the hiding animation which results in a delay and
        // discrepancy between flags.
        // discrepancy between flags. If we're in the middle of hiding, do not short circuit so that
        // we explicitly re-set state.
        if (mShowing && mKeyguardStateController.isShowing()) {
            if (mPM.isInteractive()) {
            if (mPM.isInteractive() && !mHiding) {
                // It's already showing, and we're not trying to show it while the screen is off.
                // We can simply reset all of the views.
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing (instead, resetting) because it is "
                        + "already showing, we're interactive, and we were not previously hiding. "
                        + "It should be safe to short-circuit here.");
                resetStateLocked();
                return;
            } else {
                // We are trying to show the keyguard while the screen is off - this results from
                // race conditions involving locking while unlocking. Don't short-circuit here and
                // ensure the keyguard is fully re-shown.
                // We are trying to show the keyguard while the screen is off or while we were in
                // the middle of hiding - this results from race conditions involving locking while
                // unlocking. Don't short-circuit here and ensure the keyguard is fully re-shown.
                Log.e(TAG,
                        "doKeyguard: already showing, but re-showing since we're not interactive");
                        "doKeyguard: already showing, but re-showing because we're interactive or "
                                + "were in the middle of hiding.");
            }
        }

@@ -2427,11 +2431,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
                if (DEBUG) Log.d(TAG, "handleShow");
            }

            mHiding = false;
            mKeyguardExitAnimationRunner = null;
            mWakeAndUnlocking = false;
            setPendingLock(false);
            setShowingLocked(true);

            // Force if we we're showing in the middle of hiding, to ensure we end up in the correct
            // state.
            setShowingLocked(true, mHiding /* force */);
            if (mHiding) {
                Log.d(TAG, "Forcing setShowingLocked because mHiding=true, which means we're "
                        + "showing in the middle of hiding.");
            }
            mHiding = false;

            mKeyguardViewControllerLazy.get().show(options);
            resetKeyguardDonePendingLocked();
            mHideAnimationRun = false;
+1 −1
Original line number Diff line number Diff line
@@ -429,7 +429,6 @@ public class DozeParameters implements
        }

        dispatchAlwaysOnEvent();
        mScreenOffAnimationController.onAlwaysOnChanged(getAlwaysOn());
    }

    @Override
@@ -469,6 +468,7 @@ public class DozeParameters implements
        for (Callback callback : mCallbacks) {
            callback.onAlwaysOnChange();
        }
        mScreenOffAnimationController.onAlwaysOnChanged(getAlwaysOn());
    }

    private boolean getPostureSpecificBool(
+4 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ public class DozeParametersTest extends SysuiTestCase {
        when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(true);
        mDozeParameters.onTuningChanged(Settings.Secure.DOZE_ALWAYS_ON, "1");

        verify(mScreenOffAnimationController).onAlwaysOnChanged(false);
        assertThat(mDozeParameters.getAlwaysOn()).isFalse();
    }

@@ -196,13 +197,16 @@ public class DozeParametersTest extends SysuiTestCase {
        mBatteryStateChangeCallback.getValue().onPowerSaveChanged(true);

        verify(callback, times(2)).onAlwaysOnChange();
        verify(mScreenOffAnimationController, times(2)).onAlwaysOnChanged(false);
        assertThat(mDozeParameters.getAlwaysOn()).isFalse();

        reset(mScreenOffAnimationController);
        reset(callback);
        when(mBatteryController.isAodPowerSave()).thenReturn(false);
        mBatteryStateChangeCallback.getValue().onPowerSaveChanged(true);

        verify(callback).onAlwaysOnChange();
        verify(mScreenOffAnimationController).onAlwaysOnChanged(true);
        assertThat(mDozeParameters.getAlwaysOn()).isTrue();
    }