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

Commit 2e886776 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure packages in shared user are valid" into qt-dev

parents b82f6d64 19a569ab
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -5646,9 +5646,11 @@ public class PackageManagerService extends IPackageManager.Stub
    private int checkUidPermissionImpl(String permName, int uid) {
        synchronized (mPackages) {
            final String[] packageNames = getPackagesForUid(uid);
            final PackageParser.Package pkg = (packageNames != null && packageNames.length > 0)
                    ? mPackages.get(packageNames[0])
                    : null;
            PackageParser.Package pkg = null;
            final int N = packageNames == null ? 0 : packageNames.length;
            for (int i = 0; pkg == null && i < N; i++) {
                pkg = mPackages.get(packageNames[i]);
            }
            // Additional logs for b/111075456; ignore system UIDs
            if (pkg == null && UserHandle.getAppId(uid) >= Process.FIRST_APPLICATION_UID) {
                if (packageNames == null || packageNames.length < 2) {
@@ -6385,6 +6387,16 @@ public class PackageManagerService extends IPackageManager.Stub
        }
    }
    /**
     * <em>IMPORTANT:</em> Not all packages returned by this method may be known
     * to the system. There are two conditions in which this may occur:
     * <ol>
     *   <li>The package is on adoptable storage and the device has been removed</li>
     *   <li>The package is being removed and the internal structures are partially updated</li>
     * </ol>
     * The second is an artifact of the current data structures and should be fixed. See
     * b/111075456 for one such instance.
     */
    @Override
    public String[] getPackagesForUid(int uid) {
        return getPackagesForUid_debug(uid, false);