diff options
| author | 2013-04-01 13:27:30 -0700 | |
|---|---|---|
| committer | 2013-04-02 09:38:00 -0700 | |
| commit | 3337dbf707b0c4fba34fe4ce7b36cfe1c474e02c (patch) | |
| tree | ae21e604844ee418c1674a4c778b1d95c3228ea0 | |
| parent | daae541ac3a9ce67a29ff141922182665eecd03f (diff) | |
grantPermissionsLPw: introduce isNewPlatformPermissionForPackage
Make grantPermissionsLPw by refactoring some code into a new
function, isNewPlatformPermissionForPackage.
No functional changes.
Change-Id: I467dacfe1fcf7e77cef4cb6df54536eeaafd9064
| -rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 80ff74eee85a..4c566ce412b7 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -5152,22 +5152,10 @@ public class PackageManagerService extends IPackageManager.Stub { // If this is an existing, non-system package, then // we can't add any new permissions to it. if (!allowedSig && !gp.grantedPermissions.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 " + perm + " to old pkg " - + pkg.packageName); - break; - } - } + allowed = isNewPlatformPermissionForPackage(perm, pkg); } } if (allowed) { @@ -5213,6 +5201,23 @@ public class PackageManagerService extends IPackageManager.Stub { ps.haveGids = true; } + private boolean isNewPlatformPermissionForPackage(String perm, PackageParser.Package pkg) { + boolean allowed = false; + 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 " + perm + " to old pkg " + + pkg.packageName); + break; + } + } + return allowed; + } + private boolean doSignaturePermission(String perm, PackageParser.Package pkg, BasePermission bp, HashSet<String> origPermissions) { boolean allowed; |