am 2327239d: Merge "Handle \'root\' pseudo-package in the appops command"
* commit '2327239d65525d8ba2bdbedd6e59809fef447a12':
Handle 'root' pseudo-package in the appops command
diff --git a/cmds/appops/src/com/android/commands/appops/AppOpsCommand.java b/cmds/appops/src/com/android/commands/appops/AppOpsCommand.java
index 3ec63b4..98dc752 100644
--- a/cmds/appops/src/com/android/commands/appops/AppOpsCommand.java
+++ b/cmds/appops/src/com/android/commands/appops/AppOpsCommand.java
@@ -168,7 +168,12 @@
final IPackageManager pm = ActivityThread.getPackageManager();
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
ServiceManager.getService(Context.APP_OPS_SERVICE));
- final int uid = pm.getPackageUid(packageName, userId);
+ final int uid;
+ if ("root".equals(packageName)) {
+ uid = 0;
+ } else {
+ uid = pm.getPackageUid(packageName, userId);
+ }
if (uid < 0) {
System.err.println("Error: No UID for " + packageName + " in user " + userId);
return;
@@ -211,7 +216,12 @@
final IPackageManager pm = ActivityThread.getPackageManager();
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
ServiceManager.getService(Context.APP_OPS_SERVICE));
- final int uid = pm.getPackageUid(packageName, userId);
+ final int uid;
+ if ("root".equals(packageName)) {
+ uid = 0;
+ } else {
+ uid = pm.getPackageUid(packageName, userId);
+ }
if (uid < 0) {
System.err.println("Error: No UID for " + packageName + " in user " + userId);
return;