boolean shouldAllowProvider(final @Nullable ProviderInfo provider) { if (provider == null) return true; // We know nothing about the provider, better allow than block. if (mBase.getPackageName().equals(provider.packageName)) return true; if (shouldBlockRequestTarget(OutboundType.CONTENT, null, provider.packageName)) return false; if (Settings.AUTHORITY.equals(provider.authority)) return true; // Always allow access to system settings, to avoid rare cases in the wild that the provider info of Settings provider is inaccurate. //noinspection SimplifiableIfStatement if (SDK_INT >= HONEYCOMB_MR1 && mExcludeStoppedPackages && (provider.applicationInfo.flags & (FLAG_SYSTEM | ApplicationInfo.FLAG_STOPPED)) == ApplicationInfo.FLAG_STOPPED) return mDryRun; return true; }
@CheckResult <R, T extends Throwable> R proceed(final OutboundType type, final String target_pkg, final @Nullable R negative_value, final WrappedValueProcedureThrows<R, T> procedure) throws T { if (mBase.getPackageName().equals(target_pkg)) return procedure.proceed(); // Self-targeting request is allowed unconditionally if (shouldBlockRequestTarget(type, null, target_pkg)) return negative_value; return procedure.proceed(); }
@CheckResult <R, T extends Throwable> R proceed(final OutboundType type, final @Nullable Intent intent, final @Nullable R negative_value, final WrappedValueProcedureThrows<R, T> procedure) throws T { final String target_pkg = intent != null ? getTargetPackage(intent) : null; if (target_pkg != null) { if (mBase.getPackageName().equals(target_pkg)) return procedure.proceed(); // Self-targeting request is allowed unconditionally if (shouldBlockRequestTarget(type, intent, target_pkg)) return negative_value; } final int original_flags = intent != null ? adjustIntentFlags(type, intent) : 0; try { return procedure.proceed(); } finally { if (intent != null) intent.setFlags(original_flags); } }
boolean shouldAllowProvider(final @Nullable ProviderInfo provider) { if (provider == null) return false; if (mBase.getPackageName().equals(provider.packageName)) return true; if (shouldBlockRequestTarget(OutboundType.CONTENT, null, provider.packageName)) return mDryRun; //noinspection SimplifiableIfStatement if (SDK_INT >= HONEYCOMB_MR1 && mExcludeStoppedPackages && (provider.applicationInfo.flags & (FLAG_SYSTEM | ApplicationInfo.FLAG_STOPPED)) == ApplicationInfo.FLAG_STOPPED) return mDryRun; return true; }
@SuppressWarnings("TypeParameterHidesVisibleType") @CheckResult <R, T extends Throwable> R proceed(final OutboundType type, final Intent intent, final @Nullable R negative_value, final CondomCore.WrappedValueProcedureThrows<R, T> procedure) throws T { final String target_pkg = getTargetPackage(intent); if (target_pkg != null) { if (mBase.getPackageName().equals(target_pkg)) return procedure.proceed(); // Self-targeting request is allowed unconditionally if (shouldBlockRequestTarget(type, intent, target_pkg)) return negative_value; } final int original_flags = adjustIntentFlags(type, intent); try { return procedure.proceed(); } finally { intent.setFlags(original_flags); } }