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

Commit d4b1676f authored by Svet Ganov's avatar Svet Ganov Committed by Android (Google) Code Review
Browse files

Merge "Properly handle system app permissions."

parents 95872a2e 78027f3b
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -339,7 +339,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    /** Permission grant: grant the permission as an install permission. */
    /** Permission grant: grant the permission as an install permission. */
    private static final int GRANT_INSTALL = 2;
    private static final int GRANT_INSTALL = 2;
    /** Permission grant: grant the permission as a runtime permission. */
    /** Permission grant: grant the permission as a runtime one. */
    private static final int GRANT_RUNTIME = 3;
    private static final int GRANT_RUNTIME = 3;
    /** Permission grant: grant as runtime a permission that was granted as an install time one. */
    /** Permission grant: grant as runtime a permission that was granted as an install time one. */
@@ -7022,8 +7022,8 @@ public class PackageManagerService extends IPackageManager.Stub {
                        // For legacy apps dangerous permissions are install time ones.
                        // For legacy apps dangerous permissions are install time ones.
                        grant = GRANT_INSTALL;
                        grant = GRANT_INSTALL;
                    } else if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                    } else if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                        // For modern system apps dangerous permissions are install time ones.
                        // For modern system apps dangerous permissions are runtime ones.
                        grant = GRANT_INSTALL;
                        grant = GRANT_UPGRADE;
                    } else {
                    } else {
                        if (origPermissions.hasInstallPermission(bp.name)) {
                        if (origPermissions.hasInstallPermission(bp.name)) {
                            // For legacy apps that became modern, install becomes runtime.
                            // For legacy apps that became modern, install becomes runtime.
@@ -13358,6 +13358,11 @@ public class PackageManagerService extends IPackageManager.Stub {
        }
        }
    }
    }
    void newUserCreatedLILPw(int userHandle) {
        // Adding a user requires updating runtime permissions for system apps.
        updatePermissionsLPw(null, null, UPDATE_PERMISSIONS_ALL);
    }
    @Override
    @Override
    public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
    public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
        mContext.enforceCallingOrSelfPermission(
        mContext.enforceCallingOrSelfPermission(
+1 −0
Original line number Original line Diff line number Diff line
@@ -1219,6 +1219,7 @@ public class UserManagerService extends IUserManager.Stub {
                    updateUserIdsLocked();
                    updateUserIdsLocked();
                    Bundle restrictions = new Bundle();
                    Bundle restrictions = new Bundle();
                    mUserRestrictions.append(userId, restrictions);
                    mUserRestrictions.append(userId, restrictions);
                    mPm.newUserCreatedLILPw(userId);
                }
                }
            }
            }
            if (userInfo != null) {
            if (userInfo != null) {