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

Commit 35559d61 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Allow assistant app to access any shortcuts

Bug: 68760723
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: I8c0f0ba1f01c1da7df44bb235abdaa94c36d86d3
parent a7d81598
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10568,6 +10568,7 @@ package android.content.pm {
    field public static final int FLAG_MATCH_DYNAMIC = 1; // 0x1
    field public static final int FLAG_MATCH_MANIFEST = 8; // 0x8
    field public static final int FLAG_MATCH_PINNED = 2; // 0x2
    field public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1024; // 0x400
  }
  public class PackageInfo implements android.os.Parcelable {
+1 −0
Original line number Diff line number Diff line
@@ -11186,6 +11186,7 @@ package android.content.pm {
    field public static final int FLAG_MATCH_DYNAMIC = 1; // 0x1
    field public static final int FLAG_MATCH_MANIFEST = 8; // 0x8
    field public static final int FLAG_MATCH_PINNED = 2; // 0x2
    field public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1024; // 0x400
  }
  public class PackageInfo implements android.os.Parcelable {
+1 −1
Original line number Diff line number Diff line
@@ -10647,10 +10647,10 @@ package android.content.pm {
    method public android.content.pm.LauncherApps.ShortcutQuery setQueryFlags(int);
    method public android.content.pm.LauncherApps.ShortcutQuery setShortcutIds(java.util.List<java.lang.String>);
    field public static final int FLAG_GET_KEY_FIELDS_ONLY = 4; // 0x4
    field public static final int FLAG_MATCH_ALL_PINNED = 1024; // 0x400
    field public static final int FLAG_MATCH_DYNAMIC = 1; // 0x1
    field public static final int FLAG_MATCH_MANIFEST = 8; // 0x8
    field public static final int FLAG_MATCH_PINNED = 2; // 0x2
    field public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1024; // 0x400
  }
  public class PackageInfo implements android.os.Parcelable {
+6 −6
Original line number Diff line number Diff line
@@ -282,13 +282,13 @@ public class LauncherApps {
        public static final int FLAG_GET_MANIFEST = FLAG_MATCH_MANIFEST;

        /**
         * @hide include all pinned shortcuts by any launchers, not just by the caller,
         * Include all pinned shortcuts by any launchers, not just by the caller,
         * in the result.
         * If the caller doesn't havve the {@link android.Manifest.permission#ACCESS_SHORTCUTS}
         * permission, this flag will be ignored.
         *
         * The caller must be the selected assistant app to use this flag, or have the system
         * {@code ACCESS_SHORTCUTS} permission.
         */
        @TestApi
        public static final int FLAG_MATCH_ALL_PINNED = 1 << 10;
        public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1 << 10;

        /**
         * FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED | FLAG_MATCH_MANIFEST
@@ -302,7 +302,7 @@ public class LauncherApps {
         * @hide
         */
        public static final int FLAG_MATCH_ALL_KINDS_WITH_ALL_PINNED =
                FLAG_MATCH_ALL_KINDS | FLAG_MATCH_ALL_PINNED;
                FLAG_MATCH_ALL_KINDS | FLAG_MATCH_PINNED_BY_ANY_LAUNCHER;

        /** @hide kept for unit tests */
        @Deprecated
+8 −2
Original line number Diff line number Diff line
@@ -615,10 +615,16 @@ class ShortcutPackage extends ShortcutPackageItem {

            // Fix up isPinned for the caller.  Note we need to do it before the "test" callback,
            // since it may check isPinned.
            // However, if getPinnedByAnyLauncher is set, we do it after the test.
            if (!getPinnedByAnyLauncher) {
                if (!isPinnedByCaller) {
                    clone.clearFlags(ShortcutInfo.FLAG_PINNED);
                }
            }
            if (query == null || query.test(clone)) {
                if (!isPinnedByCaller) {
                    clone.clearFlags(ShortcutInfo.FLAG_PINNED);
                }
                result.add(clone);
            }
        }
Loading