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

Commit 626323eb authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Enable in-process permission caches for system_server"

parents e0b8dd4b 642aab2c
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -206,6 +206,10 @@ public abstract class PropertyInvalidatedCache<Query, Result> {
    private static final String TAG = "PropertyInvalidatedCache";
    private static final boolean DEBUG = false;
    private static final boolean VERIFY = false;
    // If this is true, dumpsys will dump the cache entries along with cache statistics.
    // Most of the time this causes dumpsys to fail because the output stream is too
    // large.  Only set it to true in development images.
    private static final boolean DETAILED = false;

    // Per-Cache performance counters. As some cache instances are declared static,
    @GuardedBy("mLock")
@@ -912,14 +916,13 @@ public abstract class PropertyInvalidatedCache<Query, Result> {
                    "    Current Size: %d, Max Size: %d, HW Mark: %d, Overflows: %d",
                    mCache.size(), mMaxEntries, mHighWaterMark, mMissOverflow));
            pw.println(String.format("    Enabled: %s", mDisabled ? "false" : "true"));
            pw.println("");

            Set<Map.Entry<Query, Result>> cacheEntries = mCache.entrySet();
            if (cacheEntries.size() == 0) {
                pw.println("");
            if (!DETAILED || cacheEntries.size() == 0) {
                return;
            }

            pw.println("");
            pw.println("    Contents:");
            for (Map.Entry<Query, Result> entry : cacheEntries) {
                String key = Objects.toString(entry.getKey());
+1 −1
Original line number Diff line number Diff line
@@ -609,7 +609,7 @@ public final class PermissionManager {
    /** @hide */
    private static final PropertyInvalidatedCache<PermissionQuery, Integer> sPermissionCache =
            new PropertyInvalidatedCache<PermissionQuery, Integer>(
                    16, CACHE_KEY_PACKAGE_INFO, "checkPermission") {
                    2048, CACHE_KEY_PACKAGE_INFO, "checkPermission") {
                @Override
                protected Integer recompute(PermissionQuery query) {
                    return checkPermissionUncached(query.permission, query.pid, query.uid);
+2 −1
Original line number Diff line number Diff line
@@ -378,8 +378,9 @@ public class PermissionManagerService extends IPermissionManager.Stub {
            @NonNull Injector injector) {
        mInjector = injector;
        // The package info cache is the cache for package and permission information.
        // Disable the package info and package permission caches locally but leave the
        // checkPermission cache active.
        mInjector.invalidatePackageInfoCache();
        mInjector.disablePermissionCache();
        mInjector.disablePackageNamePermissionCache();

        mContext = context;