diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-03-12 10:51:26 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-03-12 15:07:31 -0700 |
commit | 7924512aa12c6af37d90e8ccfcdf04eb78a294a3 (patch) | |
tree | d0b539a6b6ea5d810458196dcff5f377428d3311 /tools | |
parent | 05f692e8050c3650ec123b2361143a121e2e7d4b (diff) | |
download | frameworks_base-7924512aa12c6af37d90e8ccfcdf04eb78a294a3.zip frameworks_base-7924512aa12c6af37d90e8ccfcdf04eb78a294a3.tar.gz frameworks_base-7924512aa12c6af37d90e8ccfcdf04eb78a294a3.tar.bz2 |
Add new READ_EXTERNAL_STORAGE permission.
Also adds some initial compatibility code for dealing with it.
Change-Id: I104bff11798349e4aaa6da9b7be787b257daa1bb
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/Command.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index c79e243..198fce4 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -636,6 +636,9 @@ int doDump(Bundle* bundle) bool hasWriteExternalStoragePermission = false; bool hasReadPhoneStatePermission = false; + // If an app requests write storage, they will also get read storage. + bool hasReadExternalStoragePermission = 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 @@ -999,6 +1002,8 @@ int doDump(Bundle* bundle) hasTelephonyPermission = true; } else if (name == "android.permission.WRITE_EXTERNAL_STORAGE") { hasWriteExternalStoragePermission = true; + } else if (name == "android.permission.READ_EXTERNAL_STORAGE") { + hasReadExternalStoragePermission = true; } else if (name == "android.permission.READ_PHONE_STATE") { hasReadPhoneStatePermission = true; } @@ -1163,12 +1168,19 @@ int doDump(Bundle* bundle) if (targetSdk < 4) { if (!hasWriteExternalStoragePermission) { printf("uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'\n"); + hasWriteExternalStoragePermission = true; } if (!hasReadPhoneStatePermission) { printf("uses-permission:'android.permission.READ_PHONE_STATE'\n"); } } + // If the application has requested WRITE_EXTERNAL_STORAGE, we will + // force them to always take READ_EXTERNAL_STORAGE as well. + if (!hasReadExternalStoragePermission && hasWriteExternalStoragePermission) { + printf("uses-permission:'android.permission.READ_EXTERNAL_STORAGE'\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 |