what-the-bank/sources/com/google/android/gms/internal/firebase_ml/zzof.java

40 lines
1.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.internal.firebase_ml;
import android.net.Uri;
import com.google.android.gms.common.internal.GmsLogger;
import com.google.common.net.HttpHeaders;
import com.google.firebase.ml.common.FirebaseMLException;
import com.google.firebase.ml.common.modeldownload.FirebaseRemoteModel;
import javax.net.ssl.HttpsURLConnection;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class zzof {
private static final GmsLogger zzaoz = new GmsLogger("BaseModelInfoRetriever", "");
/* JADX INFO: Access modifiers changed from: package-private */
public static zzop zza(FirebaseRemoteModel firebaseRemoteModel, zzon zzonVar) throws FirebaseMLException {
HttpsURLConnection zza = zzou.zza(String.format("https://mlkit.googleapis.com/_i/v1/1p/m?n=%s", firebaseRemoteModel.zzmj()), zzonVar);
if (zza == null) {
return null;
}
String headerField = zza.getHeaderField(HttpHeaders.CONTENT_LOCATION);
String headerField2 = zza.getHeaderField(HttpHeaders.ETAG);
GmsLogger gmsLogger = zzaoz;
String valueOf = String.valueOf(headerField);
gmsLogger.d("BaseModelInfoRetriever", valueOf.length() != 0 ? "Received download URL: ".concat(valueOf) : new String("Received download URL: "));
if (headerField == null) {
return null;
}
if (headerField2 == null) {
zzonVar.zza(zzmk.MODEL_INFO_DOWNLOAD_NO_HASH, false);
throw new FirebaseMLException("No hash value for the base model", 13);
}
if (!firebaseRemoteModel.zzcd(headerField2)) {
throw new FirebaseMLException("Downloaded model hash doesn't match the expected. ", 13);
}
firebaseRemoteModel.zzce(headerField2);
return new zzop(firebaseRemoteModel.zzmj(), Uri.parse(headerField), headerField2, zzok.BASE);
}
}