Loading services/core/java/com/android/server/connectivity/PermissionMonitor.java +8 −8 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS; import static android.Manifest.permission.NETWORK_STACK; 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; Loading @@ -42,6 +43,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -161,16 +163,14 @@ public class PermissionMonitor { } @VisibleForTesting boolean hasPermission(PackageInfo app, String permission) { if (app.requestedPermissions != null) { for (String p : app.requestedPermissions) { if (permission.equals(p)) { return true; } } } 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); Loading services/core/java/com/android/server/pm/PackageManagerService.java +24 −20 Original line number Diff line number Diff line Loading @@ -18337,7 +18337,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 " Loading Loading @@ -18709,7 +18709,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); Loading @@ -18717,7 +18718,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 Loading Loading @@ -18747,6 +18748,7 @@ public class PackageManagerService extends IPackageManager.Stub } } if (outInfo != null) { // Delete the updated package outInfo.isRemovedPackageSystemUpdate = true; if (outInfo.removedChildPackages != null) { Loading @@ -18764,6 +18766,7 @@ public class PackageManagerService extends IPackageManager.Stub } } } } if (disabledPs.versionCode < deletedPs.versionCode) { // Delete data for downgrades Loading Loading @@ -22691,9 +22694,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; Loading Loading @@ -23354,8 +23357,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) { Loading
services/core/java/com/android/server/connectivity/PermissionMonitor.java +8 −8 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS; import static android.Manifest.permission.NETWORK_STACK; 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; Loading @@ -42,6 +43,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -161,16 +163,14 @@ public class PermissionMonitor { } @VisibleForTesting boolean hasPermission(PackageInfo app, String permission) { if (app.requestedPermissions != null) { for (String p : app.requestedPermissions) { if (permission.equals(p)) { return true; } } } 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); Loading
services/core/java/com/android/server/pm/PackageManagerService.java +24 −20 Original line number Diff line number Diff line Loading @@ -18337,7 +18337,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 " Loading Loading @@ -18709,7 +18709,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); Loading @@ -18717,7 +18718,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 Loading Loading @@ -18747,6 +18748,7 @@ public class PackageManagerService extends IPackageManager.Stub } } if (outInfo != null) { // Delete the updated package outInfo.isRemovedPackageSystemUpdate = true; if (outInfo.removedChildPackages != null) { Loading @@ -18764,6 +18766,7 @@ public class PackageManagerService extends IPackageManager.Stub } } } } if (disabledPs.versionCode < deletedPs.versionCode) { // Delete data for downgrades Loading Loading @@ -22691,9 +22694,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; Loading Loading @@ -23354,8 +23357,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) {