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

Commit d55f9221 authored by Antoan Angelov's avatar Antoan Angelov Committed by Automerger Merge Worker
Browse files

Merge "Only add user id to content uri if launching cross-profile target" into...

Merge "Only add user id to content uri if launching cross-profile target" into rvc-dev am: 6d5e349b am: 0cc60867 am: c80bb1f3 am: 5cf58a5e

Original change: undetermined

Change-Id: Ide4287374801d6e81906a4a06339196d590e6d43
parents 5fd1767a 5cf58a5e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3023,6 +3023,10 @@ public class ChooserActivity extends ResolverActivity implements
        currentRootAdapter.updateDirectShareExpansion();
    }

    void prepareIntentForCrossProfileLaunch(Intent intent) {
        intent.fixUris(UserHandle.myUserId());
    }

    /**
     * Adapter for all types of items and targets in ShareSheet.
     * Note that ranked sections like Direct Share - while appearing grid-like - are handled on the
+9 −2
Original line number Diff line number Diff line
@@ -1235,8 +1235,8 @@ public class ResolverActivity extends Activity implements
        }

        if (target != null) {
            if (intent != null) {
                intent.fixUris(UserHandle.myUserId());
            if (intent != null && isLaunchingTargetInOtherProfile()) {
                prepareIntentForCrossProfileLaunch(intent);
            }
            safelyStartActivity(target);

@@ -1250,6 +1250,13 @@ public class ResolverActivity extends Activity implements
        return true;
    }

    void prepareIntentForCrossProfileLaunch(Intent intent) {}

    private boolean isLaunchingTargetInOtherProfile() {
        return mMultiProfilePagerAdapter.getCurrentUserHandle().getIdentifier()
                != UserHandle.myUserId();
    }

    @VisibleForTesting
    public void safelyStartActivity(TargetInfo cti) {
        // We're dispatching intents that might be coming from legacy apps, so