Merge "In getMatchingShareTargets, add callerLauncher to fetch sharesheet marked pin info." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-21 22:16:14 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 1 deletions

View File

@@ -894,8 +894,12 @@ class ShortcutPackage extends ShortcutPackageItem {
// Get the list of all dynamic shortcuts in this package.
final ArrayList<ShortcutInfo> shortcuts = new ArrayList<>();
// Pass callingLauncher to ensure pinned flag marked by system ui, e.g. ShareSheet, are
// included in the result
findAll(shortcuts, ShortcutInfo::isNonManifestVisible,
ShortcutInfo.CLONE_REMOVE_FOR_APP_PREDICTION);
ShortcutInfo.CLONE_REMOVE_FOR_APP_PREDICTION,
mShortcutUser.mService.mContext.getPackageName(),
0, /*getPinnedByAnyLauncher=*/ false);
final List<ShortcutManager.ShareShortcutInfo> result = new ArrayList<>();
for (int i = 0; i < shortcuts.size(); i++) {

View File

@@ -266,6 +266,11 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
public void sendIntentSender(IntentSender intent) {
// Placeholder for spying.
}
@Override
public String getPackageName() {
return SYSTEM_PACKAGE_NAME;
}
}
/** ShortcutService with injection override methods. */
@@ -704,6 +709,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
protected UriPermissionOwner mUriPermissionOwner;
protected static final String SYSTEM_PACKAGE_NAME = "android";
protected static final String CALLING_PACKAGE_1 = "com.android.test.1";
protected static final int CALLING_UID_1 = 10001;