Revert "Reset system fixed to clean storage perm model 2"
This reverts commit ceeb631a22e460fc0e63c3937cb925f878c3bf4b.
Reason for revert: This was only a temporary measure to clean up storage permission models that don't exist anymore
Bug: 129422305
Change-Id: Id2ff21c531f628395c0ea013b62f264c6d777c23
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index b819aa5..5df2f86 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -302,7 +302,6 @@
}
public void grantDefaultPermissions(int userId) {
- removeSystemFixedStorage(userId);
grantPermissionsToSysComponentsAndPrivApps(userId);
grantDefaultSystemHandlerPermissions(userId);
grantDefaultPermissionExceptions(userId);
@@ -311,46 +310,6 @@
}
}
- // STOPSHIP: This is meant to fix the devices messed up by storage permission model 2 and
- // should be removed once all devices were updated
- private void removeSystemFixedStorage(int userId) {
- List<PackageInfo> packages = mContext.getPackageManager().getInstalledPackagesAsUser(
- DEFAULT_PACKAGE_INFO_QUERY_FLAGS, userId);
-
- for (PackageInfo pkg : packages) {
- if (pkg == null || pkg.requestedPermissions == null) {
- continue;
- }
-
- for (String permission : pkg.requestedPermissions) {
- if (!(Manifest.permission.READ_EXTERNAL_STORAGE.equals(permission)
- || Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permission))) {
- continue;
- }
-
- int flags = mContext.getPackageManager().getPermissionFlags(permission,
- pkg.packageName, UserHandle.of(userId));
- if ((flags & PackageManager.FLAG_PERMISSION_SYSTEM_FIXED) == 0) {
- continue;
- }
-
- Log.v(TAG, "Removing system fixed " + pkg.packageName + "/" + permission);
- mContext.getPackageManager().updatePermissionFlags(permission, pkg.packageName,
- PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, 0, UserHandle.of(userId));
-
- if (!doesPackageSupportRuntimePermissions(pkg)
- || (flags & (PackageManager.FLAG_PERMISSION_USER_SET
- | PackageManager.FLAG_PERMISSION_POLICY_FIXED)) != 0) {
- continue;
- }
-
- Log.v(TAG, "Revoking " + pkg.packageName + "/" + permission);
- mContext.getPackageManager().revokeRuntimePermission(pkg.packageName, permission,
- UserHandle.of(userId));
- }
- }
- }
-
private void grantRuntimePermissionsForSystemPackage(int userId, PackageInfo pkg) {
Set<String> permissions = new ArraySet<>();
for (String permission : pkg.requestedPermissions) {