- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
625 lines
33 KiB
Java
625 lines
33 KiB
Java
package androidx.credentials.provider;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.PendingIntent;
|
|
import android.app.slice.Slice;
|
|
import android.app.slice.SliceItem;
|
|
import android.app.slice.SliceSpec;
|
|
import android.graphics.drawable.Icon;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.credentials.PasswordCredential;
|
|
import androidx.credentials.PublicKeyCredential;
|
|
import androidx.credentials.provider.utils.CryptoObjectUtils;
|
|
import java.time.Instant;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.collections.MapsKt__MapsKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlin.jvm.internal.TypeIntrinsics;
|
|
|
|
@RequiresApi(23)
|
|
@SourceDebugExtension({"SMAP\nCreateEntry.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,773:1\n1#2:774\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public final class CreateEntry {
|
|
private static final String AUTO_SELECT_FALSE_STRING = "false";
|
|
private static final String AUTO_SELECT_TRUE_STRING = "true";
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int DESCRIPTION_MAX_CHAR_LIMIT = 300;
|
|
private static final String EXTRA_CREATE_ACCOUNT_NAME_PREFIX = "androidx.credentials.provider.extra.ACCOUNT_NAME_";
|
|
private static final String EXTRA_CREATE_CREDENTIAL_COUNT_INFO_PREFIX = "androidx.credentials.provider.extra.CREDENTIAL_COUNT_INFO_";
|
|
private static final String EXTRA_CREATE_DESCRIPTION_PREFIX = "androidx.credentials.provider.extra.DESCRIPTION_";
|
|
private static final String EXTRA_CREATE_ENTRY_IS_AUTO_SELECT_ALLOWED_PREFIX = "androidx.credentials.provider.extra.IS_AUTO_SELECT_ALLOWED_";
|
|
private static final String EXTRA_CREATE_ENTRY_LAST_USED_TIME_PREFIX = "androidx.credentials.provider.extra.LAST_USED_TIME_";
|
|
private static final String EXTRA_CREATE_ENTRY_PENDING_INTENT_PREFIX = "androidx.credentials.provider.extra.PENDING_INTENT_";
|
|
private static final String EXTRA_CREATE_ENTRY_SIZE = "androidx.credentials.provider.extra.CREATE_ENTRY_SIZE";
|
|
private static final String EXTRA_CREATE_TYPE_ICON_PREFIX = "androidx.credentials.provider.extra.ICON_";
|
|
private static final int REVISION_ID = 1;
|
|
private static final String SLICE_HINT_ACCOUNT_NAME = "androidx.credentials.provider.createEntry.SLICE_HINT_USER_PROVIDER_ACCOUNT_NAME";
|
|
private static final String SLICE_HINT_ALLOWED_AUTHENTICATORS = "androidx.credentials.provider.createEntry.SLICE_HINT_ALLOWED_AUTHENTICATORS";
|
|
private static final String SLICE_HINT_AUTO_SELECT_ALLOWED = "androidx.credentials.provider.createEntry.SLICE_HINT_AUTO_SELECT_ALLOWED";
|
|
private static final String SLICE_HINT_BIOMETRIC_PROMPT_DATA = "androidx.credentials.provider.createEntry.SLICE_HINT_BIOMETRIC_PROMPT_DATA";
|
|
private static final String SLICE_HINT_CREDENTIAL_COUNT_INFORMATION = "androidx.credentials.provider.createEntry.SLICE_HINT_CREDENTIAL_COUNT_INFORMATION";
|
|
private static final String SLICE_HINT_CRYPTO_OP_ID = "androidx.credentials.provider.createEntry.SLICE_HINT_CRYPTO_OP_ID";
|
|
private static final String SLICE_HINT_ICON = "androidx.credentials.provider.createEntry.SLICE_HINT_PROFILE_ICON";
|
|
private static final String SLICE_HINT_LAST_USED_TIME_MILLIS = "androidx.credentials.provider.createEntry.SLICE_HINT_LAST_USED_TIME_MILLIS";
|
|
private static final String SLICE_HINT_NOTE = "androidx.credentials.provider.createEntry.SLICE_HINT_NOTE";
|
|
private static final String SLICE_HINT_PENDING_INTENT = "androidx.credentials.provider.createEntry.SLICE_HINT_PENDING_INTENT";
|
|
private static final String SLICE_SPEC_TYPE = "CreateEntry";
|
|
private static final String TAG = "CreateEntry";
|
|
public static final String TYPE_TOTAL_CREDENTIAL = "TOTAL_CREDENTIAL_COUNT_TYPE";
|
|
private final CharSequence accountName;
|
|
private final BiometricPromptData biometricPromptData;
|
|
private final Map<String, Integer> credentialCountInformationMap;
|
|
private final CharSequence description;
|
|
private final Icon icon;
|
|
private final boolean isAutoSelectAllowed;
|
|
private final Instant lastUsedTime;
|
|
private final PendingIntent pendingIntent;
|
|
|
|
public static final CreateEntry fromCreateEntry(android.service.credentials.CreateEntry createEntry) {
|
|
return Companion.fromCreateEntry(createEntry);
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final CreateEntry fromSlice(Slice slice) {
|
|
return Companion.fromSlice(slice);
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final Slice toSlice(CreateEntry createEntry) {
|
|
return Companion.toSlice(createEntry);
|
|
}
|
|
|
|
public final CharSequence getAccountName() {
|
|
return this.accountName;
|
|
}
|
|
|
|
public final BiometricPromptData getBiometricPromptData() {
|
|
return this.biometricPromptData;
|
|
}
|
|
|
|
public final CharSequence getDescription() {
|
|
return this.description;
|
|
}
|
|
|
|
public final Icon getIcon() {
|
|
return this.icon;
|
|
}
|
|
|
|
public final Instant getLastUsedTime() {
|
|
return this.lastUsedTime;
|
|
}
|
|
|
|
public final PendingIntent getPendingIntent() {
|
|
return this.pendingIntent;
|
|
}
|
|
|
|
public final boolean isAutoSelectAllowed() {
|
|
return this.isAutoSelectAllowed;
|
|
}
|
|
|
|
public CreateEntry(CharSequence accountName, PendingIntent pendingIntent, Icon icon, CharSequence charSequence, Instant instant, Map<String, Integer> credentialCountInformationMap, boolean z, BiometricPromptData biometricPromptData) {
|
|
Intrinsics.checkNotNullParameter(accountName, "accountName");
|
|
Intrinsics.checkNotNullParameter(pendingIntent, "pendingIntent");
|
|
Intrinsics.checkNotNullParameter(credentialCountInformationMap, "credentialCountInformationMap");
|
|
this.accountName = accountName;
|
|
this.pendingIntent = pendingIntent;
|
|
this.icon = icon;
|
|
this.description = charSequence;
|
|
this.lastUsedTime = instant;
|
|
this.credentialCountInformationMap = credentialCountInformationMap;
|
|
this.isAutoSelectAllowed = z;
|
|
this.biometricPromptData = biometricPromptData;
|
|
if (accountName.length() <= 0) {
|
|
throw new IllegalArgumentException("accountName must not be empty".toString());
|
|
}
|
|
if (charSequence != null && charSequence.length() > 300) {
|
|
throw new IllegalArgumentException("Description must follow a limit of 300 characters.".toString());
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ CreateEntry(CharSequence charSequence, PendingIntent pendingIntent, Icon icon, CharSequence charSequence2, Instant instant, Map map, boolean z, BiometricPromptData biometricPromptData, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(charSequence, pendingIntent, icon, charSequence2, instant, map, z, (i & 128) != 0 ? null : biometricPromptData);
|
|
}
|
|
|
|
public /* synthetic */ CreateEntry(CharSequence charSequence, PendingIntent pendingIntent, CharSequence charSequence2, Instant instant, Icon icon, Integer num, Integer num2, Integer num3, boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(charSequence, pendingIntent, (i & 4) != 0 ? null : charSequence2, (i & 8) != 0 ? null : instant, (i & 16) != 0 ? null : icon, (i & 32) != 0 ? null : num, (i & 64) != 0 ? null : num2, (i & 128) != 0 ? null : num3, (i & 256) != 0 ? false : z);
|
|
}
|
|
|
|
/* JADX WARN: Illegal instructions before constructor call */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public CreateEntry(java.lang.CharSequence r13, android.app.PendingIntent r14, java.lang.CharSequence r15, java.time.Instant r16, android.graphics.drawable.Icon r17, java.lang.Integer r18, java.lang.Integer r19, java.lang.Integer r20, boolean r21) {
|
|
/*
|
|
r12 = this;
|
|
java.lang.String r0 = "accountName"
|
|
r2 = r13
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r13, r0)
|
|
java.lang.String r0 = "pendingIntent"
|
|
r3 = r14
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r14, r0)
|
|
java.lang.String r0 = "android.credentials.TYPE_PASSWORD_CREDENTIAL"
|
|
r1 = r18
|
|
kotlin.Pair r0 = kotlin.TuplesKt.to(r0, r1)
|
|
java.lang.String r1 = "androidx.credentials.TYPE_PUBLIC_KEY_CREDENTIAL"
|
|
r4 = r19
|
|
kotlin.Pair r1 = kotlin.TuplesKt.to(r1, r4)
|
|
java.lang.String r4 = "TOTAL_CREDENTIAL_COUNT_TYPE"
|
|
r5 = r20
|
|
kotlin.Pair r4 = kotlin.TuplesKt.to(r4, r5)
|
|
kotlin.Pair[] r0 = new kotlin.Pair[]{r0, r1, r4}
|
|
java.util.Map r7 = kotlin.collections.MapsKt.mutableMapOf(r0)
|
|
r9 = 0
|
|
r10 = 128(0x80, float:1.8E-43)
|
|
r11 = 0
|
|
r1 = r12
|
|
r4 = r17
|
|
r5 = r15
|
|
r6 = r16
|
|
r8 = r21
|
|
r1.<init>(r2, r3, r4, r5, r6, r7, r8, r9, r10, r11)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.credentials.provider.CreateEntry.<init>(java.lang.CharSequence, android.app.PendingIntent, java.lang.CharSequence, java.time.Instant, android.graphics.drawable.Icon, java.lang.Integer, java.lang.Integer, java.lang.Integer, boolean):void");
|
|
}
|
|
|
|
public /* synthetic */ CreateEntry(CharSequence charSequence, PendingIntent pendingIntent, CharSequence charSequence2, Instant instant, Icon icon, Integer num, Integer num2, Integer num3, boolean z, BiometricPromptData biometricPromptData, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(charSequence, pendingIntent, (i & 4) != 0 ? null : charSequence2, (i & 8) != 0 ? null : instant, (i & 16) != 0 ? null : icon, (i & 32) != 0 ? null : num, (i & 64) != 0 ? null : num2, (i & 128) != 0 ? null : num3, (i & 256) != 0 ? false : z, (i & 512) != 0 ? null : biometricPromptData);
|
|
}
|
|
|
|
/* JADX WARN: Illegal instructions before constructor call */
|
|
@androidx.annotation.RequiresApi(35)
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public CreateEntry(java.lang.CharSequence r11, android.app.PendingIntent r12, java.lang.CharSequence r13, java.time.Instant r14, android.graphics.drawable.Icon r15, java.lang.Integer r16, java.lang.Integer r17, java.lang.Integer r18, boolean r19, androidx.credentials.provider.BiometricPromptData r20) {
|
|
/*
|
|
r10 = this;
|
|
java.lang.String r0 = "accountName"
|
|
r2 = r11
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r11, r0)
|
|
java.lang.String r0 = "pendingIntent"
|
|
r3 = r12
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r12, r0)
|
|
java.lang.String r0 = "android.credentials.TYPE_PASSWORD_CREDENTIAL"
|
|
r1 = r16
|
|
kotlin.Pair r0 = kotlin.TuplesKt.to(r0, r1)
|
|
java.lang.String r1 = "androidx.credentials.TYPE_PUBLIC_KEY_CREDENTIAL"
|
|
r4 = r17
|
|
kotlin.Pair r1 = kotlin.TuplesKt.to(r1, r4)
|
|
java.lang.String r4 = "TOTAL_CREDENTIAL_COUNT_TYPE"
|
|
r5 = r18
|
|
kotlin.Pair r4 = kotlin.TuplesKt.to(r4, r5)
|
|
kotlin.Pair[] r0 = new kotlin.Pair[]{r0, r1, r4}
|
|
java.util.Map r7 = kotlin.collections.MapsKt.mutableMapOf(r0)
|
|
r1 = r10
|
|
r4 = r15
|
|
r5 = r13
|
|
r6 = r14
|
|
r8 = r19
|
|
r9 = r20
|
|
r1.<init>(r2, r3, r4, r5, r6, r7, r8, r9)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.credentials.provider.CreateEntry.<init>(java.lang.CharSequence, android.app.PendingIntent, java.lang.CharSequence, java.time.Instant, android.graphics.drawable.Icon, java.lang.Integer, java.lang.Integer, java.lang.Integer, boolean, androidx.credentials.provider.BiometricPromptData):void");
|
|
}
|
|
|
|
public final Integer getPasswordCredentialCount() {
|
|
return this.credentialCountInformationMap.get(PasswordCredential.TYPE_PASSWORD_CREDENTIAL);
|
|
}
|
|
|
|
public final Integer getPublicKeyCredentialCount() {
|
|
return this.credentialCountInformationMap.get(PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL);
|
|
}
|
|
|
|
public final Integer getTotalCredentialCount() {
|
|
return this.credentialCountInformationMap.get(TYPE_TOTAL_CREDENTIAL);
|
|
}
|
|
|
|
public static final class Builder {
|
|
private final CharSequence accountName;
|
|
private boolean autoSelectAllowed;
|
|
private BiometricPromptData biometricPromptData;
|
|
private Map<String, Integer> credentialCountInformationMap;
|
|
private CharSequence description;
|
|
private Icon icon;
|
|
private Instant lastUsedTime;
|
|
private Integer passwordCredentialCount;
|
|
private final PendingIntent pendingIntent;
|
|
private Integer publicKeyCredentialCount;
|
|
private Integer totalCredentialCount;
|
|
|
|
public final Builder setAutoSelectAllowed(boolean z) {
|
|
this.autoSelectAllowed = z;
|
|
return this;
|
|
}
|
|
|
|
@RequiresApi(35)
|
|
public final Builder setBiometricPromptData(BiometricPromptData biometricPromptData) {
|
|
this.biometricPromptData = biometricPromptData;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setIcon(Icon icon) {
|
|
this.icon = icon;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setLastUsedTime(Instant instant) {
|
|
this.lastUsedTime = instant;
|
|
return this;
|
|
}
|
|
|
|
public Builder(CharSequence accountName, PendingIntent pendingIntent) {
|
|
Intrinsics.checkNotNullParameter(accountName, "accountName");
|
|
Intrinsics.checkNotNullParameter(pendingIntent, "pendingIntent");
|
|
this.accountName = accountName;
|
|
this.pendingIntent = pendingIntent;
|
|
this.credentialCountInformationMap = new LinkedHashMap();
|
|
}
|
|
|
|
public final Builder setPasswordCredentialCount(int i) {
|
|
this.passwordCredentialCount = Integer.valueOf(i);
|
|
this.credentialCountInformationMap.put(PasswordCredential.TYPE_PASSWORD_CREDENTIAL, Integer.valueOf(i));
|
|
return this;
|
|
}
|
|
|
|
public final Builder setPublicKeyCredentialCount(int i) {
|
|
this.publicKeyCredentialCount = Integer.valueOf(i);
|
|
this.credentialCountInformationMap.put(PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL, Integer.valueOf(i));
|
|
return this;
|
|
}
|
|
|
|
public final Builder setTotalCredentialCount(int i) {
|
|
this.totalCredentialCount = Integer.valueOf(i);
|
|
this.credentialCountInformationMap.put(CreateEntry.TYPE_TOTAL_CREDENTIAL, Integer.valueOf(i));
|
|
return this;
|
|
}
|
|
|
|
public final Builder setDescription(CharSequence charSequence) {
|
|
if ((charSequence != null ? Integer.valueOf(charSequence.length()) : null) != null && charSequence.length() > 300) {
|
|
throw new IllegalArgumentException("Description must follow a limit of 300 characters.");
|
|
}
|
|
this.description = charSequence;
|
|
return this;
|
|
}
|
|
|
|
public final CreateEntry build() {
|
|
return new CreateEntry(this.accountName, this.pendingIntent, this.icon, this.description, this.lastUsedTime, this.credentialCountInformationMap, this.autoSelectAllowed, this.biometricPromptData);
|
|
}
|
|
}
|
|
|
|
@RequiresApi(34)
|
|
public static final class Api34Impl {
|
|
public static final Api34Impl INSTANCE = new Api34Impl();
|
|
|
|
private Api34Impl() {
|
|
}
|
|
|
|
public static final CreateEntry fromCreateEntry(android.service.credentials.CreateEntry createEntry) {
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
Slice slice = createEntry.getSlice();
|
|
Intrinsics.checkNotNullExpressionValue(slice, "createEntry.slice");
|
|
return CreateEntry.Companion.fromSlice(slice);
|
|
}
|
|
}
|
|
|
|
@RequiresApi(35)
|
|
@SourceDebugExtension({"SMAP\nCreateEntry.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Api35Impl\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,773:1\n1855#2,2:774\n*S KotlinDebug\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Api35Impl\n*L\n406#1:774,2\n*E\n"})
|
|
public static final class Api35Impl {
|
|
public static final Api35Impl INSTANCE = new Api35Impl();
|
|
|
|
private Api35Impl() {
|
|
}
|
|
|
|
private final void addToSlice(CreateEntry createEntry, Slice.Builder builder) {
|
|
BiometricPromptData biometricPromptData = createEntry.getBiometricPromptData();
|
|
if (biometricPromptData != null) {
|
|
builder.addInt(biometricPromptData.getAllowedAuthenticators(), null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_ALLOWED_AUTHENTICATORS));
|
|
if (biometricPromptData.getCryptoObject() != null) {
|
|
builder.addLong(CryptoObjectUtils.INSTANCE.getOperationHandle(biometricPromptData.getCryptoObject()), null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_CRYPTO_OP_ID));
|
|
}
|
|
builder.addBundle(BiometricPromptData.Companion.toBundle(biometricPromptData), null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_BIOMETRIC_PROMPT_DATA));
|
|
}
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final Slice toSlice(CreateEntry createEntry) {
|
|
Slice build;
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
Slice.Builder addToSlice = Api28Impl.INSTANCE.addToSlice(createEntry);
|
|
INSTANCE.addToSlice(createEntry, addToSlice);
|
|
build = addToSlice.build();
|
|
Intrinsics.checkNotNullExpressionValue(build, "sliceBuilder.build()");
|
|
return build;
|
|
}
|
|
|
|
@SuppressLint({"WrongConstant"})
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final CreateEntry fromSlice(Slice slice) {
|
|
List items;
|
|
boolean hasHint;
|
|
Intrinsics.checkNotNullParameter(slice, "slice");
|
|
CreateEntry fromSlice = Api28Impl.fromSlice(slice);
|
|
if (fromSlice == null) {
|
|
return null;
|
|
}
|
|
items = slice.getItems();
|
|
Intrinsics.checkNotNullExpressionValue(items, "slice.items");
|
|
Iterator it = items.iterator();
|
|
Bundle bundle = null;
|
|
while (it.hasNext()) {
|
|
SliceItem m = Action$Companion$$ExternalSyntheticApiModelOutline5.m(it.next());
|
|
hasHint = m.hasHint(CredentialEntry.SLICE_HINT_BIOMETRIC_PROMPT_DATA);
|
|
if (hasHint) {
|
|
bundle = m.getBundle();
|
|
}
|
|
}
|
|
try {
|
|
return new CreateEntry(fromSlice.getAccountName(), fromSlice.getPendingIntent(), fromSlice.getIcon(), fromSlice.getDescription(), fromSlice.getLastUsedTime(), fromSlice.credentialCountInformationMap, fromSlice.isAutoSelectAllowed(), bundle != null ? BiometricPromptData.Companion.fromBundle(bundle) : null);
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("fromSlice failed with: ");
|
|
sb.append(e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
@RequiresApi(28)
|
|
@SourceDebugExtension({"SMAP\nCreateEntry.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Api28Impl\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,773:1\n1855#2,2:774\n*S KotlinDebug\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Api28Impl\n*L\n506#1:774,2\n*E\n"})
|
|
public static final class Api28Impl {
|
|
public static final Api28Impl INSTANCE = new Api28Impl();
|
|
|
|
private Api28Impl() {
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final Slice toSlice(CreateEntry createEntry) {
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
Slice build = INSTANCE.addToSlice(createEntry).build();
|
|
Intrinsics.checkNotNullExpressionValue(build, "sliceBuilder.build()");
|
|
return build;
|
|
}
|
|
|
|
public final Slice.Builder addToSlice(CreateEntry createEntry) {
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
CharSequence accountName = createEntry.getAccountName();
|
|
Icon icon = createEntry.getIcon();
|
|
CharSequence description = createEntry.getDescription();
|
|
Instant lastUsedTime = createEntry.getLastUsedTime();
|
|
Map<String, Integer> map = createEntry.credentialCountInformationMap;
|
|
PendingIntent pendingIntent = createEntry.getPendingIntent();
|
|
Slice.Builder builder = new Slice.Builder(Uri.EMPTY, new SliceSpec("CreateEntry", 1));
|
|
String str = createEntry.isAutoSelectAllowed() ? "true" : "false";
|
|
builder.addText(accountName, null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_ACCOUNT_NAME));
|
|
if (lastUsedTime != null) {
|
|
builder.addLong(lastUsedTime.toEpochMilli(), null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_LAST_USED_TIME_MILLIS));
|
|
}
|
|
if (description != null) {
|
|
builder.addText(description, null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_NOTE));
|
|
}
|
|
if (icon != null) {
|
|
builder.addIcon(icon, null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_ICON));
|
|
}
|
|
Companion companion = CreateEntry.Companion;
|
|
if (companion.convertCredentialCountInfoToBundle$credentials_release(map) != null) {
|
|
builder.addBundle(companion.convertCredentialCountInfoToBundle$credentials_release(map), null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_CREDENTIAL_COUNT_INFORMATION));
|
|
}
|
|
builder.addAction(pendingIntent, new Slice.Builder(builder).addHints(Collections.singletonList(CreateEntry.SLICE_HINT_PENDING_INTENT)).build(), null).addText(str, null, CollectionsKt__CollectionsJVMKt.listOf(CreateEntry.SLICE_HINT_AUTO_SELECT_ALLOWED));
|
|
return builder;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v8, types: [java.util.Map] */
|
|
@SuppressLint({"WrongConstant"})
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final CreateEntry fromSlice(Slice slice) {
|
|
Intrinsics.checkNotNullParameter(slice, "slice");
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
List<SliceItem> items = slice.getItems();
|
|
Intrinsics.checkNotNullExpressionValue(items, "slice.items");
|
|
LinkedHashMap linkedHashMap2 = linkedHashMap;
|
|
CharSequence charSequence = null;
|
|
PendingIntent pendingIntent = null;
|
|
Icon icon = null;
|
|
CharSequence charSequence2 = null;
|
|
Instant instant = null;
|
|
boolean z = false;
|
|
for (SliceItem sliceItem : items) {
|
|
if (sliceItem.hasHint(CreateEntry.SLICE_HINT_ACCOUNT_NAME)) {
|
|
charSequence = sliceItem.getText();
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_ICON)) {
|
|
icon = sliceItem.getIcon();
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_PENDING_INTENT)) {
|
|
pendingIntent = sliceItem.getAction();
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_CREDENTIAL_COUNT_INFORMATION)) {
|
|
Map<String, Integer> convertBundleToCredentialCountInfo$credentials_release = CreateEntry.Companion.convertBundleToCredentialCountInfo$credentials_release(sliceItem.getBundle());
|
|
Intrinsics.checkNotNull(convertBundleToCredentialCountInfo$credentials_release, "null cannot be cast to non-null type kotlin.collections.MutableMap<kotlin.String, kotlin.Int?>");
|
|
linkedHashMap2 = TypeIntrinsics.asMutableMap(convertBundleToCredentialCountInfo$credentials_release);
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_LAST_USED_TIME_MILLIS)) {
|
|
instant = Instant.ofEpochMilli(sliceItem.getLong());
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_NOTE)) {
|
|
charSequence2 = sliceItem.getText();
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_LAST_USED_TIME_MILLIS)) {
|
|
instant = Instant.ofEpochMilli(sliceItem.getLong());
|
|
} else if (sliceItem.hasHint(CreateEntry.SLICE_HINT_AUTO_SELECT_ALLOWED) && Intrinsics.areEqual(sliceItem.getText(), "true")) {
|
|
z = true;
|
|
}
|
|
}
|
|
try {
|
|
Intrinsics.checkNotNull(charSequence);
|
|
Intrinsics.checkNotNull(pendingIntent);
|
|
return new CreateEntry(charSequence, pendingIntent, icon, charSequence2, instant, linkedHashMap2, z, (BiometricPromptData) null, 128, (DefaultConstructorMarker) null);
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("fromSlice failed with: ");
|
|
sb.append(e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
@SourceDebugExtension({"SMAP\nCreateEntry.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Companion\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 _Maps.kt\nkotlin/collections/MapsKt___MapsKt\n+ 4 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,773:1\n1855#2,2:774\n1864#2,2:778\n1866#2:781\n215#3,2:776\n1#4:780\n*S KotlinDebug\n*F\n+ 1 CreateEntry.kt\nandroidx/credentials/provider/CreateEntry$Companion\n*L\n632#1:774,2\n680#1:778,2\n680#1:781\n648#1:776,2\n*E\n"})
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public final Slice toSlice(CreateEntry createEntry) {
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 35) {
|
|
return Api35Impl.toSlice(createEntry);
|
|
}
|
|
if (i >= 28) {
|
|
return Api28Impl.toSlice(createEntry);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public final CreateEntry fromSlice(Slice slice) {
|
|
Intrinsics.checkNotNullParameter(slice, "slice");
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 35) {
|
|
return Api35Impl.fromSlice(slice);
|
|
}
|
|
if (i >= 28) {
|
|
return Api28Impl.fromSlice(slice);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final CreateEntry fromCreateEntry(android.service.credentials.CreateEntry createEntry) {
|
|
Intrinsics.checkNotNullParameter(createEntry, "createEntry");
|
|
if (Build.VERSION.SDK_INT >= 34) {
|
|
return Api34Impl.fromCreateEntry(createEntry);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final Map<String, Integer> convertBundleToCredentialCountInfo$credentials_release(Bundle bundle) {
|
|
HashMap hashMap = new HashMap();
|
|
if (bundle == null) {
|
|
return hashMap;
|
|
}
|
|
Set<String> keySet = bundle.keySet();
|
|
Intrinsics.checkNotNullExpressionValue(keySet, "bundle.keySet()");
|
|
for (String it : keySet) {
|
|
try {
|
|
Intrinsics.checkNotNullExpressionValue(it, "it");
|
|
hashMap.put(it, Integer.valueOf(bundle.getInt(it)));
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Issue unpacking credential count info bundle: ");
|
|
sb.append(e.getMessage());
|
|
}
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public final Bundle convertCredentialCountInfoToBundle$credentials_release(Map<String, Integer> credentialCountInformationMap) {
|
|
Intrinsics.checkNotNullParameter(credentialCountInformationMap, "credentialCountInformationMap");
|
|
Bundle bundle = new Bundle();
|
|
boolean z = false;
|
|
for (Map.Entry<String, Integer> entry : credentialCountInformationMap.entrySet()) {
|
|
if (entry.getValue() != null) {
|
|
String key = entry.getKey();
|
|
Integer value = entry.getValue();
|
|
Intrinsics.checkNotNull(value);
|
|
bundle.putInt(key, value.intValue());
|
|
z = true;
|
|
}
|
|
}
|
|
if (z) {
|
|
return bundle;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@RequiresApi(23)
|
|
public final void marshall$credentials_release(List<CreateEntry> list, Bundle bundle) {
|
|
Intrinsics.checkNotNullParameter(list, "<this>");
|
|
Intrinsics.checkNotNullParameter(bundle, "bundle");
|
|
bundle.putInt(CreateEntry.EXTRA_CREATE_ENTRY_SIZE, list.size());
|
|
int i = 0;
|
|
for (Object obj : list) {
|
|
int i2 = i + 1;
|
|
if (i < 0) {
|
|
CollectionsKt__CollectionsKt.throwIndexOverflow();
|
|
}
|
|
CreateEntry createEntry = (CreateEntry) obj;
|
|
bundle.putCharSequence(CreateEntry.EXTRA_CREATE_ACCOUNT_NAME_PREFIX + i, createEntry.getAccountName());
|
|
bundle.putParcelable("androidx.credentials.provider.extra.PENDING_INTENT_" + i, createEntry.getPendingIntent());
|
|
Icon icon = createEntry.getIcon();
|
|
if (icon != null) {
|
|
bundle.putParcelable("androidx.credentials.provider.extra.ICON_" + i, icon);
|
|
}
|
|
CharSequence description = createEntry.getDescription();
|
|
if (description != null) {
|
|
bundle.putCharSequence(CreateEntry.EXTRA_CREATE_DESCRIPTION_PREFIX + i, description);
|
|
}
|
|
Instant lastUsedTime = createEntry.getLastUsedTime();
|
|
if (lastUsedTime != null) {
|
|
bundle.putSerializable("androidx.credentials.provider.extra.LAST_USED_TIME_" + i, lastUsedTime);
|
|
}
|
|
Bundle convertCredentialCountInfoToBundle$credentials_release = CreateEntry.Companion.convertCredentialCountInfoToBundle$credentials_release(createEntry.credentialCountInformationMap);
|
|
if (convertCredentialCountInfoToBundle$credentials_release != null) {
|
|
bundle.putBundle(CreateEntry.EXTRA_CREATE_CREDENTIAL_COUNT_INFO_PREFIX + i, convertCredentialCountInfoToBundle$credentials_release);
|
|
}
|
|
bundle.putBoolean("androidx.credentials.provider.extra.IS_AUTO_SELECT_ALLOWED_" + i, createEntry.isAutoSelectAllowed());
|
|
i = i2;
|
|
}
|
|
}
|
|
|
|
@RequiresApi(23)
|
|
public final List<CreateEntry> unmarshallCreateEntries$credentials_release(Bundle bundle) {
|
|
Map mutableMap;
|
|
Intrinsics.checkNotNullParameter(bundle, "<this>");
|
|
try {
|
|
ArrayList arrayList = new ArrayList();
|
|
int i = bundle.getInt(CreateEntry.EXTRA_CREATE_ENTRY_SIZE, 0);
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
CharSequence charSequence = bundle.getCharSequence(CreateEntry.EXTRA_CREATE_ACCOUNT_NAME_PREFIX + i2);
|
|
if (charSequence == null) {
|
|
return CollectionsKt__CollectionsKt.emptyList();
|
|
}
|
|
PendingIntent pendingIntent = (PendingIntent) bundle.getParcelable("androidx.credentials.provider.extra.PENDING_INTENT_" + i2);
|
|
if (pendingIntent == null) {
|
|
return CollectionsKt__CollectionsKt.emptyList();
|
|
}
|
|
Icon icon = (Icon) bundle.getParcelable("androidx.credentials.provider.extra.ICON_" + i2);
|
|
CharSequence charSequence2 = bundle.getCharSequence(CreateEntry.EXTRA_CREATE_DESCRIPTION_PREFIX + i2);
|
|
mutableMap = MapsKt__MapsKt.toMutableMap(convertBundleToCredentialCountInfo$credentials_release(bundle.getBundle(CreateEntry.EXTRA_CREATE_CREDENTIAL_COUNT_INFO_PREFIX + i2)));
|
|
arrayList.add(new CreateEntry(charSequence, pendingIntent, icon, charSequence2, (Instant) bundle.getSerializable("androidx.credentials.provider.extra.LAST_USED_TIME_" + i2), mutableMap, bundle.getBoolean("androidx.credentials.provider.extra.IS_AUTO_SELECT_ALLOWED_" + i2, false), (BiometricPromptData) null, 128, (DefaultConstructorMarker) null));
|
|
}
|
|
return arrayList;
|
|
} catch (Exception unused) {
|
|
return CollectionsKt__CollectionsKt.emptyList();
|
|
}
|
|
}
|
|
}
|
|
}
|