summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/tests/servicestests/assets/shortcut/dumpsys_expected.txt4
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java134
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java2740
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java37
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java262
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest12.java26
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java310
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java18
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java6
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java52
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java134
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java202
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java10
13 files changed, 1970 insertions, 1965 deletions
diff --git a/services/tests/servicestests/assets/shortcut/dumpsys_expected.txt b/services/tests/servicestests/assets/shortcut/dumpsys_expected.txt
index eed2087f80ef..029ada3f5118 100644
--- a/services/tests/servicestests/assets/shortcut/dumpsys_expected.txt
+++ b/services/tests/servicestests/assets/shortcut/dumpsys_expected.txt
@@ -1,7 +1,7 @@
{
"shortcut": [
{
- "userId": 0,
+ "userId": 10,
"launchers": [
{
"name": "com.android.launcher.1"
@@ -55,7 +55,7 @@
]
},
{
- "userId": 10,
+ "userId": 11,
"launchers": [
{
"name": "com.android.launcher.1"
diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
index 2c1e37beda26..0b2a2cdd26b9 100644
--- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
@@ -721,54 +721,56 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
protected static final String SYSTEM_PACKAGE_NAME = "android";
protected static final String CALLING_PACKAGE_1 = "com.android.test.1";
- protected static final int CALLING_UID_1 = 10001;
+ protected static final int CALLING_UID_1 = 1000001;
protected static final String CALLING_PACKAGE_2 = "com.android.test.2";
- protected static final int CALLING_UID_2 = 10002;
+ protected static final int CALLING_UID_2 = 1000002;
protected static final String CALLING_PACKAGE_3 = "com.android.test.3";
- protected static final int CALLING_UID_3 = 10003;
+ protected static final int CALLING_UID_3 = 1000003;
protected static final String CALLING_PACKAGE_4 = "com.android.test.4";
- protected static final int CALLING_UID_4 = 10004;
+ protected static final int CALLING_UID_4 = 1000004;
protected static final String LAUNCHER_1 = "com.android.launcher.1";
- protected static final int LAUNCHER_UID_1 = 10011;
+ protected static final int LAUNCHER_UID_1 = 1000011;
protected static final String LAUNCHER_2 = "com.android.launcher.2";
- protected static final int LAUNCHER_UID_2 = 10012;
+ protected static final int LAUNCHER_UID_2 = 1000012;
protected static final String LAUNCHER_3 = "com.android.launcher.3";
- protected static final int LAUNCHER_UID_3 = 10013;
+ protected static final int LAUNCHER_UID_3 = 1000013;
protected static final String LAUNCHER_4 = "com.android.launcher.4";
- protected static final int LAUNCHER_UID_4 = 10014;
+ protected static final int LAUNCHER_UID_4 = 1000014;
protected static final String CHOOSER_ACTIVITY_PACKAGE = "com.android.intentresolver";
- protected static final int CHOOSER_ACTIVITY_UID = 10015;
+ protected static final int CHOOSER_ACTIVITY_UID = 1000015;
- protected static final int USER_0 = UserHandle.USER_SYSTEM;
+ // Shifting primary user to 10 to support HSUM
protected static final int USER_10 = 10;
protected static final int USER_11 = 11;
+ protected static final int USER_12 = 12;
protected static final int USER_P0 = 20; // profile of user 0 (MANAGED_PROFILE *not* set)
protected static final int USER_P1 = 21; // another profile of user 0 (MANAGED_PROFILE set)
- protected static final UserHandle HANDLE_USER_0 = UserHandle.of(USER_0);
protected static final UserHandle HANDLE_USER_10 = UserHandle.of(USER_10);
protected static final UserHandle HANDLE_USER_11 = UserHandle.of(USER_11);
+ protected static final UserHandle HANDLE_USER_12 = UserHandle.of(USER_12);
protected static final UserHandle HANDLE_USER_P0 = UserHandle.of(USER_P0);
protected static final UserHandle HANDLE_USER_P1 = UserHandle.of(USER_P1);
- protected static final UserInfo USER_INFO_0 = withProfileGroupId(
- new UserInfo(USER_0, "user0",
- UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED), 0);
-
- protected static final UserInfo USER_INFO_10 =
- new UserInfo(USER_10, "user10", UserInfo.FLAG_INITIALIZED);
+ protected static final UserInfo USER_INFO_10 = withProfileGroupId(
+ new UserInfo(USER_10, "user10",
+ UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED),
+ USER_10);
protected static final UserInfo USER_INFO_11 =
new UserInfo(USER_11, "user11", UserInfo.FLAG_INITIALIZED);
+ protected static final UserInfo USER_INFO_12 =
+ new UserInfo(USER_12, "user12", UserInfo.FLAG_INITIALIZED);
+
/*
* Cheat: USER_P0 is a sub profile of USER_0, but it doesn't have the MANAGED_PROFILE flag set.
* Due to a change made to LauncherApps (b/34340531), work profile apps a no longer able
@@ -778,11 +780,11 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
* can't access main profile's shortcuts.)
*/
protected static final UserInfo USER_INFO_P0 = withProfileGroupId(
- new UserInfo(USER_P0, "userP0", UserInfo.FLAG_INITIALIZED), 0);
+ new UserInfo(USER_P0, "userP0", UserInfo.FLAG_INITIALIZED), USER_10);
protected static final UserInfo USER_INFO_P1 = withProfileGroupId(
new UserInfo(USER_P1, "userP1",
- UserInfo.FLAG_INITIALIZED | UserInfo.FLAG_MANAGED_PROFILE), 0);
+ UserInfo.FLAG_INITIALIZED | UserInfo.FLAG_MANAGED_PROFILE), USER_10);
protected static final UserProperties USER_PROPERTIES_0 =
new UserProperties.Builder().setItemsRestrictedOnHomeScreen(false).build();
@@ -925,14 +927,14 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
deleteAllSavedFiles();
// Set up users.
- mUserInfos.put(USER_0, USER_INFO_0);
mUserInfos.put(USER_10, USER_INFO_10);
mUserInfos.put(USER_11, USER_INFO_11);
+ mUserInfos.put(USER_12, USER_INFO_12);
mUserInfos.put(USER_P0, USER_INFO_P0);
mUserInfos.put(USER_P1, USER_INFO_P1);
- mUserProperties.put(USER_0, USER_PROPERTIES_0);
- mUserProperties.put(USER_10, USER_PROPERTIES_10);
- mUserProperties.put(USER_11, USER_PROPERTIES_11);
+ mUserProperties.put(USER_10, USER_PROPERTIES_0);
+ mUserProperties.put(USER_11, USER_PROPERTIES_10);
+ mUserProperties.put(USER_12, USER_PROPERTIES_11);
when(mMockUserManagerInternal.isUserUnlockingOrUnlocked(anyInt()))
.thenAnswer(inv -> {
@@ -994,16 +996,16 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
mUserInfos.values().toArray(new UserInfo[0]));
// User 0 and P0 are always running
- mRunningUsers.put(USER_0, true);
- mRunningUsers.put(USER_10, false);
+ mRunningUsers.put(USER_10, true);
mRunningUsers.put(USER_11, false);
+ mRunningUsers.put(USER_12, false);
mRunningUsers.put(USER_P0, true);
mRunningUsers.put(USER_P1, true);
// Unlock all users by default.
- mUnlockedUsers.put(USER_0, true);
mUnlockedUsers.put(USER_10, true);
mUnlockedUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_12, true);
mUnlockedUsers.put(USER_P0, true);
mUnlockedUsers.put(USER_P1, true);
@@ -1391,7 +1393,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
}
protected void setCaller(String packageName) {
- setCaller(packageName, UserHandle.USER_SYSTEM);
+ setCaller(packageName, USER_10);
}
protected String getCallingPackage() {
@@ -2223,7 +2225,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
dumpsysOnLogcat("Before backup");
- final byte[] payload = mService.getBackupPayload(USER_0);
+ final byte[] payload = mService.getBackupPayload(USER_10);
if (ENABLE_DUMP) {
final String xml = new String(payload);
Log.v(TAG, "Backup payload:");
@@ -2233,7 +2235,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
}
// Before doing anything else, uninstall all packages.
- for (int userId : list(USER_0, USER_P0)) {
+ for (int userId : list(USER_10, USER_P0)) {
for (String pkg : list(CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3,
LAUNCHER_1, LAUNCHER_2, LAUNCHER_3)) {
uninstallPackage(userId, pkg);
@@ -2245,11 +2247,11 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
deleteAllSavedFiles();
initService();
- mService.applyRestore(payload, USER_0);
+ mService.applyRestore(payload, USER_10);
// handleUnlockUser will perform the gone package check, but it shouldn't remove
// shadow information.
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
dumpsysOnLogcat("After restore");
@@ -2257,24 +2259,24 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
}
protected void prepareCrossProfileDataSet() {
- mRunningUsers.put(USER_10, true); // this test needs user 10.
+ mRunningUsers.put(USER_11, true); // this test needs user 10.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"),
makeShortcut("s4"), makeShortcut("s5"), makeShortcut("s6"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"),
makeShortcut("s4"), makeShortcut("s5"), makeShortcut("s6"))));
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"),
makeShortcut("s4"), makeShortcut("s5"), makeShortcut("s6"))));
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list()));
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
@@ -2282,79 +2284,79 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"),
makeShortcut("s4"), makeShortcut("s5"), makeShortcut("s6"))));
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("x1"), makeShortcut("x2"), makeShortcut("x3"),
makeShortcut("x4"), makeShortcut("x5"), makeShortcut("x6"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s1", "s2"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s1", "s2", "s3"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s1", "s2"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s1", "s2", "s3"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1", "s4"), HANDLE_USER_P0);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s2", "s3"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s2", "s3", "s4"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s2", "s3"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s2", "s3", "s4"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2", "s5"), HANDLE_USER_P0);
});
// Note LAUNCHER_3 has allowBackup=false.
- runWithCaller(LAUNCHER_3, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s3", "s4"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s3", "s4", "s5"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_3, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s3", "s4"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s3", "s4", "s5"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3", "s6"), HANDLE_USER_P0);
});
- runWithCaller(LAUNCHER_4, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list(), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list(), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list(), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_4, list(), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_4, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list(), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list(), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list(), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_4, list(), HANDLE_USER_10);
});
// Launcher on a managed profile is referring ot user 0!
runWithCaller(LAUNCHER_1, USER_P0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3", "s4"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s3", "s4", "s5"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3", "s4"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s3", "s4", "s5"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("s3", "s4", "s5", "s6"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s4", "s1"), HANDLE_USER_P0);
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("x4", "x5"), HANDLE_USER_10);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("x4", "x5", "x6"), HANDLE_USER_10);
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("x4", "x5"), HANDLE_USER_11);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("x4", "x5", "x6"), HANDLE_USER_11);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("x4", "x5", "x6", "x1"),
- HANDLE_USER_10);
+ HANDLE_USER_11);
});
// Then remove some dynamic shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list()));
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("x1"), makeShortcut("x2"), makeShortcut("x3"))));
});
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
index d70ffd2ec050..c01283a236c4 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
@@ -285,7 +285,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void SetDynamicShortcuts() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.icon1);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
@@ -338,7 +338,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat();
mInjectedCurrentTimeMillis++; // Need to advance the clock for reset to work.
- mService.resetThrottlingInner(UserHandle.USER_SYSTEM);
+ mService.resetThrottlingInner(USER_10);
dumpsysOnLogcat();
@@ -347,15 +347,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// TODO Check max number
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))));
});
}
public void AddDynamicShortcuts() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final ShortcutInfo si1 = makeShortcut("shortcut1");
final ShortcutInfo si2 = makeShortcut("shortcut2");
@@ -395,9 +395,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// TODO Check fields.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertTrue(mManager.addDynamicShortcuts(list(makeShortcut("s1"))));
});
}
@@ -406,7 +406,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=5,"
+ ShortcutService.ConfigConstants.KEY_SAVE_DELAY_MILLIS + "=1");
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final ShortcutInfo s1 = makeShortcut("s1");
final ShortcutInfo s2 = makeShortcut("s2");
@@ -420,10 +420,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Test push as first shortcut
mManager.pushDynamicShortcut(s1);
+ setCaller(CALLING_PACKAGE_1, USER_10);
assertShortcutIds(assertAllNotKeyFieldsOnly(mManager.getDynamicShortcuts()), "s1");
assertEquals(0, getCallerShortcut("s1").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_10));
// Test push when other shortcuts exist
Mockito.reset(mMockUsageStatsManagerInternal);
@@ -436,11 +437,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(1, getCallerShortcut("s1").getRank());
assertEquals(2, getCallerShortcut("s2").getRank());
verify(mMockUsageStatsManagerInternal, times(0)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_10));
verify(mMockUsageStatsManagerInternal, times(0)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s2"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s2"), eq(USER_10));
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s3"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s3"), eq(USER_10));
mInjectedCurrentTimeMillis += INTERVAL; // reset
@@ -451,7 +452,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(2, getCallerShortcut("s4").getRank());
assertEquals(3, getCallerShortcut("s2").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s4"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s4"), eq(USER_10));
// Push existing shortcut with set rank
Mockito.reset(mMockUsageStatsManagerInternal);
@@ -461,7 +462,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(2, getCallerShortcut("s2").getRank());
assertEquals(3, getCallerShortcut("s4").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s4"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s4"), eq(USER_10));
mInjectedCurrentTimeMillis += INTERVAL; // reset
@@ -476,7 +477,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(3, getCallerShortcut("s2").getRank());
assertEquals(4, getCallerShortcut("s4").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s5"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s5"), eq(USER_10));
// Push when max has already reached
Mockito.reset(mMockUsageStatsManagerInternal);
@@ -487,7 +488,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(1, getCallerShortcut("s5").getRank());
assertEquals(4, getCallerShortcut("s2").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s6"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s6"), eq(USER_10));
mInjectedCurrentTimeMillis += INTERVAL; // reset
@@ -499,7 +500,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
getCallerShortcut("s7").getActivity());
assertEquals(0, getCallerShortcut("s7").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s7"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s7"), eq(USER_10));
// Push to update shortcut with different activity
Mockito.reset(mMockUsageStatsManagerInternal);
@@ -514,7 +515,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(2, getCallerShortcut("s3").getRank());
assertEquals(3, getCallerShortcut("s2").getRank());
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s1"), eq(USER_10));
mInjectedCurrentTimeMillis += INTERVAL; // reset
@@ -524,12 +525,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
s8.setRank(100);
mManager.pushDynamicShortcut(s8);
assertEquals(4, getCallerShortcut("s8").getRank());
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s8"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s8"), HANDLE_USER_10,
CACHE_OWNER_0);
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s8"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s8"), eq(USER_10));
});
Mockito.reset(mMockUsageStatsManagerInternal);
@@ -540,7 +541,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED),
"s8");
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s9"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s9"), eq(USER_10));
}
public void PushDynamicShortcut_CallsToUsageStatsManagerAreThrottled()
@@ -549,13 +550,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
ShortcutService.ConfigConstants.KEY_SAVE_DELAY_MILLIS + "=500");
// Verify calls to UsageStatsManagerInternal#reportShortcutUsage are throttled.
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
{
final ShortcutInfo si = makeShortcut("s0");
mManager.pushDynamicShortcut(si);
}
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s0"), eq(USER_0));
+ eq(CALLING_PACKAGE_1), eq("s0"), eq(USER_10));
Mockito.reset(mMockUsageStatsManagerInternal);
for (int i = 2; i <= 10; i++) {
final ShortcutInfo si = makeShortcut("s" + i);
@@ -565,13 +566,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
any(), any(), anyInt());
// Verify pkg2 isn't blocked by pkg1, but consecutive calls from pkg2 are throttled as well.
- setCaller(CALLING_PACKAGE_2, USER_0);
+ setCaller(CALLING_PACKAGE_2, USER_10);
{
final ShortcutInfo si = makeShortcut("s1");
mManager.pushDynamicShortcut(si);
}
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_2), eq("s1"), eq(USER_0));
+ eq(CALLING_PACKAGE_2), eq("s1"), eq(USER_10));
Mockito.reset(mMockUsageStatsManagerInternal);
for (int i = 2; i <= 10; i++) {
final ShortcutInfo si = makeShortcut("s" + i);
@@ -584,18 +585,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Let time passes which resets the throttle
Thread.sleep(505);
// Verify UsageStatsManagerInternal#reportShortcutUsed can be called again
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.pushDynamicShortcut(makeShortcut("s10"));
- setCaller(CALLING_PACKAGE_2, USER_0);
+ setCaller(CALLING_PACKAGE_2, USER_10);
mManager.pushDynamicShortcut(makeShortcut("s10"));
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), any(), eq(USER_0));
+ eq(CALLING_PACKAGE_1), any(), eq(USER_10));
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_2), any(), eq(USER_0));
+ eq(CALLING_PACKAGE_2), any(), eq(USER_10));
}
public void UnlimitedCalls() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final ShortcutInfo si1 = makeShortcut("shortcut1");
@@ -628,9 +629,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void PublishWithNoActivity() {
// If activity is not explicitly set, use the default one.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
// s1 and s3 has no activities.
final ShortcutInfo si1 = new ShortcutInfo.Builder(mClientContext, "si1")
.setShortLabel("label1")
@@ -732,9 +733,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void PublishWithNoActivity_noMainActivityInPackage() {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
final ShortcutInfo si1 = new ShortcutInfo.Builder(mClientContext, "si1")
.setShortLabel("label1")
.setIntent(new Intent("action1"))
@@ -905,35 +906,35 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
setCaller(LAUNCHER_1);
// Check hasIconResource()/hasIconFile().
assertShortcutIds(assertAllHaveIconResId(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res32x32", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res32x32", USER_10))),
"res32x32");
assertShortcutIds(assertAllHaveIconResId(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res64x64", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res64x64", USER_10))),
"res64x64");
assertShortcutIds(assertAllHaveIconFile(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_10))),
"bmp32x32");
assertShortcutIds(assertAllHaveIconFile(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_10))),
"bmp64x64");
assertShortcutIds(assertAllHaveIconFile(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_10))),
"bmp512x512");
assertShortcutIds(assertAllHaveIconUri(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri32x32", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri32x32", USER_10))),
"uri32x32");
assertShortcutIds(assertAllHaveIconUri(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri64x64", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri64x64", USER_10))),
"uri64x64");
assertShortcutIds(assertAllHaveIconUri(
- list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri512x512", USER_0))),
+ list(getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "uri512x512", USER_10))),
"uri512x512");
assertShortcutIds(assertAllHaveIconResId(
@@ -947,36 +948,36 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(
R.drawable.black_32x32,
mLauncherApps.getShortcutIconResId(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res32x32", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res32x32", USER_10)));
assertEquals(
R.drawable.black_64x64,
mLauncherApps.getShortcutIconResId(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res64x64", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "res64x64", USER_10)));
assertEquals(
0, // because it's not a resource
mLauncherApps.getShortcutIconResId(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_10)));
assertEquals(
0, // because it's not a resource
mLauncherApps.getShortcutIconResId(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_10)));
assertEquals(
0, // because it's not a resource
mLauncherApps.getShortcutIconResId(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_10)));
bmp = pfdToBitmap(mLauncherApps.getShortcutIconFd(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp32x32", USER_10)));
assertBitmapSize(32, 32, bmp);
bmp = pfdToBitmap(mLauncherApps.getShortcutIconFd(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp64x64", USER_10)));
assertBitmapSize(64, 64, bmp);
bmp = pfdToBitmap(mLauncherApps.getShortcutIconFd(
- getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_0)));
+ getShortcutInfoAsLauncher(CALLING_PACKAGE_1, "bmp512x512", USER_10)));
assertBitmapSize(128, 128, bmp);
assertEquals(
@@ -991,10 +992,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Also check the overload APIs too.
assertEquals(
R.drawable.black_32x32,
- mLauncherApps.getShortcutIconResId(CALLING_PACKAGE_1, "res32x32", HANDLE_USER_0));
+ mLauncherApps.getShortcutIconResId(CALLING_PACKAGE_1, "res32x32", HANDLE_USER_10));
assertEquals(
R.drawable.black_64x64,
- mLauncherApps.getShortcutIconResId(CALLING_PACKAGE_1, "res64x64", HANDLE_USER_0));
+ mLauncherApps.getShortcutIconResId(CALLING_PACKAGE_1, "res64x64", HANDLE_USER_10));
assertEquals(
R.drawable.black_512x512,
mLauncherApps.getShortcutIconResId(CALLING_PACKAGE_1, "res32x32", HANDLE_USER_P0));
@@ -1035,14 +1036,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void CleanupDanglingBitmaps() throws Exception {
- assertBitmapDirectories(USER_0, EMPTY_STRINGS);
assertBitmapDirectories(USER_10, EMPTY_STRINGS);
+ assertBitmapDirectories(USER_11, EMPTY_STRINGS);
// Make some shortcuts with bitmap icons.
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("s1", bmp32x32),
makeShortcutWithIcon("s2", bmp32x32),
@@ -1053,7 +1054,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Increment the time (which actually we don't have to), which is used for filenames.
mInjectedCurrentTimeMillis++;
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("s4", bmp32x32),
makeShortcutWithIcon("s5", bmp32x32),
@@ -1064,29 +1065,29 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Increment the time, which is used for filenames.
mInjectedCurrentTimeMillis++;
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
mManager.setDynamicShortcuts(list(
));
});
// For USER-10, let's try without updating the times.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("10s1", bmp32x32),
makeShortcutWithIcon("10s2", bmp32x32),
makeShortcutWithIcon("10s3", bmp32x32)
));
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("10s4", bmp32x32),
makeShortcutWithIcon("10s5", bmp32x32),
makeShortcutWithIcon("10s6", bmp32x32)
));
});
- runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_11, () -> {
mManager.setDynamicShortcuts(list(
));
});
@@ -1096,102 +1097,102 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mService.waitForBitmapSavesForTest();
// Check files and directories.
// Package 3 has no bitmaps, so we don't create a directory.
- assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
assertBitmapDirectories(USER_10, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
+ assertBitmapDirectories(USER_11, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_1,
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s1"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s2"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s3")
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_1,
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s1"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s2"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s3")
);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_2,
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s4"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s5"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s6")
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_2,
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s4"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s5"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s6")
);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_3,
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_3,
EMPTY_STRINGS
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_1,
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s1"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s2"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s3")
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_1,
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s1"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s2"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s3")
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_2,
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s4"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s5"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s6")
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_2,
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s4"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s5"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s6")
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_3,
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_3,
EMPTY_STRINGS
);
// Then create random directories and files.
- makeFile(mService.getUserBitmapFilePath(USER_0), "a.b.c").mkdir();
- makeFile(mService.getUserBitmapFilePath(USER_0), "d.e.f").mkdir();
- makeFile(mService.getUserBitmapFilePath(USER_0), "d.e.f", "123").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_0), "d.e.f", "456").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), "a.b.c").mkdir();
+ makeFile(mService.getUserBitmapFilePath(USER_10), "d.e.f").mkdir();
+ makeFile(mService.getUserBitmapFilePath(USER_10), "d.e.f", "123").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), "d.e.f", "456").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_0), CALLING_PACKAGE_3).mkdir();
+ makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_3).mkdir();
- makeFile(mService.getUserBitmapFilePath(USER_0), CALLING_PACKAGE_1, "1").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_0), CALLING_PACKAGE_1, "2").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_0), CALLING_PACKAGE_1, "3").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_0), CALLING_PACKAGE_1, "4").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_1, "1").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_1, "2").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_1, "3").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_1, "4").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), "10a.b.c").mkdir();
- makeFile(mService.getUserBitmapFilePath(USER_10), "10d.e.f").mkdir();
- makeFile(mService.getUserBitmapFilePath(USER_10), "10d.e.f", "123").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), "10d.e.f", "456").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), "10a.b.c").mkdir();
+ makeFile(mService.getUserBitmapFilePath(USER_11), "10d.e.f").mkdir();
+ makeFile(mService.getUserBitmapFilePath(USER_11), "10d.e.f", "123").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), "10d.e.f", "456").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "1").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "2").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "3").createNewFile();
- makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "4").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), CALLING_PACKAGE_2, "1").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), CALLING_PACKAGE_2, "2").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), CALLING_PACKAGE_2, "3").createNewFile();
+ makeFile(mService.getUserBitmapFilePath(USER_11), CALLING_PACKAGE_2, "4").createNewFile();
mService.waitForBitmapSavesForTest();
- assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3,
+ assertBitmapDirectories(USER_10, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3,
"a.b.c", "d.e.f");
// Save and load. When a user is loaded, we do the cleanup.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
mService.handleUnlockUser(20); // Make sure the logic will still work for nonexistent user.
// The below check is the same as above, except this time USER_0 use the CALLING_PACKAGE_3
// directory.
mService.waitForBitmapSavesForTest();
- assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3);
- assertBitmapDirectories(USER_10, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
+ assertBitmapDirectories(USER_10, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3);
+ assertBitmapDirectories(USER_11, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_1,
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s1"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s2"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_1, "s3")
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_1,
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s1"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s2"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_1, "s3")
);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_2,
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s4"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s5"),
- getBitmapFilename(USER_0, CALLING_PACKAGE_2, "s6")
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_2,
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s4"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s5"),
+ getBitmapFilename(USER_10, CALLING_PACKAGE_2, "s6")
);
- assertBitmapFiles(USER_0, CALLING_PACKAGE_3,
+ assertBitmapFiles(USER_10, CALLING_PACKAGE_3,
EMPTY_STRINGS
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_1,
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s1"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s2"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_1, "10s3")
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_1,
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s1"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s2"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_1, "10s3")
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_2,
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s4"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s5"),
- getBitmapFilename(USER_10, CALLING_PACKAGE_2, "10s6")
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_2,
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s4"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s5"),
+ getBitmapFilename(USER_11, CALLING_PACKAGE_2, "10s6")
);
- assertBitmapFiles(USER_10, CALLING_PACKAGE_3,
+ assertBitmapFiles(USER_11, CALLING_PACKAGE_3,
EMPTY_STRINGS
);
}
@@ -1301,7 +1302,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void UpdateShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -1310,7 +1311,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
makeShortcut("s5")
)));
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -1319,22 +1320,22 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
makeShortcut("s5")
)));
});
- runWithCaller(LAUNCHER_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2", "s3"),
getCallingUser());
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s4", "s5"),
getCallingUser());
});
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s1"));
mManager.removeDynamicShortcuts(list("s2"));
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s1"));
mManager.removeDynamicShortcuts(list("s3"));
mManager.removeDynamicShortcuts(list("s5"));
});
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(
mManager.getDynamicShortcuts()),
"s3", "s4", "s5");
@@ -1342,7 +1343,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mManager.getPinnedShortcuts()),
"s2", "s3");
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(
mManager.getDynamicShortcuts()),
"s2", "s4");
@@ -1351,7 +1352,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"s4", "s5");
});
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
ShortcutInfo s2 = makeShortcutBuilder()
.setId("s2")
.setIcon(Icon.createWithResource(getTestContext(), R.drawable.black_32x32))
@@ -1364,7 +1365,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mManager.updateShortcuts(list(s2, s4));
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
ShortcutInfo s2 = makeShortcutBuilder()
.setId("s2")
.setIntent(makeIntent(Intent.ACTION_ANSWER, ShortcutActivity.class,
@@ -1379,7 +1380,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mManager.updateShortcuts(list(s2, s4));
});
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(
mManager.getDynamicShortcuts()),
"s3", "s4", "s5");
@@ -1398,7 +1399,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(0, s.getIconResourceId());
assertEquals("new title", s.getTitle());
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(
mManager.getDynamicShortcuts()),
"s2", "s4");
@@ -1424,15 +1425,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// TODO Check bitmap removal too.
- mRunningUsers.put(USER_11, true);
+ mRunningUsers.put(USER_12, true);
- runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_12, () -> {
mManager.updateShortcuts(list());
});
}
public void UpdateShortcuts_icons() {
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1")
)));
@@ -1533,26 +1534,26 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_3);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeLongLivedShortcut("s1"), makeLongLivedShortcut("s2"), makeShortcut("s3"))));
});
// Pin 2 and 3
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "ms3", "s2", "s3"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
// Cache 1 and 2
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"),
- HANDLE_USER_0, CACHE_OWNER_1);
+ HANDLE_USER_10, CACHE_OWNER_1);
});
setCaller(CALLING_PACKAGE_1);
@@ -1617,7 +1618,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void CachedShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"),
makeLongLivedShortcut("s4"), makeLongLivedShortcut("s5"),
@@ -1625,20 +1626,20 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Pin s2
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
// Cache some, but non long lived shortcuts will be ignored.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2", "s4", "s5"),
- HANDLE_USER_0, CACHE_OWNER_1);
+ HANDLE_USER_10, CACHE_OWNER_1);
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s5", "s6"),
- HANDLE_USER_0, CACHE_OWNER_2);
+ HANDLE_USER_10, CACHE_OWNER_2);
});
setCaller(CALLING_PACKAGE_1);
@@ -1660,32 +1661,32 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED),
"s2", "s4", "s5", "s6");
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s2", "s4"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
// s2 still cached by owner1. s4 wasn't cached by owner0 so didn't get removed.
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED),
"s2", "s4", "s5", "s6");
// uncache a non-dynamic shortcut. Should be removed.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s4"),
- HANDLE_USER_0, CACHE_OWNER_1);
+ HANDLE_USER_10, CACHE_OWNER_1);
});
// uncache s6 by its only owner. s5 still cached by owner1
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s5", "s6"),
- HANDLE_USER_0, CACHE_OWNER_2);
+ HANDLE_USER_10, CACHE_OWNER_2);
});
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED),
"s2", "s5");
// Cache another shortcut
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s3"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED),
"s2", "s3", "s5");
@@ -1701,24 +1702,24 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void CachedShortcuts_accessShortcutsPermission() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"),
makeLongLivedShortcut("s4"))));
});
// s1 is not long lived and will be ignored.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = false;
assertExpectException(
SecurityException.class, "Caller can't access shortcut information", () -> {
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
// Give ACCESS_SHORTCUTS permission to LAUNCHER_1
mInjectCheckAccessShortcutsPermission = true;
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
setCaller(CALLING_PACKAGE_1);
@@ -1726,17 +1727,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Get cached shortcuts
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED), "s2", "s3");
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = false;
assertExpectException(
SecurityException.class, "Caller can't access shortcut information", () -> {
mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s2", "s4"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
// Give ACCESS_SHORTCUTS permission to LAUNCHER_1
mInjectCheckAccessShortcutsPermission = true;
mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s2", "s4"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED), "s3");
@@ -1746,17 +1747,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=4");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeLongLivedShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"),
makeLongLivedShortcut("s4"))));
});
// Cache All
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3", "s4"),
- HANDLE_USER_0, CACHE_OWNER_0);
+ HANDLE_USER_10, CACHE_OWNER_0);
});
setCaller(CALLING_PACKAGE_1);
@@ -2004,17 +2005,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_3);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
// Pin 2 and 3
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "ms3", "s2", "s3"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
// Remove ms3 and s3
@@ -2023,15 +2024,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
});
// Check their status.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "ms3", "s1", "s2", "s3")
@@ -2071,45 +2072,45 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Finally, actual tests.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertWith(mLauncherApps.getShortcuts(
- buildQueryWithFlags(ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0))
+ buildQueryWithFlags(ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10))
.haveIds("s1", "s2");
assertWith(mLauncherApps.getShortcuts(
- buildQueryWithFlags(ShortcutQuery.FLAG_GET_MANIFEST), HANDLE_USER_0))
+ buildQueryWithFlags(ShortcutQuery.FLAG_GET_MANIFEST), HANDLE_USER_10))
.haveIds("ms1", "ms2");
assertWith(mLauncherApps.getShortcuts(
- buildQueryWithFlags(ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0))
+ buildQueryWithFlags(ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10))
.haveIds("s2", "s3", "ms2", "ms3");
assertWith(mLauncherApps.getShortcuts(
buildQueryWithFlags(
ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_PINNED
- ), HANDLE_USER_0))
+ ), HANDLE_USER_10))
.haveIds("s1", "s2", "s3", "ms2", "ms3");
assertWith(mLauncherApps.getShortcuts(
buildQueryWithFlags(
ShortcutQuery.FLAG_GET_MANIFEST | ShortcutQuery.FLAG_GET_PINNED
- ), HANDLE_USER_0))
+ ), HANDLE_USER_10))
.haveIds("ms1", "s2", "s3", "ms2", "ms3");
assertWith(mLauncherApps.getShortcuts(
buildQueryWithFlags(
ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_MANIFEST
- ), HANDLE_USER_0))
+ ), HANDLE_USER_10))
.haveIds("ms1", "ms2", "s1", "s2");
assertWith(mLauncherApps.getShortcuts(
buildQueryWithFlags(
ShortcutQuery.FLAG_GET_ALL_KINDS
- ), HANDLE_USER_0))
+ ), HANDLE_USER_10))
.haveIds("ms1", "ms2", "ms3", "s1", "s2", "s3");
});
}
public void GetShortcuts_resolveStrings() throws Exception {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
ShortcutInfo si = new ShortcutInfo.Builder(mClientContext)
.setId("id")
.setActivity(new ComponentName(mClientContext, "dummy"))
@@ -2132,17 +2133,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mManager.setDynamicShortcuts(list(si));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
final ShortcutQuery q = new ShortcutQuery();
q.setQueryFlags(ShortcutQuery.FLAG_GET_DYNAMIC);
// USER 0
List<ShortcutInfo> ret = assertShortcutIds(
- assertAllStringsResolved(mLauncherApps.getShortcuts(q, HANDLE_USER_0)),
+ assertAllStringsResolved(mLauncherApps.getShortcuts(q, HANDLE_USER_10)),
"id");
- assertEquals("string-com.android.test.1-user:0-res:10/en", ret.get(0).getTitle());
- assertEquals("string-com.android.test.1-user:0-res:11/en", ret.get(0).getText());
- assertEquals("string-com.android.test.1-user:0-res:12/en",
+ assertEquals("string-com.android.test.1-user:10-res:10/en", ret.get(0).getTitle());
+ assertEquals("string-com.android.test.1-user:10-res:11/en", ret.get(0).getText());
+ assertEquals("string-com.android.test.1-user:10-res:12/en",
ret.get(0).getDisabledMessage());
// USER P0
@@ -2280,27 +2281,27 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void PinShortcutAndGetPinnedShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ShortcutInfo s1_1 = makeShortcutWithTimestamp("s1", 1000);
final ShortcutInfo s1_2 = makeShortcutWithTimestamp("s2", 2000);
assertTrue(mManager.setDynamicShortcuts(list(s1_1, s1_2)));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
final ShortcutInfo s2_2 = makeShortcutWithTimestamp("s2", 1500);
final ShortcutInfo s2_3 = makeShortcutWithTimestamp("s3", 3000);
final ShortcutInfo s2_4 = makeShortcutWithTimestamp("s4", 500);
assertTrue(mManager.setDynamicShortcuts(list(s2_2, s2_3, s2_4)));
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
final ShortcutInfo s3_2 = makeShortcutWithTimestamp("s2", 1000);
assertTrue(mManager.setDynamicShortcuts(list(s3_2)));
});
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s2", "s3"), getCallingUser());
@@ -2312,7 +2313,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Delete some.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s2");
mManager.removeDynamicShortcuts(list("s2"));
assertShortcutIds(mManager.getPinnedShortcuts(), "s2");
@@ -2320,7 +2321,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getDynamicShortcuts(), "s1");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s3", "s4");
mManager.removeDynamicShortcuts(list("s3"));
assertShortcutIds(mManager.getPinnedShortcuts(), "s3", "s4");
@@ -2328,7 +2329,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getDynamicShortcuts(), "s2", "s4");
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts() /* none */);
mManager.removeDynamicShortcuts(list("s2"));
assertShortcutIds(mManager.getPinnedShortcuts() /* none */);
@@ -2337,7 +2338,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Get pinned shortcuts from launcher
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// CALLING_PACKAGE_1 deleted s2, but it's pinned, so it still exists.
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(assertAllEnabled(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
@@ -2361,27 +2362,27 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
* does "enable".
*/
public void DisableAndEnableShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ShortcutInfo s1_1 = makeShortcutWithTimestamp("s1", 1000);
final ShortcutInfo s1_2 = makeShortcutWithTimestamp("s2", 2000);
assertTrue(mManager.setDynamicShortcuts(list(s1_1, s1_2)));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
final ShortcutInfo s2_2 = makeShortcutWithTimestamp("s2", 1500);
final ShortcutInfo s2_3 = makeShortcutWithTimestamp("s3", 3000);
final ShortcutInfo s2_4 = makeShortcutWithTimestamp("s4", 500);
assertTrue(mManager.setDynamicShortcuts(list(s2_2, s2_3, s2_4)));
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
final ShortcutInfo s3_2 = makeShortcutWithTimestamp("s2", 1000);
assertTrue(mManager.setDynamicShortcuts(list(s3_2)));
});
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s2", "s3"), getCallingUser());
@@ -2393,7 +2394,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Disable some.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s2");
mManager.updateShortcuts(list(
@@ -2406,7 +2407,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getDynamicShortcuts(), "s1");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s3", "s4");
// disable should work even if a shortcut is not dynamic, so try calling "remove" first
@@ -2418,7 +2419,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(mManager.getDynamicShortcuts(), "s2", "s4");
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts() /* none */);
mManager.disableShortcuts(list("s2"));
@@ -2430,7 +2431,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Get pinned shortcuts from launcher
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// CALLING_PACKAGE_1 deleted s2, but it's pinned, so it still exists, and disabled.
assertWith(mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))
@@ -2442,7 +2443,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllPinned()
.areAllNotWithKeyFieldsOnly()
.areAllDisabled();
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
ActivityNotFoundException.class);
// Here, s4 is still enabled and launchable, but s3 is disabled.
@@ -2459,9 +2460,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.selectByIds("s4")
.areAllEnabled();
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s3", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s3", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s4", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s4", USER_10);
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(assertAllEnabled(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_3,
@@ -2469,30 +2470,30 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
/* none */);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.enableShortcuts(list("s2"));
assertShortcutIds(mManager.getPinnedShortcuts(), "s2");
assertShortcutIds(mManager.getDynamicShortcuts(), "s1");
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// CALLING_PACKAGE_1 deleted s2, but it's pinned, so it still exists.
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(assertAllEnabled(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser())))),
"s2");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
});
}
public void DisableShortcuts_thenRepublish() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(
- CALLING_PACKAGE_1, list("s1", "s2", "s3"), HANDLE_USER_0);
+ CALLING_PACKAGE_1, list("s1", "s2", "s3"), HANDLE_USER_10);
});
mManager.disableShortcuts(list("s1", "s2", "s3"));
@@ -2557,12 +2558,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void PinShortcutAndGetPinnedShortcuts_multi() {
// Create some shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
@@ -2570,7 +2571,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat();
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s3", "s4"), getCallingUser());
@@ -2581,7 +2582,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat();
// Delete some.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s3");
mManager.removeDynamicShortcuts(list("s3"));
assertShortcutIds(mManager.getPinnedShortcuts(), "s3");
@@ -2589,7 +2590,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat();
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(mManager.getPinnedShortcuts(), "s1", "s2");
mManager.removeDynamicShortcuts(list("s1"));
mManager.removeDynamicShortcuts(list("s3"));
@@ -2599,7 +2600,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat();
// Get pinned shortcuts from launcher
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))),
@@ -2625,7 +2626,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat("Before launcher 2");
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
// Launcher2 still has no pinned ones.
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
@@ -2698,10 +2699,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
initService();
// Load from file.
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Make sure package info is restored too.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))),
@@ -2711,7 +2712,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))),
"s1", "s2");
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED
@@ -2725,20 +2726,20 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Delete all dynamic.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()), "s1", "s2", "s3");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()), "s2", "s1");
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))),
@@ -2766,13 +2767,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"s3");
});
// Re-publish s1.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.addDynamicShortcuts(list(makeShortcut("s1"))));
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()), "s1");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()), "s1", "s2", "s3");
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(assertAllNotKeyFieldsOnly(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()))),
@@ -2789,7 +2790,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Now clear pinned shortcuts. First, from launcher 1.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list(), getCallingUser());
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list(), getCallingUser());
@@ -2800,17 +2801,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()).size());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()), "s1");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()), "s1", "s2");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()), "s2");
});
// Clear all pins from launcher 2.
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list(), getCallingUser());
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list(), getCallingUser());
@@ -2821,11 +2822,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
/* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), getCallingUser()).size());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()), "s1");
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
@@ -2833,74 +2834,74 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void PinShortcutAndGetPinnedShortcuts_assistant() {
// Create some shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s3", "s4"), getCallingUser());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
final ShortcutQuery allPinned = new ShortcutQuery().setQueryFlags(
ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.isEmpty();
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutNotLaunched(CALLING_PACKAGE_1, "s3", USER_0);
- assertShortcutNotLaunched(CALLING_PACKAGE_1, "s4", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutNotLaunched(CALLING_PACKAGE_1, "s3", USER_10);
+ assertShortcutNotLaunched(CALLING_PACKAGE_1, "s4", USER_10);
// Make it the assistant app.
- mInternal.setShortcutHostPackage("assistant", LAUNCHER_2, USER_0);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ mInternal.setShortcutHostPackage("assistant", LAUNCHER_2, USER_10);
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.haveIds("s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
- assertShortcutNotLaunched(CALLING_PACKAGE_1, "s4", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
+ assertShortcutNotLaunched(CALLING_PACKAGE_1, "s4", USER_10);
- mInternal.setShortcutHostPackage("another-type", LAUNCHER_3, USER_0);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ mInternal.setShortcutHostPackage("another-type", LAUNCHER_3, USER_10);
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.haveIds("s3");
- mInternal.setShortcutHostPackage("assistant", null, USER_0);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ mInternal.setShortcutHostPackage("assistant", null, USER_10);
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.isEmpty();
- mInternal.setShortcutHostPackage("assistant", LAUNCHER_2, USER_0);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ mInternal.setShortcutHostPackage("assistant", LAUNCHER_2, USER_10);
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.haveIds("s3");
- mInternal.setShortcutHostPackage("assistant", LAUNCHER_1, USER_0);
- assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_0))
+ mInternal.setShortcutHostPackage("assistant", LAUNCHER_1, USER_10);
+ assertWith(mLauncherApps.getShortcuts(allPinned, HANDLE_USER_10))
.isEmpty();
});
}
public void PinShortcutAndGetPinnedShortcuts_crossProfile_plusLaunch() {
// Create some shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"),
makeShortcut("s4"), makeShortcut("s5"), makeShortcut("s6"))));
@@ -2908,33 +2909,33 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Pin some shortcuts and see the result.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s1"), HANDLE_USER_0);
+ list("s1"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,
- list("s1", "s2", "s3"), HANDLE_USER_0);
+ list("s1", "s2", "s3"), HANDLE_USER_10);
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s2"), HANDLE_USER_0);
+ list("s2"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,
- list("s2", "s3"), HANDLE_USER_0);
+ list("s2", "s3"), HANDLE_USER_10);
});
runWithCaller(LAUNCHER_2, USER_P0, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s3"), HANDLE_USER_0);
+ list("s3"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,
- list("s3"), HANDLE_USER_0);
+ list("s3"), HANDLE_USER_10);
});
- runWithCaller(LAUNCHER_2, USER_10, () -> {
+ runWithCaller(LAUNCHER_2, USER_11, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s1", "s2", "s3"), HANDLE_USER_10);
+ list("s1", "s2", "s3"), HANDLE_USER_11);
});
// First, make sure managed profile can't see other profiles.
@@ -2945,540 +2946,540 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
| ShortcutQuery.FLAG_MATCH_MANIFEST);
// No shortcuts are visible.
- assertWith(mLauncherApps.getShortcuts(q, HANDLE_USER_0)).isEmpty();
+ assertWith(mLauncherApps.getShortcuts(q, HANDLE_USER_10)).isEmpty();
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10);
// Should have no effects.
- assertWith(mLauncherApps.getShortcuts(q, HANDLE_USER_0)).isEmpty();
+ assertWith(mLauncherApps.getShortcuts(q, HANDLE_USER_10)).isEmpty();
- assertShortcutNotLaunched(CALLING_PACKAGE_1, "s1", USER_0);
+ assertShortcutNotLaunched(CALLING_PACKAGE_1, "s1", USER_10);
});
// Cross profile pinning.
final int PIN_AND_DYNAMIC = ShortcutQuery.FLAG_GET_PINNED | ShortcutQuery.FLAG_GET_DYNAMIC;
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_2, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
- runWithCaller(LAUNCHER_2, USER_10, () -> {
+ runWithCaller(LAUNCHER_2, USER_11, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_11)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_11)),
"s1", "s2", "s3", "s4", "s5", "s6");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_11)),
"s1", "s2", "s3", "s4", "s5", "s6");
});
// Remove some dynamic shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"))));
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
ActivityNotFoundException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_2, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s3");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
- runWithCaller(LAUNCHER_2, USER_10, () -> {
+ runWithCaller(LAUNCHER_2, USER_11, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_11)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_11)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_11)),
"s1", "s2", "s3");
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s1", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s1", USER_10,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_10,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s3", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s3", USER_10,
SecurityException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_11);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_11);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_11);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
ActivityNotFoundException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
ActivityNotFoundException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
ActivityNotFoundException.class);
});
// Save & load and make sure we still have the same information.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s1", "s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
ActivityNotFoundException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s2", "s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s2", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s2", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_0);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s2", USER_10);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
runWithCaller(LAUNCHER_2, USER_P0, () -> {
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_1,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s3");
assertShortcutIds(assertAllPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_PINNED), HANDLE_USER_10)),
"s3");
assertShortcutIds(assertAllDynamic(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, ShortcutQuery.FLAG_GET_DYNAMIC), HANDLE_USER_10)),
"s1");
assertShortcutIds(assertAllDynamicOrPinned(
mLauncherApps.getShortcuts(buildQuery(/* time =*/ 0, CALLING_PACKAGE_2,
- /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_0)),
+ /* activity =*/ null, PIN_AND_DYNAMIC), HANDLE_USER_10)),
"s1", "s3");
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_0);
- assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_0,
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s1", USER_10);
+ assertStartShortcutThrowsException(CALLING_PACKAGE_2, "s2", USER_10,
ActivityNotFoundException.class);
- assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_2, "s3", USER_10);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s2", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s3", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s4", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s5", USER_11,
SecurityException.class);
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_10,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s6", USER_11,
SecurityException.class);
});
}
public void StartShortcut() {
// Create some shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ShortcutInfo s1_1 = makeShortcut(
"s1",
"Title 1",
@@ -3503,7 +3504,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(s1_1, s1_2, s1_3)));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
final ShortcutInfo s2_1 = makeShortcut(
"s1",
"ABC",
@@ -3516,7 +3517,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s1", "s2"), getCallingUser());
@@ -3525,12 +3526,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Just to make it complicated, delete some.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s2"));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_10);
assertEquals(ShortcutActivity2.class.getName(),
intents[0].getComponent().getClassName());
assertEquals(Intent.ACTION_ASSIST,
@@ -3545,25 +3546,25 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(
ShortcutActivity3.class.getName(),
- launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0)
+ launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_10)
.getComponent().getClassName());
assertEquals(
ShortcutActivity.class.getName(),
- launchShortcutAndGetIntent(CALLING_PACKAGE_2, "s1", USER_0)
+ launchShortcutAndGetIntent(CALLING_PACKAGE_2, "s1", USER_10)
.getComponent().getClassName());
- assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_0);
+ assertShortcutLaunchable(CALLING_PACKAGE_1, "s3", USER_10);
- assertShortcutNotLaunched("no-such-package", "s2", USER_0);
- assertShortcutNotLaunched(CALLING_PACKAGE_1, "xxxx", USER_0);
+ assertShortcutNotLaunched("no-such-package", "s2", USER_10);
+ assertShortcutNotLaunched(CALLING_PACKAGE_1, "xxxx", USER_10);
});
// LAUNCHER_1 is no longer the default launcher
setDefaultLauncherChecker((pkg, userId) -> false);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Not the default launcher, but pinned shortcuts are still lauchable.
- final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_0);
+ final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_10);
assertEquals(ShortcutActivity2.class.getName(),
intents[0].getComponent().getClassName());
assertEquals(Intent.ACTION_ASSIST,
@@ -3577,24 +3578,24 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
intents[1].getFlags());
assertEquals(
ShortcutActivity3.class.getName(),
- launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0)
+ launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_10)
.getComponent().getClassName());
assertEquals(
ShortcutActivity.class.getName(),
- launchShortcutAndGetIntent(CALLING_PACKAGE_2, "s1", USER_0)
+ launchShortcutAndGetIntent(CALLING_PACKAGE_2, "s1", USER_10)
.getComponent().getClassName());
// Not pinned, so not lauchable.
});
// Test inner errors.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Not launchable.
doReturn(ActivityManager.START_CLASS_NOT_FOUND)
.when(mMockActivityTaskManagerInternal).startActivitiesAsPackage(
anyStringOrNull(), anyStringOrNull(), anyInt(),
anyOrNull(Intent[].class), anyOrNull(Bundle.class));
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
ActivityNotFoundException.class);
// Still not launchable.
@@ -3603,7 +3604,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.startActivitiesAsPackage(
anyStringOrNull(), anyStringOrNull(), anyInt(),
anyOrNull(Intent[].class), anyOrNull(Bundle.class));
- assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_0,
+ assertStartShortcutThrowsException(CALLING_PACKAGE_1, "s1", USER_10,
ActivityNotFoundException.class);
});
@@ -3618,34 +3619,34 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
+ ConfigConstants.KEY_MAX_SHORTCUTS + "=99999999"
);
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.haveIds("s1", "s2", "s3")
.areAllWithKeyFieldsOnly()
.areAllDynamic();
// From different package.
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_2, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_2, HANDLE_USER_10)
.haveIds("s1", "s2", "s3")
.areAllWithKeyFieldsOnly()
.areAllDynamic();
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
// Different user, callback shouldn't be called.
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
@@ -3654,31 +3655,31 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Test for addDynamicShortcuts.
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.addDynamicShortcuts(list(makeShortcut("s4"))));
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.haveIds("s1", "s2", "s3", "s4")
.areAllWithKeyFieldsOnly()
.areAllDynamic();
// Test for remove
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s1"));
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.haveIds("s2", "s3", "s4")
.areAllWithKeyFieldsOnly()
.areAllDynamic();
// Test for update
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.updateShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
// All remaining shortcuts will be passed regardless of what's been updated.
.haveIds("s2", "s3", "s4")
.areAllWithKeyFieldsOnly()
@@ -3686,10 +3687,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Test for deleteAll
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.isEmpty();
// Update package1 with manifest shortcuts
@@ -3699,24 +3700,24 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.areAllManifest()
.areAllWithKeyFieldsOnly()
.haveIds("ms1", "ms2");
// Make sure pinned shortcuts are passed too.
// 1. Add dynamic shortcuts.
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
});
// 2. Pin some.
- runWithCaller(LAUNCHER_1, UserHandle.USER_SYSTEM, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "s1", "s2")
.areAllEnabled()
@@ -3736,10 +3737,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_0);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertForLauncherCallback(mLauncherApps, () -> {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s2"));
assertWith(getCallerShortcuts())
@@ -3764,16 +3765,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllEnabled()
;
});
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.haveIds("ms2", "s1", "s2")
.areAllWithKeyFieldsOnly();
// Remove CALLING_PACKAGE_2
assertForLauncherCallback(mLauncherApps, () -> {
- uninstallPackage(USER_0, CALLING_PACKAGE_2);
- mService.cleanUpPackageLocked(CALLING_PACKAGE_2, USER_0, USER_0,
+ uninstallPackage(USER_10, CALLING_PACKAGE_2);
+ mService.cleanUpPackageLocked(CALLING_PACKAGE_2, USER_10, USER_10,
/* appStillExists = */ false);
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_2, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_2, HANDLE_USER_10)
.isEmpty();
}
@@ -3798,35 +3799,35 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
setDefaultLauncherChecker((pkg, userId) -> {
switch (userId) {
- case USER_0:
+ case USER_10:
return LAUNCHER_2.equals(pkg);
case USER_P0:
return LAUNCHER_1.equals(pkg);
case USER_P1:
return LAUNCHER_1.equals(pkg);
- case USER_10:
- return LAUNCHER_1.equals(pkg);
case USER_11:
return LAUNCHER_1.equals(pkg);
+ case USER_12:
+ return LAUNCHER_1.equals(pkg);
default:
return false;
}
});
- runWithCaller(LAUNCHER_1, USER_0, () -> mLauncherApps.registerCallback(c0_1, h));
- runWithCaller(LAUNCHER_2, USER_0, () -> mLauncherApps.registerCallback(c0_2, h));
- runWithCaller(LAUNCHER_3, USER_0, () -> mLauncherApps.registerCallback(c0_3, h));
- runWithCaller(LAUNCHER_4, USER_0, () -> mLauncherApps.registerCallback(c0_4, h));
+ runWithCaller(LAUNCHER_1, USER_10, () -> mLauncherApps.registerCallback(c0_1, h));
+ runWithCaller(LAUNCHER_2, USER_10, () -> mLauncherApps.registerCallback(c0_2, h));
+ runWithCaller(LAUNCHER_3, USER_10, () -> mLauncherApps.registerCallback(c0_3, h));
+ runWithCaller(LAUNCHER_4, USER_10, () -> mLauncherApps.registerCallback(c0_4, h));
runWithCaller(LAUNCHER_1, USER_P0, () -> mLauncherApps.registerCallback(cP0_1, h));
runWithCaller(LAUNCHER_1, USER_P1, () -> mLauncherApps.registerCallback(cP1_1, h));
- runWithCaller(LAUNCHER_1, USER_10, () -> mLauncherApps.registerCallback(c10_1, h));
- runWithCaller(LAUNCHER_2, USER_10, () -> mLauncherApps.registerCallback(c10_2, h));
- runWithCaller(LAUNCHER_1, USER_11, () -> mLauncherApps.registerCallback(c11_1, h));
+ runWithCaller(LAUNCHER_1, USER_11, () -> mLauncherApps.registerCallback(c10_1, h));
+ runWithCaller(LAUNCHER_2, USER_11, () -> mLauncherApps.registerCallback(c10_2, h));
+ runWithCaller(LAUNCHER_1, USER_12, () -> mLauncherApps.registerCallback(c11_1, h));
// User 0.
resetAll(all);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list());
});
waitOnMainThread();
@@ -3837,14 +3838,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertCallbackNotReceived(c10_1);
assertCallbackNotReceived(c10_2);
assertCallbackNotReceived(c11_1);
- assertCallbackReceived(c0_2, HANDLE_USER_0, CALLING_PACKAGE_1, "s1", "s2", "s3");
- assertCallbackReceived(cP0_1, HANDLE_USER_0, CALLING_PACKAGE_1, "s1", "s2", "s3", "s4");
+ assertCallbackReceived(c0_2, HANDLE_USER_10, CALLING_PACKAGE_1, "s1", "s2", "s3");
+ assertCallbackReceived(cP0_1, HANDLE_USER_10, CALLING_PACKAGE_1, "s1", "s2", "s3", "s4");
assertCallbackNotReceived(cP1_1);
// User 0, different package.
resetAll(all);
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
mManager.removeDynamicShortcuts(list());
});
waitOnMainThread();
@@ -3855,8 +3856,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertCallbackNotReceived(c10_1);
assertCallbackNotReceived(c10_2);
assertCallbackNotReceived(c11_1);
- assertCallbackReceived(c0_2, HANDLE_USER_0, CALLING_PACKAGE_3, "s1", "s2", "s3", "s4");
- assertCallbackReceived(cP0_1, HANDLE_USER_0, CALLING_PACKAGE_3,
+ assertCallbackReceived(c0_2, HANDLE_USER_10, CALLING_PACKAGE_3, "s1", "s2", "s3", "s4");
+ assertCallbackReceived(cP0_1, HANDLE_USER_10, CALLING_PACKAGE_3,
"s1", "s2", "s3", "s4", "s5", "s6");
assertCallbackNotReceived(cP1_1);
@@ -3878,10 +3879,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertCallbackNotReceived(cP1_1);
// Normal secondary user.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
resetAll(all);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
mManager.removeDynamicShortcuts(list());
});
waitOnMainThread();
@@ -3893,7 +3894,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertCallbackNotReceived(cP0_1);
assertCallbackNotReceived(c10_2);
assertCallbackNotReceived(c11_1);
- assertCallbackReceived(c10_1, HANDLE_USER_10, CALLING_PACKAGE_1,
+ assertCallbackReceived(c10_1, HANDLE_USER_11, CALLING_PACKAGE_1,
"x1", "x2", "x3", "x4", "x5");
assertCallbackNotReceived(cP1_1);
}
@@ -3905,7 +3906,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
Log.i(TAG, "Saved state");
dumpsysOnLogcat();
- dumpUserFile(0);
+ dumpUserFile(USER_10);
// Restore.
mService.saveDirtyInfo();
@@ -3919,7 +3920,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
*/
public void SaveAndLoadUser() {
// First, create some shortcuts and save.
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x16);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -3946,7 +3947,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(START_TIME + INTERVAL, mManager.getRateLimitResetTime());
assertEquals(2, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_16x64);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -3974,9 +3975,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(2, mManager.getRemainingCallCount());
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x64);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -4012,12 +4013,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(0, mService.getShortcutsForTest().size());
// this will pre-load the per-user info.
- mService.handleUnlockUser(UserHandle.USER_SYSTEM);
+ mService.handleUnlockUser(USER_10);
// Now it's loaded.
assertEquals(1, mService.getShortcutsForTest().size());
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4025,7 +4026,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals("title1-1", getCallerShortcut("s1").getTitle());
assertEquals("title1-2", getCallerShortcut("s2").getTitle());
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4035,12 +4036,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Start another user
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
// Now the size is 2.
assertEquals(2, mService.getShortcutsForTest().size());
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4050,7 +4051,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Try stopping the user
- mService.handleStopUser(USER_10);
+ mService.handleStopUser(USER_11);
// Now it's unloaded.
assertEquals(1, mService.getShortcutsForTest().size());
@@ -4074,7 +4075,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void SaveCorruptAndLoadUser() throws Exception {
// First, create some shortcuts and save.
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x16);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -4101,7 +4102,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(START_TIME + INTERVAL, mManager.getRateLimitResetTime());
assertEquals(2, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_16x64);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -4129,9 +4130,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(2, mManager.getRemainingCallCount());
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x64);
final Icon icon2 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.icon2));
@@ -4162,14 +4163,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Save and corrupt the primary files.
mService.saveDirtyInfo();
try (Writer os = new FileWriter(
- mService.getUserFile(UserHandle.USER_SYSTEM).getBaseFile())) {
+ mService.getUserFile(USER_10).getBaseFile())) {
os.write("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n"
+ "<user locales=\"en\" last-app-scan-time2=\"14400000");
}
- try (Writer os = new FileWriter(mService.getUserFile(USER_10).getBaseFile())) {
+ try (Writer os = new FileWriter(mService.getUserFile(USER_11).getBaseFile())) {
os.write("<?xml version='1.0' encoding='utf");
}
- ShortcutPackage sp = mService.getUserShortcutsLocked(USER_0).getPackageShortcutsIfExists(
+ ShortcutPackage sp = mService.getUserShortcutsLocked(USER_10).getPackageShortcutsIfExists(
CALLING_PACKAGE_1);
try (Writer os = new FileWriter(sp.getShortcutPackageItemFile().getPath())) {
os.write("<?xml version='1.0' encoding='utf");
@@ -4182,12 +4183,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(0, mService.getShortcutsForTest().size());
// this will pre-load the per-user info.
- mService.handleUnlockUser(UserHandle.USER_SYSTEM);
+ mService.handleUnlockUser(USER_10);
// Now it's loaded.
assertEquals(1, mService.getShortcutsForTest().size());
- runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4195,7 +4196,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals("title1-1", getCallerShortcut("s1").getTitle());
assertEquals("title1-2", getCallerShortcut("s2").getTitle());
});
- runWithCaller(CALLING_PACKAGE_2, UserHandle.USER_SYSTEM, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4205,12 +4206,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Start another user
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
// Now the size is 2.
assertEquals(2, mService.getShortcutsForTest().size());
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertShortcutIds(assertAllDynamic(assertAllHaveIntents(assertAllHaveIcon(
mManager.getDynamicShortcuts()))), "s1", "s2");
assertEquals(2, mManager.getRemainingCallCount());
@@ -4220,7 +4221,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Try stopping the user
- mService.handleStopUser(USER_10);
+ mService.handleStopUser(USER_11);
// Now it's unloaded.
assertEquals(1, mService.getShortcutsForTest().size());
@@ -4229,72 +4230,72 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void CleanupPackage() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s0_1"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s0_2"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s0_1"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s0_2"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s0_1"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s0_2"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s10_1"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s10_2"))));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s10_1"),
- HANDLE_USER_10);
+ HANDLE_USER_11);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s10_2"),
- HANDLE_USER_10);
+ HANDLE_USER_11);
});
- runWithCaller(LAUNCHER_2, USER_10, () -> {
+ runWithCaller(LAUNCHER_2, USER_11, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s10_1"),
- HANDLE_USER_10);
+ HANDLE_USER_11);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("s10_2"),
- HANDLE_USER_10);
+ HANDLE_USER_11);
});
// Remove all dynamic shortcuts; now all shortcuts are just pinned.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
mManager.removeAllDynamicShortcuts();
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
mManager.removeAllDynamicShortcuts();
});
final SparseArray<ShortcutUser> users = mService.getShortcutsForTest();
assertEquals(2, users.size());
- assertEquals(USER_0, users.keyAt(0));
- assertEquals(USER_10, users.keyAt(1));
+ assertEquals(USER_10, users.keyAt(0));
+ assertEquals(USER_11, users.keyAt(1));
- final ShortcutUser user0 = users.get(USER_0);
- final ShortcutUser user10 = users.get(USER_10);
+ final ShortcutUser user0 = users.get(USER_10);
+ final ShortcutUser user10 = users.get(USER_11);
// Check the registered packages.
@@ -4304,31 +4305,31 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(CALLING_PACKAGE_1, CALLING_PACKAGE_2),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
- hashSet(user0.getAllLaunchersForTest().keySet()));
- assertEquals(
set(UserPackage.of(USER_10, LAUNCHER_1),
UserPackage.of(USER_10, LAUNCHER_2)),
+ hashSet(user0.getAllLaunchersForTest().keySet()));
+ assertEquals(
+ set(UserPackage.of(USER_11, LAUNCHER_1),
+ UserPackage.of(USER_11, LAUNCHER_2)),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_1", "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
"s0_1", "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_11),
"s10_1", "s10_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_11),
"s10_1", "s10_2");
- assertShortcutExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// Nonexistent package.
- uninstallPackage(USER_0, "abc");
- mService.cleanUpPackageLocked("abc", USER_0, USER_0, /* appStillExists = */ false);
+ uninstallPackage(USER_10, "abc");
+ mService.cleanUpPackageLocked("abc", USER_10, USER_10, /* appStillExists = */ false);
// No changes.
assertEquals(set(CALLING_PACKAGE_1, CALLING_PACKAGE_2),
@@ -4336,31 +4337,31 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(CALLING_PACKAGE_1, CALLING_PACKAGE_2),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
- hashSet(user0.getAllLaunchersForTest().keySet()));
- assertEquals(
set(UserPackage.of(USER_10, LAUNCHER_1),
UserPackage.of(USER_10, LAUNCHER_2)),
+ hashSet(user0.getAllLaunchersForTest().keySet()));
+ assertEquals(
+ set(UserPackage.of(USER_11, LAUNCHER_1),
+ UserPackage.of(USER_11, LAUNCHER_2)),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_1", "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
"s0_1", "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_11),
"s10_1", "s10_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_11),
"s10_1", "s10_2");
- assertShortcutExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// Remove a package.
- uninstallPackage(USER_0, CALLING_PACKAGE_1);
- mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_0, USER_0,
+ uninstallPackage(USER_10, CALLING_PACKAGE_1);
+ mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_10, USER_10,
/* appStillExists = */ false);
assertEquals(set(CALLING_PACKAGE_2),
@@ -4368,59 +4369,59 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(CALLING_PACKAGE_1, CALLING_PACKAGE_2),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
- hashSet(user0.getAllLaunchersForTest().keySet()));
- assertEquals(
set(UserPackage.of(USER_10, LAUNCHER_1),
UserPackage.of(USER_10, LAUNCHER_2)),
+ hashSet(user0.getAllLaunchersForTest().keySet()));
+ assertEquals(
+ set(UserPackage.of(USER_11, LAUNCHER_1),
+ UserPackage.of(USER_11, LAUNCHER_2)),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
"s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_11),
"s10_1", "s10_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_11),
"s10_1", "s10_2");
- assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// Remove a launcher.
- uninstallPackage(USER_10, LAUNCHER_1);
- mService.cleanUpPackageLocked(LAUNCHER_1, USER_10, USER_10, /* appStillExists = */ false);
+ uninstallPackage(USER_11, LAUNCHER_1);
+ mService.cleanUpPackageLocked(LAUNCHER_1, USER_11, USER_11, /* appStillExists = */ false);
assertEquals(set(CALLING_PACKAGE_2),
hashSet(user0.getAllPackagesForTest().keySet()));
assertEquals(set(CALLING_PACKAGE_1, CALLING_PACKAGE_2),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
+ set(UserPackage.of(USER_10, LAUNCHER_1),
+ UserPackage.of(USER_10, LAUNCHER_2)),
hashSet(user0.getAllLaunchersForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_10, LAUNCHER_2)),
+ set(UserPackage.of(USER_11, LAUNCHER_2)),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
- "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_2");
assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
+ "s0_2");
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_11),
"s10_1", "s10_2");
- assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// Remove a package.
- uninstallPackage(USER_10, CALLING_PACKAGE_2);
- mService.cleanUpPackageLocked(CALLING_PACKAGE_2, USER_10, USER_10,
+ uninstallPackage(USER_11, CALLING_PACKAGE_2);
+ mService.cleanUpPackageLocked(CALLING_PACKAGE_2, USER_11, USER_11,
/* appStillExists = */ false);
assertEquals(set(CALLING_PACKAGE_2),
@@ -4428,28 +4429,28 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(CALLING_PACKAGE_1),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
+ set(UserPackage.of(USER_10, LAUNCHER_1),
+ UserPackage.of(USER_10, LAUNCHER_2)),
hashSet(user0.getAllLaunchersForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_10, LAUNCHER_2)),
+ set(UserPackage.of(USER_11, LAUNCHER_2)),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
- "s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_2");
assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
+ "s0_2");
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_11),
"s10_1");
- assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// Remove the other launcher from user 10 too.
- uninstallPackage(USER_10, LAUNCHER_2);
- mService.cleanUpPackageLocked(LAUNCHER_2, USER_10, USER_10,
+ uninstallPackage(USER_11, LAUNCHER_2);
+ mService.cleanUpPackageLocked(LAUNCHER_2, USER_11, USER_11,
/* appStillExists = */ false);
assertEquals(set(CALLING_PACKAGE_2),
@@ -4457,28 +4458,28 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(CALLING_PACKAGE_1),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
+ set(UserPackage.of(USER_10, LAUNCHER_1),
+ UserPackage.of(USER_10, LAUNCHER_2)),
hashSet(user0.getAllLaunchersForTest().keySet()));
assertEquals(
set(),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
"s0_2");
// Note the pinned shortcuts on user-10 no longer referred, so they should both be removed.
- assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutNotExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
// More remove.
- uninstallPackage(USER_10, CALLING_PACKAGE_1);
- mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_10, USER_10,
+ uninstallPackage(USER_11, CALLING_PACKAGE_1);
+ mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_11, USER_11,
/* appStillExists = */ false);
assertEquals(set(CALLING_PACKAGE_2),
@@ -4486,21 +4487,21 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(set(),
hashSet(user10.getAllPackagesForTest().keySet()));
assertEquals(
- set(UserPackage.of(USER_0, LAUNCHER_1),
- UserPackage.of(USER_0, LAUNCHER_2)),
+ set(UserPackage.of(USER_10, LAUNCHER_1),
+ UserPackage.of(USER_10, LAUNCHER_2)),
hashSet(user0.getAllLaunchersForTest().keySet()));
assertEquals(set(),
hashSet(user10.getAllLaunchersForTest().keySet()));
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_1, USER_10),
"s0_2");
- assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_0),
+ assertShortcutIds(getLauncherPinnedShortcuts(LAUNCHER_2, USER_10),
"s0_2");
// Note the pinned shortcuts on user-10 no longer referred, so they should both be removed.
- assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_0);
- assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_0);
- assertShortcutNotExists(CALLING_PACKAGE_1, "s10_1", USER_10);
- assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s0_1", USER_10);
+ assertShortcutExists(CALLING_PACKAGE_2, "s0_2", USER_10);
+ assertShortcutNotExists(CALLING_PACKAGE_1, "s10_1", USER_11);
+ assertShortcutNotExists(CALLING_PACKAGE_2, "s10_2", USER_11);
mService.saveDirtyInfo();
}
@@ -4511,15 +4512,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s2", "s3", "ms1", "ms2"), HANDLE_USER_0);
+ list("s2", "s3", "ms1", "ms2"), HANDLE_USER_10);
});
// Remove ms2 from manifest.
@@ -4528,9 +4529,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
@@ -4564,9 +4565,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Clean up + re-publish manifests.
- mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_0, USER_0,
+ mService.cleanUpPackageLocked(CALLING_PACKAGE_1, USER_10, USER_10,
/* appStillExists = */ true);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1")
.areAllManifest();
@@ -4575,7 +4576,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void HandleGonePackage_crossProfile() {
// Create some shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
@@ -4583,253 +4584,253 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
// Pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s1"), HANDLE_USER_0);
+ list("s1"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s2"), UserHandle.of(USER_P0));
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,
- list("s3"), HANDLE_USER_0);
+ list("s3"), HANDLE_USER_10);
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s2"), HANDLE_USER_0);
+ list("s2"), HANDLE_USER_10);
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s3"), UserHandle.of(USER_P0));
mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,
- list("s1"), HANDLE_USER_0);
+ list("s1"), HANDLE_USER_10);
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("s3"), HANDLE_USER_10);
+ list("s3"), HANDLE_USER_11);
});
// Check the state.
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
// Make sure all the information is persisted.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
- mService.handleUnlockUser(USER_P0);
mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_P0);
+ mService.handleUnlockUser(USER_11);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
// Start uninstalling.
- uninstallPackage(USER_10, LAUNCHER_1);
- mService.checkPackageChanges(USER_10);
+ uninstallPackage(USER_11, LAUNCHER_1);
+ mService.checkPackageChanges(USER_11);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
// Uninstall.
- uninstallPackage(USER_10, CALLING_PACKAGE_1);
- mService.checkPackageChanges(USER_10);
+ uninstallPackage(USER_11, CALLING_PACKAGE_1);
+ mService.checkPackageChanges(USER_11);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
uninstallPackage(USER_P0, LAUNCHER_1);
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
mService.checkPackageChanges(USER_P0);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
uninstallPackage(USER_P0, CALLING_PACKAGE_1);
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
- mService.handleUnlockUser(USER_P0);
mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_P0);
+ mService.handleUnlockUser(USER_11);
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicAndPinned(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
// Uninstall
- uninstallPackage(USER_0, LAUNCHER_1);
+ uninstallPackage(USER_10, LAUNCHER_1);
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
- mService.handleUnlockUser(USER_P0);
mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_P0);
+ mService.handleUnlockUser(USER_11);
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
- uninstallPackage(USER_0, CALLING_PACKAGE_2);
+ uninstallPackage(USER_10, CALLING_PACKAGE_2);
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_0);
- mService.handleUnlockUser(USER_P0);
mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_P0);
+ mService.handleUnlockUser(USER_11);
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_0));
- assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_0));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
+ assertDynamicOnly(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_P0));
assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_P0));
- assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_0));
- assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_0));
- assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_0));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s1", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s2", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_2, "s3", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_10));
- assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_10));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s2", USER_11));
+ assertNull(getPackageShortcut(CALLING_PACKAGE_1, "s3", USER_11));
}
protected void checkCanRestoreTo(int expected, ShortcutPackageInfo spi,
@@ -4854,11 +4855,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
pi -> pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_ALLOW_BACKUP);
final ShortcutPackageInfo spi1 = ShortcutPackageInfo.generateForInstalledPackageForTest(
- mService, CALLING_PACKAGE_1, USER_0);
+ mService, CALLING_PACKAGE_1, USER_10);
final ShortcutPackageInfo spi2 = ShortcutPackageInfo.generateForInstalledPackageForTest(
- mService, CALLING_PACKAGE_2, USER_0);
+ mService, CALLING_PACKAGE_2, USER_10);
final ShortcutPackageInfo spi3 = ShortcutPackageInfo.generateForInstalledPackageForTest(
- mService, CALLING_PACKAGE_3, USER_0);
+ mService, CALLING_PACKAGE_3, USER_10);
checkCanRestoreTo(DISABLED_REASON_NOT_DISABLED, spi1, false, 10, true, "sig1");
checkCanRestoreTo(DISABLED_REASON_NOT_DISABLED, spi1, false, 10, true, "x", "sig1");
@@ -4927,7 +4928,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
private void checkHandlePackageDeleteInner(BiConsumer<Integer, String> remover) {
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(
makeShortcutWithIcon("s1", bmp32x32), makeShortcutWithIcon("s2", bmp32x32)
)));
@@ -4937,8 +4938,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("s1", "s2", "ms1")
@@ -4946,187 +4947,187 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.haveIds("ms1");
});
- setCaller(CALLING_PACKAGE_2, USER_0);
+ setCaller(CALLING_PACKAGE_2, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_3, USER_0);
+ setCaller(CALLING_PACKAGE_3, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_2, USER_10);
+ setCaller(CALLING_PACKAGE_2, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_3, USER_10);
+ setCaller(CALLING_PACKAGE_3, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
- remover.accept(USER_0, CALLING_PACKAGE_1);
+ remover.accept(USER_10, CALLING_PACKAGE_1);
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- remover.accept(USER_10, CALLING_PACKAGE_2);
+ remover.accept(USER_11, CALLING_PACKAGE_2);
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
mInjectedPackages.remove(CALLING_PACKAGE_1);
mInjectedPackages.remove(CALLING_PACKAGE_3);
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0)); // ---------------
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10)); // ---------------
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
- mService.checkPackageChanges(USER_10);
+ mService.checkPackageChanges(USER_11);
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
}
/** Almost ame as testHandlePackageDelete, except it doesn't uninstall packages. */
public void HandlePackageClearData() {
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(
makeShortcutWithIcon("s1", bmp32x32), makeShortcutWithIcon("s2", bmp32x32)
)));
- setCaller(CALLING_PACKAGE_2, USER_0);
+ setCaller(CALLING_PACKAGE_2, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_3, USER_0);
+ setCaller(CALLING_PACKAGE_3, USER_10);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_2, USER_10);
+ setCaller(CALLING_PACKAGE_2, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- setCaller(CALLING_PACKAGE_3, USER_10);
+ setCaller(CALLING_PACKAGE_3, USER_11);
assertTrue(mManager.addDynamicShortcuts(list(makeShortcutWithIcon("s1", bmp32x32))));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageDataClear(CALLING_PACKAGE_1, USER_0));
+ genPackageDataClear(CALLING_PACKAGE_1, USER_10));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageDataClear(CALLING_PACKAGE_2, USER_10));
+ genPackageDataClear(CALLING_PACKAGE_2, USER_11));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_0));
- assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_10));
assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_10));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "s1", USER_11));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, "s1", USER_11));
+ assertNotNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_3, "s1", USER_11));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_0));
- assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
- assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_10));
assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_1, USER_11));
+ assertFalse(bitmapDirectoryExists(CALLING_PACKAGE_2, USER_11));
+ assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_11));
}
public void HandlePackageClearData_manifestRepublished() {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
// Add two manifests and two dynamics.
addManifestShortcutResource(
@@ -5134,17 +5135,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.addDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_10);
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_11);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "s1", "s2")
.areAllEnabled()
@@ -5155,10 +5156,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Clear data
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageDataClear(CALLING_PACKAGE_1, USER_10));
+ genPackageDataClear(CALLING_PACKAGE_1, USER_11));
// Only manifest shortcuts will remain, and are no longer pinned.
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2")
.areAllEnabled()
@@ -5173,31 +5174,31 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcutWithIcon("s2", res32x32),
makeShortcutWithIcon("s3", res32x32),
makeShortcutWithIcon("s4", bmp32x32))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcutWithIcon("s2", bmp32x32))));
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("s1", res32x32))));
});
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("s1", res32x32),
makeShortcutWithIcon("s2", res32x32))));
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("s1", bmp32x32),
makeShortcutWithIcon("s2", bmp32x32))));
@@ -5206,10 +5207,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
LauncherApps.Callback c0 = mock(LauncherApps.Callback.class);
LauncherApps.Callback c10 = mock(LauncherApps.Callback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerCallback(c0, new Handler(Looper.getMainLooper()));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
mLauncherApps.registerCallback(c10, new Handler(Looper.getMainLooper()));
});
@@ -5224,7 +5225,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Then send the broadcast, to only user-0.
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageUpdateIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageUpdateIntent(CALLING_PACKAGE_1, USER_10));
waitOnMainThread();
@@ -5233,7 +5234,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
verify(c0).onShortcutsChanged(
eq(CALLING_PACKAGE_1),
shortcuts.capture(),
- eq(HANDLE_USER_0));
+ eq(HANDLE_USER_10));
// User-10 shouldn't yet get the notification.
verify(c10, times(0)).onShortcutsChanged(
@@ -5254,14 +5255,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// notification to the launcher.
mInjectedCurrentTimeMillis = START_TIME + 200;
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
reset(c0);
reset(c10);
setPackageLastUpdateTime(CALLING_PACKAGE_1, mInjectedCurrentTimeMillis);
- mService.handleUnlockUser(USER_10);
- mService.checkPackageChanges(USER_10);
+ mService.handleUnlockUser(USER_11);
+ mService.checkPackageChanges(USER_11);
waitOnMainThread();
@@ -5274,7 +5275,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
verify(c10).onShortcutsChanged(
eq(CALLING_PACKAGE_1),
shortcuts.capture(),
- eq(HANDLE_USER_10));
+ eq(HANDLE_USER_11));
assertShortcutIds(shortcuts.getValue(), "s1", "s2");
assertEquals(START_TIME + 200,
@@ -5292,7 +5293,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Then send the broadcast, to only user-0.
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageUpdateIntent(CALLING_PACKAGE_2, USER_0));
+ genPackageUpdateIntent(CALLING_PACKAGE_2, USER_10));
waitOnMainThread();
@@ -5315,8 +5316,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Then send the broadcast, to only user-0.
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageUpdateIntent(CALLING_PACKAGE_3, USER_0));
- mService.checkPackageChanges(USER_10);
+ genPackageUpdateIntent(CALLING_PACKAGE_3, USER_10));
+ mService.checkPackageChanges(USER_11);
waitOnMainThread();
@@ -5324,7 +5325,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
verify(c0).onShortcutsChanged(
eq(CALLING_PACKAGE_3),
shortcuts.capture(),
- eq(HANDLE_USER_0));
+ eq(HANDLE_USER_10));
// User 10 doesn't have package 3, so no callback.
verify(c10, times(0)).onShortcutsChanged(
@@ -5345,7 +5346,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
final Icon icon2 = Icon.createWithResource(getTestContext(), /* res ID */ 1001);
// Set up shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// Note resource strings are not officially supported (they're hidden), but
// should work.
@@ -5371,7 +5372,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Verify.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ShortcutInfo s1 = getCallerShortcut("s1");
final ShortcutInfo s2 = getCallerShortcut("s2");
@@ -5397,9 +5398,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Update the package.
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageUpdateIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageUpdateIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ShortcutInfo s1 = getCallerShortcut("s1");
final ShortcutInfo s2 = getCallerShortcut("s2");
@@ -5422,20 +5423,20 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mSystemPackages.add(CALLING_PACKAGE_1);
// Initial state: no shortcuts.
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
assertEquals(mInjectedCurrentTimeMillis,
- mService.getUserShortcutsLocked(USER_0).getLastAppScanTime());
+ mService.getUserShortcutsLocked(USER_10).getLastAppScanTime());
assertEquals(mInjectedBuildFingerprint,
- mService.getUserShortcutsLocked(USER_0).getLastAppScanOsFingerprint());
+ mService.getUserShortcutsLocked(USER_10).getLastAppScanOsFingerprint());
// They have no shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.isEmpty();
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerShortcuts())
.isEmpty();
});
@@ -5451,13 +5452,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
new ComponentName(CALLING_PACKAGE_2, ShortcutActivity.class.getName()),
R.xml.shortcut_1);
mInjectedCurrentTimeMillis += 1000;
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.isEmpty();
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerShortcuts())
.isEmpty();
});
@@ -5466,13 +5467,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Update the build finger print. All apps will be scanned now.
mInjectedBuildFingerprint = "update1";
mInjectedCurrentTimeMillis += 1000;
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1");
});
@@ -5486,14 +5487,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
new ComponentName(CALLING_PACKAGE_2, ShortcutActivity.class.getName()),
R.xml.shortcut_2);
mInjectedCurrentTimeMillis += 1000;
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
// Fingerprint hasn't changed, so there packages weren't scanned.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1");
});
@@ -5502,13 +5503,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// all apps anyway.
mInjectedBuildFingerprint = "update2";
mInjectedCurrentTimeMillis += 1000;
- mService.checkPackageChanges(USER_0);
+ mService.checkPackageChanges(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2");
});
@@ -5516,9 +5517,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Make sure getLastAppScanTime / getLastAppScanOsFingerprint are persisted.
initService();
assertEquals(mInjectedCurrentTimeMillis,
- mService.getUserShortcutsLocked(USER_0).getLastAppScanTime());
+ mService.getUserShortcutsLocked(USER_10).getLastAppScanTime());
assertEquals(mInjectedBuildFingerprint,
- mService.getUserShortcutsLocked(USER_0).getLastAppScanOsFingerprint());
+ mService.getUserShortcutsLocked(USER_10).getLastAppScanOsFingerprint());
}
public void HandlePackageChanged() {
@@ -5528,23 +5529,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
addManifestShortcutResource(ACTIVITY1, R.xml.shortcut_1);
addManifestShortcutResource(ACTIVITY2, R.xml.shortcut_1_alt);
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.addDynamicShortcuts(list(
makeShortcutWithActivity("s1", ACTIVITY1),
makeShortcutWithActivity("s2", ACTIVITY2)
)));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1-alt", "s2"), HANDLE_USER_10);
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1-alt", "s2"), HANDLE_USER_11);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms1-alt", "s1", "s2")
.areAllEnabled()
@@ -5564,9 +5565,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// First, no changes.
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageChangedIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageChangedIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms1-alt", "s1", "s2")
.areAllEnabled()
@@ -5587,9 +5588,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Disable activity 1
mEnabledActivityChecker = (activity, userId) -> !ACTIVITY1.equals(activity);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageChangedIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageChangedIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1-alt", "s2")
.areAllEnabled()
@@ -5607,9 +5608,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Manifest shortcuts will be re-published, but dynamic ones are not.
mEnabledActivityChecker = (activity, userId) -> true;
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageChangedIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageChangedIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms1-alt", "s2")
.areAllEnabled()
@@ -5631,9 +5632,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Because "ms1-alt" and "s2" are both pinned, they will remain, but disabled.
mEnabledActivityChecker = (activity, userId) -> !ACTIVITY2.equals(activity);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageChangedIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageChangedIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms1-alt", "s2")
@@ -5652,7 +5653,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void HandlePackageUpdate_activityNoLongerMain() throws Throwable {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithActivity("s1a",
new ComponentName(getCallingPackage(), "act1")),
@@ -5671,12 +5672,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.haveIds("s1a", "s1b", "s2a", "s2b", "s3a", "s3b")
.areAllDynamic();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("s1b", "s2b", "s3b"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("s1a", "s1b", "s2a", "s2b", "s3a", "s3b")
.areAllDynamic()
@@ -5690,17 +5691,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
return activity.getClassName().equals("act1");
};
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
assertForLauncherCallback(mLauncherApps, () -> {
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageUpdateIntent(CALLING_PACKAGE_1, USER_0));
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ genPackageUpdateIntent(CALLING_PACKAGE_1, USER_10));
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
// Make sure the launcher gets callbacks.
.haveIds("s1a", "s1b", "s2b", "s3b")
.areAllWithKeyFieldsOnly();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// s2a and s3a are gone, but s2b and s3b will remain because they're pinned, and
// disabled.
assertWith(getCallerShortcuts())
@@ -5800,24 +5801,24 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(0, userP0.getAllLaunchersForTest().size());
// Make sure only "allowBackup" apps are restored, and are shadow.
- final ShortcutUser user0 = mService.getUserShortcutsLocked(USER_0);
+ final ShortcutUser user0 = mService.getUserShortcutsLocked(USER_10);
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_1));
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_2));
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_3));
assertExistsAndShadow(user0.getAllLaunchersForTest().get(
- UserPackage.of(USER_0, LAUNCHER_1)));
+ UserPackage.of(USER_10, LAUNCHER_1)));
assertExistsAndShadow(user0.getAllLaunchersForTest().get(
- UserPackage.of(USER_0, LAUNCHER_2)));
+ UserPackage.of(USER_10, LAUNCHER_2)));
- assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_0, LAUNCHER_3)));
+ assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_10, LAUNCHER_3)));
assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_P0, LAUNCHER_1)));
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(any(byte[].class),
anyString());
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.selectDynamic()
.isEmpty()
@@ -5828,25 +5829,25 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllEnabled();
});
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s1")
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.isEmpty();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
assertWith(mLauncherApps.getShortcuts(QUERY_ALL, HANDLE_USER_P0))
.isEmpty();
});
- installPackage(USER_0, CALLING_PACKAGE_2);
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_2);
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.selectDynamic()
.isEmpty()
@@ -5857,18 +5858,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllEnabled();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s1")
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.areAllPinned()
.haveIds("s1", "s2")
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
assertWith(mLauncherApps.getShortcuts(QUERY_ALL, HANDLE_USER_P0))
@@ -5876,19 +5877,19 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// 3 shouldn't be backed up, so no pinned shortcuts.
- installPackage(USER_0, CALLING_PACKAGE_3);
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_3);
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.isEmpty();
});
// Launcher on a different profile shouldn't be restored.
runWithCaller(LAUNCHER_1, USER_P0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.isEmpty();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.isEmpty();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
});
@@ -5900,21 +5901,21 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Restore launcher 2 on user 0.
- installPackage(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2")
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2", "s3")
.areAllEnabled();
if (firstRestore) {
assertWith(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.haveIds("s2", "s3", "s4")
.areAllDisabled()
.areAllPinned()
@@ -5923,7 +5924,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
ShortcutInfo.DISABLED_REASON_BACKUP_NOT_SUPPORTED);
} else {
assertWith(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
}
@@ -5934,28 +5935,28 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Restoration of launcher2 shouldn't affect other packages; so do the same checks and
// make sure they still have the same result.
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.areAllPinned()
.haveIds("s1", "s2");
});
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s1")
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.areAllPinned()
.haveIds("s1", "s2")
.areAllEnabled();
if (firstRestore) {
assertWith(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.haveIds("s1", "s2", "s3")
.areAllDisabled()
.areAllPinned()
@@ -5963,7 +5964,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllWithDisabledReason(ShortcutInfo.DISABLED_REASON_BACKUP_NOT_SUPPORTED);
} else {
assertWith(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
}
@@ -5971,8 +5972,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.isEmpty();
});
- installPackage(USER_0, CALLING_PACKAGE_2);
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_2);
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.areAllPinned()
.haveIds("s1", "s2", "s3")
@@ -6004,30 +6005,30 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mMockPackageManagerInternal).isDataRestoreSafe(any(byte[].class),
eq(CALLING_PACKAGE_1));
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- assertFalse(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_0)
+ assertFalse(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_10)
.getPackageInfo().isShadow());
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(
any(byte[].class), anyString());
- installPackage(USER_0, CALLING_PACKAGE_2);
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_2);
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(
mManager.getPinnedShortcuts()),
"s1", "s2", "s3");
});
- assertFalse(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, USER_0)
+ assertFalse(mService.getPackageShortcutForTest(CALLING_PACKAGE_2, USER_10)
.getPackageInfo().isShadow());
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.haveIds("s1")
.areAllPinned()
.areAllDisabled()
@@ -6055,61 +6056,61 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
fail("Unhandled disabled reason: " + package1DisabledReason);
}
});
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.haveIds("s1", "s2")
.areAllPinned()
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
});
- installPackage(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.haveIds("s2")
.areAllPinned()
.areAllDisabled()
.areAllWithDisabledReason(package1DisabledReason);
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.haveIds("s2", "s3")
.areAllPinned()
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
});
- installPackage(USER_0, CALLING_PACKAGE_3);
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_3);
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.haveIds("s1")
.areAllPinned()
.areAllDisabled()
.areAllWithDisabledReason(package1DisabledReason);
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.haveIds("s1", "s2")
.areAllPinned()
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.haveIds("s1", "s2", "s3")
.areAllPinned()
.areAllDisabled()
.areAllWithDisabledReason(ShortcutInfo.DISABLED_REASON_BACKUP_NOT_SUPPORTED);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.haveIds("s2")
.areAllPinned()
.areAllDisabled()
.areAllWithDisabledReason(package1DisabledReason);
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.haveIds("s2", "s3")
.areAllPinned()
.areAllEnabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.haveIds("s2", "s3", "s4")
.areAllPinned()
.areAllDisabled()
@@ -6147,8 +6148,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(
any(byte[].class), anyString());
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
// s1 was pinned by launcher 1, which is not restored, yet, so we still see "s1" here.
@@ -6157,8 +6158,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"s1", "s2");
});
- installPackage(USER_0, CALLING_PACKAGE_2);
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_2);
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(
mManager.getPinnedShortcuts()),
@@ -6170,22 +6171,22 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Now we try to restore launcher 1. Then we realize it's not restorable, so L1 has no pinned
// shortcuts.
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
/* empty */);
});
- assertFalse(mService.getLauncherShortcutForTest(LAUNCHER_1, USER_0)
+ assertFalse(mService.getLauncherShortcutForTest(LAUNCHER_1, USER_10)
.getPackageInfo().isShadow());
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
// Now CALLING_PACKAGE_1 realizes "s1" is no longer pinned.
@@ -6197,44 +6198,44 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(
any(byte[].class), anyString());
- installPackage(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ installPackage(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0)),
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10)),
"s2");
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0)),
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10)),
"s2", "s3");
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
/* empty */);
});
- assertFalse(mService.getLauncherShortcutForTest(LAUNCHER_2, USER_0)
+ assertFalse(mService.getLauncherShortcutForTest(LAUNCHER_2, USER_10)
.getPackageInfo().isShadow());
- installPackage(USER_0, CALLING_PACKAGE_3);
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_3);
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
/* empty */);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0)),
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10)),
"s2");
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0)),
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10)),
"s2", "s3");
});
}
@@ -6254,80 +6255,80 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
protected void checkBackupAndRestore_publisherAndLauncherNotRestored() {
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(any(byte[].class),
anyString());
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- installPackage(USER_0, CALLING_PACKAGE_2);
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_2);
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(
mManager.getPinnedShortcuts()),
"s1", "s2", "s3");
});
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
/* empty */);
});
- installPackage(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ installPackage(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2")
.areAllDisabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2", "s3");
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
});
// Because launcher 1 wasn't restored, "s1" is no longer pinned.
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertShortcutIds(assertAllPinned(
mManager.getPinnedShortcuts()),
"s2", "s3");
});
- installPackage(USER_0, CALLING_PACKAGE_3);
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_3);
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(0, mManager.getDynamicShortcuts().size());
assertEquals(0, mManager.getPinnedShortcuts().size());
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
/* empty */);
assertShortcutIds(assertAllPinned(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
/* empty */);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2")
.areAllDisabled();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.areAllPinned()
.haveIds("s2", "s3");
assertWith(
- mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.haveIds("s2", "s3", "s4")
.areAllDisabled()
.areAllPinned()
@@ -6341,7 +6342,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
prepareCrossProfileDataSet();
// Before doing backup & restore, disable s1.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.disableShortcuts(list("s1"));
});
@@ -6355,23 +6356,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertEquals(0, userP0.getAllLaunchersForTest().size());
// Make sure only "allowBackup" apps are restored, and are shadow.
- final ShortcutUser user0 = mService.getUserShortcutsLocked(USER_0);
+ final ShortcutUser user0 = mService.getUserShortcutsLocked(USER_10);
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_1));
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_2));
assertExistsAndShadow(user0.getAllPackagesForTest().get(CALLING_PACKAGE_3));
assertExistsAndShadow(user0.getAllLaunchersForTest().get(
- UserPackage.of(USER_0, LAUNCHER_1)));
+ UserPackage.of(USER_10, LAUNCHER_1)));
assertExistsAndShadow(user0.getAllLaunchersForTest().get(
- UserPackage.of(USER_0, LAUNCHER_2)));
+ UserPackage.of(USER_10, LAUNCHER_2)));
- assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_0, LAUNCHER_3)));
+ assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_10, LAUNCHER_3)));
assertNull(user0.getAllLaunchersForTest().get(UserPackage.of(USER_P0, LAUNCHER_1)));
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(any(byte[].class),
anyString());
- installPackage(USER_0, CALLING_PACKAGE_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ installPackage(USER_10, CALLING_PACKAGE_1);
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.areAllEnabled() // disabled shortcuts shouldn't be restored.
@@ -6384,16 +6385,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.haveIds("s2");
});
- installPackage(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ installPackage(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Note, s1 was pinned by launcher 1, but was disabled, so isn't restored.
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10))
.isEmpty();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_2), HANDLE_USER_10))
.isEmpty();
- assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_0))
+ assertWith(mLauncherApps.getShortcuts(buildAllQuery(CALLING_PACKAGE_3), HANDLE_USER_10))
.isEmpty();
assertWith(mLauncherApps.getShortcuts(QUERY_ALL, HANDLE_USER_P0))
@@ -6409,17 +6410,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
// Pin from launcher 1.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("ms1", "ms2", "s1", "s2"), HANDLE_USER_0);
+ list("ms1", "ms2", "s1", "s2"), HANDLE_USER_10);
});
// Update and now ms2 is gone -> disabled.
@@ -6428,10 +6429,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Make sure the manifest shortcuts have been published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.selectManifest()
.haveIds("ms1")
@@ -6461,11 +6462,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// When re-installing the app, the manifest shortcut should be re-published.
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(LAUNCHER_1, USER_0));
+ genPackageAddIntent(LAUNCHER_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.selectPinned()
// ms2 was disabled, so not restored.
@@ -6502,17 +6503,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3"))));
});
// Pin from launcher 1.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("ms1", "ms2", "s1", "s2"), HANDLE_USER_0);
+ list("ms1", "ms2", "s1", "s2"), HANDLE_USER_10);
});
// Update and now ms2 is gone -> disabled.
@@ -6521,7 +6522,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Set up shortcuts for package 3, which won't be backed up / restored.
addManifestShortcutResource(
@@ -6529,15 +6530,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_3, 1);
mService.mPackageMonitor.onReceive(mServiceContext,
- genPackageAddIntent(CALLING_PACKAGE_3, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_3, USER_10));
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertTrue(getManager().setDynamicShortcuts(list(
makeShortcut("s1"))));
});
// Make sure the manifest shortcuts have been published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.selectManifest()
.haveIds("ms1")
@@ -6561,7 +6562,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllDisabled();
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("s1", "ms1");
});
@@ -6575,7 +6576,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat("Before backup");
- final byte[] payload = mService.getBackupPayload(USER_0);
+ final byte[] payload = mService.getBackupPayload(USER_10);
if (ENABLE_DUMP) {
final String xml = new String(payload);
Log.v(TAG, "Backup payload:");
@@ -6583,7 +6584,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
Log.v(TAG, line);
}
}
- mService.applyRestore(payload, USER_0);
+ mService.applyRestore(payload, USER_10);
dumpsysOnLogcat("After restore");
@@ -6591,7 +6592,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
// The check is also the same as testBackupAndRestore_manifestRePublished().
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerVisibleShortcuts())
.selectPinned()
// ms2 was disabled, so not restored.
@@ -6609,7 +6610,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Package 3 still has the same shortcuts.
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("s1", "ms1");
});
@@ -6627,31 +6628,31 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(
any(byte[].class), anyString());
- runWithSystemUid(() -> mService.applyRestore(payload, USER_0));
+ runWithSystemUid(() -> mService.applyRestore(payload, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.areAllPinned()
.haveIds("s1")
.areAllEnabled();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(getShortcutAsLauncher(USER_0))
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(getShortcutAsLauncher(USER_10))
.areAllPinned()
.haveIds("s1")
.areAllEnabled();
});
// Make sure getBackupSourceVersionCode and isBackupSourceBackupAllowed
// are correct. We didn't have them in the old format.
- assertEquals(8, mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_0)
+ assertEquals(8, mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_10)
.getPackageInfo().getBackupSourceVersionCode());
- assertTrue(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_0)
+ assertTrue(mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_10)
.getPackageInfo().isBackupSourceBackupAllowed());
- assertEquals(9, mService.getLauncherShortcutForTest(LAUNCHER_1, USER_0)
+ assertEquals(9, mService.getLauncherShortcutForTest(LAUNCHER_1, USER_10)
.getPackageInfo().getBackupSourceVersionCode());
- assertTrue(mService.getLauncherShortcutForTest(LAUNCHER_1, USER_0)
+ assertTrue(mService.getLauncherShortcutForTest(LAUNCHER_1, USER_10)
.getPackageInfo().isBackupSourceBackupAllowed());
}
@@ -6664,25 +6665,25 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mService.saveDirtyInfo();
initService();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()),
"s1", "s2", "s3", "s4");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()),
"s1", "s2", "s3", "s4", "s5");
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()),
"s1", "s2", "s3");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()),
"s1", "s2", "s3", "s4", "s5", "s6");
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts())
/* empty */);
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts())
@@ -6700,24 +6701,24 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts())
/* empty */);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertShortcutIds(assertAllDynamic(mManager.getDynamicShortcuts()),
"x1", "x2", "x3");
assertShortcutIds(assertAllPinned(mManager.getPinnedShortcuts()),
"x4", "x5");
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10),
"s1");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10),
"s1", "s2");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10),
"s1", "s2", "s3");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_P0),
@@ -6728,21 +6729,21 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertExpectException(
SecurityException.class, "", () -> {
mLauncherApps.getShortcuts(
- buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10);
+ buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_11);
});
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10),
"s2");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10),
"s2", "s3");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10),
"s2", "s3", "s4");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_P0),
@@ -6751,18 +6752,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_P0)
/* empty */);
});
- runWithCaller(LAUNCHER_3, USER_0, () -> {
+ runWithCaller(LAUNCHER_3, USER_10, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10),
"s3");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10),
"s3", "s4");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10),
"s3", "s4", "s5");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_P0),
@@ -6771,18 +6772,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_P0)
/* empty */);
});
- runWithCaller(LAUNCHER_4, USER_0, () -> {
+ runWithCaller(LAUNCHER_4, USER_10, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_0)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_4), HANDLE_USER_10)
/* empty */);
assertShortcutIds(
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_P0)
@@ -6793,13 +6794,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
runWithCaller(LAUNCHER_1, USER_P0, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10),
"s3", "s4");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10),
"s3", "s4", "s5");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_0),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10),
"s3", "s4", "s5", "s6");
assertShortcutIds(
mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_P0),
@@ -6807,23 +6808,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertExpectException(
SecurityException.class, "unrelated profile", () -> {
mLauncherApps.getShortcuts(
- buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10);
+ buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_11);
});
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_10),
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_1), HANDLE_USER_11),
"x4", "x5");
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_10)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_2), HANDLE_USER_11)
/* empty */);
assertShortcutIds(
- mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_10)
+ mLauncherApps.getShortcuts(buildPinnedQuery(CALLING_PACKAGE_3), HANDLE_USER_11)
/* empty */);
assertExpectException(
SecurityException.class, "unrelated profile", () -> {
mLauncherApps.getShortcuts(
- buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_0);
+ buildAllQuery(CALLING_PACKAGE_1), HANDLE_USER_10);
});
assertExpectException(
SecurityException.class, "unrelated profile", () -> {
@@ -6832,11 +6833,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
});
// Check the user-IDs.
- assertEquals(USER_0,
- mService.getUserShortcutsLocked(USER_0).getPackageShortcuts(CALLING_PACKAGE_1)
+ assertEquals(USER_10,
+ mService.getUserShortcutsLocked(USER_10).getPackageShortcuts(CALLING_PACKAGE_1)
.getOwnerUserId());
- assertEquals(USER_0,
- mService.getUserShortcutsLocked(USER_0).getPackageShortcuts(CALLING_PACKAGE_1)
+ assertEquals(USER_10,
+ mService.getUserShortcutsLocked(USER_10).getPackageShortcuts(CALLING_PACKAGE_1)
.getPackageUserId());
assertEquals(USER_P0,
mService.getUserShortcutsLocked(USER_P0).getPackageShortcuts(CALLING_PACKAGE_1)
@@ -6845,27 +6846,27 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mService.getUserShortcutsLocked(USER_P0).getPackageShortcuts(CALLING_PACKAGE_1)
.getPackageUserId());
- assertEquals(USER_0,
- mService.getUserShortcutsLocked(USER_0).getLauncherShortcuts(LAUNCHER_1, USER_0)
+ assertEquals(USER_10,
+ mService.getUserShortcutsLocked(USER_10).getLauncherShortcuts(LAUNCHER_1, USER_10)
.getOwnerUserId());
- assertEquals(USER_0,
- mService.getUserShortcutsLocked(USER_0).getLauncherShortcuts(LAUNCHER_1, USER_0)
+ assertEquals(USER_10,
+ mService.getUserShortcutsLocked(USER_10).getLauncherShortcuts(LAUNCHER_1, USER_10)
.getPackageUserId());
assertEquals(USER_P0,
- mService.getUserShortcutsLocked(USER_P0).getLauncherShortcuts(LAUNCHER_1, USER_0)
+ mService.getUserShortcutsLocked(USER_P0).getLauncherShortcuts(LAUNCHER_1, USER_10)
.getOwnerUserId());
- assertEquals(USER_0,
- mService.getUserShortcutsLocked(USER_P0).getLauncherShortcuts(LAUNCHER_1, USER_0)
+ assertEquals(USER_10,
+ mService.getUserShortcutsLocked(USER_P0).getLauncherShortcuts(LAUNCHER_1, USER_10)
.getPackageUserId());
}
public void OnApplicationActive_permission() {
assertExpectException(SecurityException.class, "Missing permission", () ->
- mManager.onApplicationActive(CALLING_PACKAGE_1, USER_0));
+ mManager.onApplicationActive(CALLING_PACKAGE_1, USER_10));
// Has permission, now it should pass.
mCallerPermissions.add(permission.RESET_SHORTCUT_MANAGER_THROTTLING);
- mManager.onApplicationActive(CALLING_PACKAGE_1, USER_0);
+ mManager.onApplicationActive(CALLING_PACKAGE_1, USER_10);
}
public void GetShareTargets_permission() {
@@ -6881,7 +6882,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
mCallerPermissions.add(permission.MANAGE_APP_PREDICTIONS);
mManager.getShareTargets(filter);
- runWithCaller(CHOOSER_ACTIVITY_PACKAGE, USER_0, () -> {
+ runWithCaller(CHOOSER_ACTIVITY_PACKAGE, USER_10, () -> {
// Access is allowed when called from the configured system ChooserActivity
mManager.getShareTargets(filter);
});
@@ -6897,13 +6898,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void isSharingShortcut_permission() throws IntentFilter.MalformedMimeTypeException {
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
IntentFilter filter_any = new IntentFilter();
filter_any.addDataType("*/*");
assertExpectException(SecurityException.class, "Missing permission", () ->
- mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_any));
// Has permission, now it should pass.
@@ -6935,23 +6936,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Unlock user-0.
mInjectedCurrentTimeMillis += 100;
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
@@ -6959,27 +6960,27 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Try on another user, with some packages uninstalled.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- uninstallPackage(USER_10, CALLING_PACKAGE_1);
- uninstallPackage(USER_10, CALLING_PACKAGE_3);
+ uninstallPackage(USER_11, CALLING_PACKAGE_1);
+ uninstallPackage(USER_11, CALLING_PACKAGE_3);
mInjectedCurrentTimeMillis += 100;
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_11, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
@@ -6999,23 +7000,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled( // FAIL
mManager.getManifestShortcuts()))),
"ms1");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
@@ -7031,23 +7032,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
updatePackageLastUpdateTime(CALLING_PACKAGE_3, 1);
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7055,12 +7056,12 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Next, try removing all shortcuts, with some of them pinned.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms3"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("ms2"), HANDLE_USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("ms1"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms3"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("ms2"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_3, list("ms1"), HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
@@ -7069,7 +7070,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"ms3");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
@@ -7078,7 +7079,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"ms2");
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7106,16 +7107,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
updatePackageVersion(CALLING_PACKAGE_3, 1);
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertShortcutIds(assertAllImmutable(assertAllPinned(assertAllNotManifest(
assertAllDisabled(mManager.getPinnedShortcuts())))),
"ms3");
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7124,7 +7125,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"ms2");
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertShortcutIds(assertAllImmutable(assertAllPinned(assertAllNotManifest(
assertAllDisabled(mManager.getPinnedShortcuts())))),
@@ -7132,38 +7133,38 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Make sure we don't have ShortcutPackage for packages that don't have shortcuts.
- assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_4, USER_0));
- assertNull(mService.getPackageShortcutForTest(LAUNCHER_1, USER_0));
+ assertNull(mService.getPackageShortcutForTest(CALLING_PACKAGE_4, USER_10));
+ assertNull(mService.getPackageShortcutForTest(LAUNCHER_1, USER_10));
}
public void ManifestShortcut_publishOnBroadcast() {
// First, no packages are installed.
- uninstallPackage(USER_0, CALLING_PACKAGE_1);
- uninstallPackage(USER_0, CALLING_PACKAGE_2);
- uninstallPackage(USER_0, CALLING_PACKAGE_3);
- uninstallPackage(USER_0, CALLING_PACKAGE_4);
uninstallPackage(USER_10, CALLING_PACKAGE_1);
uninstallPackage(USER_10, CALLING_PACKAGE_2);
uninstallPackage(USER_10, CALLING_PACKAGE_3);
uninstallPackage(USER_10, CALLING_PACKAGE_4);
+ uninstallPackage(USER_11, CALLING_PACKAGE_1);
+ uninstallPackage(USER_11, CALLING_PACKAGE_2);
+ uninstallPackage(USER_11, CALLING_PACKAGE_3);
+ uninstallPackage(USER_11, CALLING_PACKAGE_4);
- mService.handleUnlockUser(USER_0);
-
- mRunningUsers.put(USER_10, true);
mService.handleUnlockUser(USER_10);
+ mRunningUsers.put(USER_11, true);
+ mService.handleUnlockUser(USER_11);
+
// Originally no manifest shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
@@ -7174,16 +7175,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
@@ -7195,16 +7196,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5_altalt);
updatePackageVersion(CALLING_PACKAGE_2, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
@@ -7221,8 +7222,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
dumpsysOnLogcat("Before pinning");
// Also pin some.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("ms2", "ms3"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_2, list("ms2", "ms3"), HANDLE_USER_10);
});
dumpsysOnLogcat("After pinning");
@@ -7232,18 +7233,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageLastUpdateTime(CALLING_PACKAGE_2, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
dumpsysOnLogcat("After updating package 2");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
assertEmpty(mManager.getPinnedShortcuts());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
@@ -7267,10 +7268,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Make sure the launcher see the correct disabled reason.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- assertWith(getShortcutAsLauncher(USER_0))
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ assertWith(getShortcutAsLauncher(USER_10))
.forShortcutWithId("ms3", si -> {
- assertEquals("string-com.android.test.2-user:0-res:"
+ assertEquals("string-com.android.test.2-user:10-res:"
+ R.string.shortcut_disabled_message3 + "/en",
si.getDisabledMessage());
});
@@ -7278,18 +7279,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Package 2 on user 10 has no shortcuts yet.
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
});
// Send add broadcast, but the user is not running, so should be ignored.
- mService.handleStopUser(USER_10);
- mRunningUsers.put(USER_10, false);
- mUnlockedUsers.put(USER_10, false);
+ mService.handleStopUser(USER_11);
+ mRunningUsers.put(USER_11, false);
+ mUnlockedUsers.put(USER_11, false);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_11));
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
// Don't use the mManager APIs to get shortcuts, because they'll trigger the package
// update check.
// So look the internal data directly using getCallerShortcuts().
@@ -7297,10 +7298,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Try again, but the user is locked, so still ignored.
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_11));
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
// Don't use the mManager APIs to get shortcuts, because they'll trigger the package
// update check.
// So look the internal data directly using getCallerShortcuts().
@@ -7308,13 +7309,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Unlock the user, now it should work.
- mUnlockedUsers.put(USER_10, true);
+ mUnlockedUsers.put(USER_11, true);
// Send PACKAGE_ADD broadcast to have Package 2 on user-10 publish manifest shortcuts.
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_11));
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
@@ -7326,7 +7327,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// But it shouldn't affect user-0.
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2");
@@ -7353,9 +7354,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
updatePackageLastUpdateTime(CALLING_PACKAGE_2, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5",
@@ -7381,10 +7382,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_0);
updatePackageLastUpdateTime(CALLING_PACKAGE_2, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_2, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_2, USER_10));
// No manifest shortcuts, and pinned ones are disabled.
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertShortcutIds(assertAllImmutable(assertAllPinned(assertAllDisabled(
mManager.getPinnedShortcuts()))),
@@ -7394,15 +7395,15 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void ManifestShortcuts_missingMandatoryFields() {
// Start with no apps installed.
- uninstallPackage(USER_0, CALLING_PACKAGE_1);
- uninstallPackage(USER_0, CALLING_PACKAGE_2);
- uninstallPackage(USER_0, CALLING_PACKAGE_3);
- uninstallPackage(USER_0, CALLING_PACKAGE_4);
+ uninstallPackage(USER_10, CALLING_PACKAGE_1);
+ uninstallPackage(USER_10, CALLING_PACKAGE_2);
+ uninstallPackage(USER_10, CALLING_PACKAGE_3);
+ uninstallPackage(USER_10, CALLING_PACKAGE_4);
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Make sure no manifest shortcuts.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
});
@@ -7412,10 +7413,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_error_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.areAllManifest()
.areAllImmutable()
@@ -7429,10 +7430,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_error_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.areAllManifest()
.areAllImmutable()
@@ -7446,10 +7447,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_error_3);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.areAllManifest()
.areAllImmutable()
@@ -7467,9 +7468,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_error_4);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// Make sure invalid ones are not published.
// Note that at this point disabled ones don't show up because they weren't pinned.
assertWith(getCallerShortcuts())
@@ -7525,9 +7526,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// Make sure 5 manifest shortcuts are published.
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "ms3", "ms4", "ms5")
@@ -7538,13 +7539,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
.areAllEnabled();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
- list("ms3", "ms4", "ms5"), HANDLE_USER_0);
+ list("ms3", "ms4", "ms5"), HANDLE_USER_10);
});
// Make sure they're pinned.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "ms3", "ms4", "ms5")
.selectByIds("ms1", "ms2")
@@ -7563,10 +7564,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_error_4);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Make sure 3, 4 and 5 still exist but disabled.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "ms3", "ms4", "ms5")
.areAllNotDynamic()
@@ -7604,7 +7605,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_checkAllFields() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Package 1 updated, which has one valid manifest shortcut and one invalid.
addManifestShortcutResource(
@@ -7612,10 +7613,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "ms3", "ms4", "ms5")
.areAllManifest()
@@ -7709,7 +7710,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_localeChange() throws InterruptedException {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Package 1 updated, which has one valid manifest shortcut and one invalid.
addManifestShortcutResource(
@@ -7717,9 +7718,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.setDynamicShortcuts(list(makeShortcutWithTitle("s1", "title")));
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
@@ -7730,11 +7731,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
ShortcutInfo si = getCallerShortcut("ms1");
assertEquals("ms1", si.getId());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_title1 + "/en",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_title1 + "/en",
si.getTitle());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_text1 + "/en",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_text1 + "/en",
si.getText());
- assertEquals("string-com.android.test.1-user:0-res:"
+ assertEquals("string-com.android.test.1-user:10-res:"
+ R.string.shortcut_disabled_message1 + "/en",
si.getDisabledMessage());
assertEquals(START_TIME, si.getLastChangedTimestamp());
@@ -7743,11 +7744,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
si = getCallerShortcut("ms2");
assertEquals("ms2", si.getId());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_title2 + "/en",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_title2 + "/en",
si.getTitle());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_text2 + "/en",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_text2 + "/en",
si.getText());
- assertEquals("string-com.android.test.1-user:0-res:"
+ assertEquals("string-com.android.test.1-user:10-res:"
+ R.string.shortcut_disabled_message2 + "/en",
si.getDisabledMessage());
assertEquals(START_TIME, si.getLastChangedTimestamp());
@@ -7767,23 +7768,23 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the locale and send the broadcast, make sure the launcher gets a callback too.
mInjectedLocale = Locale.JAPANESE;
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
assertForLauncherCallback(mLauncherApps, () -> {
mService.mReceiver.onReceive(mServiceContext, new Intent(Intent.ACTION_LOCALE_CHANGED));
- }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_0)
+ }).assertCallbackCalledForPackageAndUser(CALLING_PACKAGE_1, HANDLE_USER_10)
.haveIds("ms1", "ms2", "s1");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// check first shortcut.
ShortcutInfo si = getCallerShortcut("ms1");
assertEquals("ms1", si.getId());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_title1 + "/ja",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_title1 + "/ja",
si.getTitle());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_text1 + "/ja",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_text1 + "/ja",
si.getText());
- assertEquals("string-com.android.test.1-user:0-res:"
+ assertEquals("string-com.android.test.1-user:10-res:"
+ R.string.shortcut_disabled_message1 + "/ja",
si.getDisabledMessage());
assertEquals(START_TIME + 1, si.getLastChangedTimestamp());
@@ -7792,11 +7793,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
si = getCallerShortcut("ms2");
assertEquals("ms2", si.getId());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_title2 + "/ja",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_title2 + "/ja",
si.getTitle());
- assertEquals("string-com.android.test.1-user:0-res:" + R.string.shortcut_text2 + "/ja",
+ assertEquals("string-com.android.test.1-user:10-res:" + R.string.shortcut_text2 + "/ja",
si.getText());
- assertEquals("string-com.android.test.1-user:0-res:"
+ assertEquals("string-com.android.test.1-user:10-res:"
+ R.string.shortcut_disabled_message2 + "/ja",
si.getDisabledMessage());
assertEquals(START_TIME + 1, si.getLastChangedTimestamp());
@@ -7813,7 +7814,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_updateAndDisabled_notPinned() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// First, just publish a manifest shortcut.
addManifestShortcutResource(
@@ -7821,10 +7822,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7840,10 +7841,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1_disable);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Because shortcut 1 wasn't pinned, it'll just go away.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertEmpty(mManager.getPinnedShortcuts());
@@ -7853,7 +7854,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_updateAndDisabled_pinned() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// First, just publish a manifest shortcut.
addManifestShortcutResource(
@@ -7861,10 +7862,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Only the valid one is published.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7874,8 +7875,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
assertShortcutIds(getCallerShortcuts(), "ms1");
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_10);
});
// Now upgrade, the manifest shortcut is disabled now.
@@ -7884,10 +7885,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1_disable);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// Because shortcut 1 was pinned, it'll still exist as pinned, but disabled.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEmpty(mManager.getManifestShortcuts());
assertShortcutIds(assertAllNotManifest(assertAllImmutable(assertAllDisabled(
mManager.getPinnedShortcuts()))),
@@ -7909,7 +7910,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_duplicateInSingleActivity() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// The XML has two shortcuts with the same ID.
addManifestShortcutResource(
@@ -7917,9 +7918,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2_duplicate);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1");
@@ -7934,7 +7935,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void ManifestShortcuts_duplicateInTwoActivities() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// ShortcutActivity has shortcut ms1
addManifestShortcutResource(
@@ -7947,9 +7948,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllManifest(assertAllImmutable(assertAllEnabled(
mManager.getManifestShortcuts()))),
"ms1", "ms2", "ms3", "ms4", "ms5");
@@ -7986,11 +7987,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
* Manifest shortcuts cannot override shortcuts that were published via the APIs.
*/
public void ManifestShortcuts_cannotOverrideNonManifest() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Create a non-pinned dynamic shortcut and a non-dynamic pinned shortcut.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.setDynamicShortcuts(list(
makeShortcut("ms1", "title1",
new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()),
@@ -8000,11 +8001,11 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
/* icon */ null, new Intent("action1"), /* rank */ 0)));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2"), HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("ms2"));
assertShortcutIds(mManager.getDynamicShortcuts(), "ms1");
@@ -8019,9 +8020,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllNotManifest(mManager.getDynamicShortcuts()), "ms1");
assertShortcutIds(assertAllNotManifest(mManager.getPinnedShortcuts()), "ms2");
assertShortcutIds(assertAllManifest(mManager.getManifestShortcuts()),
@@ -8037,7 +8038,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
protected void checkManifestShortcuts_immutable_verify() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertShortcutIds(assertAllNotManifest(assertAllEnabled(
mManager.getDynamicShortcuts())),
"s1");
@@ -8059,7 +8060,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
* Make sure the APIs won't work on manifest shortcuts.
*/
public void ManifestShortcuts_immutable() {
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
// Create a non-pinned manifest shortcut, a pinned shortcut that was originally
// a manifest shortcut, as well as a dynamic shortcut.
@@ -8069,10 +8070,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2"), HANDLE_USER_10);
});
addManifestShortcutResource(
@@ -8080,9 +8081,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.addDynamicShortcuts(list(makeShortcutWithTitle("s1", "t1")));
});
@@ -8091,7 +8092,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Note that even though the first argument is not immutable and only the second one
// is immutable, the first argument should not be executed either.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.setDynamicShortcuts(list(makeShortcut("xx"), makeShortcut("ms1")));
});
@@ -8101,7 +8102,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
checkManifestShortcuts_immutable_verify();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.addDynamicShortcuts(list(makeShortcut("xx"), makeShortcut("ms1")));
});
@@ -8112,7 +8113,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
checkManifestShortcuts_immutable_verify();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.updateShortcuts(list(makeShortcut("s1"), makeShortcut("ms1")));
});
@@ -8122,7 +8123,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
checkManifestShortcuts_immutable_verify();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.removeDynamicShortcuts(list("s1", "ms1"));
});
@@ -8132,14 +8133,14 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
checkManifestShortcuts_immutable_verify();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.disableShortcuts(list("s1", "ms1"));
});
});
checkManifestShortcuts_immutable_verify();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertCannotUpdateImmutable(() -> {
mManager.enableShortcuts(list("s1", "ms2"));
});
@@ -8155,16 +8156,16 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
addManifestShortcutResource(
new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()),
R.xml.shortcut_5);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// Only the first 3 should be published.
assertShortcutIds(mManager.getManifestShortcuts(), "ms1", "ms2", "ms3");
});
@@ -8174,7 +8175,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ComponentName a1 = new ComponentName(mClientContext, ShortcutActivity.class);
final ComponentName a2 = new ComponentName(mClientContext, ShortcutActivity2.class);
final ShortcutInfo s1_1 = makeShortcutWithActivity("s11", a1);
@@ -8232,7 +8233,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(2, mManager.getManifestShortcuts().size());
// Setting 1 to activity 1 will work.
@@ -8255,7 +8256,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ComponentName a1 = new ComponentName(mClientContext, ShortcutActivity.class);
final ComponentName a2 = new ComponentName(mClientContext, ShortcutActivity2.class);
final ShortcutInfo s1_1 = makeShortcutWithActivity("s11", a1);
@@ -8305,9 +8306,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Make sure pinned shortcuts won't affect.
// - Pin s11 - s13, and remove all dynamic.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s11", "s12", "s13"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
mManager.removeAllDynamicShortcuts();
@@ -8358,7 +8359,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(2, mManager.getManifestShortcuts().size());
@@ -8382,7 +8383,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ComponentName a1 = new ComponentName(mClientContext, ShortcutActivity.class);
final ComponentName a2 = new ComponentName(mClientContext, ShortcutActivity2.class);
final ShortcutInfo s1_1 = makeShortcutWithActivity("s11", a1);
@@ -8431,9 +8432,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"s11", "s12", "s13", "s21", "s22", "s23");
// Pin some to have more shortcuts for a1.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s11", "s12", "s13"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
mManager.setDynamicShortcuts(list(s1_4, s1_5, s2_1, s2_2, s2_3));
assertShortcutIds(mManager.getDynamicShortcuts(),
@@ -8473,7 +8474,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
final ComponentName a1 = new ComponentName(mClientContext, ShortcutActivity.class);
final ComponentName a2 = new ComponentName(mClientContext, ShortcutActivity2.class);
final ShortcutInfo s1_1 = makeShortcutWithActivityAndRank("s11", a1, 4);
@@ -8489,9 +8490,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
// Initial state.
mManager.setDynamicShortcuts(list(s1_1, s1_2, s1_3, s2_1, s2_2, s2_3));
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s11", "s12", "s21", "s22"),
- HANDLE_USER_0);
+ HANDLE_USER_10);
});
mManager.setDynamicShortcuts(list(s1_2, s1_3, s1_4, s2_2, s2_3, s2_4));
assertShortcutIds(assertAllEnabled(mManager.getDynamicShortcuts()),
@@ -8507,7 +8508,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(1, mManager.getManifestShortcuts().size());
// s12 removed.
@@ -8527,7 +8528,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1_alt);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(3, mManager.getManifestShortcuts().size());
// Note the ones with the highest rank values (== least important) will be removed.
@@ -8547,7 +8548,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_5_alt); // manifest has 5, but max is 3, so a2 will have 3.
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(5, mManager.getManifestShortcuts().size());
assertShortcutIds(assertAllEnabled(mManager.getDynamicShortcuts()),
@@ -8566,7 +8567,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_0);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
assertEquals(0, mManager.getManifestShortcuts().size());
assertShortcutIds(assertAllEnabled(mManager.getDynamicShortcuts()),
@@ -8584,9 +8585,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_1);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(mManager.getManifestShortcuts())
.haveIds("ms1")
.forAllShortcuts(si -> assertTrue(si.isReturnedByServer()));
@@ -8599,21 +8600,21 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
});
// Pin them.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1,
list("ms1", "s1"), getCallingUser());
- assertWith(getShortcutAsLauncher(USER_0))
+ assertWith(getShortcutAsLauncher(USER_10))
.haveIds("ms1", "s1")
.forAllShortcuts(si -> assertTrue(si.isReturnedByServer()));
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(mManager.getPinnedShortcuts())
.haveIds("ms1", "s1")
.forAllShortcuts(si -> assertTrue(si.isReturnedByServer()));
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// This shows a warning log, but should still work.
assertTrue(mManager.setDynamicShortcuts(mManager.getDynamicShortcuts()));
@@ -8624,9 +8625,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void IsForegroundDefaultLauncher_true() {
- final int uid = 1024;
+ // random uid in the USER_10 range.
+ final int uid = 1000024;
- setDefaultLauncher(UserHandle.USER_SYSTEM, "default");
+ setDefaultLauncher(USER_10, "default");
makeUidForeground(uid);
assertTrue(mInternal.isForegroundDefaultLauncher("default", uid));
@@ -8634,18 +8636,20 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
public void IsForegroundDefaultLauncher_defaultButNotForeground() {
- final int uid = 1024;
+ // random uid in the USER_10 range.
+ final int uid = 1000024;
- setDefaultLauncher(UserHandle.USER_SYSTEM, "default");
+ setDefaultLauncher(USER_10, "default");
makeUidBackground(uid);
assertFalse(mInternal.isForegroundDefaultLauncher("default", uid));
}
public void IsForegroundDefaultLauncher_foregroundButNotDefault() {
- final int uid = 1024;
+ // random uid in the USER_10 range.
+ final int uid = 1000024;
- setDefaultLauncher(UserHandle.USER_SYSTEM, "default");
+ setDefaultLauncher(USER_10, "default");
makeUidForeground(uid);
assertFalse(mInternal.isForegroundDefaultLauncher("another", uid));
@@ -8670,7 +8674,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_share_targets);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
List<ShareTargetInfo> shareTargets = getCallerShareTargets();
@@ -8775,9 +8779,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_share_targets);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final ShortcutInfo s1 = makeShortcutWithCategory("s1",
set("com.test.category.CATEGORY1", "com.test.category.CATEGORY2"));
@@ -8796,26 +8800,26 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
IntentFilter filter_any = new IntentFilter();
filter_any.addDataType("*/*");
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
mCallerPermissions.add(permission.MANAGE_APP_PREDICTIONS);
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_cat1));
- assertFalse(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ assertFalse(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_cat5));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_any));
- assertFalse(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_0,
+ assertFalse(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_10,
filter_cat1));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_10,
filter_cat5));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_10,
filter_any));
- assertFalse(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_0,
+ assertFalse(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_10,
filter_any));
- assertFalse(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s4", USER_0,
+ assertFalse(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s4", USER_10,
filter_any));
}
@@ -8826,7 +8830,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
R.xml.shortcut_share_targets);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
final ShortcutInfo s1 = makeShortcutWithCategory("s1",
set("com.test.category.CATEGORY1", "com.test.category.CATEGORY2"));
@@ -8837,7 +8841,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
s1.setLongLived();
s2.setLongLived();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(s1, s2, s3)));
assertShortcutIds(assertAllNotKeyFieldsOnly(mManager.getDynamicShortcuts()),
"s1", "s2", "s3");
@@ -8846,33 +8850,33 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
IntentFilter filter_any = new IntentFilter();
filter_any.addDataType("*/*");
- setCaller(LAUNCHER_1, USER_0);
+ setCaller(LAUNCHER_1, USER_10);
mCallerPermissions.add(permission.MANAGE_APP_PREDICTIONS);
// Assert all are sharing shortcuts
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_any));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_10,
filter_any));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_10,
filter_any));
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
// Remove one cached shortcut, and leave one cached-only and pinned-only shortcuts.
mManager.removeLongLivedShortcuts(list("s1"));
mManager.removeDynamicShortcuts(list("s2, s3"));
});
- assertFalse(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_0,
+ assertFalse(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s1", USER_10,
filter_any));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s2", USER_10,
filter_any));
- assertTrue(mInternal.isSharingShortcut(USER_0, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_0,
+ assertTrue(mInternal.isSharingShortcut(USER_10, LAUNCHER_1, CALLING_PACKAGE_1, "s3", USER_10,
filter_any));
}
@@ -8881,17 +8885,17 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
final ShortcutInfo s2 = makeShortcutExcludedFromLauncher("s2");
final ShortcutInfo s3 = makeShortcutExcludedFromLauncher("s3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(s1, s2, s3)));
assertEmpty(mManager.getDynamicShortcuts());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.addDynamicShortcuts(list(s1, s2, s3)));
assertEmpty(mManager.getDynamicShortcuts());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.pushDynamicShortcut(s1);
assertEmpty(mManager.getDynamicShortcuts());
});
@@ -8902,7 +8906,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
final ShortcutInfo s2 = makeShortcut("s2");
final ShortcutInfo s3 = makeShortcut("s3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(s1, s2, s3)));
assertThrown(IllegalArgumentException.class, () -> {
mManager.updateShortcuts(list(makeShortcutExcludedFromLauncher("s1")));
@@ -8911,7 +8915,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}
public void PinHiddenShortcuts_ThrowsException() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertThrown(IllegalArgumentException.class, () -> {
mManager.requestPinShortcut(makeShortcutExcludedFromLauncher("s1"), null);
});
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java
index 57ada9b9c499..748f0a5dc949 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest10.java
@@ -28,7 +28,6 @@ import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps.PinItemRequest;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
-import android.os.Process;
import android.platform.test.annotations.Presubmit;
import androidx.test.filters.SmallTest;
@@ -56,7 +55,7 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
}
public void testCreateShortcutResult_validResult() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcut("s1");
@@ -64,20 +63,20 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
mRequest = verifyAndGetCreateShortcutResult(intent);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertTrue(mRequest.isValid());
assertTrue(mRequest.accept());
});
}
public void testCreateShortcutResult_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
@@ -87,7 +86,7 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
mRequest = verifyAndGetCreateShortcutResult(intent);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertTrue(mRequest.isValid());
assertTrue(mRequest.getShortcutInfo().isPinned());
assertTrue(mRequest.accept());
@@ -100,18 +99,18 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
});
// Initially all launchers have the shortcut permission, until we call setDefaultLauncher().
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcut("s1");
Intent intent = mManager.createShortcutResultIntent(s1);
mRequest = verifyAndGetCreateShortcutResult(intent);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertTrue(mRequest.isValid());
assertFalse(mRequest.getShortcutInfo().isPinned());
assertTrue(mRequest.accept());
@@ -119,7 +118,7 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
}
public void testCreateShortcutResult_defaultLauncherChanges() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcut("s1");
@@ -127,15 +126,15 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
mRequest = verifyAndGetCreateShortcutResult(intent);
});
- setDefaultLauncher(USER_0, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_2);
// Verify that other launcher can't use this request
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
assertFalse(mRequest.isValid());
assertExpectException(SecurityException.class, "Calling uid mismatch",
mRequest::accept);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Set some random caller UID.
mInjectedCallingUid = 12345;
@@ -144,7 +143,7 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
mRequest::accept);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertTrue(mRequest.isValid());
assertTrue(mRequest.accept());
});
@@ -157,23 +156,23 @@ public class ShortcutManagerTest10 extends BaseShortcutManagerTest {
LauncherActivityInfo info = mock(LauncherActivityInfo.class);
when(info.getComponentName()).thenReturn(
new ComponentName(getTestContext(), "a.ShortcutConfigActivity"));
- when(info.getUser()).thenReturn(Process.myUserHandle());
+ when(info.getUser()).thenReturn(HANDLE_USER_10);
return info;
}
public void testStartConfigActivity_defaultLauncher() {
LauncherActivityInfo info = setupMockActivityInfo();
prepareIntentActivities(info.getComponentName());
- setDefaultLauncher(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () ->
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () ->
assertNotNull(mLauncherApps.getShortcutConfigActivityIntent(info))
);
}
public void testStartConfigActivity_nonDefaultLauncher() {
LauncherActivityInfo info = setupMockActivityInfo();
- setDefaultLauncher(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_2, USER_0, () ->
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_2, USER_10, () ->
assertExpectException(SecurityException.class, null, () ->
mLauncherApps.getShortcutConfigActivityIntent(info))
);
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java
index 98fa2d68fb73..676558ddcf6c 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest11.java
@@ -56,12 +56,12 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_setDynamicShortcuts() {
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
@@ -69,7 +69,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -78,17 +78,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_setDynamicShortcuts_replaceSameId() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s2", "s3")));
});
@@ -96,11 +96,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -112,25 +112,25 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_setDynamicShortcuts_pinnedAndCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(
list(makeShortcut("s1"), makeLongLivedShortcut("s2"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10);
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s3", "s4")));
});
@@ -138,7 +138,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(changedShortcuts.getValue())
@@ -147,22 +147,22 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_pinShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10);
});
mTestLooper.dispatchAll();
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -171,34 +171,34 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_pinShortcuts_unpinOthers() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2", "s3")));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s1", "s2"));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2", "s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2", "s3"), HANDLE_USER_10);
});
mTestLooper.dispatchAll();
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -210,19 +210,19 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_cacheShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeLongLivedShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_10,
CACHE_OWNER_1);
});
@@ -230,7 +230,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(2)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -239,23 +239,23 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_cacheShortcuts_alreadyCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeLongLivedShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_10,
CACHE_OWNER_0);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
// Should not cause any callback events
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_10,
CACHE_OWNER_0);
// Should cause a change event
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s3"), HANDLE_USER_10,
CACHE_OWNER_1);
});
@@ -263,7 +263,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -272,19 +272,19 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_uncacheShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeLongLivedShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2"), HANDLE_USER_10,
CACHE_OWNER_0);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
- mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
});
@@ -292,7 +292,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -301,41 +301,41 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_uncacheShortcuts_causeDeletion() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeLongLivedShortcut("s1"),
makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0);
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_0,
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10);
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10,
CACHE_OWNER_1);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s2", "s3"));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
- mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"), HANDLE_USER_0,
- CACHE_OWNER_0);
+ mLauncherApps.uncacheShortcuts(CALLING_PACKAGE_1, list("s1", "s2", "s3"),
+ HANDLE_USER_10, CACHE_OWNER_0);
});
mTestLooper.dispatchAll();
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
// s1 is still cached for owner1, s2 is pinned.
assertWith(changedShortcuts.getValue())
@@ -348,19 +348,19 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_updateShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeShortcutWithActivity("s2", new ComponentName(CALLING_PACKAGE_1, "test")))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
final ComponentName updatedCn = new ComponentName(CALLING_PACKAGE_1, "updated activity");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.updateShortcuts(list(makeShortcutWithActivity("s2", updatedCn))));
});
@@ -368,7 +368,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -378,17 +378,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_addDynamicShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.addDynamicShortcuts(makeShortcuts("s1", "s2")));
});
@@ -396,7 +396,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -406,12 +406,12 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_pushDynamicShortcut() {
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.pushDynamicShortcut(makeShortcut("s1"));
});
@@ -419,7 +419,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -431,17 +431,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts((makeShortcuts("s1", "s2", "s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.pushDynamicShortcut(makeShortcut("s2"));
});
@@ -449,7 +449,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -461,17 +461,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts((makeShortcuts("s1", "s2", "s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.pushDynamicShortcut(makeShortcut("s4"));
});
@@ -479,11 +479,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -498,7 +498,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
// Change the max number of shortcuts.
mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3");
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts((makeShortcuts("s1", "s2"))));
ShortcutInfo s3 = makeLongLivedShortcut("s3");
s3.setRank(3);
@@ -506,15 +506,15 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10,
CACHE_OWNER_0);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.pushDynamicShortcut(makeShortcut("s4"));
});
@@ -522,7 +522,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -532,17 +532,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_disableShortcuts() {
updatePackageVersion(CALLING_PACKAGE_1, 1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.disableShortcuts(list("s2"));
});
@@ -552,7 +552,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
assertWith(shortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -560,22 +560,22 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_disableShortcuts_pinnedAndCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(
list(makeShortcut("s1"), makeLongLivedShortcut("s2"), makeShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.disableShortcuts(list("s1", "s2", "s3"));
});
@@ -583,11 +583,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -599,29 +599,29 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_enableShortcuts() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(
list(makeShortcut("s1"), makeLongLivedShortcut("s2"), makeShortcut("s3"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.disableShortcuts(list("s1", "s2", "s3"));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.enableShortcuts(list("s1", "s2", "s3"));
});
@@ -629,7 +629,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
verify(callback, times(0)).onShortcutsRemoved(any(), any(), any());
assertWith(shortcuts.getValue())
@@ -639,17 +639,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_removeDynamicShortcuts() {
updatePackageVersion(CALLING_PACKAGE_1, 1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s2"));
});
@@ -659,7 +659,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
assertWith(shortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -667,22 +667,22 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_removeDynamicShortcuts_pinnedAndCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeLongLivedShortcut("s2"), makeShortcut("s3"), makeShortcut("s4"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeDynamicShortcuts(list("s1", "s2", "s3"));
});
@@ -690,11 +690,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -707,17 +707,17 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_removeAllDynamicShortcuts() {
updatePackageVersion(CALLING_PACKAGE_1, 1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(makeShortcuts("s1", "s2")));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
});
@@ -727,7 +727,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
assertWith(shortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -735,22 +735,22 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_removeAllDynamicShortcuts_pinnedAndCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(
list(makeShortcut("s1"), makeLongLivedShortcut("s2"), makeShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeAllDynamicShortcuts();
});
@@ -758,11 +758,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -775,18 +775,18 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
public void testShortcutChangeCallback_removeLongLivedShortcuts_notCached() {
updatePackageVersion(CALLING_PACKAGE_1, 1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeLongLivedShortcut("s2"), makeShortcut("s3"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeLongLivedShortcuts(list("s1", "s2"));
});
@@ -796,7 +796,7 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> shortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), shortcuts.capture(), eq(HANDLE_USER_10));
assertWith(shortcuts.getValue())
.areAllWithKeyFieldsOnly()
@@ -804,22 +804,22 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
}
public void testShortcutChangeCallback_removeLongLivedShortcuts_pinnedAndCached() {
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"),
makeLongLivedShortcut("s2"), makeShortcut("s3"), makeShortcut("s4"))));
});
ShortcutChangeCallback callback = mock(ShortcutChangeCallback.class);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_0,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_10,
CACHE_OWNER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_0);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s3"), HANDLE_USER_10);
mLauncherApps.registerShortcutChangeCallback(callback, QUERY_MATCH_ALL,
mTestLooper.getNewExecutor());
});
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.removeLongLivedShortcuts(list("s1", "s2", "s3"));
});
@@ -827,11 +827,11 @@ public class ShortcutManagerTest11 extends BaseShortcutManagerTest {
ArgumentCaptor<List> changedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsAddedOrUpdated(
- eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), changedShortcuts.capture(), eq(HANDLE_USER_10));
ArgumentCaptor<List> removedShortcuts = ArgumentCaptor.forClass(List.class);
verify(callback, times(1)).onShortcutsRemoved(
- eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_0));
+ eq(CALLING_PACKAGE_1), removedShortcuts.capture(), eq(HANDLE_USER_10));
assertWith(changedShortcuts.getValue())
.areAllWithKeyFieldsOnly()
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest12.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest12.java
index 78bcf0c692b8..10e8bf039627 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest12.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest12.java
@@ -50,21 +50,21 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
@Override
protected void tearDown() throws Exception {
if (mService.isAppSearchEnabled()) {
- setCaller(CALLING_PACKAGE_1, USER_0);
- mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_0)
+ setCaller(CALLING_PACKAGE_1, USER_10);
+ mService.getPackageShortcutForTest(CALLING_PACKAGE_1, USER_10)
.removeAllShortcutsAsync();
}
super.tearDown();
}
public void testGetShortcutIntents_ReturnsMutablePendingIntents() throws RemoteException {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () ->
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () ->
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))))
);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
final PendingIntent intent = mLauncherApps.getShortcutIntent(
CALLING_PACKAGE_1, "s1", null, UserHandle.SYSTEM);
assertNotNull(intent);
@@ -75,7 +75,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
// Verifies setDynamicShortcuts persists shortcuts into AppSearch
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
@@ -102,7 +102,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -126,7 +126,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -168,7 +168,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -194,7 +194,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -218,7 +218,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -243,7 +243,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcut("s1"),
makeShortcut("s2"),
@@ -266,7 +266,7 @@ public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
if (!mService.isAppSearchEnabled()) {
return;
}
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
mManager.setDynamicShortcuts(list(
makeShortcutExcludedFromLauncher("s1"),
makeShortcutExcludedFromLauncher("s2"),
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
index 1cfaf7c83584..9528467f7ad1 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
@@ -238,15 +238,15 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoParcel() {
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
ShortcutInfo si = parceled(new ShortcutInfo.Builder(mClientContext)
.setId("id")
.setTitle("title")
.setIntent(makeIntent("action", ShortcutActivity.class))
.build());
assertEquals(mClientContext.getPackageName(), si.getPackage());
- assertEquals(USER_10, si.getUserId());
- assertEquals(HANDLE_USER_10, si.getUserHandle());
+ assertEquals(USER_11, si.getUserId());
+ assertEquals(HANDLE_USER_11, si.getUserHandle());
assertEquals("id", si.getId());
assertEquals("title", si.getTitle());
assertEquals("action", si.getIntent().getAction());
@@ -325,7 +325,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoParcel_resId() {
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
ShortcutInfo si;
PersistableBundle pb = new PersistableBundle();
@@ -379,7 +379,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoClone() {
- setCaller(CALLING_PACKAGE_1, USER_11);
+ setCaller(CALLING_PACKAGE_1, USER_12);
PersistableBundle pb = new PersistableBundle();
pb.putInt("k", 1);
@@ -406,8 +406,8 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
ShortcutInfo si = sorig.clone(/* clone flags*/ 0);
- assertEquals(USER_11, si.getUserId());
- assertEquals(HANDLE_USER_11, si.getUserHandle());
+ assertEquals(USER_12, si.getUserId());
+ assertEquals(HANDLE_USER_12, si.getUserHandle());
assertEquals(mClientContext.getPackageName(), si.getPackage());
assertEquals("id", si.getId());
assertEquals(new ComponentName("a", "b"), si.getActivity());
@@ -527,7 +527,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoClone_resId() {
- setCaller(CALLING_PACKAGE_1, USER_11);
+ setCaller(CALLING_PACKAGE_1, USER_12);
PersistableBundle pb = new PersistableBundle();
pb.putInt("k", 1);
@@ -552,8 +552,8 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
ShortcutInfo si = sorig.clone(/* clone flags*/ 0);
- assertEquals(USER_11, si.getUserId());
- assertEquals(HANDLE_USER_11, si.getUserHandle());
+ assertEquals(USER_12, si.getUserId());
+ assertEquals(HANDLE_USER_12, si.getUserHandle());
assertEquals(mClientContext.getPackageName(), si.getPackage());
assertEquals("id", si.getId());
assertEquals(new ComponentName("a", "b"), si.getActivity());
@@ -953,9 +953,9 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoSaveAndLoad() throws InterruptedException {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
@@ -1010,16 +1010,16 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Save and load.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
- dumpUserFile(USER_10);
+ dumpUserFile(USER_11);
dumpsysOnLogcat("after load");
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_11);
- assertEquals(USER_10, si.getUserId());
- assertEquals(HANDLE_USER_10, si.getUserHandle());
+ assertEquals(USER_11, si.getUserId());
+ assertEquals(HANDLE_USER_11, si.getUserHandle());
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
assertEquals(ShortcutActivity2.class.getName(), si.getActivity().getClassName());
@@ -1056,19 +1056,19 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Make sure ranks are saved too. Because of the auto-adjusting, we need two shortcuts
// to test it.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_11);
assertEquals(1, si.getRank());
assertEquals(2, si.getPersons().length);
assertEquals("personUri2", si.getPersons()[1].getUri());
assertEquals("6.7.8.9", si.getLocusId().getId());
- dumpUserFile(USER_10);
+ dumpUserFile(USER_11);
}
public void testShortcutInfoSaveAndLoad_maskableBitmap() throws InterruptedException {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
final Icon bmp32x32 = Icon.createWithAdaptiveBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
@@ -1100,16 +1100,16 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Save and load.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
- dumpUserFile(USER_10);
+ dumpUserFile(USER_11);
dumpsysOnLogcat("after load");
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_11);
- assertEquals(USER_10, si.getUserId());
- assertEquals(HANDLE_USER_10, si.getUserHandle());
+ assertEquals(USER_11, si.getUserId());
+ assertEquals(HANDLE_USER_11, si.getUserHandle());
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
assertEquals(ShortcutActivity2.class.getName(), si.getActivity().getClassName());
@@ -1131,13 +1131,13 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertNull(si.getIconUri());
assertTrue(si.getLastChangedTimestamp() < now);
- dumpUserFile(USER_10);
+ dumpUserFile(USER_11);
}
public void testShortcutInfoSaveAndLoad_resId() throws InterruptedException {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
final Icon res32x32 = Icon.createWithResource(mClientContext, R.drawable.black_32x32);
@@ -1175,13 +1175,13 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Save and load.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_11);
- assertEquals(USER_10, si.getUserId());
- assertEquals(HANDLE_USER_10, si.getUserHandle());
+ assertEquals(USER_11, si.getUserId());
+ assertEquals(HANDLE_USER_11, si.getUserHandle());
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
assertEquals(ShortcutActivity2.class.getName(), si.getActivity().getClassName());
@@ -1207,14 +1207,14 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Make sure ranks are saved too. Because of the auto-adjusting, we need two shortcuts
// to test it.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_11);
assertEquals(1, si.getRank());
}
public void testShortcutInfoSaveAndLoad_uri() throws InterruptedException {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- setCaller(CALLING_PACKAGE_1, USER_10);
+ setCaller(CALLING_PACKAGE_1, USER_11);
final Icon uriIcon = Icon.createWithContentUri("test_uri");
@@ -1255,13 +1255,13 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Save and load.
mService.saveDirtyInfo();
initService();
- mService.handleUnlockUser(USER_10);
+ mService.handleUnlockUser(USER_11);
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_11);
- assertEquals(USER_10, si.getUserId());
- assertEquals(HANDLE_USER_10, si.getUserHandle());
+ assertEquals(USER_11, si.getUserId());
+ assertEquals(HANDLE_USER_11, si.getUserHandle());
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
assertEquals(ShortcutActivity2.class.getName(), si.getActivity().getClassName());
@@ -1288,7 +1288,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Make sure ranks are saved too. Because of the auto-adjusting, we need two shortcuts
// to test it.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_11);
assertEquals(1, si.getRank());
assertEquals(ShortcutInfo.FLAG_DYNAMIC | ShortcutInfo.FLAG_HAS_ICON_URI
| ShortcutInfo.FLAG_STRINGS_RESOLVED | ShortcutInfo.FLAG_ADAPTIVE_BITMAP,
@@ -1300,7 +1300,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
}
public void testShortcutInfoSaveAndLoad_forBackup() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_32x32));
@@ -1332,16 +1332,16 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mManager.addDynamicShortcuts(list(sorig, sorig2));
// Dynamic shortcuts won't be backed up, so we need to pin it.
- setCaller(LAUNCHER_1, USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_0);
+ setCaller(LAUNCHER_1, USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_10);
// Do backup & restore.
backupAndRestore();
- mService.handleUnlockUser(USER_0); // Load user-0.
+ mService.handleUnlockUser(USER_10); // Load user-0.
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
@@ -1364,12 +1364,12 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertNull(si.getIconUri());
// Note when restored from backup, it's no longer dynamic, so shouldn't have a rank.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
assertEquals(0, si.getRank());
}
public void testShortcutInfoSaveAndLoad_forBackup_resId() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final Icon res32x32 = Icon.createWithResource(mClientContext, R.drawable.black_32x32);
@@ -1399,16 +1399,16 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mManager.addDynamicShortcuts(list(sorig, sorig2));
// Dynamic shortcuts won't be backed up, so we need to pin it.
- setCaller(LAUNCHER_1, USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_0);
+ setCaller(LAUNCHER_1, USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_10);
// Do backup & restore.
backupAndRestore();
- mService.handleUnlockUser(USER_0); // Load user-0.
+ mService.handleUnlockUser(USER_10); // Load user-0.
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
@@ -1434,12 +1434,12 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertNull(si.getIconUri());
// Note when restored from backup, it's no longer dynamic, so shouldn't have a rank.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
assertEquals(0, si.getRank());
}
public void testShortcutInfoSaveAndLoad_forBackup_uri() {
- setCaller(CALLING_PACKAGE_1, USER_0);
+ setCaller(CALLING_PACKAGE_1, USER_10);
final Icon uriIcon = Icon.createWithContentUri("test_uri");
@@ -1469,16 +1469,16 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mManager.addDynamicShortcuts(list(sorig, sorig2));
// Dynamic shortcuts won't be backed up, so we need to pin it.
- setCaller(LAUNCHER_1, USER_0);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_0);
+ setCaller(LAUNCHER_1, USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("id", "id2"), HANDLE_USER_10);
// Do backup & restore.
backupAndRestore();
- mService.handleUnlockUser(USER_0); // Load user-0.
+ mService.handleUnlockUser(USER_10); // Load user-0.
ShortcutInfo si;
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id", USER_10);
assertEquals(CALLING_PACKAGE_1, si.getPackage());
assertEquals("id", si.getId());
@@ -1504,7 +1504,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertNull(si.getIconUri());
// Note when restored from backup, it's no longer dynamic, so shouldn't have a rank.
- si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_0);
+ si = mService.getPackageShortcutForTest(CALLING_PACKAGE_1, "id2", USER_10);
assertEquals(0, si.getRank());
}
@@ -1512,7 +1512,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIntent("s1", intent))));
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
assertWith(getCallerShortcuts())
.haveIds("s1")
@@ -1528,7 +1528,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIntents("s1", intents))));
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
assertWith(getCallerShortcuts())
.haveIds("s1")
@@ -1804,35 +1804,35 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// but it will work for other users too because we check the locale change at any
// API entry point.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
// Make sure even if we receive ACTION_LOCALE_CHANGED, if the locale hasn't actually
// changed, we don't reset throttling.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
mManager.updateShortcuts(list());
assertEquals(2, mManager.getRemainingCallCount());
});
mService.mReceiver.onReceive(mServiceContext, new Intent(Intent.ACTION_LOCALE_CHANGED));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(2, mManager.getRemainingCallCount()); // Still 2.
});
@@ -1842,7 +1842,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// The locale should be persisted, so it still shouldn't reset throttling.
mService.mReceiver.onReceive(mServiceContext, new Intent(Intent.ACTION_LOCALE_CHANGED));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(2, mManager.getRemainingCallCount()); // Still 2.
});
}
@@ -1861,22 +1861,22 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// First, all packages have less than 3 (== initial value) remaining calls.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
@@ -1886,22 +1886,22 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mService.mUidObserver.onUidStateChanged(
CALLING_UID_1, ActivityManager.PROCESS_STATE_TOP_SLEEPING, 0,
ActivityManager.PROCESS_CAPABILITY_NONE);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
@@ -1911,22 +1911,22 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mService.mUidObserver.onUidStateChanged(
CALLING_UID_1, ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE, 0,
ActivityManager.PROCESS_CAPABILITY_NONE);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
mService.mUidObserver.onUidStateChanged(
@@ -1944,22 +1944,22 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
CALLING_UID_2, ActivityManager.PROCESS_STATE_TOP_SLEEPING, 0,
ActivityManager.PROCESS_CAPABILITY_NONE);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
@@ -1967,7 +1967,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Do the same thing one more time. This would catch the bug with mixuing up
// the current time and the elapsed time.
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
mManager.updateShortcuts(list(makeShortcut("s")));
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
@@ -1979,22 +1979,22 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
CALLING_UID_2, ActivityManager.PROCESS_STATE_TOP_SLEEPING, 0,
ActivityManager.PROCESS_CAPABILITY_NONE);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
@@ -2003,10 +2003,10 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// Package 1 on user-10 comes to foreground.
// Now, also try calling some APIs and make sure foreground apps don't get throttled.
mService.mUidObserver.onUidStateChanged(
- UserHandle.getUid(USER_10, CALLING_UID_1),
+ UserHandle.getUid(USER_11, CALLING_UID_1),
ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE, 0,
ActivityManager.PROCESS_CAPABILITY_NONE);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
assertFalse(mManager.isRateLimitingActive());
@@ -2025,7 +2025,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertEquals(0, mManager.getRemainingCallCount());
assertTrue(mManager.isRateLimitingActive());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
mManager.setDynamicShortcuts(list(makeShortcut("s")));
@@ -2035,7 +2035,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertEquals(0, mManager.getRemainingCallCount());
assertTrue(mManager.isRateLimitingActive());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
mManager.setDynamicShortcuts(list(makeShortcut("s")));
@@ -2045,7 +2045,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertEquals(0, mManager.getRemainingCallCount());
assertTrue(mManager.isRateLimitingActive());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
mManager.setDynamicShortcuts(list(makeShortcut("s")));
@@ -2065,7 +2065,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
assertEquals(0, mManager.getRemainingCallCount());
assertTrue(mManager.isRateLimitingActive());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEquals(3, mManager.getRemainingCallCount());
mManager.setDynamicShortcuts(list(makeShortcut("s")));
@@ -2088,95 +2088,95 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
// First, all packages have less than 3 (== initial value) remaining calls.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
// Simulate a call from sys UI.
mCallerPermissions.add(permission.RESET_SHORTCUT_MANAGER_THROTTLING);
- mManager.onApplicationActive(CALLING_PACKAGE_1, USER_0);
+ mManager.onApplicationActive(CALLING_PACKAGE_1, USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- mManager.onApplicationActive(CALLING_PACKAGE_3, USER_0);
+ mManager.onApplicationActive(CALLING_PACKAGE_3, USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- mManager.onApplicationActive(CALLING_PACKAGE_1, USER_10);
+ mManager.onApplicationActive(CALLING_PACKAGE_1, USER_11);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_3, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_3, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_4, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_4, USER_10, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
MoreAsserts.assertNotEqual(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
}
public void testReportShortcutUsed() {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
reset(mMockUsageStatsManagerInternal);
// Report with an nonexistent shortcut.
@@ -2192,9 +2192,9 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mManager.reportShortcutUsed("s2");
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_1), eq("s2"), eq(USER_10));
+ eq(CALLING_PACKAGE_1), eq("s2"), eq(USER_11));
});
- runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_11, () -> {
// Try with a different package.
reset(mMockUsageStatsManagerInternal);
@@ -2211,7 +2211,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mManager.reportShortcutUsed("s3");
verify(mMockUsageStatsManagerInternal, times(1)).reportShortcutUsage(
- eq(CALLING_PACKAGE_2), eq("s3"), eq(USER_10));
+ eq(CALLING_PACKAGE_2), eq("s3"), eq(USER_11));
});
}
@@ -2333,7 +2333,7 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
final Icon bmp64x64 = Icon.createWithBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_64x64));
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithIcon("res32x32", res32x32),
makeShortcutWithIcon("res64x64", res64x64),
@@ -2342,9 +2342,9 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
});
// We can't predict the compressed bitmap sizes, so get the real sizes here.
- final long bitmapTotal =
- new File(getBitmapAbsPath(USER_0, CALLING_PACKAGE_2, "bmp32x32")).length() +
- new File(getBitmapAbsPath(USER_0, CALLING_PACKAGE_2, "bmp64x64")).length();
+ final long bitmapTotal = new File(getBitmapAbsPath(
+ USER_10, CALLING_PACKAGE_2, "bmp32x32")).length() + new File(
+ getBitmapAbsPath(USER_10, CALLING_PACKAGE_2, "bmp64x64")).length();
// Read the expected output and inject the bitmap size.
final String expected = readTestAsset("shortcut/dumpsys_expected.txt")
@@ -2358,15 +2358,15 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
* can still be read.
*/
public void testLoadLegacySavedFile() throws Exception {
- final File path = mService.getUserFile(USER_0).getBaseFile();
+ final File path = mService.getUserFile(USER_10).getBaseFile();
path.getParentFile().mkdirs();
try (Writer w = new FileWriter(path)) {
w.write(readTestAsset("shortcut/shortcut_legacy_file.xml"));
};
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("manifest-shortcut-storage")
.forShortcutWithId("manifest-shortcut-storage", si -> {
@@ -2381,58 +2381,58 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
mRunningUsers.clear();
mUnlockedUsers.clear();
- assertFalse(mService.isUserUnlockedL(USER_0));
assertFalse(mService.isUserUnlockedL(USER_10));
+ assertFalse(mService.isUserUnlockedL(USER_11));
// Start user 0, still locked.
- mRunningUsers.put(USER_0, true);
- assertFalse(mService.isUserUnlockedL(USER_0));
+ mRunningUsers.put(USER_10, true);
assertFalse(mService.isUserUnlockedL(USER_10));
+ assertFalse(mService.isUserUnlockedL(USER_11));
// Unlock user.
- mUnlockedUsers.put(USER_0, true);
- assertTrue(mService.isUserUnlockedL(USER_0));
- assertFalse(mService.isUserUnlockedL(USER_10));
+ mUnlockedUsers.put(USER_10, true);
+ assertTrue(mService.isUserUnlockedL(USER_10));
+ assertFalse(mService.isUserUnlockedL(USER_11));
// Clear again.
mRunningUsers.clear();
mUnlockedUsers.clear();
// Directly call the lifecycle event. Now also locked.
- mService.handleUnlockUser(USER_0);
- assertTrue(mService.isUserUnlockedL(USER_0));
- assertFalse(mService.isUserUnlockedL(USER_10));
+ mService.handleUnlockUser(USER_10);
+ assertTrue(mService.isUserUnlockedL(USER_10));
+ assertFalse(mService.isUserUnlockedL(USER_11));
// Directly call the stop lifecycle event. Goes back to the initial state.
- mService.handleStopUser(USER_0);
- assertFalse(mService.isUserUnlockedL(USER_0));
+ mService.handleStopUser(USER_10);
assertFalse(mService.isUserUnlockedL(USER_10));
+ assertFalse(mService.isUserUnlockedL(USER_11));
}
public void testEphemeralApp() {
- mRunningUsers.put(USER_10, true); // this test needs user 10.
+ mRunningUsers.put(USER_11, true); // this test needs user 10.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(mManager.getDynamicShortcuts()).isEmpty();
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(mManager.getDynamicShortcuts()).isEmpty();
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(mManager.getDynamicShortcuts()).isEmpty();
});
// Make package 1 ephemeral.
- mEphemeralPackages.add(UserPackage.of(USER_0, CALLING_PACKAGE_1));
+ mEphemeralPackages.add(UserPackage.of(USER_10, CALLING_PACKAGE_1));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertExpectException(IllegalStateException.class, "Ephemeral apps", () -> {
mManager.getDynamicShortcuts();
});
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(mManager.getDynamicShortcuts()).isEmpty();
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertWith(mManager.getDynamicShortcuts()).isEmpty();
});
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java
index 43e527c3d706..aad06c6d6c0e 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest3.java
@@ -70,14 +70,14 @@ public class ShortcutManagerTest3 extends BaseShortcutManagerTest {
+ ConfigConstants.KEY_MAX_SHORTCUTS + "=99999999"
);
- setCaller(CALLING_PACKAGE, USER_0);
+ setCaller(CALLING_PACKAGE, USER_10);
}
private void publishManifestShortcuts(ComponentName activity, int resId) {
addManifestShortcutResource(activity, resId);
updatePackageVersion(CALLING_PACKAGE, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE, USER_10));
}
public void testSetDynamicShortcuts_noManifestShortcuts() {
@@ -299,8 +299,8 @@ public class ShortcutManagerTest3 extends BaseShortcutManagerTest {
.isEmpty();
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE, list("s2", "s4", "x2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE, list("s2", "s4", "x2"), HANDLE_USER_10);
});
// Still same order.
assertWith(getCallerShortcuts()).selectDynamic().selectByActivity(A1)
@@ -408,9 +408,9 @@ public class ShortcutManagerTest3 extends BaseShortcutManagerTest {
assertWith(getCallerShortcuts()).selectDynamic().selectByChangedSince(lastApiTime)
.isEmpty();
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(
- CALLING_PACKAGE, list("s2", "s4", "x1", "x2"), HANDLE_USER_0);
+ CALLING_PACKAGE, list("s2", "s4", "x1", "x2"), HANDLE_USER_10);
});
// Still same order.
@@ -483,8 +483,8 @@ public class ShortcutManagerTest3 extends BaseShortcutManagerTest {
assertWith(getCallerShortcuts()).selectDynamic().selectByChangedSince(lastApiTime)
.haveIds("s2", "s4");
- runWithCaller(LAUNCHER_1, USER_0, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE, list("s2", "s4", "x2"), HANDLE_USER_0);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE, list("s2", "s4", "x2"), HANDLE_USER_10);
});
// Still same order.
assertWith(getCallerShortcuts()).selectDynamic().selectByActivity(A1)
@@ -518,7 +518,7 @@ public class ShortcutManagerTest3 extends BaseShortcutManagerTest {
R.xml.shortcut_share_targets);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_0));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
// There are two valid <share-target> definitions in the test manifest with two different
// categories: {"com.test.category.CATEGORY1", "com.test.category.CATEGORY2"} and
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java
index 11a2a8a39a46..42c1767023f1 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest4.java
@@ -116,7 +116,7 @@ public class ShortcutManagerTest4 extends BaseShortcutManagerTest {
final Intent intent = new Intent(Intent.ACTION_MAIN)
.putExtras(sIntentExtras);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.setDynamicShortcuts(list(
makeShortcutWithExtras("s1", intent, sShortcutExtras),
makeShortcut("s{\u0000}{\u0001}{\uD800\uDC00}x[\uD801][\uDC01]")
@@ -125,9 +125,9 @@ public class ShortcutManagerTest4 extends BaseShortcutManagerTest {
// Make sure save & load works fine. (i.e. shouldn't crash even with invalid characters.)
initService();
- mService.handleUnlockUser(USER_0);
+ mService.handleUnlockUser(USER_10);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertWith(getCallerShortcuts())
.haveIds("s1", "s{\u0000}{\u0001}{\uD800\uDC00}x[?][?]")
.forShortcutWithId("s1", si -> {
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java
index 6c10bfd274da..7f7a4ae13245 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest6.java
@@ -28,59 +28,59 @@ import androidx.test.filters.SmallTest;
public class ShortcutManagerTest6 extends BaseShortcutManagerTest {
public void testHasShortcutHostPermissionInner_with3pLauncher_complicated() {
// Set the default launcher.
- prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_0);
- assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_0));
- assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_0));
- assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_0));
- assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_0));
+ prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_10);
+ assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_10));
+ assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_10));
// Last known launcher should be set.
assertEquals(CALLING_PACKAGE_2,
- mService.getUserShortcutsLocked(USER_0).getCachedLauncher());
+ mService.getUserShortcutsLocked(USER_10).getCachedLauncher());
// Now the default launcher has changed.
- prepareGetRoleHoldersAsUser(CALLING_PACKAGE_1, USER_0);
+ prepareGetRoleHoldersAsUser(CALLING_PACKAGE_1, USER_10);
- assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_0));
+ assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_10));
// Last known launcher should be set.
assertEquals(CALLING_PACKAGE_1,
- mService.getUserShortcutsLocked(USER_0).getCachedLauncher());
+ mService.getUserShortcutsLocked(USER_10).getCachedLauncher());
// Change the default launcher again.
prepareGetRoleHoldersAsUser(
- getSystemLauncher().activityInfo.getComponentName().getPackageName(), USER_0);
+ getSystemLauncher().activityInfo.getComponentName().getPackageName(), USER_10);
- assertTrue(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_0));
- assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_0));
+ assertTrue(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_10));
// Last known launcher should be set to default.
assertEquals(PACKAGE_SYSTEM_LAUNCHER,
- mService.getUserShortcutsLocked(USER_0).getCachedLauncher());
+ mService.getUserShortcutsLocked(USER_10).getCachedLauncher());
}
public void testHasShortcutHostPermissionInner_multiUser() {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- prepareGetRoleHoldersAsUser(PACKAGE_FALLBACK_LAUNCHER, USER_0);
- prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_10);
+ prepareGetRoleHoldersAsUser(PACKAGE_FALLBACK_LAUNCHER, USER_10);
+ prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_11);
- assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_0));
- assertTrue(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_0));
- assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_0));
- assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_0));
+ assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_10));
+ assertTrue(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_10));
// Last known launcher should be set.
assertEquals(PACKAGE_FALLBACK_LAUNCHER,
- mService.getUserShortcutsLocked(USER_0).getCachedLauncher());
+ mService.getUserShortcutsLocked(USER_10).getCachedLauncher());
- assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_10));
- assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_10));
- assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_10));
- assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_10));
+ assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_SYSTEM_LAUNCHER, USER_11));
+ assertFalse(mService.hasShortcutHostPermissionInner(PACKAGE_FALLBACK_LAUNCHER, USER_11));
+ assertFalse(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_1, USER_11));
+ assertTrue(mService.hasShortcutHostPermissionInner(CALLING_PACKAGE_2, USER_11));
// Last known launcher should be set.
assertEquals(CALLING_PACKAGE_2,
- mService.getUserShortcutsLocked(USER_10).getCachedLauncher());
+ mService.getUserShortcutsLocked(USER_11).getCachedLauncher());
}
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java
index 161b18c80e77..86bde837bfe1 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest7.java
@@ -131,20 +131,20 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
public void testResetThrottling() throws Exception {
prepareCrossProfileDataSet();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
mInjectedCallingUid = Process.SHELL_UID;
- assertSuccess(callShellCommand("reset-throttling"));
+ assertSuccess(callShellCommand("reset-throttling", "--user", "10"));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
}
@@ -152,27 +152,27 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
public void testResetThrottling_user_not_running() throws Exception {
prepareCrossProfileDataSet();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
mInjectedCallingUid = Process.SHELL_UID;
- mRunningUsers.put(USER_10, false);
+ mRunningUsers.put(USER_11, false);
assertTrue(resultContains(
- callShellCommand("reset-throttling", "--user", "10"),
- "User (with userId=10) is not running or locked"));
+ callShellCommand("reset-throttling", "--user", "11"),
+ "User (with userId=11) is not running or locked"));
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
}
@@ -180,23 +180,23 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
public void testResetThrottling_user_running() throws Exception {
prepareCrossProfileDataSet();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
mInjectedCallingUid = Process.SHELL_UID;
- assertSuccess(callShellCommand("reset-throttling", "--user", "10"));
+ assertSuccess(callShellCommand("reset-throttling", "--user", "11"));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
}
@@ -204,81 +204,81 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
public void testResetAllThrottling() throws Exception {
prepareCrossProfileDataSet();
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.getRemainingCallCount() < 3);
});
mInjectedCallingUid = Process.SHELL_UID;
assertSuccess(callShellCommand("reset-all-throttling"));
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertEquals(3, mManager.getRemainingCallCount());
});
}
// This command is deprecated. Will remove the test later.
public void testLauncherCommands() throws Exception {
- prepareGetRoleHoldersAsUser(getSystemLauncher().activityInfo.packageName, USER_0);
+ prepareGetRoleHoldersAsUser(getSystemLauncher().activityInfo.packageName, USER_10);
prepareGetHomeActivitiesAsUser(
/* preferred */ getSystemLauncher().activityInfo.getComponentName(),
list(getSystemLauncher(), getFallbackLauncher()),
- USER_0);
+ USER_10);
- prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_10);
+ prepareGetRoleHoldersAsUser(CALLING_PACKAGE_2, USER_11);
prepareGetHomeActivitiesAsUser(
/* preferred */ cn(CALLING_PACKAGE_2, "name"),
list(getSystemLauncher(), getFallbackLauncher(),
ri(CALLING_PACKAGE_1, "name", false, 0),
ri(CALLING_PACKAGE_2, "name", false, 0)
),
- USER_10);
+ USER_11);
// First, test "get".
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
mInjectedCallingUid = Process.SHELL_UID;
assertContains(
- assertSuccess(callShellCommand("get-default-launcher")),
+ assertSuccess(callShellCommand("get-default-launcher", "--user", "10")),
"Launcher: ComponentInfo{com.android.systemlauncher/systemlauncher_name}");
assertContains(
- assertSuccess(callShellCommand("get-default-launcher", "--user", "10")),
+ assertSuccess(callShellCommand("get-default-launcher", "--user", "11")),
"Launcher: ComponentInfo{com.android.test.2/name}");
// Change user-0's launcher.
- prepareGetRoleHoldersAsUser(CALLING_PACKAGE_1, USER_0);
+ prepareGetRoleHoldersAsUser(CALLING_PACKAGE_1, USER_10);
prepareGetHomeActivitiesAsUser(
/* preferred */ cn(CALLING_PACKAGE_1, "name"),
list(ri(CALLING_PACKAGE_1, "name", false, 0)),
- USER_0);
+ USER_10);
assertContains(
- assertSuccess(callShellCommand("get-default-launcher")),
+ assertSuccess(callShellCommand("get-default-launcher", "--user", "10")),
"Launcher: ComponentInfo{com.android.test.1/name}");
}
public void testUnloadUser() throws Exception {
prepareCrossProfileDataSet();
- assertNotNull(mService.getShortcutsForTest().get(USER_10));
+ assertNotNull(mService.getShortcutsForTest().get(USER_11));
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
mInjectedCallingUid = Process.SHELL_UID;
- assertSuccess(callShellCommand("unload-user", "--user", "10"));
+ assertSuccess(callShellCommand("unload-user", "--user", "11"));
- assertNull(mService.getShortcutsForTest().get(USER_10));
+ assertNull(mService.getShortcutsForTest().get(USER_11));
}
public void testClearShortcuts() throws Exception {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
// Add two manifests and two dynamics.
addManifestShortcutResource(
@@ -286,17 +286,17 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.addDynamicShortcuts(list(
makeShortcut("s1"), makeShortcut("s2"))));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_10);
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_11);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "s1", "s2")
.areAllEnabled()
@@ -307,14 +307,14 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
// First, call for a different package.
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
mInjectedCallingUid = Process.SHELL_UID;
- assertSuccess(callShellCommand("clear-shortcuts", "--user", "10", CALLING_PACKAGE_2));
+ assertSuccess(callShellCommand("clear-shortcuts", "--user", "11", CALLING_PACKAGE_2));
// Shouldn't be cleared yet.
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "s1", "s2")
.areAllEnabled()
@@ -324,10 +324,10 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
});
mInjectedCallingUid = Process.SHELL_UID;
- assertSuccess(callShellCommand("clear-shortcuts", "--user", "10", CALLING_PACKAGE_1));
+ assertSuccess(callShellCommand("clear-shortcuts", "--user", "11", CALLING_PACKAGE_1));
// Only manifest shortcuts will remain, and are no longer pinned.
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2")
.areAllEnabled()
@@ -337,7 +337,7 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
public void testGetShortcuts() throws Exception {
- mRunningUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
// Add two manifests and two dynamics.
addManifestShortcutResource(
@@ -345,20 +345,20 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
R.xml.shortcut_2);
updatePackageVersion(CALLING_PACKAGE_1, 1);
mService.mPackageMonitor.onReceive(getTestContext(),
- genPackageAddIntent(CALLING_PACKAGE_1, USER_10));
+ genPackageAddIntent(CALLING_PACKAGE_1, USER_11));
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.addDynamicShortcuts(list(
makeLongLivedShortcut("s1"), makeShortcut("s2"))));
});
- runWithCaller(LAUNCHER_1, USER_10, () -> {
+ runWithCaller(LAUNCHER_1, USER_11, () -> {
mInjectCheckAccessShortcutsPermission = true;
- mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_10,
+ mLauncherApps.cacheShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_11,
CACHE_OWNER);
- mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_10);
+ mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms2", "s2"), HANDLE_USER_11);
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertWith(getCallerShortcuts())
.haveIds("ms1", "ms2", "s1", "s2")
.areAllEnabled()
@@ -368,33 +368,33 @@ public class ShortcutManagerTest7 extends BaseShortcutManagerTest {
});
- mRunningUsers.put(USER_10, true);
- mUnlockedUsers.put(USER_10, true);
+ mRunningUsers.put(USER_11, true);
+ mUnlockedUsers.put(USER_11, true);
mInjectedCallingUid = Process.SHELL_UID;
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_CACHED), CALLING_PACKAGE_1),
"s1");
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_DYNAMIC), CALLING_PACKAGE_1),
"s1", "s2");
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_MANIFEST), CALLING_PACKAGE_1),
"ms1", "ms2");
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_PINNED), CALLING_PACKAGE_1),
"ms2", "s2");
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_DYNAMIC
| ShortcutManager.FLAG_MATCH_PINNED), CALLING_PACKAGE_1),
"ms2", "s1", "s2");
- assertHaveIds(callShellCommand("get-shortcuts", "--user", "10", "--flags",
+ assertHaveIds(callShellCommand("get-shortcuts", "--user", "11", "--flags",
Integer.toString(ShortcutManager.FLAG_MATCH_MANIFEST
| ShortcutManager.FLAG_MATCH_CACHED), CALLING_PACKAGE_1),
"ms1", "ms2", "s1");
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java
index a85c7227b954..9b02a3abf14b 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest8.java
@@ -85,32 +85,32 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testGetParentOrSelfUserId() {
- assertEquals(USER_0, mService.getParentOrSelfUserId(USER_0));
assertEquals(USER_10, mService.getParentOrSelfUserId(USER_10));
assertEquals(USER_11, mService.getParentOrSelfUserId(USER_11));
- assertEquals(USER_0, mService.getParentOrSelfUserId(USER_P0));
+ assertEquals(USER_12, mService.getParentOrSelfUserId(USER_12));
+ assertEquals(USER_10, mService.getParentOrSelfUserId(USER_P0));
}
public void testIsRequestPinShortcutSupported() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
- setDefaultLauncher(USER_10, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ setDefaultLauncher(USER_11, LAUNCHER_2);
Pair<ComponentName, Integer> actual;
// User 0
- actual = mProcessor.getRequestPinConfirmationActivity(USER_0,
+ actual = mProcessor.getRequestPinConfirmationActivity(USER_10,
PinItemRequest.REQUEST_TYPE_SHORTCUT);
assertEquals(LAUNCHER_1, actual.first.getPackageName());
assertEquals(PIN_CONFIRM_ACTIVITY_CLASS, actual.first.getClassName());
- assertEquals(USER_0, (int) actual.second);
+ assertEquals(USER_10, (int) actual.second);
// User 10
- actual = mProcessor.getRequestPinConfirmationActivity(USER_10,
+ actual = mProcessor.getRequestPinConfirmationActivity(USER_11,
PinItemRequest.REQUEST_TYPE_SHORTCUT);
assertEquals(LAUNCHER_2, actual.first.getPackageName());
assertEquals(PIN_CONFIRM_ACTIVITY_CLASS, actual.first.getClassName());
- assertEquals(USER_10, (int) actual.second);
+ assertEquals(USER_11, (int) actual.second);
// User P0 -> managed profile, return user-0's launcher.
actual = mProcessor.getRequestPinConfirmationActivity(USER_P0,
@@ -118,16 +118,16 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
assertEquals(LAUNCHER_1, actual.first.getPackageName());
assertEquals(PIN_CONFIRM_ACTIVITY_CLASS, actual.first.getClassName());
- assertEquals(USER_0, (int) actual.second);
+ assertEquals(USER_10, (int) actual.second);
// Check from the public API.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertTrue(mManager.isRequestPinShortcutSupported());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertTrue(mManager.isRequestPinShortcutSupported());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.isRequestPinShortcutSupported());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
@@ -140,27 +140,27 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
? null : new ComponentName(packageName, PIN_CONFIRM_ACTIVITY_CLASS);
// User 10 -- still has confirm activity.
- actual = mProcessor.getRequestPinConfirmationActivity(USER_10,
+ actual = mProcessor.getRequestPinConfirmationActivity(USER_11,
PinItemRequest.REQUEST_TYPE_SHORTCUT);
assertEquals(LAUNCHER_2, actual.first.getPackageName());
assertEquals(PIN_CONFIRM_ACTIVITY_CLASS, actual.first.getClassName());
- assertEquals(USER_10, (int) actual.second);
+ assertEquals(USER_11, (int) actual.second);
// But user-0 and user p0 no longer has a confirmation activity.
- assertNull(mProcessor.getRequestPinConfirmationActivity(USER_0,
+ assertNull(mProcessor.getRequestPinConfirmationActivity(USER_10,
PinItemRequest.REQUEST_TYPE_SHORTCUT));
assertNull(mProcessor.getRequestPinConfirmationActivity(USER_P0,
PinItemRequest.REQUEST_TYPE_SHORTCUT));
// Check from the public API.
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
assertFalse(mManager.isRequestPinShortcutSupported());
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
assertFalse(mManager.isRequestPinShortcutSupported());
});
- runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_11, () -> {
assertTrue(mManager.isRequestPinShortcutSupported());
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
@@ -170,13 +170,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
public void testRequestPinShortcut_notSupported() {
// User-0's launcher has no confirmation activity.
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
mPinConfirmActivityFetcher = (packageName, userId) ->
!LAUNCHER_2.equals(packageName)
? null : new ComponentName(packageName, PIN_CONFIRM_ACTIVITY_CLASS);
- runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_1, USER_10, () -> {
ShortcutInfo s1 = makeShortcut("s1");
assertFalse(mManager.requestPinShortcut(s1,
@@ -188,7 +188,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.sendIntentSender(any(IntentSender.class));
});
- runWithCaller(CALLING_PACKAGE_2, USER_0, () -> {
+ runWithCaller(CALLING_PACKAGE_2, USER_10, () -> {
ShortcutInfo s1 = makeShortcut("s1");
assertFalse(mManager.requestPinShortcut(s1,
@@ -223,7 +223,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testNotForeground() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
makeCallerBackground();
@@ -252,8 +252,8 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* - Shortcut doesn't pre-exist.
*/
private void checkRequestPinShortcut(@Nullable IntentSender resultIntent) {
- setDefaultLauncher(USER_0, LAUNCHER_1);
- setDefaultLauncher(USER_10, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ setDefaultLauncher(USER_11, LAUNCHER_2);
final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32);
@@ -276,11 +276,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -337,8 +337,8 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_explicitTargetActivity() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
- setDefaultLauncher(USER_10, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ setDefaultLauncher(USER_11, LAUNCHER_2);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcutWithActivity("s1",
@@ -353,11 +353,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -393,7 +393,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_wrongTargetActivity() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
// Create dynamic shortcut
@@ -411,8 +411,8 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_noTargetActivity_noMainActivity() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
- setDefaultLauncher(USER_10, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ setDefaultLauncher(USER_11, LAUNCHER_2);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
/// Create a shortcut with no target activity.
@@ -435,11 +435,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -476,7 +476,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_dynamicExists() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32);
@@ -497,11 +497,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllNotPinned();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -534,7 +534,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_manifestExists() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
@@ -552,11 +552,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllNotPinned();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -591,7 +591,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_dynamicExists_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32);
@@ -604,7 +604,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(s)));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
@@ -633,11 +633,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
});
// ... But the launcher will still receive the request.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -676,13 +676,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_manifestExists_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_P0);
});
@@ -713,11 +713,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
});
// ... But the launcher will still receive the request.
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -758,13 +758,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_wasDynamic_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
@@ -786,13 +786,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_wasDynamic_disabled_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
@@ -817,13 +817,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_wasManifest_alreadyPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_P0);
});
@@ -855,11 +855,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"))));
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertWith(getCallerShortcuts())
@@ -876,11 +876,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
verify(mServiceContext, times(0)).sendIntentSender(any(IntentSender.class));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -917,11 +917,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
});
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_P0);
});
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertWith(getCallerShortcuts())
@@ -939,11 +939,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
verify(mServiceContext, times(0)).sendIntentSender(any(IntentSender.class));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -980,13 +980,13 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* the existing one.
*/
public void testRequestPinShortcut_launcherAlreadyHasPinned() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"), makeShortcut("s2"))));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s2"), HANDLE_USER_P0);
});
@@ -997,11 +997,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
verify(mServiceContext, times(0)).sendIntentSender(any(IntentSender.class));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1042,7 +1042,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* When trying to pin an existing shortcut, the new fields shouldn't override existing fields.
*/
public void testRequestPinShortcut_dynamicExists_titleWontChange() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32);
@@ -1063,11 +1063,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllNotPinned();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1107,7 +1107,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* When trying to pin an existing shortcut, the new fields shouldn't override existing fields.
*/
public void testRequestPinShortcut_manifestExists_titleWontChange() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
@@ -1125,11 +1125,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllNotPinned();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1174,7 +1174,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has a partial shortcut, accept() should fail.
*/
public void testRequestPinShortcut_dynamicExists_thenRemoved_error() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
// Create dynamic shortcut
@@ -1192,11 +1192,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1232,7 +1232,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has all the mandatory fields, we can go ahead and still publish it.
*/
public void testRequestPinShortcut_dynamicExists_thenRemoved_okay() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
// Create dynamic shortcut
@@ -1250,11 +1250,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1288,7 +1288,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has a partial shortcut, accept() should fail.
*/
public void testRequestPinShortcut_manifestExists_thenRemoved_error() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
@@ -1304,11 +1304,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1345,7 +1345,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has all the mandatory fields, we can go ahead and still publish it.
*/
public void testRequestPinShortcut_manifestExists_thenRemoved_okay() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
@@ -1361,11 +1361,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.isEmpty();
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1405,7 +1405,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has a partial shortcut, accept() should fail.
*/
public void testRequestPinShortcut_dynamicExists_thenDisabled_error() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcut("s1");
@@ -1419,8 +1419,8 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
// Then, pin by another launcher and disable it.
// We have to pin it here so that disable() won't remove it.
- setDefaultLauncher(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ setDefaultLauncher(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("s1"), HANDLE_USER_P0);
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
@@ -1431,12 +1431,12 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllDisabled();
});
- setDefaultLauncher(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1479,7 +1479,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
* has a partial shortcut, accept() should fail.
*/
public void testRequestPinShortcut_manifestExists_thenDisabled_error() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
publishManifestShortcutsAsCaller(R.xml.shortcut_1);
@@ -1492,8 +1492,8 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
// Then, pin by another launcher and disable it.
// We have to pin it here so that disable() won't remove it.
- setDefaultLauncher(USER_0, LAUNCHER_2);
- runWithCaller(LAUNCHER_2, USER_0, () -> {
+ setDefaultLauncher(USER_10, LAUNCHER_2);
+ runWithCaller(LAUNCHER_2, USER_10, () -> {
mLauncherApps.pinShortcuts(CALLING_PACKAGE_1, list("ms1"), HANDLE_USER_P0);
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
@@ -1505,12 +1505,12 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
.areAllDisabled();
});
- setDefaultLauncher(USER_0, LAUNCHER_1);
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);
@@ -1551,7 +1551,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
}
public void testRequestPinShortcut_wrongLauncherCannotAccept() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo s1 = makeShortcut("s1");
@@ -1560,11 +1560,11 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
});
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
final PinItemRequest request = mLauncherApps.getPinItemRequest(intent.getValue());
// Verify that other launcher can't use this request
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Set some random caller UID.
mInjectedCallingUid = 12345;
@@ -1573,7 +1573,7 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
});
// The default launcher can still use this request
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
assertTrue(request.isValid());
assertTrue(request.accept());
});
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java
index 2fca3d07149e..ee1bf38a6b24 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest9.java
@@ -91,7 +91,7 @@ public class ShortcutManagerTest9 extends BaseShortcutManagerTest {
}
public void testNotForeground() {
- setDefaultLauncher(USER_0, LAUNCHER_1);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
makeCallerBackground();
@@ -108,8 +108,8 @@ public class ShortcutManagerTest9 extends BaseShortcutManagerTest {
}
private void checkRequestPinAppWidget(@Nullable PendingIntent resultIntent) {
- setDefaultLauncher(USER_0, LAUNCHER_1);
- setDefaultLauncher(USER_10, LAUNCHER_2);
+ setDefaultLauncher(USER_10, LAUNCHER_1);
+ setDefaultLauncher(USER_11, LAUNCHER_2);
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
AppWidgetProviderInfo info = makeProviderInfo("c1");
@@ -120,11 +120,11 @@ public class ShortcutManagerTest9 extends BaseShortcutManagerTest {
verify(mServiceContext, times(0)).sendIntentSender(any(IntentSender.class));
});
- runWithCaller(LAUNCHER_1, USER_0, () -> {
+ runWithCaller(LAUNCHER_1, USER_10, () -> {
// Check the intent passed to startActivityAsUser().
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_0));
+ verify(mServiceContext).startActivityAsUser(intent.capture(), eq(HANDLE_USER_10));
assertPinItemRequestIntent(intent.getValue(), mInjectedClientPackage);