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

Unverified Commit 9f82ba71 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-8.1.0_r74' into staging/lineage-15.1_merge-android-8.1.0_r74

Android 8.1.0 release 74

* tag 'android-8.1.0_r74':
  Fixes NPE when preparing app data during init
  Use KNOWN_PACKAGES when shared lib consumers
  Handles null outInfo in deleteSystemPackageLI
  Fix security problem on PermissionMonitor#hasPermission

Change-Id: I578a27915317b36ecb04ac87751200125f96d294
parents ab4c74c9 e8ae9fcf
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
import static android.Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS;
import static android.content.pm.ApplicationInfo.FLAG_SYSTEM;
import static android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED;
import static android.content.pm.PackageManager.GET_PERMISSIONS;

import android.content.BroadcastReceiver;
@@ -39,6 +40,8 @@ import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.util.ArrayUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -150,16 +153,14 @@ public class PermissionMonitor {
        update(mUsers, mApps, true);
    }

    private boolean hasPermission(PackageInfo app, String permission) {
        if (app.requestedPermissions != null) {
            for (String p : app.requestedPermissions) {
                if (permission.equals(p)) {
                    return true;
                }
            }
        }
    private boolean hasPermission(final PackageInfo app, final String permission) {
        if (app.requestedPermissions == null || app.requestedPermissionsFlags == null) {
            return false;
        }
        final int index = ArrayUtils.indexOf(app.requestedPermissions, permission);
        if (index < 0 || index >= app.requestedPermissionsFlags.length) return false;
        return (app.requestedPermissionsFlags[index] & REQUESTED_PERMISSION_GRANTED) != 0;
    }

    private boolean hasNetworkPermission(PackageInfo app) {
        return hasPermission(app, CHANGE_NETWORK_STATE);
+24 −20
Original line number Diff line number Diff line
@@ -19634,7 +19634,7 @@ public class PackageManagerService extends IPackageManager.Stub
                            continue;
                        }
                        List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
                                libEntry.info, 0, currUserId);
                                libEntry.info, MATCH_KNOWN_PACKAGES, currUserId);
                        if (!ArrayUtils.isEmpty(libClientPackages)) {
                            Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
                                    + " hosting lib " + libEntry.info.getName() + " version "
@@ -19967,7 +19967,8 @@ public class PackageManagerService extends IPackageManager.Stub
     * Tries to delete system package.
     */
    private boolean deleteSystemPackageLIF(PackageParser.Package deletedPkg,
            PackageSetting deletedPs, int[] allUserHandles, int flags, PackageRemovedInfo outInfo,
            PackageSetting deletedPs, int[] allUserHandles, int flags,
            @Nullable PackageRemovedInfo outInfo,
            boolean writeSettings) {
        if (deletedPs.parentPackageName != null) {
            Slog.w(TAG, "Attempt to delete child system package " + deletedPkg.packageName);
@@ -19975,7 +19976,7 @@ public class PackageManagerService extends IPackageManager.Stub
        }
        final boolean applyUserRestrictions
                = (allUserHandles != null) && (outInfo.origUsers != null);
                = (allUserHandles != null) && outInfo != null && (outInfo.origUsers != null);
        final PackageSetting disabledPs;
        // Confirm if the system package has been updated
        // An updated system app can be deleted. This will also have to restore
@@ -20005,6 +20006,7 @@ public class PackageManagerService extends IPackageManager.Stub
            }
        }
        if (outInfo != null) {
            // Delete the updated package
            outInfo.isRemovedPackageSystemUpdate = true;
            if (outInfo.removedChildPackages != null) {
@@ -20022,6 +20024,7 @@ public class PackageManagerService extends IPackageManager.Stub
                    }
                }
            }
        }
        if (disabledPs.versionCode < deletedPs.versionCode) {
            // Delete data for downgrades
@@ -24286,9 +24289,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
            mSettings.writeKernelMappingLPr(ps);
        }
        final UserManager um = mContext.getSystemService(UserManager.class);
        final UserManagerService um = sUserManager;
        UserManagerInternal umInternal = getUserManagerInternal();
        for (UserInfo user : um.getUsers()) {
        for (UserInfo user : um.getUsers(false /* excludeDying */)) {
            final int flags;
            if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
                flags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
@@ -24928,8 +24931,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                continue;
            }
            final String packageName = ps.pkg.packageName;
            // Skip over if system app
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
            // Skip over if system app or static shared library
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0
                    || !TextUtils.isEmpty(ps.pkg.staticSharedLibName)) {
                continue;
            }
            if (DEBUG_CLEAN_APKS) {