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

Commit 5e77a2d1 authored by Matt Pietal's avatar Matt Pietal Committed by Android Build Coastguard Worker
Browse files

Update broken tests

These did not compile after merging a security fix for user switching.

Fixes: 442583448
Test: atest KeyguardViewMediatorTest
Flag: EXEMPT bugfix
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:7e2fe661ec8be0ef93117eded48d79f62e5974cc
Merged-In: Idc6df43d4801c9320885f8aa10f11396da5df0b2
Change-Id: Idc6df43d4801c9320885f8aa10f11396da5df0b2
parent 9c8c99ba
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        // Setup keyguard
        mViewMediator.onSystemReady();
        processAllMessagesAndBgExecutorMessages();
        mViewMediator.setShowingLocked(true, "");
        mViewMediator.setShowingLocked(true);

        // Request keyguard going away
        when(mKeyguardStateController.isKeyguardGoingAway()).thenReturn(true);
@@ -366,7 +366,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {

        // The call to exit should be rejected, and keyguard should still be visible
        verify(mKeyguardUnlockAnimationController, never()).notifyStartSurfaceBehindRemoteAnimation(
                any(), any(), any(), anyLong(), anyBoolean());
                any(), any(), anyLong(), anyBoolean());
        try {
            assertATMSLockScreenShowing(true);
        } catch (Exception e) {
@@ -383,7 +383,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        // Setup keyguard
        mViewMediator.onSystemReady();
        processAllMessagesAndBgExecutorMessages();
        mViewMediator.setShowingLocked(true, "");
        mViewMediator.setShowingLocked(true);

        // After the request, begin a switch to a new secure user
        int nextUserId = 500;
@@ -419,7 +419,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        // Setup keyguard
        mViewMediator.onSystemReady();
        processAllMessagesAndBgExecutorMessages();
        mViewMediator.setShowingLocked(true, "");
        mViewMediator.setShowingLocked(true);

        // After the request, begin a switch to an insecure user
        int nextUserId = 500;
@@ -447,7 +447,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        // Setup keyguard as not visible
        mViewMediator.onSystemReady();
        processAllMessagesAndBgExecutorMessages();
        mViewMediator.setShowingLocked(false, "");
        mViewMediator.setShowingLocked(false);
        processAllMessagesAndBgExecutorMessages();

        // Begin a switch to a new secure user
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ class FakeUserTracker(
    private var _userHandle: UserHandle = UserHandle.of(_userId),
    private var _userInfo: UserInfo = mock(),
    private var _userProfiles: List<UserInfo> = emptyList(),
    private var _isUserSwitching: Boolean = false,
    userContentResolver: ContentResolver = MockContentResolver(),
    userContext: Context = mock(),
    private val onCreateCurrentUserContext: (Context) -> Context = { mock() },
@@ -48,6 +49,9 @@ class FakeUserTracker(
    override val userProfiles: List<UserInfo>
        get() = _userProfiles

    override val isUserSwitching: Boolean
        get() = _isUserSwitching

    override val userContentResolver: ContentResolver = userContentResolver
    override val userContext: Context = userContext

@@ -81,11 +85,13 @@ class FakeUserTracker(
    }

    fun onUserChanging(userId: Int = _userId) {
        _isUserSwitching = true
        val copy = callbacks.toList()
        copy.forEach { it.onUserChanging(userId, userContext) {} }
    }

    fun onUserChanged(userId: Int = _userId) {
        _isUserSwitching = false
        val copy = callbacks.toList()
        copy.forEach { it.onUserChanged(userId, userContext) }
    }