summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2011-12-08 08:46:03 -0800
committerKenny Root <kroot@google.com>2011-12-08 08:46:34 -0800
commit063a44e541335819b673fb1c20a338bbcaf3a3f5 (patch)
tree40cfd3630f98f27573f4d0b77012a401a3399d1e /tools
parent9cf8c86c624b1e76c4adef8fa60f4d5db7abe4da (diff)
downloadframeworks_base-063a44e541335819b673fb1c20a338bbcaf3a3f5.zip
frameworks_base-063a44e541335819b673fb1c20a338bbcaf3a3f5.tar.gz
frameworks_base-063a44e541335819b673fb1c20a338bbcaf3a3f5.tar.bz2
Add aapt support for implicitly-granted permissions
Bug: 2363582 Bug: 2877343 Change-Id: Iff7b496fb845e45fe1be2317089a96f7d63ed223
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/Command.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 637c27d..d7ac15e 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -625,6 +625,11 @@ int doDump(Bundle* bundle)
bool actImeService = false;
bool actWallpaperService = false;
+ // These two implement the implicit permissions that are granted
+ // to pre-1.6 applications.
+ bool hasWriteExternalStoragePermission = false;
+ bool hasReadPhoneStatePermission = false;
+
// This next group of variables is used to implement a group of
// backward-compatibility heuristics necessitated by the addition of
// some new uses-feature constants in 2.1 and 2.2. In most cases, the
@@ -986,6 +991,10 @@ int doDump(Bundle* bundle)
name == "android.permission.WRITE_APN_SETTINGS" ||
name == "android.permission.WRITE_SMS") {
hasTelephonyPermission = true;
+ } else if (name == "android.permission.WRITE_EXTERNAL_STORAGE") {
+ hasWriteExternalStoragePermission = true;
+ } else if (name == "android.permission.READ_PHONE_STATE") {
+ hasReadPhoneStatePermission = true;
}
printf("uses-permission:'%s'\n", name.string());
} else {
@@ -1144,6 +1153,16 @@ int doDump(Bundle* bundle)
}
}
+ // Pre-1.6 implicitly granted permission compatibility logic
+ if (targetSdk < 4) {
+ if (!hasWriteExternalStoragePermission) {
+ printf("uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'\n");
+ }
+ if (!hasReadPhoneStatePermission) {
+ printf("uses-permission:'android.permission.READ_PHONE_STATE'\n");
+ }
+ }
+
/* The following blocks handle printing "inferred" uses-features, based
* on whether related features or permissions are used by the app.
* Note that the various spec*Feature variables denote whether the