diff options
| author | Pinyao Ting <pinyaoting@google.com> | 2021-01-14 09:32:45 -0800 |
|---|---|---|
| committer | Pinyao Ting <pinyaoting@google.com> | 2021-02-24 14:55:00 -0800 |
| commit | 85ad9ee3f7fb4feb747da9933cbdf8bfe26f68f6 (patch) | |
| tree | 311b631ea89080231334f903ac89075cf26ec75b /core/java/android | |
| parent | 01af9eec33b37edc1ad8bba4cb9022c2e31bfd73 (diff) | |
Shortcut integration with AppSearch (Part 1)
This CL includes the initial code change to integrate shortcuts with
AppSearch and provides a public api to allow publishers sharing access
to shortcuts with other apps.
Bug: 151359749
CTS-Coverage-Bug: 180558621
Test: manual
Change-Id: I08430dc3d49e4f2588c68c61561fffb2b248f4c9
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/pm/IShortcutService.aidl | 3 | ||||
| -rw-r--r-- | core/java/android/content/pm/ShortcutManager.java | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/content/pm/IShortcutService.aidl b/core/java/android/content/pm/IShortcutService.aidl index 29a55b7a74da..b34574811bca 100644 --- a/core/java/android/content/pm/IShortcutService.aidl +++ b/core/java/android/content/pm/IShortcutService.aidl @@ -78,4 +78,7 @@ interface IShortcutService { ParceledListSlice getShortcuts(String packageName, int matchFlags, int userId); void pushDynamicShortcut(String packageName, in ShortcutInfo shortcut, int userId); + + void updateShortcutVisibility(String callingPkg, String packageName, in byte[] certificate, + in boolean visible, int userId); }
\ No newline at end of file diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java index 35c99a13a152..d3bac79aa2b9 100644 --- a/core/java/android/content/pm/ShortcutManager.java +++ b/core/java/android/content/pm/ShortcutManager.java @@ -39,6 +39,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import com.android.internal.annotations.VisibleForTesting; @@ -771,4 +772,20 @@ public class ShortcutManager { } } + /** + * Granting another app the access to the shortcuts you own. You must provide the package name + * and their SHA256 certificate digest in order to granting the access. + * + * Once granted, the other app can retain a copy of all the shortcuts you own when calling + * {@link LauncherApps#getShortcuts(LauncherApps.ShortcutQuery, UserHandle)}. + */ + public void updateShortcutVisibility(@NonNull final String packageName, + @Nullable final byte[] certificate, final boolean visible) { + try { + mService.updateShortcutVisibility(mContext.getPackageName(), packageName, certificate, + visible, injectMyUserId()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } |
