frameworks/base
修訂 | 2905e604a691cf8d04b9014f74b41d0f7d6079e4 (tree) |
---|---|
時間 | 2016-12-04 00:33:05 |
作者 | Jorge Ruesga <jorge@rues...> |
Commiter | Michael Bestas |
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>
@@ -322,10 +322,17 @@ public class AppOpsService extends IAppOpsService.Stub { | ||
322 | 322 | } catch (RemoteException ignored) { |
323 | 323 | } |
324 | 324 | if (curUid != ops.uidState.uid) { |
325 | - Slog.i(TAG, "Pruning old package " + ops.packageName | |
326 | - + "/" + ops.uidState + ": new uid=" + curUid); | |
327 | - it.remove(); | |
328 | - changed = true; | |
325 | + // Do not prune apps that are not currently present in the device | |
326 | + // (like SDcard ones). While booting, SDcards are not available but | |
327 | + // must not be purged from AppOps, because they are still present | |
328 | + // in the Android app database. | |
329 | + String pkgName = mContext.getPackageManager().getNameForUid(ops.uidState.uid); | |
330 | + if (curUid != -1 || pkgName == null || !pkgName.equals(ops.packageName)) { | |
331 | + Slog.i(TAG, "Pruning old package " + ops.packageName | |
332 | + + "/" + ops.uidState + ": new uid=" + curUid); | |
333 | + it.remove(); | |
334 | + changed = true; | |
335 | + } | |
329 | 336 | } |
330 | 337 | } |
331 | 338 |