Loading services/java/com/android/server/am/ActiveServices.java +2 −2 Original line number Diff line number Diff line Loading @@ -832,8 +832,8 @@ public final class ActiveServices { + " requires " + r.permission); return new ServiceLookupResult(null, r.permission); } if (!mAm.mIntentFirewall.checkService(service, callingUid, callingPid, resolvedType, r.appInfo)) { if (!mAm.mIntentFirewall.checkService(r.name, service, callingUid, callingPid, resolvedType, r.appInfo)) { return null; } return new ServiceLookupResult(r, null); Loading services/java/com/android/server/firewall/AndFilter.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; import org.xmlpull.v1.XmlPullParser; Loading @@ -25,11 +26,11 @@ import java.io.IOException; class AndFilter extends FilterList { @Override public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { for (int i=0; i<children.size(); i++) { if (!children.get(i).matches(ifw, intent, callerUid, callerPid, resolvedType, resolvedApp)) { if (!children.get(i).matches(ifw, resolvedComponent, intent, callerUid, callerPid, resolvedType, resolvedApp)) { return false; } } Loading services/java/com/android/server/firewall/CategoryFilter.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; import org.xmlpull.v1.XmlPullParser; Loading @@ -34,8 +35,8 @@ class CategoryFilter implements Filter { } @Override public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { Set<String> categories = intent.getCategories(); if (categories == null) { return false; Loading services/java/com/android/server/firewall/Filter.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; Loading @@ -24,12 +25,13 @@ interface Filter { * Does the given intent + context info match this filter? * * @param ifw The IntentFirewall instance * @param resolvedComponent The actual component that the intent was resolved to * @param intent The intent being started/bound/broadcast * @param callerUid The uid of the caller * @param callerPid The pid of the caller * @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, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp); boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp); } services/java/com/android/server/firewall/IntentFirewall.java +11 −9 Original line number Diff line number Diff line Loading @@ -120,25 +120,27 @@ public class IntentFirewall { */ public boolean checkStartActivity(Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mActivityResolver, TYPE_ACTIVITY, intent, callerUid, callerPid, resolvedType, resolvedApp); return checkIntent(mActivityResolver, intent.getComponent(), TYPE_ACTIVITY, intent, callerUid, callerPid, resolvedType, resolvedApp); } public boolean checkService(Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mServiceResolver, TYPE_SERVICE, intent, callerUid, callerPid, resolvedType, resolvedApp); public boolean checkService(ComponentName resolvedService, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mServiceResolver, resolvedService, TYPE_SERVICE, intent, callerUid, callerPid, resolvedType, resolvedApp); } public boolean checkIntent(FirewallIntentResolver resolver, int intentType, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean checkIntent(FirewallIntentResolver resolver, ComponentName resolvedComponent, int intentType, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { List<Rule> matchingRules = resolver.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, callerUid, callerPid, resolvedType, resolvedApp)) { if (rule.matches(this, resolvedComponent, intent, callerUid, callerPid, resolvedType, resolvedApp)) { block |= rule.getBlock(); log |= rule.getLog(); Loading Loading
services/java/com/android/server/am/ActiveServices.java +2 −2 Original line number Diff line number Diff line Loading @@ -832,8 +832,8 @@ public final class ActiveServices { + " requires " + r.permission); return new ServiceLookupResult(null, r.permission); } if (!mAm.mIntentFirewall.checkService(service, callingUid, callingPid, resolvedType, r.appInfo)) { if (!mAm.mIntentFirewall.checkService(r.name, service, callingUid, callingPid, resolvedType, r.appInfo)) { return null; } return new ServiceLookupResult(r, null); Loading
services/java/com/android/server/firewall/AndFilter.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; import org.xmlpull.v1.XmlPullParser; Loading @@ -25,11 +26,11 @@ import java.io.IOException; class AndFilter extends FilterList { @Override public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { for (int i=0; i<children.size(); i++) { if (!children.get(i).matches(ifw, intent, callerUid, callerPid, resolvedType, resolvedApp)) { if (!children.get(i).matches(ifw, resolvedComponent, intent, callerUid, callerPid, resolvedType, resolvedApp)) { return false; } } Loading
services/java/com/android/server/firewall/CategoryFilter.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; import org.xmlpull.v1.XmlPullParser; Loading @@ -34,8 +35,8 @@ class CategoryFilter implements Filter { } @Override public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { Set<String> categories = intent.getCategories(); if (categories == null) { return false; Loading
services/java/com/android/server/firewall/Filter.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.firewall; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ApplicationInfo; Loading @@ -24,12 +25,13 @@ interface Filter { * Does the given intent + context info match this filter? * * @param ifw The IntentFirewall instance * @param resolvedComponent The actual component that the intent was resolved to * @param intent The intent being started/bound/broadcast * @param callerUid The uid of the caller * @param callerPid The pid of the caller * @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, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp); boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp); }
services/java/com/android/server/firewall/IntentFirewall.java +11 −9 Original line number Diff line number Diff line Loading @@ -120,25 +120,27 @@ public class IntentFirewall { */ public boolean checkStartActivity(Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mActivityResolver, TYPE_ACTIVITY, intent, callerUid, callerPid, resolvedType, resolvedApp); return checkIntent(mActivityResolver, intent.getComponent(), TYPE_ACTIVITY, intent, callerUid, callerPid, resolvedType, resolvedApp); } public boolean checkService(Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mServiceResolver, TYPE_SERVICE, intent, callerUid, callerPid, resolvedType, resolvedApp); public boolean checkService(ComponentName resolvedService, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { return checkIntent(mServiceResolver, resolvedService, TYPE_SERVICE, intent, callerUid, callerPid, resolvedType, resolvedApp); } public boolean checkIntent(FirewallIntentResolver resolver, int intentType, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { public boolean checkIntent(FirewallIntentResolver resolver, ComponentName resolvedComponent, int intentType, Intent intent, int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) { List<Rule> matchingRules = resolver.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, callerUid, callerPid, resolvedType, resolvedApp)) { if (rule.matches(this, resolvedComponent, intent, callerUid, callerPid, resolvedType, resolvedApp)) { block |= rule.getBlock(); log |= rule.getLog(); Loading