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

Commit a9c35b3e authored by Lee Shombert's avatar Lee Shombert
Browse files

Revert "Do not cache wildcard users (PackageManager)"

This reverts commit 8d6900e0.

Reason for revert: The UIDs in this CL are Linux UIDs, which are never
negative.  The @UserIdInt annotation is incorrect and the bypass()
override is unnecessary.  See the comments on ag/15339446 for another
instance of this issue.

Change-Id: I79ccbb40c3f0ab1a3bb48f55da5a72696d4fb2b1
parent 2ae9aa42
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -1014,17 +1014,13 @@ public class ApplicationPackageManager extends PackageManager {
                    }
                }
                @Override
                protected boolean bypass(Integer uid) {
                    return uid < 0;
                }
                @Override
                public String queryToString(Integer uid) {
                    return String.format("uid=%d", uid.intValue());
                }
            };

    @Override
    public String[] getPackagesForUid(@UserIdInt int uid) {
    public String[] getPackagesForUid(int uid) {
        return mGetPackagesForUidCache.query(uid).value();
    }

@@ -1039,7 +1035,7 @@ public class ApplicationPackageManager extends PackageManager {
    }

    @Override
    public String getNameForUid(@UserIdInt int uid) {
    public String getNameForUid(int uid) {
        try {
            return mPM.getNameForUid(uid);
        } catch (RemoteException e) {
+2 −12
Original line number Diff line number Diff line
@@ -9096,7 +9096,6 @@ public abstract class PackageManager {
    private static final class ApplicationInfoQuery {
        final String packageName;
        final int flags;
        @UserIdInt
        final int userId;

        ApplicationInfoQuery(@Nullable String packageName, int flags, int userId) {
@@ -9158,10 +9157,6 @@ public abstract class PackageManager {
                            query.packageName, query.flags, query.userId);
                }
                @Override
                protected boolean bypass(ApplicationInfoQuery query) {
                    return query.userId < 0;
                }
                @Override
                protected ApplicationInfo maybeCheckConsistency(
                        ApplicationInfoQuery query, ApplicationInfo proposedResult) {
                    // Implementing this debug check for ApplicationInfo would require a
@@ -9172,7 +9167,7 @@ public abstract class PackageManager {

    /** @hide */
    public static ApplicationInfo getApplicationInfoAsUserCached(
            String packageName, int flags, @UserIdInt int userId) {
            String packageName, int flags, int userId) {
        return sApplicationInfoCache.query(
                new ApplicationInfoQuery(packageName, flags, userId));
    }
@@ -9204,7 +9199,6 @@ public abstract class PackageManager {
    private static final class PackageInfoQuery {
        final String packageName;
        final int flags;
        @UserIdInt
        final int userId;

        PackageInfoQuery(@Nullable String packageName, int flags, int userId) {
@@ -9265,10 +9259,6 @@ public abstract class PackageManager {
                            query.packageName, query.flags, query.userId);
                }
                @Override
                protected boolean bypass(PackageInfoQuery query) {
                    return query.userId < 0;
                }
                @Override
                protected PackageInfo maybeCheckConsistency(
                        PackageInfoQuery query, PackageInfo proposedResult) {
                    // Implementing this debug check for PackageInfo would require a
@@ -9279,7 +9269,7 @@ public abstract class PackageManager {

    /** @hide */
    public static PackageInfo getPackageInfoAsUserCached(
            String packageName, int flags, @UserIdInt int userId) {
            String packageName, int flags, int userId) {
        return sPackageInfoCache.query(new PackageInfoQuery(packageName, flags, userId));
    }