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

Commit 89603ad8 authored by Pinyao Ting's avatar Pinyao Ting Committed by Android (Google) Code Review
Browse files

Merge "Fix the issue where pinning share target doesn't work in HSUM" into main

parents 899dedf5 573b2626
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -912,12 +912,13 @@ class ShortcutPackage extends ShortcutPackageItem {
     * available ShareTarget definitions in this package.
     */
    public List<ShortcutManager.ShareShortcutInfo> getMatchingShareTargets(
            @NonNull final IntentFilter filter) {
        return getMatchingShareTargets(filter, null);
            @NonNull final IntentFilter filter, final int callingUserId) {
        return getMatchingShareTargets(filter, null, callingUserId);
    }

    List<ShortcutManager.ShareShortcutInfo> getMatchingShareTargets(
            @NonNull final IntentFilter filter, @Nullable final String pkgName) {
            @NonNull final IntentFilter filter, @Nullable final String pkgName,
            final int callingUserId) {
        synchronized (mPackageItemLock) {
            final List<ShareTargetInfo> matchedTargets = new ArrayList<>();
            for (int i = 0; i < mShareTargets.size(); i++) {
@@ -941,7 +942,7 @@ class ShortcutPackage extends ShortcutPackageItem {
            // included in the result
            findAll(shortcuts, ShortcutInfo::isNonManifestVisible,
                    ShortcutInfo.CLONE_REMOVE_FOR_APP_PREDICTION,
                    pkgName, 0, /*getPinnedByAnyLauncher=*/ false);
                    pkgName, callingUserId, /*getPinnedByAnyLauncher=*/ false);

            final List<ShortcutManager.ShareShortcutInfo> result = new ArrayList<>();
            for (int i = 0; i < shortcuts.size(); i++) {
+4 −2
Original line number Diff line number Diff line
@@ -2591,7 +2591,8 @@ public class ShortcutService extends IShortcutService.Stub {
            final List<ShortcutManager.ShareShortcutInfo> shortcutInfoList = new ArrayList<>();
            final ShortcutUser user = getUserShortcutsLocked(userId);
            user.forAllPackages(p -> shortcutInfoList.addAll(
                    p.getMatchingShareTargets(filter, pkg)));
                    p.getMatchingShareTargets(filter, pkg,
                            mUserManagerInternal.getProfileParentId(userId))));
            return new ParceledListSlice<>(shortcutInfoList);
        }
    }
@@ -2623,7 +2624,8 @@ public class ShortcutService extends IShortcutService.Stub {

            final List<ShortcutManager.ShareShortcutInfo> matchedTargets =
                    getPackageShortcutsLocked(packageName, userId)
                            .getMatchingShareTargets(filter);
                            .getMatchingShareTargets(filter,
                                    mUserManagerInternal.getProfileParentId(callingUserId));
            final int matchedSize = matchedTargets.size();
            for (int i = 0; i < matchedSize; i++) {
                if (matchedTargets.get(i).getShortcutInfo().getId().equals(shortcutId)) {