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

Commit 5fd967d2 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Move grantDefaultPermissions back to onNewUserCreated

Otherwise pre-grants may not work on managed profiles because apps could be
uninstalled when the user is started

Bug: 29955102
Change-Id: I8fafaf1ca6193c1a13bd2f0b463ee30fe473e6b5
parent b6378cf4
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -20448,12 +20448,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
        }
    }
    void onBeforeUserStartUninitialized(final int userId) {
        synchronized (mPackages) {
            if (mSettings.areDefaultRuntimePermissionsGrantedLPr(userId)) {
                return;
            }
        }
    void onNewUserCreated(final int userId) {
        mDefaultPermissionPolicy.grantDefaultPermissions(userId);
        // If permission review for legacy apps is required, we represent
        // dagerous permissions for such apps as always granted runtime
+1 −4
Original line number Diff line number Diff line
@@ -2304,6 +2304,7 @@ public class UserManagerService extends IUserManager.Stub {
            synchronized (mRestrictionsLock) {
                mBaseUserRestrictions.append(userId, restrictions);
            }
            mPm.onNewUserCreated(userId);
            Intent addedIntent = new Intent(Intent.ACTION_USER_ADDED);
            addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
            mContext.sendBroadcastAsUser(addedIntent, UserHandle.ALL,
@@ -2874,10 +2875,6 @@ public class UserManagerService extends IUserManager.Stub {
            synchronized (mRestrictionsLock) {
                applyUserRestrictionsLR(userId);
            }
            UserInfo userInfo = getUserInfoNoChecks(userId);
            if (userInfo != null && !userInfo.isInitialized()) {
                mPm.onBeforeUserStartUninitialized(userId);
            }
        }

        maybeInitializeDemoMode(userId);