Merge "Allow shortcuts to be pinned by unbundled chooser" into tm-qpr-dev am: 8727c63973
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21146312 Change-Id: I454030fac0581452cd0c3be0e535e45d93d6a512 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -885,7 +885,12 @@ class ShortcutPackage extends ShortcutPackageItem {
|
|||||||
* available ShareTarget definitions in this package.
|
* available ShareTarget definitions in this package.
|
||||||
*/
|
*/
|
||||||
public List<ShortcutManager.ShareShortcutInfo> getMatchingShareTargets(
|
public List<ShortcutManager.ShareShortcutInfo> getMatchingShareTargets(
|
||||||
@NonNull IntentFilter filter) {
|
@NonNull final IntentFilter filter) {
|
||||||
|
return getMatchingShareTargets(filter, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ShortcutManager.ShareShortcutInfo> getMatchingShareTargets(
|
||||||
|
@NonNull final IntentFilter filter, @Nullable final String pkgName) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final List<ShareTargetInfo> matchedTargets = new ArrayList<>();
|
final List<ShareTargetInfo> matchedTargets = new ArrayList<>();
|
||||||
for (int i = 0; i < mShareTargets.size(); i++) {
|
for (int i = 0; i < mShareTargets.size(); i++) {
|
||||||
@@ -909,8 +914,7 @@ class ShortcutPackage extends ShortcutPackageItem {
|
|||||||
// included in the result
|
// included in the result
|
||||||
findAll(shortcuts, ShortcutInfo::isNonManifestVisible,
|
findAll(shortcuts, ShortcutInfo::isNonManifestVisible,
|
||||||
ShortcutInfo.CLONE_REMOVE_FOR_APP_PREDICTION,
|
ShortcutInfo.CLONE_REMOVE_FOR_APP_PREDICTION,
|
||||||
mShortcutUser.mService.mContext.getPackageName(),
|
pkgName, 0, /*getPinnedByAnyLauncher=*/ false);
|
||||||
0, /*getPinnedByAnyLauncher=*/ false);
|
|
||||||
|
|
||||||
final List<ShortcutManager.ShareShortcutInfo> result = new ArrayList<>();
|
final List<ShortcutManager.ShareShortcutInfo> result = new ArrayList<>();
|
||||||
for (int i = 0; i < shortcuts.size(); i++) {
|
for (int i = 0; i < shortcuts.size(); i++) {
|
||||||
@@ -1108,7 +1112,7 @@ class ShortcutPackage extends ShortcutPackageItem {
|
|||||||
|
|
||||||
// Now prepare to publish manifest shortcuts.
|
// Now prepare to publish manifest shortcuts.
|
||||||
List<ShortcutInfo> newManifestShortcutList = null;
|
List<ShortcutInfo> newManifestShortcutList = null;
|
||||||
final int shareTargetSize;
|
int shareTargetSize = 0;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
try {
|
try {
|
||||||
shareTargetSize = mShareTargets.size();
|
shareTargetSize = mShareTargets.size();
|
||||||
|
|||||||
@@ -2512,11 +2512,17 @@ public class ShortcutService extends IShortcutService.Stub {
|
|||||||
}
|
}
|
||||||
enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_APP_PREDICTIONS,
|
enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_APP_PREDICTIONS,
|
||||||
"getShareTargets");
|
"getShareTargets");
|
||||||
|
final ComponentName chooser = injectChooserActivity();
|
||||||
|
final String pkg = (chooser != null
|
||||||
|
&& mPackageManagerInternal.getComponentEnabledSetting(chooser,
|
||||||
|
injectBinderCallingUid(), userId) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED)
|
||||||
|
? chooser.getPackageName() : mContext.getPackageName();
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
throwIfUserLockedL(userId);
|
throwIfUserLockedL(userId);
|
||||||
final List<ShortcutManager.ShareShortcutInfo> shortcutInfoList = new ArrayList<>();
|
final List<ShortcutManager.ShareShortcutInfo> shortcutInfoList = new ArrayList<>();
|
||||||
final ShortcutUser user = getUserShortcutsLocked(userId);
|
final ShortcutUser user = getUserShortcutsLocked(userId);
|
||||||
user.forAllPackages(p -> shortcutInfoList.addAll(p.getMatchingShareTargets(filter)));
|
user.forAllPackages(p -> shortcutInfoList.addAll(
|
||||||
|
p.getMatchingShareTargets(filter, pkg)));
|
||||||
return new ParceledListSlice<>(shortcutInfoList);
|
return new ParceledListSlice<>(shortcutInfoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user