Loading services/core/java/com/android/server/compat/PlatformCompat.java +19 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,25 @@ public class PlatformCompat extends IPlatformCompat.Stub { return enabled; } /** * Internal version of {@link #isChangeEnabledByUid(long, int)}. * * <p>Does not perform costly permission check and logging. */ public boolean isChangeEnabledByUidInternalNoLogging(long changeId, int uid) { String[] packages = mContext.getPackageManager().getPackagesForUid(uid); if (packages == null || packages.length == 0) { return mCompatConfig.defaultChangeIdValue(changeId); } boolean enabled = true; final int userId = UserHandle.getUserId(uid); for (String packageName : packages) { final var appInfo = getApplicationInfo(packageName, userId); enabled &= isChangeEnabledInternalNoLogging(changeId, appInfo); } return enabled; } @Override @EnforcePermission(OVERRIDE_COMPAT_CHANGE_CONFIG) public void setOverrides(CompatibilityChangeConfig overrides, String packageName) { Loading services/core/java/com/android/server/pm/SaferIntentUtils.java +4 −2 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class SaferIntentUtils { @Disabled private static final long ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS = 161252188; @Nullable private static ParsedMainComponent infoToComponent( ComponentInfo info, ComponentResolverApi resolver, boolean isReceiver) { if (info instanceof ActivityInfo) { Loading Loading @@ -186,7 +187,7 @@ public class SaferIntentUtils { } boolean isChangeEnabled(long changeId) { return platformCompat == null || platformCompat.isChangeEnabledByUidInternal( return platformCompat == null || platformCompat.isChangeEnabledByUidInternalNoLogging( changeId, callingUid); } Loading Loading @@ -233,7 +234,8 @@ public class SaferIntentUtils { } final ParsedMainComponent comp = infoToComponent( resolveInfo.getComponentInfo(), resolver, args.isReceiver); if (!comp.getIntents().isEmpty() && args.intent.getAction() == null) { if (comp != null && !comp.getIntents().isEmpty() && args.intent.getAction() == null) { match = false; } } else if (c instanceof IntentFilter) { Loading Loading
services/core/java/com/android/server/compat/PlatformCompat.java +19 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,25 @@ public class PlatformCompat extends IPlatformCompat.Stub { return enabled; } /** * Internal version of {@link #isChangeEnabledByUid(long, int)}. * * <p>Does not perform costly permission check and logging. */ public boolean isChangeEnabledByUidInternalNoLogging(long changeId, int uid) { String[] packages = mContext.getPackageManager().getPackagesForUid(uid); if (packages == null || packages.length == 0) { return mCompatConfig.defaultChangeIdValue(changeId); } boolean enabled = true; final int userId = UserHandle.getUserId(uid); for (String packageName : packages) { final var appInfo = getApplicationInfo(packageName, userId); enabled &= isChangeEnabledInternalNoLogging(changeId, appInfo); } return enabled; } @Override @EnforcePermission(OVERRIDE_COMPAT_CHANGE_CONFIG) public void setOverrides(CompatibilityChangeConfig overrides, String packageName) { Loading
services/core/java/com/android/server/pm/SaferIntentUtils.java +4 −2 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class SaferIntentUtils { @Disabled private static final long ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS = 161252188; @Nullable private static ParsedMainComponent infoToComponent( ComponentInfo info, ComponentResolverApi resolver, boolean isReceiver) { if (info instanceof ActivityInfo) { Loading Loading @@ -186,7 +187,7 @@ public class SaferIntentUtils { } boolean isChangeEnabled(long changeId) { return platformCompat == null || platformCompat.isChangeEnabledByUidInternal( return platformCompat == null || platformCompat.isChangeEnabledByUidInternalNoLogging( changeId, callingUid); } Loading Loading @@ -233,7 +234,8 @@ public class SaferIntentUtils { } final ParsedMainComponent comp = infoToComponent( resolveInfo.getComponentInfo(), resolver, args.isReceiver); if (!comp.getIntents().isEmpty() && args.intent.getAction() == null) { if (comp != null && !comp.getIntents().isEmpty() && args.intent.getAction() == null) { match = false; } } else if (c instanceof IntentFilter) { Loading