Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a90d3b authored by Ben Gruver's avatar Ben Gruver Committed by Android (Google) Code Review
Browse files

Merge "Remove the sender package filter from the intent firewall" into jb-mr2-dev

parents cf837a6e 9cc60e81
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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) {
+3 −4
Original line number Diff line number Diff line
@@ -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<children.size(); i++) {
            if (!children.get(i).matches(ifw, intent, callerApp, callerPackage, callerUid,
                    callerPid, resolvedType, resolvedApp)) {
            if (!children.get(i).matches(ifw, intent, callerApp, callerUid, callerPid, resolvedType,
                    resolvedApp)) {
                return false;
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ class CategoryFilter implements Filter {
    }

    @Override
    public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp, String callerPackage,
    public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp,
            int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) {
        Set<String> categories = intent.getCategories();
        if (categories == null) {
+4 −7
Original line number Diff line number Diff line
@@ -29,14 +29,11 @@ interface Filter {
     *                  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.
     * @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);
}
+4 −6
Original line number Diff line number Diff line
@@ -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<Rule> 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();

Loading