mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
418 lines
30 KiB
Java
418 lines
30 KiB
Java
package androidx.fragment.app.strictmode;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.util.Log;
|
|
import android.view.ViewGroup;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.strictmode.FragmentStrictMode;
|
|
import io.sentry.protocol.OperatingSystem;
|
|
import io.sentry.protocol.Request;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import kotlin.Metadata;
|
|
import kotlin.collections.CollectionsKt;
|
|
import kotlin.collections.MapsKt;
|
|
import kotlin.collections.SetsKt;
|
|
import kotlin.jvm.JvmStatic;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* compiled from: FragmentStrictMode.kt */
|
|
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\bÆ\u0002\u0018\u00002\u00020\u0001:\u0003123B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0012\u0010\u000b\u001a\u00020\u00062\b\u0010\f\u001a\u0004\u0018\u00010\rH\u0002J\u0018\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00062\u0006\u0010\u0011\u001a\u00020\u0012H\u0002J\u0010\u0010\u0013\u001a\u00020\u000f2\u0006\u0010\u0011\u001a\u00020\u0012H\u0002J\u0018\u0010\u0014\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u0015\u001a\u00020\u0004H\u0007J\u001a\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\b\u0010\u0017\u001a\u0004\u0018\u00010\u0018H\u0007J\u0010\u0010\u0019\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\rH\u0007J\u0010\u0010\u001a\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\rH\u0007J\u0010\u0010\u001b\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\rH\u0007J\u0010\u0010\u001c\u001a\u00020\u000f2\u0006\u0010\u0011\u001a\u00020\u0012H\u0007J\u0010\u0010\u001d\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\rH\u0007J \u0010\u001e\u001a\u00020\u000f2\u0006\u0010\u001f\u001a\u00020\r2\u0006\u0010 \u001a\u00020\r2\u0006\u0010!\u001a\u00020\"H\u0007J\u0018\u0010#\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010$\u001a\u00020%H\u0007J\u0018\u0010&\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u0017\u001a\u00020\u0018H\u0007J \u0010'\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010(\u001a\u00020\r2\u0006\u0010)\u001a\u00020\"H\u0007J\u0018\u0010*\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010+\u001a\u00020,H\u0002J0\u0010-\u001a\u00020%2\u0006\u0010\u0010\u001a\u00020\u00062\u000e\u0010.\u001a\n\u0012\u0006\b\u0001\u0012\u00020\r0/2\u000e\u00100\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00120/H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u001a\u0010\u0005\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\n¨\u00064"}, d2 = {"Landroidx/fragment/app/strictmode/FragmentStrictMode;", "", "()V", "TAG", "", "defaultPolicy", "Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy;", "getDefaultPolicy", "()Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy;", "setDefaultPolicy", "(Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy;)V", "getNearestPolicy", Request.JsonKeys.FRAGMENT, "Landroidx/fragment/app/Fragment;", "handlePolicyViolation", "", "policy", "violation", "Landroidx/fragment/app/strictmode/Violation;", "logIfDebuggingEnabled", "onFragmentReuse", "previousFragmentId", "onFragmentTagUsage", "container", "Landroid/view/ViewGroup;", "onGetRetainInstanceUsage", "onGetTargetFragmentRequestCodeUsage", "onGetTargetFragmentUsage", "onPolicyViolation", "onSetRetainInstanceUsage", "onSetTargetFragmentUsage", "violatingFragment", "targetFragment", "requestCode", "", "onSetUserVisibleHint", "isVisibleToUser", "", "onWrongFragmentContainer", "onWrongNestedHierarchy", "expectedParentFragment", "containerId", "runOnHostThread", "runnable", "Ljava/lang/Runnable;", "shouldHandlePolicyViolation", "fragmentClass", "Ljava/lang/Class;", "violationClass", "Flag", "OnViolationListener", "Policy", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class FragmentStrictMode {
|
|
private static final String TAG = "FragmentStrictMode";
|
|
public static final FragmentStrictMode INSTANCE = new FragmentStrictMode();
|
|
private static Policy defaultPolicy = Policy.LAX;
|
|
|
|
/* compiled from: FragmentStrictMode.kt */
|
|
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u000b\b\u0080\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006j\u0002\b\u0007j\u0002\b\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000b¨\u0006\f"}, d2 = {"Landroidx/fragment/app/strictmode/FragmentStrictMode$Flag;", "", "(Ljava/lang/String;I)V", "PENALTY_LOG", "PENALTY_DEATH", "DETECT_FRAGMENT_REUSE", "DETECT_FRAGMENT_TAG_USAGE", "DETECT_WRONG_NESTED_HIERARCHY", "DETECT_RETAIN_INSTANCE_USAGE", "DETECT_SET_USER_VISIBLE_HINT", "DETECT_TARGET_FRAGMENT_USAGE", "DETECT_WRONG_FRAGMENT_CONTAINER", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public enum Flag {
|
|
PENALTY_LOG,
|
|
PENALTY_DEATH,
|
|
DETECT_FRAGMENT_REUSE,
|
|
DETECT_FRAGMENT_TAG_USAGE,
|
|
DETECT_WRONG_NESTED_HIERARCHY,
|
|
DETECT_RETAIN_INSTANCE_USAGE,
|
|
DETECT_SET_USER_VISIBLE_HINT,
|
|
DETECT_TARGET_FRAGMENT_USAGE,
|
|
DETECT_WRONG_FRAGMENT_CONTAINER
|
|
}
|
|
|
|
/* compiled from: FragmentStrictMode.kt */
|
|
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bæ\u0080\u0001\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&ø\u0001\u0000\u0082\u0002\u0006\n\u0004\b!0\u0001¨\u0006\u0006À\u0006\u0001"}, d2 = {"Landroidx/fragment/app/strictmode/FragmentStrictMode$OnViolationListener;", "", "onViolation", "", "violation", "Landroidx/fragment/app/strictmode/Violation;", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public interface OnViolationListener {
|
|
void onViolation(Violation violation);
|
|
}
|
|
|
|
public final Policy getDefaultPolicy() {
|
|
return defaultPolicy;
|
|
}
|
|
|
|
public final void setDefaultPolicy(Policy policy) {
|
|
Intrinsics.checkNotNullParameter(policy, "<set-?>");
|
|
defaultPolicy = policy;
|
|
}
|
|
|
|
private FragmentStrictMode() {
|
|
}
|
|
|
|
private final Policy getNearestPolicy(Fragment fragment) {
|
|
while (fragment != null) {
|
|
if (fragment.isAdded()) {
|
|
FragmentManager parentFragmentManager = fragment.getParentFragmentManager();
|
|
Intrinsics.checkNotNullExpressionValue(parentFragmentManager, "declaringFragment.parentFragmentManager");
|
|
if (parentFragmentManager.getStrictModePolicy() != null) {
|
|
Policy strictModePolicy = parentFragmentManager.getStrictModePolicy();
|
|
Intrinsics.checkNotNull(strictModePolicy);
|
|
return strictModePolicy;
|
|
}
|
|
}
|
|
fragment = fragment.getParentFragment();
|
|
}
|
|
return defaultPolicy;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onFragmentReuse(Fragment fragment, String previousFragmentId) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
Intrinsics.checkNotNullParameter(previousFragmentId, "previousFragmentId");
|
|
FragmentReuseViolation fragmentReuseViolation = new FragmentReuseViolation(fragment, previousFragmentId);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(fragmentReuseViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_FRAGMENT_REUSE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), fragmentReuseViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, fragmentReuseViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onFragmentTagUsage(Fragment fragment, ViewGroup container) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
FragmentTagUsageViolation fragmentTagUsageViolation = new FragmentTagUsageViolation(fragment, container);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(fragmentTagUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_FRAGMENT_TAG_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), fragmentTagUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, fragmentTagUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onWrongNestedHierarchy(Fragment fragment, Fragment expectedParentFragment, int containerId) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
Intrinsics.checkNotNullParameter(expectedParentFragment, "expectedParentFragment");
|
|
WrongNestedHierarchyViolation wrongNestedHierarchyViolation = new WrongNestedHierarchyViolation(fragment, expectedParentFragment, containerId);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(wrongNestedHierarchyViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_WRONG_NESTED_HIERARCHY) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), wrongNestedHierarchyViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, wrongNestedHierarchyViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onSetRetainInstanceUsage(Fragment fragment) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
SetRetainInstanceUsageViolation setRetainInstanceUsageViolation = new SetRetainInstanceUsageViolation(fragment);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(setRetainInstanceUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_RETAIN_INSTANCE_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), setRetainInstanceUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, setRetainInstanceUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onGetRetainInstanceUsage(Fragment fragment) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
GetRetainInstanceUsageViolation getRetainInstanceUsageViolation = new GetRetainInstanceUsageViolation(fragment);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(getRetainInstanceUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_RETAIN_INSTANCE_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), getRetainInstanceUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, getRetainInstanceUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onSetUserVisibleHint(Fragment fragment, boolean isVisibleToUser) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
SetUserVisibleHintViolation setUserVisibleHintViolation = new SetUserVisibleHintViolation(fragment, isVisibleToUser);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(setUserVisibleHintViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_SET_USER_VISIBLE_HINT) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), setUserVisibleHintViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, setUserVisibleHintViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onSetTargetFragmentUsage(Fragment violatingFragment, Fragment targetFragment, int requestCode) {
|
|
Intrinsics.checkNotNullParameter(violatingFragment, "violatingFragment");
|
|
Intrinsics.checkNotNullParameter(targetFragment, "targetFragment");
|
|
SetTargetFragmentUsageViolation setTargetFragmentUsageViolation = new SetTargetFragmentUsageViolation(violatingFragment, targetFragment, requestCode);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(setTargetFragmentUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(violatingFragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_TARGET_FRAGMENT_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, violatingFragment.getClass(), setTargetFragmentUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, setTargetFragmentUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onGetTargetFragmentUsage(Fragment fragment) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
GetTargetFragmentUsageViolation getTargetFragmentUsageViolation = new GetTargetFragmentUsageViolation(fragment);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(getTargetFragmentUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_TARGET_FRAGMENT_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), getTargetFragmentUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, getTargetFragmentUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onGetTargetFragmentRequestCodeUsage(Fragment fragment) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
GetTargetFragmentRequestCodeUsageViolation getTargetFragmentRequestCodeUsageViolation = new GetTargetFragmentRequestCodeUsageViolation(fragment);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(getTargetFragmentRequestCodeUsageViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_TARGET_FRAGMENT_USAGE) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), getTargetFragmentRequestCodeUsageViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, getTargetFragmentRequestCodeUsageViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
public static final void onWrongFragmentContainer(Fragment fragment, ViewGroup container) {
|
|
Intrinsics.checkNotNullParameter(fragment, "fragment");
|
|
Intrinsics.checkNotNullParameter(container, "container");
|
|
WrongFragmentContainerViolation wrongFragmentContainerViolation = new WrongFragmentContainerViolation(fragment, container);
|
|
FragmentStrictMode fragmentStrictMode = INSTANCE;
|
|
fragmentStrictMode.logIfDebuggingEnabled(wrongFragmentContainerViolation);
|
|
Policy nearestPolicy = fragmentStrictMode.getNearestPolicy(fragment);
|
|
if (nearestPolicy.getFlags$fragment_release().contains(Flag.DETECT_WRONG_FRAGMENT_CONTAINER) && fragmentStrictMode.shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), wrongFragmentContainerViolation.getClass())) {
|
|
fragmentStrictMode.handlePolicyViolation(nearestPolicy, wrongFragmentContainerViolation);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final void onPolicyViolation(Violation violation) {
|
|
Intrinsics.checkNotNullParameter(violation, "violation");
|
|
logIfDebuggingEnabled(violation);
|
|
Fragment fragment = violation.getFragment();
|
|
Policy nearestPolicy = getNearestPolicy(fragment);
|
|
if (shouldHandlePolicyViolation(nearestPolicy, fragment.getClass(), violation.getClass())) {
|
|
handlePolicyViolation(nearestPolicy, violation);
|
|
}
|
|
}
|
|
|
|
private final void logIfDebuggingEnabled(Violation violation) {
|
|
if (FragmentManager.isLoggingEnabled(3)) {
|
|
Log.d(FragmentManager.TAG, "StrictMode violation in " + violation.getFragment().getClass().getName(), violation);
|
|
}
|
|
}
|
|
|
|
private final boolean shouldHandlePolicyViolation(Policy policy, Class<? extends Fragment> fragmentClass, Class<? extends Violation> violationClass) {
|
|
Set<Class<? extends Violation>> set = policy.getMAllowedViolations$fragment_release().get(fragmentClass.getName());
|
|
if (set == null) {
|
|
return true;
|
|
}
|
|
if (Intrinsics.areEqual(violationClass.getSuperclass(), Violation.class) || !CollectionsKt.contains(set, violationClass.getSuperclass())) {
|
|
return !set.contains(violationClass);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private final void handlePolicyViolation(final Policy policy, final Violation violation) {
|
|
Fragment fragment = violation.getFragment();
|
|
final String name = fragment.getClass().getName();
|
|
if (policy.getFlags$fragment_release().contains(Flag.PENALTY_LOG)) {
|
|
Log.d(TAG, "Policy violation in " + name, violation);
|
|
}
|
|
if (policy.getListener() != null) {
|
|
runOnHostThread(fragment, new Runnable() { // from class: androidx.fragment.app.strictmode.FragmentStrictMode$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
FragmentStrictMode.handlePolicyViolation$lambda$0(FragmentStrictMode.Policy.this, violation);
|
|
}
|
|
});
|
|
}
|
|
if (policy.getFlags$fragment_release().contains(Flag.PENALTY_DEATH)) {
|
|
runOnHostThread(fragment, new Runnable() { // from class: androidx.fragment.app.strictmode.FragmentStrictMode$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
FragmentStrictMode.handlePolicyViolation$lambda$1(name, violation);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void handlePolicyViolation$lambda$0(Policy policy, Violation violation) {
|
|
Intrinsics.checkNotNullParameter(policy, "$policy");
|
|
Intrinsics.checkNotNullParameter(violation, "$violation");
|
|
policy.getListener().onViolation(violation);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void handlePolicyViolation$lambda$1(String str, Violation violation) {
|
|
Intrinsics.checkNotNullParameter(violation, "$violation");
|
|
Log.e(TAG, "Policy violation with PENALTY_DEATH in " + str, violation);
|
|
throw violation;
|
|
}
|
|
|
|
private final void runOnHostThread(Fragment fragment, Runnable runnable) {
|
|
if (fragment.isAdded()) {
|
|
Handler handler = fragment.getParentFragmentManager().getHost().getHandler();
|
|
Intrinsics.checkNotNullExpressionValue(handler, "fragment.parentFragmentManager.host.handler");
|
|
if (Intrinsics.areEqual(handler.getLooper(), Looper.myLooper())) {
|
|
runnable.run();
|
|
return;
|
|
} else {
|
|
handler.post(runnable);
|
|
return;
|
|
}
|
|
}
|
|
runnable.run();
|
|
}
|
|
|
|
/* compiled from: FragmentStrictMode.kt */
|
|
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\u0010#\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\u0018\u0000 \u00162\u00020\u0001:\u0002\u0015\u0016BA\b\u0000\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006\u0012 \u0010\u0007\u001a\u001c\u0012\u0004\u0012\u00020\t\u0012\u0012\u0012\u0010\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\f0\u000b0\n0\b¢\u0006\u0002\u0010\rR\u001a\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000fR\u0016\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u0011R.\u0010\u0012\u001a\u001c\u0012\u0004\u0012\u00020\t\u0012\u0012\u0012\u0010\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\f0\u000b0\u00030\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014¨\u0006\u0017"}, d2 = {"Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy;", "", "flags", "", "Landroidx/fragment/app/strictmode/FragmentStrictMode$Flag;", "listener", "Landroidx/fragment/app/strictmode/FragmentStrictMode$OnViolationListener;", "allowedViolations", "", "", "", "Ljava/lang/Class;", "Landroidx/fragment/app/strictmode/Violation;", "(Ljava/util/Set;Landroidx/fragment/app/strictmode/FragmentStrictMode$OnViolationListener;Ljava/util/Map;)V", "getFlags$fragment_release", "()Ljava/util/Set;", "getListener$fragment_release", "()Landroidx/fragment/app/strictmode/FragmentStrictMode$OnViolationListener;", "mAllowedViolations", "getMAllowedViolations$fragment_release", "()Ljava/util/Map;", "Builder", "Companion", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Policy {
|
|
public static final Policy LAX = new Policy(SetsKt.emptySet(), null, MapsKt.emptyMap());
|
|
private final Set<Flag> flags;
|
|
private final OnViolationListener listener;
|
|
private final Map<String, Set<Class<? extends Violation>>> mAllowedViolations;
|
|
|
|
public final Set<Flag> getFlags$fragment_release() {
|
|
return this.flags;
|
|
}
|
|
|
|
/* renamed from: getListener$fragment_release, reason: from getter */
|
|
public final OnViolationListener getListener() {
|
|
return this.listener;
|
|
}
|
|
|
|
public final Map<String, Set<Class<? extends Violation>>> getMAllowedViolations$fragment_release() {
|
|
return this.mAllowedViolations;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Policy(Set<? extends Flag> flags, OnViolationListener onViolationListener, Map<String, ? extends Set<Class<? extends Violation>>> allowedViolations) {
|
|
Intrinsics.checkNotNullParameter(flags, "flags");
|
|
Intrinsics.checkNotNullParameter(allowedViolations, "allowedViolations");
|
|
this.flags = flags;
|
|
this.listener = onViolationListener;
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
for (Map.Entry<String, ? extends Set<Class<? extends Violation>>> entry : allowedViolations.entrySet()) {
|
|
linkedHashMap.put(entry.getKey(), entry.getValue());
|
|
}
|
|
this.mAllowedViolations = linkedHashMap;
|
|
}
|
|
|
|
/* compiled from: FragmentStrictMode.kt */
|
|
@Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010#\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010%\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J(\u0010\r\u001a\u00020\u00002\u000e\u0010\u000e\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u000f0\u000b2\u000e\u0010\u0010\u001a\n\u0012\u0006\b\u0001\u0012\u00020\f0\u000bH\u0007J \u0010\r\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\n2\u000e\u0010\u0010\u001a\n\u0012\u0006\b\u0001\u0012\u00020\f0\u000bH\u0007J\u0006\u0010\u0011\u001a\u00020\u0012J\b\u0010\u0013\u001a\u00020\u0000H\u0007J\b\u0010\u0014\u001a\u00020\u0000H\u0007J\b\u0010\u0015\u001a\u00020\u0000H\u0007J\b\u0010\u0016\u001a\u00020\u0000H\u0007J\b\u0010\u0017\u001a\u00020\u0000H\u0007J\b\u0010\u0018\u001a\u00020\u0000H\u0007J\b\u0010\u0019\u001a\u00020\u0000H\u0007J\b\u0010\u001a\u001a\u00020\u0000H\u0007J\u0010\u0010\u001b\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0007J\b\u0010\u001c\u001a\u00020\u0000H\u0007R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R(\u0010\b\u001a\u001c\u0012\u0004\u0012\u00020\n\u0012\u0012\u0012\u0010\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\f0\u000b0\u00040\tX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001d"}, d2 = {"Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy$Builder;", "", "()V", "flags", "", "Landroidx/fragment/app/strictmode/FragmentStrictMode$Flag;", "listener", "Landroidx/fragment/app/strictmode/FragmentStrictMode$OnViolationListener;", "mAllowedViolations", "", "", "Ljava/lang/Class;", "Landroidx/fragment/app/strictmode/Violation;", "allowViolation", "fragmentClass", "Landroidx/fragment/app/Fragment;", "violationClass", OperatingSystem.JsonKeys.BUILD, "Landroidx/fragment/app/strictmode/FragmentStrictMode$Policy;", "detectFragmentReuse", "detectFragmentTagUsage", "detectRetainInstanceUsage", "detectSetUserVisibleHint", "detectTargetFragmentUsage", "detectWrongFragmentContainer", "detectWrongNestedHierarchy", "penaltyDeath", "penaltyListener", "penaltyLog", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Builder {
|
|
private OnViolationListener listener;
|
|
private final Set<Flag> flags = new LinkedHashSet();
|
|
private final Map<String, Set<Class<? extends Violation>>> mAllowedViolations = new LinkedHashMap();
|
|
|
|
public final Builder penaltyListener(OnViolationListener listener) {
|
|
Intrinsics.checkNotNullParameter(listener, "listener");
|
|
this.listener = listener;
|
|
return this;
|
|
}
|
|
|
|
public final Builder penaltyLog() {
|
|
this.flags.add(Flag.PENALTY_LOG);
|
|
return this;
|
|
}
|
|
|
|
public final Builder penaltyDeath() {
|
|
this.flags.add(Flag.PENALTY_DEATH);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectFragmentReuse() {
|
|
this.flags.add(Flag.DETECT_FRAGMENT_REUSE);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectFragmentTagUsage() {
|
|
this.flags.add(Flag.DETECT_FRAGMENT_TAG_USAGE);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectWrongNestedHierarchy() {
|
|
this.flags.add(Flag.DETECT_WRONG_NESTED_HIERARCHY);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectRetainInstanceUsage() {
|
|
this.flags.add(Flag.DETECT_RETAIN_INSTANCE_USAGE);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectSetUserVisibleHint() {
|
|
this.flags.add(Flag.DETECT_SET_USER_VISIBLE_HINT);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectTargetFragmentUsage() {
|
|
this.flags.add(Flag.DETECT_TARGET_FRAGMENT_USAGE);
|
|
return this;
|
|
}
|
|
|
|
public final Builder detectWrongFragmentContainer() {
|
|
this.flags.add(Flag.DETECT_WRONG_FRAGMENT_CONTAINER);
|
|
return this;
|
|
}
|
|
|
|
public final Builder allowViolation(Class<? extends Fragment> fragmentClass, Class<? extends Violation> violationClass) {
|
|
Intrinsics.checkNotNullParameter(fragmentClass, "fragmentClass");
|
|
Intrinsics.checkNotNullParameter(violationClass, "violationClass");
|
|
String fragmentClassString = fragmentClass.getName();
|
|
Intrinsics.checkNotNullExpressionValue(fragmentClassString, "fragmentClassString");
|
|
return allowViolation(fragmentClassString, violationClass);
|
|
}
|
|
|
|
public final Builder allowViolation(String fragmentClass, Class<? extends Violation> violationClass) {
|
|
Intrinsics.checkNotNullParameter(fragmentClass, "fragmentClass");
|
|
Intrinsics.checkNotNullParameter(violationClass, "violationClass");
|
|
LinkedHashSet linkedHashSet = this.mAllowedViolations.get(fragmentClass);
|
|
if (linkedHashSet == null) {
|
|
linkedHashSet = new LinkedHashSet();
|
|
}
|
|
linkedHashSet.add(violationClass);
|
|
this.mAllowedViolations.put(fragmentClass, linkedHashSet);
|
|
return this;
|
|
}
|
|
|
|
public final Policy build() {
|
|
if (this.listener == null && !this.flags.contains(Flag.PENALTY_DEATH)) {
|
|
penaltyLog();
|
|
}
|
|
return new Policy(this.flags, this.listener, this.mAllowedViolations);
|
|
}
|
|
}
|
|
}
|
|
}
|