diff options
author | Christopher Tate <ctate@google.com> | 2013-11-05 12:28:10 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2013-11-05 16:27:07 -0800 |
commit | 3aeea1f25a901b2c8d41aee35af91cf415908f64 (patch) | |
tree | 10a5b39d47701e41bbf778e371076b9f324a6b96 /services/java | |
parent | 8869d6f3537b323d1c9d1339d057a4866520e649 (diff) | |
download | frameworks_base-3aeea1f25a901b2c8d41aee35af91cf415908f64.zip frameworks_base-3aeea1f25a901b2c8d41aee35af91cf415908f64.tar.gz frameworks_base-3aeea1f25a901b2c8d41aee35af91cf415908f64.tar.bz2 |
System package permission decls take precedence over 3rd party apps'
In particular, if a 3rd party app tries to define a permission that
turns out to be defined by system packages following an upgrade,
the system package gets ownership and grants are re-evaluated
on that basis.
Bug 11242510
Change-Id: Id3a2b53d52750c629414cd8226e33e5e03dd0c54
Diffstat (limited to 'services/java')
-rwxr-xr-x | services/java/com/android/server/pm/PackageManagerService.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 3d6b3c9..7291dd4 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -4959,6 +4959,18 @@ public class PackageManagerService extends IPackageManager.Stub { permissionMap.put(p.info.name, bp); } if (bp.perm == null) { + if (bp.sourcePackage != null + && !bp.sourcePackage.equals(p.info.packageName)) { + // If this is a permission that was formerly defined by a non-system + // app, but is now defined by a system app (following an upgrade), + // discard the previous declaration and consider the system's to be + // canonical. + if (isSystemApp(p.owner)) { + Slog.i(TAG, "New decl " + p.owner + " of permission " + + p.info.name + " is system"); + bp.sourcePackage = null; + } + } if (bp.sourcePackage == null || bp.sourcePackage.equals(p.info.packageName)) { BasePermission tree = findPermissionTreeLP(p.info.name); |