summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2013-10-30 12:20:06 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-30 12:20:06 -0700
commit9dcfcc845d5fdbedbbb41e0d22dd3e16a6a53fe5 (patch)
tree29a202a276093040315de0114721d96d05e6adee
parent9a4c69882401f243f07c3bf77bf57a957b89c767 (diff)
parent194271565399a9216b8e0dece118874fc5f7e474 (diff)
downloadframeworks_base-9dcfcc845d5fdbedbbb41e0d22dd3e16a6a53fe5.zip
frameworks_base-9dcfcc845d5fdbedbbb41e0d22dd3e16a6a53fe5.tar.gz
frameworks_base-9dcfcc845d5fdbedbbb41e0d22dd3e16a6a53fe5.tar.bz2
am 19427156: Merge "Don\'t crash when preferred activity settings are malformed" into klp-dev
* commit '194271565399a9216b8e0dece118874fc5f7e474': Don't crash when preferred activity settings are malformed
-rwxr-xr-xservices/java/com/android/server/pm/PackageManagerService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index a781d5f..3d6b3c9 100755
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -9965,6 +9965,10 @@ public class PackageManagerService extends IPackageManager.Stub {
// writer
int callingUid = Binder.getCallingUid();
enforceCrossUserPermission(callingUid, userId, true, "add preferred activity");
+ if (filter.countActions() == 0) {
+ Slog.w(TAG, "Cannot set a preferred activity with no filter actions");
+ return;
+ }
synchronized (mPackages) {
if (mContext.checkCallingOrSelfPermission(
android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
@@ -10024,7 +10028,9 @@ public class PackageManagerService extends IPackageManager.Stub {
String category = filter.getCategory(0);
while (it.hasNext()) {
PreferredActivity pa = it.next();
- if (pa.getAction(0).equals(action) && pa.getCategory(0).equals(category)) {
+ if ((pa.countActions() == 0) || (pa.countCategories() == 0)
+ || (pa.getAction(0).equals(action)
+ && pa.getCategory(0).equals(category))) {
if (removed == null) {
removed = new ArrayList<PreferredActivity>();
}