Loading services/core/java/com/android/server/pm/ShortcutPackage.java +250 −503 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/pm/ShortcutService.java +0 −13 Original line number Diff line number Diff line Loading @@ -1051,8 +1051,6 @@ public class ShortcutService extends IShortcutService.Stub { } final ShortcutUser user = getUserShortcutsLocked(userId); // Close AppSearchSession to flush pending changes. user.forAllPackages(ShortcutPackage::closeAppSearchSession); user.logSharingShortcutStats(mMetricsLogger); } Loading Loading @@ -5082,17 +5080,6 @@ public class ShortcutService extends IShortcutService.Stub { } } @VisibleForTesting void updatePackageShortcutForTest(String packageName, String shortcutId, int userId, Consumer<ShortcutInfo> cb) { synchronized (mLock) { final ShortcutPackage pkg = getPackageShortcutForTest(packageName, userId); if (pkg == null) return; pkg.mutateShortcut(shortcutId, null, cb); } } @VisibleForTesting ShortcutLauncher getLauncherShortcutForTest(String packageName, int userId) { synchronized (mLock) { Loading services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -2041,11 +2041,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { return mService.getPackageShortcutForTest(packageName, shortcutId, userId); } protected void updatePackageShortcut(String packageName, String shortcutId, int userId, Consumer<ShortcutInfo> cb) { mService.updatePackageShortcutForTest(packageName, shortcutId, userId, cb); } protected void assertShortcutExists(String packageName, String shortcutId, int userId) { assertTrue(getPackageShortcut(packageName, shortcutId, userId) != null); } Loading Loading @@ -2241,10 +2236,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { return getPackageShortcut(getCallingPackage(), shortcutId, getCallingUserId()); } protected void updateCallerShortcut(String shortcutId, Consumer<ShortcutInfo> cb) { updatePackageShortcut(getCallingPackage(), shortcutId, getCallingUserId(), cb); } protected List<ShortcutInfo> getLauncherShortcuts(String launcher, int userId, int queryFlags) { final List<ShortcutInfo>[] ret = new List[1]; runWithCaller(launcher, userId, () -> { Loading Loading @@ -2404,8 +2395,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { deleteAllSavedFiles(); mMockAppSearchManager.removeShortcuts(); initService(); mService.applyRestore(payload, USER_0); Loading services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +7 −8 Original line number Diff line number Diff line Loading @@ -1385,7 +1385,6 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mService.waitForBitmapSavesForTest(); assertWith(getCallerShortcuts()) .forShortcutWithId("s1", si -> { Log.d("ShortcutManagerTest1", si.toString()); assertTrue(si.hasIconFile()); }); Loading Loading @@ -1703,8 +1702,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // Because setDynamicShortcuts will update the timestamps when ranks are changing, // we explicitly set timestamps here. updateCallerShortcut("s1", si -> si.setTimestamp(5000)); updateCallerShortcut("s2", si -> si.setTimestamp(1000)); getCallerShortcut("s1").setTimestamp(5000); getCallerShortcut("s2").setTimestamp(1000); setCaller(CALLING_PACKAGE_2); final ShortcutInfo s2_2 = makeShortcut("s2"); Loading @@ -1714,9 +1713,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { makeComponent(ShortcutActivity.class)); assertTrue(mManager.setDynamicShortcuts(list(s2_2, s2_3, s2_4))); updateCallerShortcut("s2", si -> si.setTimestamp(1500)); updateCallerShortcut("s3", si -> si.setTimestamp(3000)); updateCallerShortcut("s4", si -> si.setTimestamp(500)); getCallerShortcut("s2").setTimestamp(1500); getCallerShortcut("s3").setTimestamp(3000); getCallerShortcut("s4").setTimestamp(500); setCaller(CALLING_PACKAGE_3); final ShortcutInfo s3_2 = makeShortcutWithLocusId("s3", makeLocusId("l2")); Loading @@ -1724,7 +1723,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertTrue(mManager.setDynamicShortcuts(list(s3_2))); updateCallerShortcut("s3", si -> si.setTimestamp(START_TIME + 5000)); getCallerShortcut("s3").setTimestamp(START_TIME + 5000); setCaller(LAUNCHER_1); Loading Loading @@ -7687,7 +7686,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals("http://www/", si.getIntent().getData().toString()); assertEquals("foo/bar", si.getIntent().getType()); assertEquals( new ComponentName("abc", "abc.xyz"), si.getIntent().getComponent()); new ComponentName("abc", ".xyz"), si.getIntent().getComponent()); assertEquals(set("cat1", "cat2"), si.getIntent().getCategories()); assertEquals("value1", si.getIntent().getStringExtra("key1")); Loading Loading
services/core/java/com/android/server/pm/ShortcutPackage.java +250 −503 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/pm/ShortcutService.java +0 −13 Original line number Diff line number Diff line Loading @@ -1051,8 +1051,6 @@ public class ShortcutService extends IShortcutService.Stub { } final ShortcutUser user = getUserShortcutsLocked(userId); // Close AppSearchSession to flush pending changes. user.forAllPackages(ShortcutPackage::closeAppSearchSession); user.logSharingShortcutStats(mMetricsLogger); } Loading Loading @@ -5082,17 +5080,6 @@ public class ShortcutService extends IShortcutService.Stub { } } @VisibleForTesting void updatePackageShortcutForTest(String packageName, String shortcutId, int userId, Consumer<ShortcutInfo> cb) { synchronized (mLock) { final ShortcutPackage pkg = getPackageShortcutForTest(packageName, userId); if (pkg == null) return; pkg.mutateShortcut(shortcutId, null, cb); } } @VisibleForTesting ShortcutLauncher getLauncherShortcutForTest(String packageName, int userId) { synchronized (mLock) { Loading
services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -2041,11 +2041,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { return mService.getPackageShortcutForTest(packageName, shortcutId, userId); } protected void updatePackageShortcut(String packageName, String shortcutId, int userId, Consumer<ShortcutInfo> cb) { mService.updatePackageShortcutForTest(packageName, shortcutId, userId, cb); } protected void assertShortcutExists(String packageName, String shortcutId, int userId) { assertTrue(getPackageShortcut(packageName, shortcutId, userId) != null); } Loading Loading @@ -2241,10 +2236,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { return getPackageShortcut(getCallingPackage(), shortcutId, getCallingUserId()); } protected void updateCallerShortcut(String shortcutId, Consumer<ShortcutInfo> cb) { updatePackageShortcut(getCallingPackage(), shortcutId, getCallingUserId(), cb); } protected List<ShortcutInfo> getLauncherShortcuts(String launcher, int userId, int queryFlags) { final List<ShortcutInfo>[] ret = new List[1]; runWithCaller(launcher, userId, () -> { Loading Loading @@ -2404,8 +2395,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { deleteAllSavedFiles(); mMockAppSearchManager.removeShortcuts(); initService(); mService.applyRestore(payload, USER_0); Loading
services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +7 −8 Original line number Diff line number Diff line Loading @@ -1385,7 +1385,6 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mService.waitForBitmapSavesForTest(); assertWith(getCallerShortcuts()) .forShortcutWithId("s1", si -> { Log.d("ShortcutManagerTest1", si.toString()); assertTrue(si.hasIconFile()); }); Loading Loading @@ -1703,8 +1702,8 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // Because setDynamicShortcuts will update the timestamps when ranks are changing, // we explicitly set timestamps here. updateCallerShortcut("s1", si -> si.setTimestamp(5000)); updateCallerShortcut("s2", si -> si.setTimestamp(1000)); getCallerShortcut("s1").setTimestamp(5000); getCallerShortcut("s2").setTimestamp(1000); setCaller(CALLING_PACKAGE_2); final ShortcutInfo s2_2 = makeShortcut("s2"); Loading @@ -1714,9 +1713,9 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { makeComponent(ShortcutActivity.class)); assertTrue(mManager.setDynamicShortcuts(list(s2_2, s2_3, s2_4))); updateCallerShortcut("s2", si -> si.setTimestamp(1500)); updateCallerShortcut("s3", si -> si.setTimestamp(3000)); updateCallerShortcut("s4", si -> si.setTimestamp(500)); getCallerShortcut("s2").setTimestamp(1500); getCallerShortcut("s3").setTimestamp(3000); getCallerShortcut("s4").setTimestamp(500); setCaller(CALLING_PACKAGE_3); final ShortcutInfo s3_2 = makeShortcutWithLocusId("s3", makeLocusId("l2")); Loading @@ -1724,7 +1723,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertTrue(mManager.setDynamicShortcuts(list(s3_2))); updateCallerShortcut("s3", si -> si.setTimestamp(START_TIME + 5000)); getCallerShortcut("s3").setTimestamp(START_TIME + 5000); setCaller(LAUNCHER_1); Loading Loading @@ -7687,7 +7686,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals("http://www/", si.getIntent().getData().toString()); assertEquals("foo/bar", si.getIntent().getType()); assertEquals( new ComponentName("abc", "abc.xyz"), si.getIntent().getComponent()); new ComponentName("abc", ".xyz"), si.getIntent().getComponent()); assertEquals(set("cat1", "cat2"), si.getIntent().getCategories()); assertEquals("value1", si.getIntent().getStringExtra("key1")); Loading