- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
154 lines
9.4 KiB
Java
154 lines
9.4 KiB
Java
package androidx.credentials.internal;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Icon;
|
|
import android.os.Bundle;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.credentials.CreateCredentialRequest;
|
|
import androidx.credentials.CreatePasswordRequest;
|
|
import androidx.credentials.CreatePublicKeyCredentialRequest;
|
|
import androidx.credentials.R;
|
|
import androidx.credentials.exceptions.CreateCredentialCancellationException;
|
|
import androidx.credentials.exceptions.CreateCredentialCustomException;
|
|
import androidx.credentials.exceptions.CreateCredentialException;
|
|
import androidx.credentials.exceptions.CreateCredentialInterruptedException;
|
|
import androidx.credentials.exceptions.CreateCredentialNoCreateOptionException;
|
|
import androidx.credentials.exceptions.CreateCredentialProviderConfigurationException;
|
|
import androidx.credentials.exceptions.CreateCredentialUnknownException;
|
|
import androidx.credentials.exceptions.CreateCredentialUnsupportedException;
|
|
import androidx.credentials.exceptions.GetCredentialCancellationException;
|
|
import androidx.credentials.exceptions.GetCredentialCustomException;
|
|
import androidx.credentials.exceptions.GetCredentialException;
|
|
import androidx.credentials.exceptions.GetCredentialInterruptedException;
|
|
import androidx.credentials.exceptions.GetCredentialProviderConfigurationException;
|
|
import androidx.credentials.exceptions.GetCredentialUnknownException;
|
|
import androidx.credentials.exceptions.GetCredentialUnsupportedException;
|
|
import androidx.credentials.exceptions.NoCredentialException;
|
|
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException;
|
|
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException;
|
|
import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialDomException;
|
|
import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialException;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.StringsKt__StringsJVMKt;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ConversionUtilsKt {
|
|
@RequiresApi(23)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final Bundle getFinalCreateCredentialData(CreateCredentialRequest request, Context context) {
|
|
int i;
|
|
Intrinsics.checkNotNullParameter(request, "request");
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
Bundle credentialData = request.getCredentialData();
|
|
Bundle bundle = request.getDisplayInfo().toBundle();
|
|
if (request instanceof CreatePasswordRequest) {
|
|
i = R.drawable.ic_password;
|
|
} else {
|
|
i = request instanceof CreatePublicKeyCredentialRequest ? R.drawable.ic_passkey : R.drawable.ic_other_sign_in;
|
|
}
|
|
bundle.putParcelable(CreateCredentialRequest.DisplayInfo.BUNDLE_KEY_CREDENTIAL_TYPE_ICON, Icon.createWithResource(context, i));
|
|
credentialData.putBundle(CreateCredentialRequest.DisplayInfo.BUNDLE_KEY_REQUEST_DISPLAY_INFO, bundle);
|
|
return credentialData;
|
|
}
|
|
|
|
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue
|
|
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "jadx.core.dex.visitors.regions.SwitchOverStringVisitor$SwitchData.getNewCases()" is null
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.restoreSwitchOverString(SwitchOverStringVisitor.java:109)
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.visitRegion(SwitchOverStringVisitor.java:66)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterativeStepInternal(DepthRegionTraversal.java:77)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterativeStepInternal(DepthRegionTraversal.java:82)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterative(DepthRegionTraversal.java:31)
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.visit(SwitchOverStringVisitor.java:60)
|
|
*/
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static final GetCredentialException toJetpackGetException(String errorType, CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(errorType, "errorType");
|
|
switch (errorType.hashCode()) {
|
|
case -781118336:
|
|
if (errorType.equals("android.credentials.GetCredentialException.TYPE_UNKNOWN")) {
|
|
return new GetCredentialUnknownException(charSequence);
|
|
}
|
|
break;
|
|
case -408155724:
|
|
if (errorType.equals(GetCredentialUnsupportedException.TYPE_GET_CREDENTIAL_UNSUPPORTED_EXCEPTION)) {
|
|
return new GetCredentialUnsupportedException(charSequence);
|
|
}
|
|
break;
|
|
case -45448328:
|
|
if (errorType.equals(GetCredentialInterruptedException.TYPE_GET_CREDENTIAL_INTERRUPTED_EXCEPTION)) {
|
|
return new GetCredentialInterruptedException(charSequence);
|
|
}
|
|
break;
|
|
case 580557411:
|
|
if (errorType.equals("android.credentials.GetCredentialException.TYPE_USER_CANCELED")) {
|
|
return new GetCredentialCancellationException(charSequence);
|
|
}
|
|
break;
|
|
case 627896683:
|
|
if (errorType.equals("android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL")) {
|
|
return new NoCredentialException(charSequence);
|
|
}
|
|
break;
|
|
case 1594095913:
|
|
if (errorType.equals(GetCredentialProviderConfigurationException.TYPE_GET_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION)) {
|
|
return new GetCredentialProviderConfigurationException(charSequence);
|
|
}
|
|
break;
|
|
}
|
|
if (StringsKt__StringsJVMKt.startsWith$default(errorType, GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION, false, 2, null)) {
|
|
return GetPublicKeyCredentialException.Companion.createFrom(errorType, charSequence != null ? charSequence.toString() : null);
|
|
}
|
|
return new GetCredentialCustomException(errorType, charSequence);
|
|
}
|
|
|
|
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue
|
|
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "jadx.core.dex.visitors.regions.SwitchOverStringVisitor$SwitchData.getNewCases()" is null
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.restoreSwitchOverString(SwitchOverStringVisitor.java:109)
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.visitRegion(SwitchOverStringVisitor.java:66)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterativeStepInternal(DepthRegionTraversal.java:77)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterativeStepInternal(DepthRegionTraversal.java:82)
|
|
at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseIterative(DepthRegionTraversal.java:31)
|
|
at jadx.core.dex.visitors.regions.SwitchOverStringVisitor.visit(SwitchOverStringVisitor.java:60)
|
|
*/
|
|
public static final CreateCredentialException toJetpackCreateException(String errorType, CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(errorType, "errorType");
|
|
switch (errorType.hashCode()) {
|
|
case -2055374133:
|
|
if (errorType.equals(CreateCredentialCancellationException.TYPE_CREATE_CREDENTIAL_CANCELLATION_EXCEPTION)) {
|
|
return new CreateCredentialCancellationException(charSequence);
|
|
}
|
|
break;
|
|
case -1166690414:
|
|
if (errorType.equals(CreateCredentialUnsupportedException.TYPE_CREATE_CREDENTIAL_UNSUPPORTED_EXCEPTION)) {
|
|
return new CreateCredentialUnsupportedException(charSequence);
|
|
}
|
|
break;
|
|
case -580283253:
|
|
if (errorType.equals(CreateCredentialProviderConfigurationException.TYPE_CREATE_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION)) {
|
|
return new CreateCredentialProviderConfigurationException(charSequence);
|
|
}
|
|
break;
|
|
case 1316905704:
|
|
if (errorType.equals(CreateCredentialUnknownException.TYPE_CREATE_CREDENTIAL_UNKNOWN_EXCEPTION)) {
|
|
return new CreateCredentialUnknownException(charSequence);
|
|
}
|
|
break;
|
|
case 2092588512:
|
|
if (errorType.equals(CreateCredentialInterruptedException.TYPE_CREATE_CREDENTIAL_INTERRUPTED_EXCEPTION)) {
|
|
return new CreateCredentialInterruptedException(charSequence);
|
|
}
|
|
break;
|
|
case 2131915191:
|
|
if (errorType.equals(CreateCredentialNoCreateOptionException.TYPE_CREATE_CREDENTIAL_NO_CREATE_OPTION)) {
|
|
return new CreateCredentialNoCreateOptionException(charSequence);
|
|
}
|
|
break;
|
|
}
|
|
if (StringsKt__StringsJVMKt.startsWith$default(errorType, CreatePublicKeyCredentialDomException.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION, false, 2, null)) {
|
|
return CreatePublicKeyCredentialException.Companion.createFrom(errorType, charSequence != null ? charSequence.toString() : null);
|
|
}
|
|
return new CreateCredentialCustomException(errorType, charSequence);
|
|
}
|
|
}
|