From 31b0e0e86ad061cd8005e80817bcad017e2d56dd Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Thu, 5 Apr 2012 19:33:30 -0700 Subject: Implement call log permission compatibility. If a pre-JellyBean application requests read/write contacts, it will implicitly be given read/write call log. Change-Id: I029db4b09fda737bb8fba4e1611355ebdbbfd34f --- core/java/android/content/pm/PackageParser.java | 16 +++++++++++++--- tools/aapt/Command.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 15ccda3..7ff9bfa 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -94,10 +94,12 @@ public class PackageParser { public static class SplitPermissionInfo { public final String rootPerm; public final String[] newPerms; + public final int targetSdk; - public SplitPermissionInfo(String rootPerm, String[] newPerms) { + public SplitPermissionInfo(String rootPerm, String[] newPerms, int targetSdk) { this.rootPerm = rootPerm; this.newPerms = newPerms; + this.targetSdk = targetSdk; } } @@ -126,7 +128,14 @@ public class PackageParser { 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 }) + new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE }, + android.os.Build.VERSION_CODES.CUR_DEVELOPMENT+1), + new PackageParser.SplitPermissionInfo(android.Manifest.permission.READ_CONTACTS, + new String[] { android.Manifest.permission.READ_CALL_LOG }, + android.os.Build.VERSION_CODES.JELLY_BEAN), + new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_CONTACTS, + new String[] { android.Manifest.permission.WRITE_CALL_LOG }, + android.os.Build.VERSION_CODES.JELLY_BEAN) }; private String mArchiveSourcePath; @@ -1293,7 +1302,8 @@ public class PackageParser { for (int is=0; is= spi.targetSdk + || !pkg.requestedPermissions.contains(spi.rootPerm)) { break; } for (int in=0; in