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

Commit 4635dad8 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24102276', 'googleplex-android-review.googlesource.com/23987753', 'googleplex-android-review.googlesource.com/24101116', 'googleplex-android-review.googlesource.com/24031910', 'googleplex-android-review.googlesource.com/24081945', 'googleplex-android-review.googlesource.com/24058478'] into sparse-10502572-L39700000962039696.
SPARSE_CHANGE: Ie826bdb163288e5741a33e26209d3175de426bd1
SPARSE_CHANGE: I3ba4478e7f26a77ef7d3e3be380e75e7c197edc2
SPARSE_CHANGE: Ibd786995cc6b8252aa5ce07d2aea5977ae2551db
SPARSE_CHANGE: Id5aee1323b9b3b254e19e8a4e189c1fa4f9d96ea
SPARSE_CHANGE: If664fbc58554d7cfabae86c9ec282f3f7cf50526
SPARSE_CHANGE: I362f0f253b466cfcbcebbe79936ae9a5c5261d92

Change-Id: I29a897592b815a71bbe03a386cb6d55ec363573f
parents 48a86e27 6a2ab0c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1008,7 +1008,7 @@ public class LockPatternUtils {
                    CREDENTIAL_TYPE_API, CREDENTIAL_TYPE_API, mCredentialTypeQuery);

    /**
     * Invalidate the credential cache
     * Invalidate the credential type cache
     * @hide
     */
    public final static void invalidateCredentialTypeCache() {
+2 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ namespace android {
namespace uirenderer {
namespace renderthread {

static std::array<std::string_view, 19> sEnableExtensions{
static std::array<std::string_view, 20> sEnableExtensions{
        VK_KHR_BIND_MEMORY_2_EXTENSION_NAME,
        VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME,
        VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME,
@@ -60,6 +60,7 @@ static std::array<std::string_view, 19> sEnableExtensions{
        VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME,
        VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
        VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
        VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME,
};

static bool shouldEnableExtension(const std::string_view& extension) {
+21 −3
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
    private KeyguardViewController mKeyguardViewController;
    private DozeScrimController mDozeScrimController;
    private KeyguardViewMediator mKeyguardViewMediator;
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private PendingAuthenticated mPendingAuthenticated = null;
    private boolean mHasScreenTurnedOnSinceAuthenticating;
    private boolean mFadedAwayAfterWakeAndUnlock;
@@ -280,7 +281,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            LatencyTracker latencyTracker,
            ScreenOffAnimationController screenOffAnimationController,
            VibratorHelper vibrator,
            SystemClock systemClock
            SystemClock systemClock,
            StatusBarKeyguardViewManager statusBarKeyguardViewManager
    ) {
        mPowerManager = powerManager;
        mUpdateMonitor = keyguardUpdateMonitor;
@@ -308,6 +310,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        mVibratorHelper = vibrator;
        mLogger = biometricUnlockLogger;
        mSystemClock = systemClock;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;

        dumpManager.registerDumpable(getClass().getName(), this);
    }
@@ -449,8 +452,19 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        // During wake and unlock, we need to draw black before waking up to avoid abrupt
        // brightness changes due to display state transitions.
        Runnable wakeUp = ()-> {
            if (!wasDeviceInteractive || mUpdateMonitor.isDreaming()) {
            // Check to see if we are still locked when we are waking and unlocking from dream.
            // This runnable should be executed after unlock. If that's true, we could be not
            // dreaming, but still locked. In this case, we should attempt to authenticate instead
            // of waking up.
            if (mode == MODE_WAKE_AND_UNLOCK_FROM_DREAM
                    && !mKeyguardStateController.isUnlocked()
                    && !mUpdateMonitor.isDreaming()) {
                // Post wakeUp runnable is called from a callback in keyguard.
                mHandler.post(() -> mKeyguardViewController.notifyKeyguardAuthenticated(
                        false /* primaryAuth */));
            } else if (!wasDeviceInteractive || mUpdateMonitor.isDreaming()) {
                mLogger.i("bio wakelock: Authenticated, waking up...");

                mPowerManager.wakeUp(
                        mSystemClock.uptimeMillis(),
                        PowerManager.WAKE_REASON_BIOMETRIC,
@@ -462,7 +476,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            Trace.endSection();
        };

        if (mMode != MODE_NONE) {
        if (mMode != MODE_NONE && mMode != MODE_WAKE_AND_UNLOCK_FROM_DREAM) {
            wakeUp.run();
        }
        switch (mMode) {
@@ -484,6 +498,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                Trace.endSection();
                break;
            case MODE_WAKE_AND_UNLOCK_FROM_DREAM:
                // In the case of waking and unlocking from dream, waking up is delayed until after
                // unlock is complete to avoid conflicts during each sequence's transitions.
                mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(wakeUp);
                // Execution falls through here to proceed unlocking.
            case MODE_WAKE_AND_UNLOCK_PULSING:
            case MODE_WAKE_AND_UNLOCK:
                if (mMode == MODE_WAKE_AND_UNLOCK_PULSING) {
+1 −3
Original line number Diff line number Diff line
@@ -187,9 +187,7 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {

    @Test
    public void testLockedOut_verifyPasswordAndUnlock_doesNotEnableViewInput() {
        mKeyguardAbsKeyInputViewController.handleAttemptLockout(
                SystemClock.elapsedRealtime() + 1000);
        mKeyguardAbsKeyInputViewController.verifyPasswordAndUnlock();
        mKeyguardAbsKeyInputViewController.handleAttemptLockout(SystemClock.elapsedRealtime());
        verify(mAbsKeyInputView).setPasswordEntryInputEnabled(false);
        verify(mAbsKeyInputView).setPasswordEntryEnabled(false);
        verify(mAbsKeyInputView, never()).setPasswordEntryInputEnabled(true);
+70 −1
Original line number Diff line number Diff line
@@ -142,7 +142,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
                mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
                mAuthController, mStatusBarStateController,
                mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper,
                mSystemClock
                mSystemClock,
                mStatusBarKeyguardViewManager
        );
        mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
        mBiometricUnlockController.addListener(mBiometricUnlockEventsListener);
@@ -463,6 +464,69 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        verify(mVibratorHelper, never()).vibrateAuthSuccess(anyString());
    }

    @Test
    public void onSideFingerprintSuccess_dreaming_unlockThenWake() {
        when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true);
        when(mWakefulnessLifecycle.getLastWakeReason())
                .thenReturn(PowerManager.WAKE_REASON_POWER_BUTTON);
        final ArgumentCaptor<Runnable> afterKeyguardGoneRunnableCaptor =
                ArgumentCaptor.forClass(Runnable.class);
        givenDreamingLocked();
        mBiometricUnlockController.startWakeAndUnlock(BiometricSourceType.FINGERPRINT, true);

        // Make sure the BiometricUnlockController has registered a callback for when the keyguard
        // is gone
        verify(mStatusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(
                afterKeyguardGoneRunnableCaptor.capture());
        // Ensure that the power hasn't been told to wake up yet.
        verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());
        // Check that the keyguard has been told to unlock.
        verify(mKeyguardViewMediator).onWakeAndUnlocking();

        // Simulate the keyguard disappearing.
        afterKeyguardGoneRunnableCaptor.getValue().run();
        // Verify that the power manager has been told to wake up now.
        verify(mPowerManager).wakeUp(anyLong(), anyInt(), anyString());
    }

    @Test
    public void onSideFingerprintSuccess_dreaming_unlockIfStillLockedNotDreaming() {
        when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true);
        when(mWakefulnessLifecycle.getLastWakeReason())
                .thenReturn(PowerManager.WAKE_REASON_POWER_BUTTON);
        final ArgumentCaptor<Runnable> afterKeyguardGoneRunnableCaptor =
                ArgumentCaptor.forClass(Runnable.class);
        givenDreamingLocked();
        mBiometricUnlockController.startWakeAndUnlock(BiometricSourceType.FINGERPRINT, true);

        // Make sure the BiometricUnlockController has registered a callback for when the keyguard
        // is gone
        verify(mStatusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(
                afterKeyguardGoneRunnableCaptor.capture());
        // Ensure that the power hasn't been told to wake up yet.
        verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());
        // Check that the keyguard has been told to unlock.
        verify(mKeyguardViewMediator).onWakeAndUnlocking();

        when(mUpdateMonitor.isDreaming()).thenReturn(false);
        when(mKeyguardStateController.isUnlocked()).thenReturn(false);

        // Simulate the keyguard disappearing.
        afterKeyguardGoneRunnableCaptor.getValue().run();

        final ArgumentCaptor<Runnable> dismissKeyguardRunnableCaptor =
                ArgumentCaptor.forClass(Runnable.class);
        verify(mHandler).post(dismissKeyguardRunnableCaptor.capture());

        // Verify that the power manager was not told to wake up.
        verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());

        dismissKeyguardRunnableCaptor.getValue().run();
        // Verify that the keyguard controller is told to unlock.
        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
    }


    @Test
    public void onSideFingerprintSuccess_oldPowerButtonPress_playHaptic() {
        // GIVEN side fingerprint enrolled, last wake reason was power button
@@ -537,6 +601,11 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(anyBoolean());
    }

    private void givenDreamingLocked() {
        when(mUpdateMonitor.isDreaming()).thenReturn(true);
        when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
    }

    private void givenFingerprintModeUnlockCollapsing() {
        when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
Loading