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

Commit 55e13807 authored by Alison Cichowlas's avatar Alison Cichowlas Committed by Automerger Merge Worker
Browse files

Merge "When Nearby is present as a chip, exclude it from app list." into...

Merge "When Nearby is present as a chip, exclude it from app list." into rvc-dev am: 974d1720 am: c71b0edf am: f231e027

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

Change-Id: Id0a70a98b3f6a52b4d5dfa3475b7d77fe7b3e677
parents e559e16c f231e027
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -691,8 +691,14 @@ public class ChooserActivity extends ResolverActivity implements
        mPinnedSharedPrefs = getPinnedSharedPrefs(this);

        pa = intent.getParcelableArrayExtra(Intent.EXTRA_EXCLUDE_COMPONENTS);


        // Exclude out Nearby from main list if chip is present, to avoid duplication
        ComponentName nearbySharingComponent = getNearbySharingComponent();
        boolean hasNearby = nearbySharingComponent != null;

        if (pa != null) {
            ComponentName[] names = new ComponentName[pa.length];
            ComponentName[] names = new ComponentName[pa.length + (hasNearby ? 1 : 0)];
            for (int i = 0; i < pa.length; i++) {
                if (!(pa[i] instanceof ComponentName)) {
                    Log.w(TAG, "Filtered component #" + i + " not a ComponentName: " + pa[i]);
@@ -701,7 +707,14 @@ public class ChooserActivity extends ResolverActivity implements
                }
                names[i] = (ComponentName) pa[i];
            }
            if (hasNearby) {
                names[names.length - 1] = nearbySharingComponent;
            }

            mFilteredComponentNames = names;
        } else if (hasNearby) {
            mFilteredComponentNames = new ComponentName[1];
            mFilteredComponentNames[0] = nearbySharingComponent;
        }

        pa = intent.getParcelableArrayExtra(Intent.EXTRA_CHOOSER_TARGETS);