summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-07-21 16:57:51 -0700
committerDianne Hackborn <hackbod@google.com>2015-07-21 17:01:15 -0700
commitcfbfafe1b9ca2fd135a4fb6b528b3829830803bf (patch)
tree7e482505909554ef6cc3367060628f71a061dfa1 /services
parent673ccfd45a81482d97eecf76dc0fef0dfd57be73 (diff)
downloadframeworks_base-cfbfafe1b9ca2fd135a4fb6b528b3829830803bf.zip
frameworks_base-cfbfafe1b9ca2fd135a4fb6b528b3829830803bf.tar.gz
frameworks_base-cfbfafe1b9ca2fd135a4fb6b528b3829830803bf.tar.bz2
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
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java11
-rw-r--r--services/core/java/com/android/server/pm/Settings.java63
2 files changed, 56 insertions, 18 deletions
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<N; i++) {
PackageParser.Permission p = pkg.permissions.get(i);
+ // Assume by default that we did not install this permission into the system.
+ p.info.flags &= ~PermissionInfo.FLAG_INSTALLED;
+
// Now that permission groups have a special meaning, we ignore permission
// groups for legacy apps to prevent unexpected behavior. In particular,
// permissions for one app being granted to someone just becuase they happen
@@ -7350,6 +7353,7 @@ public class PackageManagerService extends IPackageManager.Stub {
bp.perm = p;
bp.uid = pkg.applicationInfo.uid;
bp.sourcePackage = p.info.packageName;
+ p.info.flags |= PermissionInfo.FLAG_INSTALLED;
} else if (!currentOwnerIsSystem) {
String msg = "New decl " + p.owner + " of permission "
+ p.info.name + " is system; overriding " + bp.sourcePackage;
@@ -7375,6 +7379,7 @@ public class PackageManagerService extends IPackageManager.Stub {
bp.perm = p;
bp.uid = pkg.applicationInfo.uid;
bp.sourcePackage = p.info.packageName;
+ p.info.flags |= PermissionInfo.FLAG_INSTALLED;
if ((parseFlags&PackageParser.PARSE_CHATTY) != 0) {
if (r == null) {
r = new StringBuilder(256);
@@ -14688,12 +14693,12 @@ public class PackageManagerService extends IPackageManager.Stub {
pw.println(" s[hared-users]: dump shared user IDs");
pw.println(" m[essages]: print collected runtime messages");
pw.println(" v[erifiers]: print package verifier info");
+ pw.println(" d[omain-preferred-apps]: print domains preferred apps");
+ pw.println(" i[ntent-filter-verifiers]|ifv: print intent filter verifier info");
pw.println(" version: print database version info");
pw.println(" write: write current settings now");
- pw.println(" <package.name>: 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(" <package.name>: 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<PackageParser.Permission> perms = ps.pkg.permissions;
+ pw.print(prefix); pw.println(" declared permissions:");
+ for (int i=0; i<perms.size(); i++) {
+ PackageParser.Permission perm = perms.get(i);
+ if (permissionNames != null
+ && !permissionNames.contains(perm.info.name)) {
+ continue;
+ }
+ pw.print(prefix); pw.print(" "); pw.print(perm.info.name);
+ pw.print(": prot=");
+ pw.print(PermissionInfo.protectionToString(perm.info.protectionLevel));
+ if ((perm.info.flags&PermissionInfo.FLAG_COSTS_MONEY) != 0) {
+ pw.print(", COSTS_MONEY");
+ }
+ if ((perm.info.flags&PermissionInfo.FLAG_INSTALLED) != 0) {
+ pw.print(", INSTALLED");
+ }
+ pw.println();
+ }
+ }
+
if (ps.sharedUser == null || permissionNames != null) {
PermissionsState permissionsState = ps.getPermissionsState();
dumpInstallPermissionsLPr(pw, prefix + " ", permissionNames, permissionsState);
@@ -4155,14 +4177,14 @@ final class Settings {
if (cmp != null && cmp.size() > 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<String> 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()));
}
}