package androidx.credentials.provider.utils; import android.annotation.SuppressLint; import android.app.slice.Slice; import android.content.pm.SigningInfo; import android.os.Bundle; import android.service.credentials.BeginCreateCredentialResponse; import android.service.credentials.CallingAppInfo; import androidx.annotation.RequiresApi; import androidx.credentials.provider.BeginCreateCredentialRequest; import androidx.credentials.provider.CallingAppInfo; import androidx.credentials.provider.CreateEntry; import androidx.credentials.provider.RemoteEntry; import androidx.credentials.provider.utils.BeginCreateCredentialUtil; import java.util.Iterator; import java.util.List; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; /* loaded from: classes.dex */ public final class BeginCreateCredentialUtil { public static final Companion Companion = new Companion(null); @SourceDebugExtension({"SMAP\nBeginCreateCredentialUtil.kt\nKotlin\n*S Kotlin\n*F\n+ 1 BeginCreateCredentialUtil.kt\nandroidx/credentials/provider/utils/BeginCreateCredentialUtil$Companion\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,124:1\n1855#2,2:125\n1#3:127\n*S KotlinDebug\n*F\n+ 1 BeginCreateCredentialUtil.kt\nandroidx/credentials/provider/utils/BeginCreateCredentialUtil$Companion\n*L\n76#1:125,2\n*E\n"}) public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } @RequiresApi(34) public final BeginCreateCredentialRequest convertToJetpackRequest$credentials_release(android.service.credentials.BeginCreateCredentialRequest request) { String type; Bundle data; CallingAppInfo callingAppInfo; androidx.credentials.provider.CallingAppInfo callingAppInfo2; String packageName; SigningInfo signingInfo; String origin; Intrinsics.checkNotNullParameter(request, "request"); BeginCreateCredentialRequest.Companion companion = BeginCreateCredentialRequest.Companion; type = request.getType(); Intrinsics.checkNotNullExpressionValue(type, "request.type"); data = request.getData(); Intrinsics.checkNotNullExpressionValue(data, "request.data"); callingAppInfo = request.getCallingAppInfo(); if (callingAppInfo != null) { CallingAppInfo.Companion companion2 = androidx.credentials.provider.CallingAppInfo.Companion; packageName = callingAppInfo.getPackageName(); Intrinsics.checkNotNullExpressionValue(packageName, "it.packageName"); signingInfo = callingAppInfo.getSigningInfo(); Intrinsics.checkNotNullExpressionValue(signingInfo, "it.signingInfo"); origin = callingAppInfo.getOrigin(); callingAppInfo2 = companion2.create(packageName, signingInfo, origin); } else { callingAppInfo2 = null; } return companion.createFrom$credentials_release(type, data, callingAppInfo2); } @RequiresApi(34) public final BeginCreateCredentialResponse convertToFrameworkResponse(androidx.credentials.provider.BeginCreateCredentialResponse response) { BeginCreateCredentialResponse build; Intrinsics.checkNotNullParameter(response, "response"); BeginCreateCredentialResponse.Builder m = BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline12.m(); populateCreateEntries(m, response.getCreateEntries()); populateRemoteEntry(m, response.getRemoteEntry()); build = m.build(); Intrinsics.checkNotNullExpressionValue(build, "frameworkBuilder.build()"); return build; } @RequiresApi(34) @SuppressLint({"MissingPermission"}) private final void populateRemoteEntry(BeginCreateCredentialResponse.Builder builder, RemoteEntry remoteEntry) { if (remoteEntry == null) { return; } BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline18.m(); builder.setRemoteCreateEntry(BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline17.m(RemoteEntry.Companion.toSlice(remoteEntry))); } @RequiresApi(34) private final void populateCreateEntries(BeginCreateCredentialResponse.Builder builder, List list) { Iterator it = list.iterator(); while (it.hasNext()) { Slice slice = CreateEntry.Companion.toSlice((CreateEntry) it.next()); if (slice != null) { builder.addCreateEntry(BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline19.m(slice)); } } } @RequiresApi(34) public final android.service.credentials.BeginCreateCredentialRequest convertToFrameworkRequest(BeginCreateCredentialRequest request) { android.service.credentials.CallingAppInfo callingAppInfo; Intrinsics.checkNotNullParameter(request, "request"); if (request.getCallingAppInfo() != null) { BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline15.m(); callingAppInfo = BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline13.m(request.getCallingAppInfo().getPackageName(), request.getCallingAppInfo().getSigningInfo(), request.getCallingAppInfo().getOrigin$credentials_release()); } else { callingAppInfo = null; } BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline16.m(); return BeginCreateCredentialUtil$Companion$$ExternalSyntheticApiModelOutline14.m(request.getType(), request.getCandidateQueryData(), callingAppInfo); } @RequiresApi(34) public final androidx.credentials.provider.BeginCreateCredentialResponse convertToJetpackResponse(BeginCreateCredentialResponse frameworkResponse) { List createEntries; android.service.credentials.RemoteEntry remoteCreateEntry; RemoteEntry remoteEntry; Slice slice; Intrinsics.checkNotNullParameter(frameworkResponse, "frameworkResponse"); createEntries = frameworkResponse.getCreateEntries(); Stream stream = createEntries.stream(); final BeginCreateCredentialUtil$Companion$convertToJetpackResponse$1 beginCreateCredentialUtil$Companion$convertToJetpackResponse$1 = new Function1() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$convertToJetpackResponse$1 public final CreateEntry invoke(android.service.credentials.CreateEntry createEntry) { Slice slice2; CreateEntry.Companion companion = CreateEntry.Companion; slice2 = createEntry.getSlice(); Intrinsics.checkNotNullExpressionValue(slice2, "entry.slice"); return companion.fromSlice(slice2); } @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Object invoke(Object obj) { return invoke(BeginCreateCredentialUtil$Companion$convertToJetpackResponse$1$$ExternalSyntheticApiModelOutline0.m(obj)); } }; Stream map = stream.map(new Function() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$$ExternalSyntheticLambda20 @Override // java.util.function.Function public final Object apply(Object obj) { CreateEntry convertToJetpackResponse$lambda$2; convertToJetpackResponse$lambda$2 = BeginCreateCredentialUtil.Companion.convertToJetpackResponse$lambda$2(Function1.this, obj); return convertToJetpackResponse$lambda$2; } }); final BeginCreateCredentialUtil$Companion$convertToJetpackResponse$2 beginCreateCredentialUtil$Companion$convertToJetpackResponse$2 = new Function1() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$convertToJetpackResponse$2 @Override // kotlin.jvm.functions.Function1 public final Boolean invoke(CreateEntry createEntry) { return Boolean.valueOf(createEntry != null); } }; Stream filter = map.filter(new Predicate() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$$ExternalSyntheticLambda21 @Override // java.util.function.Predicate public final boolean test(Object obj) { boolean convertToJetpackResponse$lambda$3; convertToJetpackResponse$lambda$3 = BeginCreateCredentialUtil.Companion.convertToJetpackResponse$lambda$3(Function1.this, obj); return convertToJetpackResponse$lambda$3; } }); final BeginCreateCredentialUtil$Companion$convertToJetpackResponse$3 beginCreateCredentialUtil$Companion$convertToJetpackResponse$3 = new Function1() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$convertToJetpackResponse$3 @Override // kotlin.jvm.functions.Function1 public final CreateEntry invoke(CreateEntry createEntry) { Intrinsics.checkNotNull(createEntry); return createEntry; } }; Object collect = filter.map(new Function() { // from class: androidx.credentials.provider.utils.BeginCreateCredentialUtil$Companion$$ExternalSyntheticLambda22 @Override // java.util.function.Function public final Object apply(Object obj) { CreateEntry convertToJetpackResponse$lambda$4; convertToJetpackResponse$lambda$4 = BeginCreateCredentialUtil.Companion.convertToJetpackResponse$lambda$4(Function1.this, obj); return convertToJetpackResponse$lambda$4; } }).collect(Collectors.toList()); Intrinsics.checkNotNullExpressionValue(collect, "frameworkResponse.create…lect(Collectors.toList())"); List list = (List) collect; remoteCreateEntry = frameworkResponse.getRemoteCreateEntry(); if (remoteCreateEntry != null) { RemoteEntry.Companion companion = RemoteEntry.Companion; slice = remoteCreateEntry.getSlice(); Intrinsics.checkNotNullExpressionValue(slice, "it.slice"); remoteEntry = companion.fromSlice(slice); } else { remoteEntry = null; } return new androidx.credentials.provider.BeginCreateCredentialResponse(list, remoteEntry); } /* JADX INFO: Access modifiers changed from: private */ public static final CreateEntry convertToJetpackResponse$lambda$2(Function1 function1, Object obj) { return (CreateEntry) function1.invoke(obj); } /* JADX INFO: Access modifiers changed from: private */ public static final boolean convertToJetpackResponse$lambda$3(Function1 function1, Object obj) { return ((Boolean) function1.invoke(obj)).booleanValue(); } /* JADX INFO: Access modifiers changed from: private */ public static final CreateEntry convertToJetpackResponse$lambda$4(Function1 function1, Object obj) { return (CreateEntry) function1.invoke(obj); } } }