- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
108 lines
5.6 KiB
Java
108 lines
5.6 KiB
Java
package com.google.android.gms.identitycredentials;
|
|
|
|
import android.content.Intent;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import java.util.ArrayList;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class IntentHelper {
|
|
public static final String ACTION_GET_CREDENTIAL = "androidx.identitycredentials.action.GET_CREDENTIALS";
|
|
public static final String EXTRA_CREDENTIAL_ID = "androidx.identitycredentials.extra.CREDENTIAL_ID";
|
|
public static final IntentHelper INSTANCE = new IntentHelper();
|
|
|
|
private IntentHelper() {
|
|
}
|
|
|
|
@Nullable
|
|
public static final CallingAppInfo extractCallingAppInfo(@NonNull Intent intent) {
|
|
Intrinsics.checkNotNullParameter(intent, "intent");
|
|
intent.setExtrasClassLoader(null);
|
|
String stringExtra = intent.getStringExtra("androidx.identitycredentials.extra.CALLING_PACKAGE_NAME");
|
|
if (stringExtra == null) {
|
|
return null;
|
|
}
|
|
String stringExtra2 = intent.getStringExtra("androidx.identitycredentials.extra.ORIGIN");
|
|
int intExtra = intent.getIntExtra("androidx.identitycredentials.extra.SIGNATURE_COUNT", 0);
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i = 0; i < intExtra; i++) {
|
|
byte[] byteArrayExtra = intent.getByteArrayExtra("androidx.identitycredentials.extra.SIGNATURE_" + i);
|
|
if (byteArrayExtra == null) {
|
|
Log.w("IntentHelper", "cannot find expected signature at count " + i);
|
|
return null;
|
|
}
|
|
arrayList.add(byteArrayExtra);
|
|
}
|
|
return new CallingAppInfo(stringExtra, arrayList, stringExtra2);
|
|
}
|
|
|
|
@Nullable
|
|
public static final GetCredentialRequest extractGetCredentialRequest(@NonNull Intent intent) {
|
|
Intrinsics.checkNotNullParameter(intent, "intent");
|
|
intent.setExtrasClassLoader(GetCredentialRequest.class.getClassLoader());
|
|
return (GetCredentialRequest) intent.getParcelableExtra("androidx.identitycredentials.extra.GET_CREDENTIAL_REQUEST");
|
|
}
|
|
|
|
public static final GetCredentialResponse extractGetCredentialResponse(int i, @NonNull Bundle resultData) throws GetCredentialException {
|
|
Intent intent;
|
|
Object parcelable;
|
|
Intrinsics.checkNotNullParameter(resultData, "resultData");
|
|
if (i != -1) {
|
|
if (i == 0) {
|
|
CharSequence charSequence = resultData.getCharSequence("androidx.identitycredentials.BUNDLE_KEY_EXCEPTION_TYPE");
|
|
String obj = charSequence != null ? charSequence.toString() : "android.credentials.GetCredentialException.TYPE_USER_CANCELED";
|
|
CharSequence charSequence2 = resultData.getCharSequence("androidx.identitycredentials.BUNDLE_KEY_EXCEPTION_MESSAGE");
|
|
throw new GetCredentialException(obj, charSequence2 != null ? charSequence2.toString() : null);
|
|
}
|
|
throw INSTANCE.newUnknownException("Activity result has unexpected resultCode: " + i);
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 33) {
|
|
parcelable = resultData.getParcelable("androidx.identitycredentials.BUNDLE_KEY_PROVIDER_DATA", Intent.class);
|
|
intent = (Intent) parcelable;
|
|
} else {
|
|
intent = (Intent) resultData.getParcelable("androidx.identitycredentials.BUNDLE_KEY_PROVIDER_DATA");
|
|
}
|
|
if (intent == null) {
|
|
throw INSTANCE.newUnknownException("Provider result is empty");
|
|
}
|
|
if (intent.hasExtra("androidx.identitycredentials.EXTRA_CREDENTIAL_TYPE")) {
|
|
String stringExtra = intent.getStringExtra("androidx.identitycredentials.EXTRA_CREDENTIAL_TYPE");
|
|
Bundle bundleExtra = intent.getBundleExtra("androidx.identitycredentials.EXTRA_CREDENTIAL_DATA");
|
|
if (stringExtra == null || bundleExtra == null) {
|
|
throw INSTANCE.newUnknownException("Credential result is empty");
|
|
}
|
|
return new GetCredentialResponse(new Credential(stringExtra, bundleExtra));
|
|
}
|
|
if (!intent.hasExtra("androidx.identitycredentials.EXTRA_EXCEPTION_TYPE")) {
|
|
throw INSTANCE.newUnknownException("Unknown provider error");
|
|
}
|
|
String stringExtra2 = intent.getStringExtra("androidx.identitycredentials.EXTRA_EXCEPTION_TYPE");
|
|
if (stringExtra2 == null) {
|
|
throw INSTANCE.newUnknownException("Unknown provider error");
|
|
}
|
|
throw new GetCredentialException(stringExtra2, intent.getStringExtra("androidx.identitycredentials.EXTRA_EXCEPTION_MESSAGE"));
|
|
}
|
|
|
|
private final GetCredentialException newUnknownException(String str) {
|
|
return new GetCredentialException("android.credentials.GetCredentialException.TYPE_UNKNOWN", str);
|
|
}
|
|
|
|
public static final void setGetCredentialException(@NonNull Intent intent, @NonNull String errorType, String str) {
|
|
Intrinsics.checkNotNullParameter(intent, "intent");
|
|
Intrinsics.checkNotNullParameter(errorType, "errorType");
|
|
intent.putExtra("androidx.identitycredentials.EXTRA_EXCEPTION_TYPE", errorType);
|
|
intent.putExtra("androidx.identitycredentials.EXTRA_EXCEPTION_MESSAGE", str);
|
|
}
|
|
|
|
public static final void setGetCredentialResponse(@NonNull Intent intent, @NonNull GetCredentialResponse response) {
|
|
Intrinsics.checkNotNullParameter(intent, "intent");
|
|
Intrinsics.checkNotNullParameter(response, "response");
|
|
intent.putExtra("androidx.identitycredentials.EXTRA_CREDENTIAL_TYPE", response.getCredential().getType());
|
|
intent.putExtra("androidx.identitycredentials.EXTRA_CREDENTIAL_DATA", response.getCredential().getData());
|
|
}
|
|
}
|