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

Commit 83c29fa5 authored by Azhara Assanova's avatar Azhara Assanova Committed by Android (Google) Code Review
Browse files

Merge "Grant app visibility if launching app opts in to sharing identity" into main

parents e5fedf02 e32633ff
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ConstrainDisplayApisConfig;
import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.pm.UserProperties;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -5009,7 +5010,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * method will be called at the proper time.
     */
    final void deliverNewIntentLocked(int callingUid, Intent intent, NeededUriGrants intentGrants,
            String referrer, boolean isShareIdentityEnabled) {
            String referrer, boolean isShareIdentityEnabled, int userId, int recipientAppId) {
        IBinder callerToken = new Binder();
        if (android.security.Flags.contentUriPermissionApis()) {
            computeCallerInfo(callerToken, intent, callingUid, referrer, isShareIdentityEnabled);
@@ -5017,6 +5018,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // The activity now gets access to the data associated with this Intent.
        mAtmService.mUgmInternal.grantUriPermissionUncheckedFromIntent(intentGrants,
                getUriPermissionsLocked());
        if (isShareIdentityEnabled && android.security.Flags.contentUriPermissionApis()) {
            final PackageManagerInternal pmInternal = mAtmService.getPackageManagerInternalLocked();
            pmInternal.grantImplicitAccess(userId, intent, recipientAppId /*recipient*/,
                    callingUid /*visible*/, true /*direct*/);
        }
        final ReferrerIntent rintent = new ReferrerIntent(intent, getFilteredReferrer(referrer),
                callerToken);
        boolean unsent = true;
+3 −1
Original line number Diff line number Diff line
@@ -2915,7 +2915,9 @@ class ActivityStarter {

        activity.logStartActivity(EventLogTags.WM_NEW_INTENT, activity.getTask());
        activity.deliverNewIntentLocked(mCallingUid, mStartActivity.intent, intentGrants,
                mStartActivity.launchedFromPackage, mStartActivity.mShareIdentity);
                mStartActivity.launchedFromPackage, mStartActivity.mShareIdentity,
                mStartActivity.mUserId,
                UserHandle.getAppId(mStartActivity.info.applicationInfo.uid));
        mIntentDelivered = true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ public class ActivityTaskSupervisorTests extends WindowTestsBase {

        activity.deliverNewIntentLocked(ActivityBuilder.DEFAULT_FAKE_UID,
                new Intent(), null /* intentGrants */, "other.package2",
                /* isShareIdentityEnabled */ false);
                /* isShareIdentityEnabled */ false, /* userId */ -1, /* recipientAppId */ -1);
        verify(activity).getFilteredReferrer(eq("other.package2"));
    }