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

Commit 218abfcd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Initialize caches os UserManagerService creation." into main

parents 4a84bde3 f107453a
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3763,7 +3763,8 @@ public class UserManager {
    }

    private static final String CACHE_KEY_IS_USER_UNLOCKED_PROPERTY =
            "cache_key.is_user_unlocked";
        PropertyInvalidatedCache.createPropertyName(
            PropertyInvalidatedCache.MODULE_SYSTEM, "is_user_unlocked");

    private final PropertyInvalidatedCache<Integer, Boolean> mIsUserUnlockedCache =
            new PropertyInvalidatedCache<Integer, Boolean>(
@@ -6694,7 +6695,9 @@ public class UserManager {
    }

    /* Cache key for anything that assumes that userIds cannot be re-used without rebooting. */
    private static final String CACHE_KEY_STATIC_USER_PROPERTIES = "cache_key.static_user_props";
    private static final String CACHE_KEY_STATIC_USER_PROPERTIES =
        PropertyInvalidatedCache.createPropertyName(
            PropertyInvalidatedCache.MODULE_SYSTEM, "static_user_props");

    private final PropertyInvalidatedCache<Integer, String> mProfileTypeCache =
            new PropertyInvalidatedCache<Integer, String>(32, CACHE_KEY_STATIC_USER_PROPERTIES) {
@@ -6721,7 +6724,9 @@ public class UserManager {
    }

    /* Cache key for UserProperties object. */
    private static final String CACHE_KEY_USER_PROPERTIES = "cache_key.user_properties";
    private static final String CACHE_KEY_USER_PROPERTIES =
        PropertyInvalidatedCache.createPropertyName(
            PropertyInvalidatedCache.MODULE_SYSTEM, "user_properties");

    // TODO: It would be better to somehow have this as static, so that it can work cross-context.
    private final PropertyInvalidatedCache<Integer, UserProperties> mUserPropertiesCache =
+15 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,21 @@ public class UserManagerService extends IUserManager.Stub {
        mUser0Allocations = DBG_ALLOCATION ? new AtomicInteger() : null;
        mPrivateSpaceAutoLockSettingsObserver = new SettingsObserver(mHandler);
        emulateSystemUserModeIfNeeded();
        initPropertyInvalidatedCaches();
    }

    /**
     * This method is used to invalidate the caches at server statup,
     * so that caches can start working.
     */
    private static final void initPropertyInvalidatedCaches() {
        if (android.multiuser.Flags.cachesNotInvalidatedAtStartReadOnly()) {
            UserManager.invalidateIsUserUnlockedCache();
            UserManager.invalidateQuietModeEnabledCache();
            UserManager.invalidateStaticUserProperties();
            UserManager.invalidateUserPropertiesCache();
            UserManager.invalidateUserSerialNumberCache();
        }
    }

    private boolean doesDeviceHardwareSupportPrivateSpace() {