Merge "Support floating but long-lived shortcuts to be pinned in ShortcutLauncher. Floating shortcuts can surface on sharesheet to be pinned." into tm-qpr-dev am: 88c3812c4e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18745982

Change-Id: I05230a5c10f2d92d82c13c3848b768c3757a2ae9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Song Hu
2022-06-08 05:45:29 +00:00
committed by Automerger Merge Worker

View File

@@ -144,8 +144,8 @@ class ShortcutLauncher extends ShortcutPackageItem {
final ArraySet<String> prevSet = mPinnedShortcuts.get(pu);
// Actually pin shortcuts.
// This logic here is to make sure a launcher cannot pin a shortcut that is floating
// (i.e. not dynamic nor manifest but is pinned) and pinned by another launcher.
// This logic here is to make sure a launcher cannot pin a shortcut that is not dynamic
// nor long-lived nor manifest but is pinned.
// In this case, technically the shortcut doesn't exist to this launcher, so it can't
// pin it.
// (Maybe unnecessarily strict...)
@@ -158,7 +158,7 @@ class ShortcutLauncher extends ShortcutPackageItem {
if (si == null) {
continue;
}
if (si.isDynamic()
if (si.isDynamic() || si.isLongLived()
|| si.isManifestShortcut()
|| (prevSet != null && prevSet.contains(id))
|| forPinRequest) {