diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2014-06-08 00:33:48 +0200 |
---|---|---|
committer | Michael Bestas <mikeioannina@cyanogenmod.org> | 2016-12-03 07:33:05 -0800 |
commit | 2905e604a691cf8d04b9014f74b41d0f7d6079e4 (patch) | |
tree | 4aad82c380fa1a7ff28eea43cd748387bf64cc7f | |
parent | 0abadb1a3fb040ae58cd061d29a1f89740fa38fc (diff) | |
download | frameworks_base-2905e604a691cf8d04b9014f74b41d0f7d6079e4.zip frameworks_base-2905e604a691cf8d04b9014f74b41d0f7d6079e4.tar.gz frameworks_base-2905e604a691cf8d04b9014f74b41d0f7d6079e4.tar.bz2 |
AppOps: Do not prune apps that are not present
Do not prune apps that are not currently present in the device (like
USB memory ones). While booting, they are not available but must not
be purged from AppOps, because they are still present in the Android
app database.
Issue-Id: CYAN-2811
Change-Id: I6680cbdf0022812b45d966dffee754399e92accb
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r-- | services/core/java/com/android/server/AppOpsService.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index 3b12ed6..b205d24 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -322,10 +322,17 @@ public class AppOpsService extends IAppOpsService.Stub { } catch (RemoteException ignored) { } if (curUid != ops.uidState.uid) { - Slog.i(TAG, "Pruning old package " + ops.packageName - + "/" + ops.uidState + ": new uid=" + curUid); - it.remove(); - changed = true; + // Do not prune apps that are not currently present in the device + // (like SDcard ones). While booting, SDcards are not available but + // must not be purged from AppOps, because they are still present + // in the Android app database. + String pkgName = mContext.getPackageManager().getNameForUid(ops.uidState.uid); + if (curUid != -1 || pkgName == null || !pkgName.equals(ops.packageName)) { + Slog.i(TAG, "Pruning old package " + ops.packageName + + "/" + ops.uidState + ": new uid=" + curUid); + it.remove(); + changed = true; + } } } |