summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-05-13 15:06:13 -0700
committerDianne Hackborn <hackbod@google.com>2009-05-15 18:02:47 -0700
commita96cbb435d7b2197ab2b61fd98d14cbd6e0c5c3d (patch)
tree75e0804e6628f9bb818c5f6f918315640c721d4b /services/java
parentba2a3a1b32e242eea4e97c927d886e8987fde3d4 (diff)
downloadframeworks_base-a96cbb435d7b2197ab2b61fd98d14cbd6e0c5c3d.zip
frameworks_base-a96cbb435d7b2197ab2b61fd98d14cbd6e0c5c3d.tar.gz
frameworks_base-a96cbb435d7b2197ab2b61fd98d14cbd6e0c5c3d.tar.bz2
Implement compatibility support for WRITE_SDCARD permission.
Now old applications will automatically be granted it. Also renamed it from SDCARD_WRITE to WRITE_SDCARD to be consistent with our other permissions, and re-arranged how we do targetSdkVersion to actually be usuable for this kind of stuff. Note that right now this results in basically all apps being given the WRITE_SDCARD permission, because their targetSdkVersion is not set. I will be dealing with that in a future change.
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/PackageManagerService.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 4ce40b6..c85e10a 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -2828,6 +2828,21 @@ class PackageManagerService extends IPackageManager.Stub {
// we can't add any new permissions to it.
if (!gp.loadedPermissions.contains(perm)) {
allowed = false;
+ // Except... if this is a permission that was added
+ // to the platform (note: need to only do this when
+ // updating the platform).
+ final int NP = PackageParser.NEW_PERMISSIONS.length;
+ for (int ip=0; ip<NP; ip++) {
+ final PackageParser.NewPermissionInfo npi
+ = PackageParser.NEW_PERMISSIONS[ip];
+ if (npi.name.equals(perm)
+ && pkg.applicationInfo.targetSdkVersion < npi.sdkVersion) {
+ allowed = true;
+ Log.i(TAG, "Auto-granting WRITE_SDCARD to old pkg "
+ + pkg.packageName);
+ break;
+ }
+ }
}
}
if (allowed) {
@@ -3586,7 +3601,9 @@ class PackageManagerService extends IPackageManager.Stub {
} else {
// Re installation failed. Restore old information
// Remove new pkg information
- removePackageLI(newPackage, true);
+ if (newPackage != null) {
+ removePackageLI(newPackage, true);
+ }
// Add back the old system package
scanPackageLI(oldPkgSetting.codePath, oldPkgSetting.codePath,
oldPkgSetting.resourcePath,