package androidx.core.app;

import android.app.RemoteInput;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/* JADX INFO: loaded from: classes.dex */
public final class b2 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f1526a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final CharSequence f1527b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final CharSequence[] f1528c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final boolean f1529d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f1530e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final Bundle f1531f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final Set f1532g;

    public b2(String str, CharSequence charSequence, CharSequence[] charSequenceArr, boolean z10, int i10, Bundle bundle, HashSet hashSet) {
        this.f1526a = str;
        this.f1527b = charSequence;
        this.f1528c = charSequenceArr;
        this.f1529d = z10;
        this.f1530e = i10;
        this.f1531f = bundle;
        this.f1532g = hashSet;
        if (i10 == 2 && !z10) {
            throw new IllegalArgumentException("setEditChoicesBeforeSending requires setAllowFreeFormInput");
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x0012  */
    @Nullable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static Map<String, Uri> getDataResultsFromIntent(@NonNull Intent intent, @NonNull String str) {
        Intent intent2;
        String string;
        if (Build.VERSION.SDK_INT >= 26) {
            return a0.i(intent, str);
        }
        ClipData clipData = intent.getClipData();
        if (clipData == null) {
            intent2 = null;
        } else {
            ClipDescription description = clipData.getDescription();
            if (description.hasMimeType("text/vnd.android.intent") && description.getLabel().toString().contentEquals("android.remoteinput.results")) {
                intent2 = clipData.getItemAt(0).getIntent();
            }
        }
        if (intent2 == null) {
            return null;
        }
        HashMap map = new HashMap();
        for (String str2 : intent2.getExtras().keySet()) {
            if (str2.startsWith("android.remoteinput.dataTypeResultsData")) {
                String strSubstring = str2.substring(39);
                if (!strSubstring.isEmpty() && (string = intent2.getBundleExtra(str2).getString(str)) != null && !string.isEmpty()) {
                    map.put(strSubstring, Uri.parse(string));
                }
            }
        }
        if (map.isEmpty()) {
            return null;
        }
        return map;
    }

    @Nullable
    public static Bundle getResultsFromIntent(@NonNull Intent intent) {
        return RemoteInput.getResultsFromIntent(intent);
    }

    @Nullable
    public Set<String> getAllowedDataTypes() {
        return this.f1532g;
    }

    @Nullable
    public CharSequence[] getChoices() {
        return this.f1528c;
    }

    @Nullable
    public CharSequence getLabel() {
        return this.f1527b;
    }
}
