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

Commit 572143fb authored by Patrick Baumann's avatar Patrick Baumann Committed by Android (Google) Code Review
Browse files

Merge "Breaks isInstantApp into public and internal"

parents a620de30 b6e72978
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -334,11 +334,11 @@ public abstract class PackageManagerInternal {
     * <p>
     * @param userId the user
     * @param intent the intent that triggered the grant
     * @param callingAppId The app ID of the calling application
     * @param callingUid The uid of the calling application
     * @param targetAppId The app ID of the target application
     */
    public abstract void grantImplicitAccess(
            @UserIdInt int userId, Intent intent, @AppIdInt int callingAppId,
            @UserIdInt int userId, Intent intent, int callingUid,
            @AppIdInt int targetAppId);

    public abstract boolean isInstantAppInstallerComponent(ComponentName component);
+2 −2
Original line number Diff line number Diff line
@@ -1749,7 +1749,7 @@ public final class ActiveServices {
            // Once the apps have become associated, if one of them is caller is ephemeral
            // the target app should now be able to see the calling app
            mAm.grantImplicitAccess(callerApp.userId, service,
                    UserHandle.getAppId(callerApp.uid), UserHandle.getAppId(s.appInfo.uid));
                    callerApp.uid, UserHandle.getAppId(s.appInfo.uid));

            AppBindRecord b = s.retrieveAppBindingLocked(service, callerApp);
            ConnectionRecord c = new ConnectionRecord(b, activity,
@@ -2802,7 +2802,7 @@ public final class ActiveServices {
                mAm.mUgmInternal.grantUriPermissionUncheckedFromIntent(si.neededGrants,
                        si.getUriPermissionsLocked());
            }
            mAm.grantImplicitAccess(r.userId, si.intent, UserHandle.getAppId(si.callingId),
            mAm.grantImplicitAccess(r.userId, si.intent, si.callingId,
                    UserHandle.getAppId(r.appInfo.uid)
            );
            bumpServiceExecutingLocked(r, execInFg, "start");
+2 −2
Original line number Diff line number Diff line
@@ -6118,9 +6118,9 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    @VisibleForTesting
    public void grantImplicitAccess(int userId, Intent intent, int callingAppId, int targetAppId) {
    public void grantImplicitAccess(int userId, Intent intent, int callingUid, int targetAppId) {
        getPackageManagerInternalLocked().
                grantImplicitAccess(userId, intent, callingAppId, targetAppId);
                grantImplicitAccess(userId, intent, callingUid, targetAppId);
    }
    /**
+16 −10
Original line number Diff line number Diff line
@@ -8187,15 +8187,20 @@ public class PackageManagerService extends IPackageManager.Stub
    @Override
    public boolean isInstantApp(String packageName, int userId) {
        mPermissionManager.enforceCrossUserPermission(Binder.getCallingUid(), userId,
        final int callingUid = Binder.getCallingUid();
        mPermissionManager.enforceCrossUserPermission(callingUid, userId,
                true /* requireFullPermission */, false /* checkShell */,
                "isInstantApp");
        return isInstantAppInternal(packageName, userId, callingUid);
    }
    private boolean isInstantAppInternal(String packageName, @UserIdInt int userId,
            int callingUid) {
        if (HIDE_EPHEMERAL_APIS) {
            return false;
        }
        synchronized (mLock) {
            int callingUid = Binder.getCallingUid();
            if (Process.isIsolated(callingUid)) {
                callingUid = mIsolatedOwners.get(callingUid);
            }
@@ -23129,19 +23134,20 @@ public class PackageManagerService extends IPackageManager.Stub
        @Override
        public void grantImplicitAccess(int userId, Intent intent,
                int callingAppId, int targetAppId) {
                int callingUid, int targetAppId) {
            synchronized (mLock) {
                final PackageParser.Package callingPackage = getPackage(
                        UserHandle.getUid(userId, callingAppId));
                final PackageParser.Package targetPackage = getPackage(
                        UserHandle.getUid(userId, targetAppId));
                final PackageParser.Package callingPackage = getPackage(callingUid);
                final PackageParser.Package targetPackage =
                        getPackage(UserHandle.getUid(userId, targetAppId));
                if (callingPackage == null || targetPackage == null) {
                    return;
                }
                if (isInstantApp(callingPackage.packageName, userId)) {
                final boolean instantApp = isInstantAppInternal(callingPackage.packageName, userId,
                        callingUid);
                if (instantApp) {
                    mInstantAppRegistry.grantInstantAccessLPw(userId, intent,
                            callingAppId, targetAppId);
                            UserHandle.getAppId(callingUid), targetAppId);
                } else {
                    mAppsFilter.grantImplicitAccess(
                            callingPackage.packageName, targetPackage.packageName, userId);
+1 −1
Original line number Diff line number Diff line
@@ -1552,7 +1552,7 @@ class ActivityStarter {
                mIntent, mStartActivity.getUriPermissionsLocked(), mStartActivity.mUserId);
        mService.getPackageManagerInternalLocked().grantImplicitAccess(
                mStartActivity.mUserId, mIntent,
                UserHandle.getAppId(mCallingUid),
                mCallingUid,
                UserHandle.getAppId(mStartActivity.info.applicationInfo.uid)
        );
        if (newTask) {