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

Commit 82722a04 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Shortcut integration with AppSearch (Part 5)"" into sc-dev

parents bfe78e73 ca75c70a
Loading
Loading
Loading
Loading
+250 −503

File changed.

Preview size limit exceeded, changes collapsed.

+0 −13
Original line number Diff line number Diff line
@@ -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);
    }

@@ -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) {
+0 −11
Original line number Diff line number Diff line
@@ -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);
    }
@@ -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, () -> {
@@ -2404,8 +2395,6 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {

        deleteAllSavedFiles();

        mMockAppSearchManager.removeShortcuts();

        initService();
        mService.applyRestore(payload, USER_0);

+7 −8
Original line number Diff line number Diff line
@@ -1385,7 +1385,6 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
            mService.waitForBitmapSavesForTest();
            assertWith(getCallerShortcuts())
                    .forShortcutWithId("s1", si -> {
                        Log.d("ShortcutManagerTest1", si.toString());
                        assertTrue(si.hasIconFile());
                    });

@@ -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");
@@ -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"));
@@ -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);

@@ -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"));