summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/PackageManagerService.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-03-10 18:27:09 -0800
committerDianne Hackborn <hackbod@google.com>2010-03-10 21:26:23 -0800
commit2ee89ea2887252053c31541c54126a8b084c9bca (patch)
tree69be707136b1cde8ccfcb7bbb129e74ef2a64429 /services/java/com/android/server/PackageManagerService.java
parentd8929fa76881b4b0f12d66dfc118dec291a59177 (diff)
downloadframeworks_base-2ee89ea2887252053c31541c54126a8b084c9bca.zip
frameworks_base-2ee89ea2887252053c31541c54126a8b084c9bca.tar.gz
frameworks_base-2ee89ea2887252053c31541c54126a8b084c9bca.tar.bz2
Applications should -not- be able to set preferred activities.
I can't believe I let this slip through. And in the SDK no less. :( The APIs for setting preferred activities will now throw a security exception when used. This may break some apps, we'll see how it goes. If it is too bad we can just make these log and not throw anything, but I would much prefer they throw an exception. Change-Id: I3aed434750eef8b202aa9d5bd774a0121be521c6
Diffstat (limited to 'services/java/com/android/server/PackageManagerService.java')
-rw-r--r--services/java/com/android/server/PackageManagerService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 4c1356b..63afabc 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -6321,10 +6321,14 @@ class PackageManagerService extends IPackageManager.Stub {
}
public void clearPackagePreferredActivities(String packageName) {
- mContext.enforceCallingOrSelfPermission(
- android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
-
synchronized (mPackages) {
+ int uid = Binder.getCallingUid();
+ PackageParser.Package pkg = mPackages.get(packageName);
+ if (pkg.applicationInfo.uid != uid) {
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
+ }
+
if (clearPackagePreferredActivitiesLP(packageName)) {
mSettings.writeLP();
}