am 2327239d: Merge "Handle \'root\' pseudo-package in the appops command"
* commit '2327239d65525d8ba2bdbedd6e59809fef447a12': Handle 'root' pseudo-package in the appops command
This commit is contained in:
@@ -168,7 +168,12 @@ public class AppOpsCommand extends BaseCommand {
|
|||||||
final IPackageManager pm = ActivityThread.getPackageManager();
|
final IPackageManager pm = ActivityThread.getPackageManager();
|
||||||
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
|
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.APP_OPS_SERVICE));
|
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) {
|
if (uid < 0) {
|
||||||
System.err.println("Error: No UID for " + packageName + " in user " + userId);
|
System.err.println("Error: No UID for " + packageName + " in user " + userId);
|
||||||
return;
|
return;
|
||||||
@@ -211,7 +216,12 @@ public class AppOpsCommand extends BaseCommand {
|
|||||||
final IPackageManager pm = ActivityThread.getPackageManager();
|
final IPackageManager pm = ActivityThread.getPackageManager();
|
||||||
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
|
final IAppOpsService appOpsService = IAppOpsService.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.APP_OPS_SERVICE));
|
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) {
|
if (uid < 0) {
|
||||||
System.err.println("Error: No UID for " + packageName + " in user " + userId);
|
System.err.println("Error: No UID for " + packageName + " in user " + userId);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user