summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-03-12 15:26:46 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-12 15:26:46 -0700
commit035c20f5b4f31a2a4b592ff5004fe67fef0106d2 (patch)
treeff95dfdf573554288125057cf8494b5226e3a234 /core
parentbdc5afeee57a943adac3896297fab74b96b307c1 (diff)
parent7924512aa12c6af37d90e8ccfcdf04eb78a294a3 (diff)
downloadframeworks_base-035c20f5b4f31a2a4b592ff5004fe67fef0106d2.zip
frameworks_base-035c20f5b4f31a2a4b592ff5004fe67fef0106d2.tar.gz
frameworks_base-035c20f5b4f31a2a4b592ff5004fe67fef0106d2.tar.bz2
Merge "Add new READ_EXTERNAL_STORAGE permission."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/pm/PackageParser.java45
-rw-r--r--core/res/AndroidManifest.xml7
-rwxr-xr-xcore/res/res/values/strings.xml9
3 files changed, 59 insertions, 2 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index e88ee02..207f077 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -89,11 +89,25 @@ public class PackageParser {
this.fileVersion = fileVersion;
}
}
-
+
+ /** @hide */
+ public static class SplitPermissionInfo {
+ public final String rootPerm;
+ public final String[] newPerms;
+
+ public SplitPermissionInfo(String rootPerm, String[] newPerms) {
+ this.rootPerm = rootPerm;
+ this.newPerms = newPerms;
+ }
+ }
+
/**
* List of new permissions that have been added since 1.0.
* NOTE: These must be declared in SDK version order, with permissions
* added to older SDKs appearing before those added to newer SDKs.
+ * If sdkVersion is 0, then this is not a permission that we want to
+ * automatically add to older apps, but we do want to allow it to be
+ * granted during a platform update.
* @hide
*/
public static final PackageParser.NewPermissionInfo NEW_PERMISSIONS[] =
@@ -104,6 +118,17 @@ public class PackageParser {
android.os.Build.VERSION_CODES.DONUT, 0)
};
+ /**
+ * List of permissions that have been split into more granular or dependent
+ * permissions.
+ * @hide
+ */
+ public static final PackageParser.SplitPermissionInfo SPLIT_PERMISSIONS[] =
+ new PackageParser.SplitPermissionInfo[] {
+ new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE })
+ };
+
private String mArchiveSourcePath;
private String[] mSeparateProcesses;
private boolean mOnlyCoreApps;
@@ -1245,7 +1270,23 @@ public class PackageParser {
if (implicitPerms != null) {
Slog.i(TAG, implicitPerms.toString());
}
-
+
+ final int NS = PackageParser.SPLIT_PERMISSIONS.length;
+ for (int is=0; is<NS; is++) {
+ final PackageParser.SplitPermissionInfo spi
+ = PackageParser.SPLIT_PERMISSIONS[is];
+ if (!pkg.requestedPermissions.contains(spi.rootPerm)) {
+ break;
+ }
+ for (int in=0; in<spi.newPerms.length; in++) {
+ final String perm = spi.newPerms[in];
+ if (!pkg.requestedPermissions.contains(perm)) {
+ pkg.requestedPermissions.add(perm);
+ pkg.requestedPermissionsRequired.add(Boolean.TRUE);
+ }
+ }
+ }
+
if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
&& pkg.applicationInfo.targetSdkVersion
>= android.os.Build.VERSION_CODES.DONUT)) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 17d2212..8f03fe0 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -639,6 +639,13 @@
android:label="@string/permgrouplab_storage"
android:description="@string/permgroupdesc_storage" />
+ <!-- Allows an application to read from external storage -->
+ <permission android:name="android.permission.READ_EXTERNAL_STORAGE"
+ android:permissionGroup="android.permission-group.STORAGE"
+ android:label="@string/permlab_sdcardRead"
+ android:description="@string/permdesc_sdcardRead"
+ android:protectionLevel="dangerous" />
+
<!-- Allows an application to write to external storage -->
<permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:permissionGroup="android.permission-group.STORAGE"
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index c8df649..7137b7c 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1429,6 +1429,15 @@
user dictionary.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
+ <string name="permlab_sdcardRead" product="nosdcard">read USB storage contents</string>
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_sdcardRead" product="default">read SD card contents</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
+ <string name="permdesc_sdcardRead" product="nosdcard">Allows the app to read contents of USB storage.</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_sdcardRead" product="default">Allows the app to read contents of SD card.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
<string name="permlab_sdcardWrite" product="nosdcard">modify/delete USB storage contents</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_sdcardWrite" product="default">modify/delete SD card contents</string>