Merge "Use killUid() instead of killApplication()." into rvc-dev

This commit is contained in:
Martijn Coenen
2020-06-05 14:45:17 +00:00
committed by Android (Google) Code Review

View File

@@ -4657,9 +4657,8 @@ class StorageManagerService extends IStorageManager.Stub
private void killAppForOpChange(int code, int uid, String packageName) { private void killAppForOpChange(int code, int uid, String packageName) {
final IActivityManager am = ActivityManager.getService(); final IActivityManager am = ActivityManager.getService();
try { try {
am.killApplication(packageName, am.killUid(UserHandle.getAppId(uid), UserHandle.USER_ALL,
UserHandle.getAppId(uid), AppOpsManager.opToName(code) + " changed.");
UserHandle.USER_ALL, AppOpsManager.opToName(code) + " changed.");
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -4681,7 +4680,12 @@ class StorageManagerService extends IStorageManager.Stub
// results in a bad UX, especially since the gid only gives access // results in a bad UX, especially since the gid only gives access
// to unreliable volumes, USB OTGs that are rarely mounted. The app // to unreliable volumes, USB OTGs that are rarely mounted. The app
// will get the external_storage gid on next organic restart. // will get the external_storage gid on next organic restart.
if (packageName != null) {
killAppForOpChange(code, uid, packageName); killAppForOpChange(code, uid, packageName);
} else {
// TODO(b/158283222) this can happen, figure out if we need
// to kill in this case as well.
}
} }
return; return;
case OP_LEGACY_STORAGE: case OP_LEGACY_STORAGE: