package com.google.android.gms.internal.ads;

import android.content.ClipData;
import android.content.Intent;
import android.net.Uri;
import androidx.media3.common.C;

/* JADX INFO: loaded from: classes2.dex */
public abstract class kp1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final ClipData f13367a = ClipData.newIntent("", new Intent());

    public static Intent a(int i10, Intent intent) {
        ih1.e0("Cannot set any dangerous parts of intent to be mutable.", (i10 & 88) == 0);
        ih1.e0("Cannot use Intent.FILL_IN_ACTION unless the action is marked as mutable.", (i10 & 1) == 0 || b(0, 3));
        ih1.e0("Cannot use Intent.FILL_IN_DATA unless the data is marked as mutable.", (i10 & 2) == 0 || b(0, 5));
        ih1.e0("Cannot use Intent.FILL_IN_CATEGORIES unless the category is marked as mutable.", (i10 & 4) == 0 || b(0, 9));
        ih1.e0("Cannot use Intent.FILL_IN_CLIP_DATA unless the clip data is marked as mutable.", (i10 & 128) == 0 || b(0, 17));
        ih1.e0("Must set component on Intent.", intent.getComponent() != null);
        if (b(0, 1)) {
            ih1.e0("Cannot set mutability flags if PendingIntent.FLAG_IMMUTABLE is set.", !b(i10, C.BUFFER_FLAG_NOT_DEPENDED_ON));
        } else {
            ih1.e0("Must set PendingIntent.FLAG_IMMUTABLE for SDK >= 23 if no parts of intent are mutable.", b(i10, C.BUFFER_FLAG_NOT_DEPENDED_ON));
        }
        Intent intent2 = new Intent(intent);
        if (!b(i10, C.BUFFER_FLAG_NOT_DEPENDED_ON)) {
            if (intent2.getPackage() == null) {
                intent2.setPackage(intent2.getComponent().getPackageName());
            }
            if (!b(0, 3) && intent2.getAction() == null) {
                intent2.setAction("");
            }
            if (!b(0, 9) && intent2.getCategories() == null) {
                intent2.addCategory("");
            }
            if (!b(0, 5) && intent2.getData() == null) {
                intent2.setDataAndType(Uri.EMPTY, "*/*");
            }
            if (!b(0, 17) && intent2.getClipData() == null) {
                intent2.setClipData(f13367a);
            }
        }
        return intent2;
    }

    public static boolean b(int i10, int i11) {
        return (i10 & i11) == i11;
    }
}
