• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂2905e604a691cf8d04b9014f74b41d0f7d6079e4 (tree)
時間2016-12-04 00:33:05
作者Jorge Ruesga <jorge@rues...>
CommiterMichael Bestas

Log Message

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>

Change Summary

差異

--- 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 {
322322 } catch (RemoteException ignored) {
323323 }
324324 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+ }
329336 }
330337 }
331338