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

Commit 3e86ab6f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ib99310a4,I3bae98bc into main

* changes:
  ModifierShortcutTest improvement
  Add flag for making ModifierShortcutManager multiuser aware.
parents c6937041 d1718991
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -35,3 +35,13 @@ flag {
    description: "Enable BackgroundInstallControl based on system feature to prevent it from starting on form factors."
    bug: "340928990"
}

flag {
    namespace: "input"
    name: "modifier_shortcut_manager_multiuser"
    description: "Update Modifier Shortcut Manager to work correctly with multiple users, including HSUM"
    bug: "351963350"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
            mPhoneWindowManager.assertLaunchCategory(category);
        }

        mPhoneWindowManager.overrideRoleManager();
        for (int i = 0; i < ROLE_SHORTCUTS.size(); i++) {
            final int keyCode = ROLE_SHORTCUTS.keyAt(i);
            final String role = ROLE_SHORTCUTS.valueAt(i);
+10 −4
Original line number Diff line number Diff line
@@ -568,6 +568,12 @@ class TestPhoneWindowManager {
        doReturn(isShowing).when(mKeyguardServiceDelegate).isShowing();
    }

    void overrideRoleManager() {
        doReturn(mContext).when(mContext).createContextAsUser(any(), anyInt());
        doReturn(mRoleManager).when(mContext).getSystemService(eq(RoleManager.class));
        doReturn(mPackageManager).when(mContext).getPackageManager();
    }

    void setupAssistForLaunch() {
        doNothing().when(mPhoneWindowManager).sendCloseSystemWindows();
        doReturn(true).when(mPhoneWindowManager).isUserSetupComplete();
@@ -709,7 +715,7 @@ class TestPhoneWindowManager {
            throw new AssertionError("failed to assert " + category, t);
        }
        // Reset verifier for next call.
        Mockito.reset(mContext);
        Mockito.clearInvocations(mContext);
    }

    void assertLaunchRole(String role) {
@@ -719,10 +725,10 @@ class TestPhoneWindowManager {
            verify(mContext).startActivityAsUser(intentCaptor.capture(), any());
            switch (role) {
                case RoleManager.ROLE_BROWSER:
                    Assert.assertEquals(intentCaptor.getValue(), mBrowserIntent);
                    Assert.assertEquals(mBrowserIntent, intentCaptor.getValue());
                    break;
                case RoleManager.ROLE_SMS:
                    Assert.assertEquals(intentCaptor.getValue(), mSmsIntent);
                    Assert.assertEquals(mSmsIntent, intentCaptor.getValue());
                    break;
                default:
                    throw new AssertionError("Role " + role + " not supported in tests.");
@@ -731,7 +737,7 @@ class TestPhoneWindowManager {
            throw new AssertionError("failed to assert " + role, t);
        }
        // Reset verifier for next call.
        Mockito.reset(mContext);
        Mockito.clearInvocations(mContext);
    }