Loading services/core/java/com/android/server/IntentResolver.java +1 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public abstract class IntentResolver<F, R extends Object> { * Returns whether an intent matches the IntentFilter with a pre-resolved type. */ public static boolean intentMatchesFilter( IntentFilter filter, Intent intent, String resolvedType, boolean defaultOnly) { IntentFilter filter, Intent intent, String resolvedType) { final boolean debug = localLOGV || ((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0); Loading @@ -97,10 +97,6 @@ public abstract class IntentResolver<F, R extends Object> { int match = filter.match(intent.getAction(), resolvedType, intent.getScheme(), intent.getData(), intent.getCategories(), TAG); if (match >= 0 && defaultOnly && !filter.hasCategory(Intent.CATEGORY_DEFAULT)) { match = IntentFilter.NO_MATCH_CATEGORY; } if (match >= 0) { if (debug) { Slog.v(TAG, "Filter matched! match=0x" + Integer.toHexString(match)); Loading services/core/java/com/android/server/pm/ComputerEngine.java +4 −4 Original line number Diff line number Diff line Loading @@ -586,7 +586,7 @@ public class ComputerEngine implements Computer { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, intent, resolvedType, flags, filterCallingUid); list, false, intent, resolvedType, filterCallingUid); } } } else { Loading Loading @@ -616,7 +616,7 @@ public class ComputerEngine implements Computer { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, originalIntent, resolvedType, flags, filterCallingUid); list, false, originalIntent, resolvedType, filterCallingUid); } return skipPostResolution ? list : applyPostResolutionFilter( Loading Loading @@ -700,7 +700,7 @@ public class ComputerEngine implements Computer { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, intent, resolvedType, flags, callingUid); list, false, intent, resolvedType, callingUid); } } } else { Loading @@ -712,7 +712,7 @@ public class ComputerEngine implements Computer { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, originalIntent, resolvedType, flags, callingUid); list, false, originalIntent, resolvedType, callingUid); } return list; Loading services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +7 −10 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.compat.annotation.ChangeId; import android.compat.annotation.Disabled; import android.compat.annotation.EnabledAfter; import android.compat.annotation.Overridable; import android.content.Context; import android.content.Intent; Loading Loading @@ -198,7 +198,7 @@ public class PackageManagerServiceUtils { */ @Overridable @ChangeId @Disabled /* Enforcement reverted in T: b/274147456 */ @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) private static final long ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS = 161252188; /** Loading Loading @@ -1192,8 +1192,7 @@ public class PackageManagerServiceUtils { public static void applyEnforceIntentFilterMatching( PlatformCompat compat, ComponentResolverApi resolver, List<ResolveInfo> resolveInfos, boolean isReceiver, Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int filterCallingUid) { Intent intent, String resolvedType, int filterCallingUid) { if (DISABLE_ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS.get()) return; // Do not enforce filter matching when the caller is system or root Loading @@ -1203,9 +1202,8 @@ public class PackageManagerServiceUtils { ? new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM) : null; final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0; final boolean enforce = compat.isChangeEnabledByUidInternal( final boolean enforce = android.security.Flags.enforceIntentFilterMatch() && compat.isChangeEnabledByUidInternal( ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS, filterCallingUid); for (int i = resolveInfos.size() - 1; i >= 0; --i) { Loading Loading @@ -1237,8 +1235,7 @@ public class PackageManagerServiceUtils { boolean match = false; for (int j = 0, size = comp.getIntents().size(); j < size; ++j) { IntentFilter intentFilter = comp.getIntents().get(j).getIntentFilter(); if (IntentResolver.intentMatchesFilter( intentFilter, intent, resolvedType, defaultOnly)) { if (IntentResolver.intentMatchesFilter(intentFilter, intent, resolvedType)) { match = true; break; } Loading services/core/java/com/android/server/pm/ResolveIntentHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -459,7 +459,7 @@ final class ResolveIntentHelper { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mPlatformCompat, componentResolver, list, true, intent, resolvedType, flags, filterCallingUid); resolvedType, filterCallingUid); } } } else { Loading @@ -485,7 +485,7 @@ final class ResolveIntentHelper { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mPlatformCompat, componentResolver, list, true, originalIntent, resolvedType, flags, filterCallingUid); list, true, originalIntent, resolvedType, filterCallingUid); } return computer.applyPostResolutionFilter(list, instantAppPkgName, false, queryingUid, Loading Loading
services/core/java/com/android/server/IntentResolver.java +1 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public abstract class IntentResolver<F, R extends Object> { * Returns whether an intent matches the IntentFilter with a pre-resolved type. */ public static boolean intentMatchesFilter( IntentFilter filter, Intent intent, String resolvedType, boolean defaultOnly) { IntentFilter filter, Intent intent, String resolvedType) { final boolean debug = localLOGV || ((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0); Loading @@ -97,10 +97,6 @@ public abstract class IntentResolver<F, R extends Object> { int match = filter.match(intent.getAction(), resolvedType, intent.getScheme(), intent.getData(), intent.getCategories(), TAG); if (match >= 0 && defaultOnly && !filter.hasCategory(Intent.CATEGORY_DEFAULT)) { match = IntentFilter.NO_MATCH_CATEGORY; } if (match >= 0) { if (debug) { Slog.v(TAG, "Filter matched! match=0x" + Integer.toHexString(match)); Loading
services/core/java/com/android/server/pm/ComputerEngine.java +4 −4 Original line number Diff line number Diff line Loading @@ -586,7 +586,7 @@ public class ComputerEngine implements Computer { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, intent, resolvedType, flags, filterCallingUid); list, false, intent, resolvedType, filterCallingUid); } } } else { Loading Loading @@ -616,7 +616,7 @@ public class ComputerEngine implements Computer { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, originalIntent, resolvedType, flags, filterCallingUid); list, false, originalIntent, resolvedType, filterCallingUid); } return skipPostResolution ? list : applyPostResolutionFilter( Loading Loading @@ -700,7 +700,7 @@ public class ComputerEngine implements Computer { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, intent, resolvedType, flags, callingUid); list, false, intent, resolvedType, callingUid); } } } else { Loading @@ -712,7 +712,7 @@ public class ComputerEngine implements Computer { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mInjector.getCompatibility(), mComponentResolver, list, false, originalIntent, resolvedType, flags, callingUid); list, false, originalIntent, resolvedType, callingUid); } return list; Loading
services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +7 −10 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.compat.annotation.ChangeId; import android.compat.annotation.Disabled; import android.compat.annotation.EnabledAfter; import android.compat.annotation.Overridable; import android.content.Context; import android.content.Intent; Loading Loading @@ -198,7 +198,7 @@ public class PackageManagerServiceUtils { */ @Overridable @ChangeId @Disabled /* Enforcement reverted in T: b/274147456 */ @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) private static final long ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS = 161252188; /** Loading Loading @@ -1192,8 +1192,7 @@ public class PackageManagerServiceUtils { public static void applyEnforceIntentFilterMatching( PlatformCompat compat, ComponentResolverApi resolver, List<ResolveInfo> resolveInfos, boolean isReceiver, Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int filterCallingUid) { Intent intent, String resolvedType, int filterCallingUid) { if (DISABLE_ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS.get()) return; // Do not enforce filter matching when the caller is system or root Loading @@ -1203,9 +1202,8 @@ public class PackageManagerServiceUtils { ? new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM) : null; final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0; final boolean enforce = compat.isChangeEnabledByUidInternal( final boolean enforce = android.security.Flags.enforceIntentFilterMatch() && compat.isChangeEnabledByUidInternal( ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS, filterCallingUid); for (int i = resolveInfos.size() - 1; i >= 0; --i) { Loading Loading @@ -1237,8 +1235,7 @@ public class PackageManagerServiceUtils { boolean match = false; for (int j = 0, size = comp.getIntents().size(); j < size; ++j) { IntentFilter intentFilter = comp.getIntents().get(j).getIntentFilter(); if (IntentResolver.intentMatchesFilter( intentFilter, intent, resolvedType, defaultOnly)) { if (IntentResolver.intentMatchesFilter(intentFilter, intent, resolvedType)) { match = true; break; } Loading
services/core/java/com/android/server/pm/ResolveIntentHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -459,7 +459,7 @@ final class ResolveIntentHelper { list.add(ri); PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mPlatformCompat, componentResolver, list, true, intent, resolvedType, flags, filterCallingUid); resolvedType, filterCallingUid); } } } else { Loading @@ -485,7 +485,7 @@ final class ResolveIntentHelper { // We also have to ensure all components match the original intent PackageManagerServiceUtils.applyEnforceIntentFilterMatching( mPlatformCompat, componentResolver, list, true, originalIntent, resolvedType, flags, filterCallingUid); list, true, originalIntent, resolvedType, filterCallingUid); } return computer.applyPostResolutionFilter(list, instantAppPkgName, false, queryingUid, Loading