package h0;

import android.content.LocusId;
import android.content.pm.ShortcutInfo;
import android.os.Build;
import android.os.PersistableBundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.core.app.b0;
import androidx.core.app.y1;
import androidx.core.app.z1;
import g0.i;
import p0.g;

/* JADX INFO: loaded from: classes.dex */
public abstract class b {
    @Nullable
    @RequiresApi(25)
    public static i getLocusId(@NonNull ShortcutInfo shortcutInfo) {
        if (Build.VERSION.SDK_INT < 29) {
            return getLocusIdFromExtra(shortcutInfo.getExtras());
        }
        if (shortcutInfo.getLocusId() == null) {
            return null;
        }
        LocusId locusId = shortcutInfo.getLocusId();
        g.checkNotNull(locusId, "locusId cannot be null");
        return new i((String) g.checkStringNotEmpty(b0.f(locusId), "id cannot be empty"));
    }

    @Nullable
    @RequiresApi(25)
    @RestrictTo({RestrictTo.Scope.f557c})
    private static i getLocusIdFromExtra(@Nullable PersistableBundle persistableBundle) {
        String string;
        if (persistableBundle == null || (string = persistableBundle.getString("extraLocusId")) == null) {
            return null;
        }
        return new i(string);
    }

    @RequiresApi(25)
    @RestrictTo({RestrictTo.Scope.f557c})
    @VisibleForTesting
    public static boolean getLongLivedFromExtra(@Nullable PersistableBundle persistableBundle) {
        if (persistableBundle == null || !persistableBundle.containsKey("extraLongLived")) {
            return false;
        }
        return persistableBundle.getBoolean("extraLongLived");
    }

    @VisibleForTesting
    @Nullable
    @RequiresApi(25)
    @RestrictTo({RestrictTo.Scope.f557c})
    public static z1[] getPersonsFromExtra(@NonNull PersistableBundle persistableBundle) {
        if (persistableBundle == null || !persistableBundle.containsKey("extraPersonCount")) {
            return null;
        }
        int i10 = persistableBundle.getInt("extraPersonCount");
        z1[] z1VarArr = new z1[i10];
        int i11 = 0;
        while (i11 < i10) {
            StringBuilder sb = new StringBuilder("extraPerson_");
            int i12 = i11 + 1;
            sb.append(i12);
            PersistableBundle persistableBundle2 = persistableBundle.getPersistableBundle(sb.toString());
            y1 key = new y1().setName(persistableBundle2.getString("name")).setUri(persistableBundle2.getString("uri")).setKey(persistableBundle2.getString("key"));
            key.f1696a = persistableBundle2.getBoolean("isBot");
            key.f1697b = persistableBundle2.getBoolean("isImportant");
            z1VarArr[i11] = key.a();
            i11 = i12;
        }
        return z1VarArr;
    }
}
