From 9cc60e81d700f12a5fa7e2246301268bbaafc6fb Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Fri, 5 Apr 2013 09:56:51 -0700 Subject: [PATCH] Remove the sender package filter from the intent firewall Change-Id: I3124c6969984eef646f22216c709bdfb324d6679 --- .../java/com/android/server/am/ActivityStack.java | 3 +- .../com/android/server/firewall/AndFilter.java | 7 ++- .../android/server/firewall/CategoryFilter.java | 2 +- .../java/com/android/server/firewall/Filter.java | 11 ++--- .../android/server/firewall/IntentFirewall.java | 10 ++-- .../com/android/server/firewall/NotFilter.java | 7 ++- .../java/com/android/server/firewall/OrFilter.java | 7 ++- .../com/android/server/firewall/PortFilter.java | 3 +- .../com/android/server/firewall/SenderFilter.java | 12 ++--- .../server/firewall/SenderPermissionFilter.java | 3 +- .../com/android/server/firewall/StringFilter.java | 57 +++++++++------------- 11 files changed, 48 insertions(+), 74 deletions(-) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 3d7da7bb70ec..3d2e912d69fa 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -2594,8 +2594,7 @@ final class ActivityStack { } boolean abort = !mService.mIntentFirewall.checkStartActivity(intent, - callerApp==null?null:callerApp.info, callingPackage, callingUid, callingPid, - resolvedType, aInfo); + callerApp==null?null:callerApp.info, callingUid, callingPid, resolvedType, aInfo); if (mMainStack) { if (mService.mController != null) { diff --git a/services/java/com/android/server/firewall/AndFilter.java b/services/java/com/android/server/firewall/AndFilter.java index cabf00b3b271..e4276d085196 100644 --- a/services/java/com/android/server/firewall/AndFilter.java +++ b/services/java/com/android/server/firewall/AndFilter.java @@ -26,11 +26,10 @@ import java.io.IOException; class AndFilter extends FilterList { @Override public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp, - String callerPackage, int callerUid, int callerPid, String resolvedType, - ApplicationInfo resolvedApp) { + int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { for (int i=0; i categories = intent.getCategories(); if (categories == null) { diff --git a/services/java/com/android/server/firewall/Filter.java b/services/java/com/android/server/firewall/Filter.java index 76394662572d..0e783e80316f 100644 --- a/services/java/com/android/server/firewall/Filter.java +++ b/services/java/com/android/server/firewall/Filter.java @@ -26,17 +26,14 @@ interface Filter { * @param ifw The IntentFirewall instance * @param intent The intent being started/bound/broadcast * @param callerApp An ApplicationInfo of an application in the caller's process. This may not - * be the specific app that is actually sending the intent. This also may be - * null, if the caller is the system process, or an unrecognized process (e.g. - * am start) - * @param callerPackage The package name of the component sending the intent. This value is -* provided by the caller and might be forged/faked. + * be the specific app that is actually sending the intent. This also may be + * null, if the caller is the system process, or an unrecognized process (e.g. + * am start) * @param callerUid * @param callerPid * @param resolvedType The resolved mime type of the intent * @param resolvedApp The application that contains the resolved component that the intent is */ boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp, - String callerPackage, int callerUid, int callerPid, String resolvedType, - ApplicationInfo resolvedApp); + int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp); } diff --git a/services/java/com/android/server/firewall/IntentFirewall.java b/services/java/com/android/server/firewall/IntentFirewall.java index 062183b1b090..46a0917b0795 100644 --- a/services/java/com/android/server/firewall/IntentFirewall.java +++ b/services/java/com/android/server/firewall/IntentFirewall.java @@ -76,7 +76,6 @@ public class IntentFirewall { StringFilter.HOST, StringFilter.MIME_TYPE, StringFilter.PATH, - StringFilter.SENDER_PACKAGE, StringFilter.SSP, CategoryFilter.FACTORY, @@ -98,17 +97,16 @@ public class IntentFirewall { readRules(getRulesFile()); } - public boolean checkStartActivity(Intent intent, ApplicationInfo callerApp, - String callerPackage, int callerUid, int callerPid, String resolvedType, - ActivityInfo resolvedActivity) { + public boolean checkStartActivity(Intent intent, ApplicationInfo callerApp, int callerUid, + int callerPid, String resolvedType, ActivityInfo resolvedActivity) { List matchingRules = mActivityResolver.queryIntent(intent, resolvedType, false, 0); boolean log = false; boolean block = false; for (int i=0; i< matchingRules.size(); i++) { Rule rule = matchingRules.get(i); - if (rule.matches(this, intent, callerApp, callerPackage, callerUid, callerPid, - resolvedType, resolvedActivity.applicationInfo)) { + if (rule.matches(this, intent, callerApp, callerUid, callerPid, resolvedType, + resolvedActivity.applicationInfo)) { block |= rule.getBlock(); log |= rule.getLog(); diff --git a/services/java/com/android/server/firewall/NotFilter.java b/services/java/com/android/server/firewall/NotFilter.java index 2ff108a1db8b..f0fc337c5be2 100644 --- a/services/java/com/android/server/firewall/NotFilter.java +++ b/services/java/com/android/server/firewall/NotFilter.java @@ -33,10 +33,9 @@ class NotFilter implements Filter { @Override public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp, - String callerPackage, int callerUid, int callerPid, String resolvedType, - ApplicationInfo resolvedApp) { - return !mChild.matches(ifw, intent, callerApp, callerPackage, callerUid, callerPid, - resolvedType, resolvedApp); + int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { + return !mChild.matches(ifw, intent, callerApp, callerUid, callerPid, resolvedType, + resolvedApp); } public static final FilterFactory FACTORY = new FilterFactory("not") { diff --git a/services/java/com/android/server/firewall/OrFilter.java b/services/java/com/android/server/firewall/OrFilter.java index 1ed1c85ae1b0..72db31e2edf1 100644 --- a/services/java/com/android/server/firewall/OrFilter.java +++ b/services/java/com/android/server/firewall/OrFilter.java @@ -26,11 +26,10 @@ import java.io.IOException; class OrFilter extends FilterList { @Override public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp, - String callerPackage, int callerUid, int callerPid, String resolvedType, - ApplicationInfo resolvedApp) { + int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { for (int i=0; i