From cfbfafe1b9ca2fd135a4fb6b528b3829830803bf Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 21 Jul 2015 16:57:51 -0700 Subject: Work on issue #22303510: Additional permissions aren't properly... ...disabled after toggling them off Keep track of whether a permission that has been declared by an app was able to actually be installed in the system, along with an API to find this information so that system UI can tell whether that permission is of interest. Also clean up some of the permission debug output. Change-Id: If4541bedb857789b255bb18f03cad155dcda0b95 --- .../android/server/pm/PackageManagerService.java | 11 ++-- .../core/java/com/android/server/pm/Settings.java | 63 ++++++++++++++++------ 2 files changed, 56 insertions(+), 18 deletions(-) (limited to 'services') diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index c139389..e456370 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -7321,6 +7321,9 @@ public class PackageManagerService extends IPackageManager.Stub { for (i=0; i: info about given package"); pw.println(" installs: details about install sessions"); - pw.println(" d[omain-preferred-apps]: print domains preferred apps"); - pw.println(" i[ntent-filter-verifiers]|ifv: print intent filter verifier info"); + pw.println(" : info about given package"); return; } else if ("--checkin".equals(opt)) { checkin = true; diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 92b9da6..736b153 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -4120,6 +4120,28 @@ final class Settings { pw.print(prefix); pw.print(" pkgFlags="); printFlags(pw, ps.pkgFlags, FLAG_DUMP_SPEC); pw.println(); + if (ps.pkg != null && ps.pkg.permissions != null && ps.pkg.permissions.size() > 0) { + final ArrayList perms = ps.pkg.permissions; + pw.print(prefix); pw.println(" declared permissions:"); + for (int i=0; i 0) { pw.print(prefix); pw.println(" disabledComponents:"); for (String s : cmp) { - pw.print(prefix); pw.print(" "); pw.println(s); + pw.print(prefix); pw.print(" "); pw.println(s); } } cmp = ps.getEnabledComponents(user.id); if (cmp != null && cmp.size() > 0) { pw.print(prefix); pw.println(" enabledComponents:"); for (String s : cmp) { - pw.print(prefix); pw.print(" "); pw.println(s); + pw.print(prefix); pw.print(" "); pw.println(s); } } } @@ -4267,11 +4289,14 @@ final class Settings { pw.print(" type="); pw.print(p.type); pw.print(" prot="); pw.println(PermissionInfo.protectionToString(p.protectionLevel)); - if (p.packageSetting != null) { - pw.print(" packageSetting="); pw.println(p.packageSetting); - } if (p.perm != null) { pw.print(" perm="); pw.println(p.perm); + if (p.perm.info.flags != PermissionInfo.FLAG_INSTALLED) { + pw.print(" flags=0x"); pw.println(Integer.toHexString(p.perm.info.flags)); + } + } + if (p.packageSetting != null) { + pw.print(" packageSetting="); pw.println(p.packageSetting); } if (READ_EXTERNAL_STORAGE.equals(p.name)) { pw.print(" enforced="); @@ -4372,24 +4397,32 @@ final class Settings { continue; } pw.print(prefix); pw.print(" "); pw.print(permissionState.getName()); - pw.print(", granted="); pw.print(permissionState.isGranted()); - pw.print(", flags="); pw.println(permissionFlagsToString( - permissionState.getFlags())); + pw.print(": granted="); pw.print(permissionState.isGranted()); + pw.println(permissionFlagsToString(", flags=", + permissionState.getFlags())); } } } - private static String permissionFlagsToString(int flags) { - StringBuilder flagsString = new StringBuilder(); - flagsString.append("[ "); + private static String permissionFlagsToString(String prefix, int flags) { + StringBuilder flagsString = null; while (flags != 0) { + if (flagsString == null) { + flagsString = new StringBuilder(); + flagsString.append(prefix); + flagsString.append("[ "); + } final int flag = 1 << Integer.numberOfTrailingZeros(flags); flags &= ~flag; flagsString.append(PackageManager.permissionFlagToString(flag)); flagsString.append(' '); } - flagsString.append(']'); - return flagsString.toString(); + if (flagsString != null) { + flagsString.append(']'); + return flagsString.toString(); + } else { + return ""; + } } void dumpInstallPermissionsLPr(PrintWriter pw, String prefix, ArraySet permissionNames, @@ -4403,8 +4436,8 @@ final class Settings { continue; } pw.print(prefix); pw.print(" "); pw.print(permissionState.getName()); - pw.print(", granted="); pw.print(permissionState.isGranted()); - pw.print(", flags="); pw.println(permissionFlagsToString( + pw.print(": granted="); pw.print(permissionState.isGranted()); + pw.println(permissionFlagsToString(", flags=", permissionState.getFlags())); } } -- cgit v1.1