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

Commit b45d9833 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Delay grantDefaultPermissions until user's first start

Bug: 28765487
Change-Id: I6a7b0a9fc85964def1e991aafe967977080dfdab
parent b0d38b6d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -20049,8 +20049,13 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
        }
    }
    void newUserCreated(final int userHandle) {
        mDefaultPermissionPolicy.grantDefaultPermissions(userHandle);
    void onBeforeUserStartUninitialized(final int userId) {
        synchronized (mPackages) {
            if (mSettings.areDefaultRuntimePermissionsGrantedLPr(userId)) {
                return;
            }
        }
        mDefaultPermissionPolicy.grantDefaultPermissions(userId);
        // If permission review for legacy apps is required, we represent
        // dagerous permissions for such apps as always granted runtime
        // permissions to keep per user flag state whether review is needed.
+4 −2
Original line number Diff line number Diff line

/*
 * Copyright (C) 2011 The Android Open Source Project
 *
@@ -2074,7 +2073,6 @@ public class UserManagerService extends IUserManager.Stub {
            synchronized (mRestrictionsLock) {
                mBaseUserRestrictions.append(userId, restrictions);
            }
            mPm.newUserCreated(userId);
            Intent addedIntent = new Intent(Intent.ACTION_USER_ADDED);
            addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
            mContext.sendBroadcastAsUser(addedIntent, UserHandle.ALL,
@@ -2634,6 +2632,10 @@ public class UserManagerService extends IUserManager.Stub {
            synchronized (mRestrictionsLock) {
                applyUserRestrictionsLR(userId);
            }
            UserInfo userInfo = getUserInfoNoChecks(userId);
            if (userInfo != null && !userInfo.isInitialized()) {
                mPm.onBeforeUserStartUninitialized(userId);
            }
        }
    }