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

Commit 6a8a1dd5 authored by Lee Shombert's avatar Lee Shombert
Browse files

Fix a leak in HasSystemFeatureCache.

Bug: 150037560

Make HasSystemFeatureQuery static so that it does not retain a handle
to ApplicationPackageManager.

Test: Boot with an instrumented image to verify that caching still works
as expected.  Took a heap profile to verify that there were no leaks in
the cache.

Change-Id: I2cd39a6dfab9cc1bf04bb7f55638a572213f04ce
parent abcbadb4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import android.util.Log;
import android.view.Display;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.Immutable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.UserIcons;
@@ -612,7 +613,11 @@ public class ApplicationPackageManager extends PackageManager {
        return hasSystemFeature(name, 0);
    }

    private class HasSystemFeatureQuery {
    /**
     * Identifies a single hasSystemFeature query.
     */
    @Immutable
    private static final class HasSystemFeatureQuery {
        public final String name;
        public final int version;
        public HasSystemFeatureQuery(String n, int v) {