151 lines
7.7 KiB
Java
151 lines
7.7 KiB
Java
|
package com.google.android.gms.internal.firebase_ml;
|
||
|
|
||
|
import android.os.SystemClock;
|
||
|
import com.google.android.gms.common.internal.GmsLogger;
|
||
|
import com.google.firebase.FirebaseApp;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzoa {
|
||
|
private static final GmsLogger zzaoz = new GmsLogger("SharedPrefManager", "");
|
||
|
|
||
|
public static boolean zzc(FirebaseApp firebaseApp) {
|
||
|
boolean z;
|
||
|
synchronized (zzoa.class) {
|
||
|
z = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getBoolean(String.format("logging_%s_%s", "vision", firebaseApp.getPersistenceKey()), true);
|
||
|
}
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
public static void zza(FirebaseApp firebaseApp, boolean z) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putBoolean(String.format("logging_%s_%s", "vision", firebaseApp.getPersistenceKey()), z).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static boolean zzd(FirebaseApp firebaseApp) {
|
||
|
boolean z;
|
||
|
synchronized (zzoa.class) {
|
||
|
z = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getBoolean(String.format("logging_%s_%s", "model", firebaseApp.getPersistenceKey()), true);
|
||
|
}
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
public static void zzb(FirebaseApp firebaseApp, boolean z) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putBoolean(String.format("logging_%s_%s", "model", firebaseApp.getPersistenceKey()), z).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static Long zza(FirebaseApp firebaseApp, String str) {
|
||
|
synchronized (zzoa.class) {
|
||
|
long j = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getLong(String.format("downloading_model_id_%s_%s", firebaseApp.getPersistenceKey(), str), -1L);
|
||
|
if (j < 0) {
|
||
|
return null;
|
||
|
}
|
||
|
return Long.valueOf(j);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static zzok zzb(FirebaseApp firebaseApp, String str) {
|
||
|
zzok zzokVar;
|
||
|
synchronized (zzoa.class) {
|
||
|
String string = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getString(String.format("downloading_model_type_%s", str), "");
|
||
|
try {
|
||
|
zzokVar = zzok.zzbx(string);
|
||
|
} catch (IllegalArgumentException unused) {
|
||
|
GmsLogger gmsLogger = zzaoz;
|
||
|
String valueOf = String.valueOf(string);
|
||
|
gmsLogger.e("SharedPrefManager", valueOf.length() != 0 ? "Invalid model type ".concat(valueOf) : new String("Invalid model type "));
|
||
|
zzokVar = null;
|
||
|
}
|
||
|
}
|
||
|
return zzokVar;
|
||
|
}
|
||
|
|
||
|
public static String zzc(FirebaseApp firebaseApp, String str) {
|
||
|
String string;
|
||
|
synchronized (zzoa.class) {
|
||
|
string = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getString(String.format("downloading_model_hash_%s_%s", firebaseApp.getPersistenceKey(), str), null);
|
||
|
}
|
||
|
return string;
|
||
|
}
|
||
|
|
||
|
public static String zzd(FirebaseApp firebaseApp, String str) {
|
||
|
String string;
|
||
|
synchronized (zzoa.class) {
|
||
|
string = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getString(String.format("current_model_hash_%s_%s", firebaseApp.getPersistenceKey(), str), null);
|
||
|
}
|
||
|
return string;
|
||
|
}
|
||
|
|
||
|
public static String zze(FirebaseApp firebaseApp, String str) {
|
||
|
String string;
|
||
|
synchronized (zzoa.class) {
|
||
|
string = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getString(String.format("bad_hash_%s_%s", firebaseApp.getPersistenceKey(), str), null);
|
||
|
}
|
||
|
return string;
|
||
|
}
|
||
|
|
||
|
public static String zze(FirebaseApp firebaseApp) {
|
||
|
String string;
|
||
|
synchronized (zzoa.class) {
|
||
|
string = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getString("app_version", null);
|
||
|
}
|
||
|
return string;
|
||
|
}
|
||
|
|
||
|
public static long zzf(FirebaseApp firebaseApp, String str) {
|
||
|
long j;
|
||
|
synchronized (zzoa.class) {
|
||
|
j = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getLong(String.format("downloading_begin_time_%s_%s", firebaseApp.getPersistenceKey(), str), 0L);
|
||
|
}
|
||
|
return j;
|
||
|
}
|
||
|
|
||
|
public static long zzg(FirebaseApp firebaseApp, String str) {
|
||
|
long j;
|
||
|
synchronized (zzoa.class) {
|
||
|
j = firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).getLong(String.format("model_first_use_time_%s_%s", firebaseApp.getPersistenceKey(), str), 0L);
|
||
|
}
|
||
|
return j;
|
||
|
}
|
||
|
|
||
|
public static void zza(FirebaseApp firebaseApp, String str, long j) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putLong(String.format("model_first_use_time_%s_%s", firebaseApp.getPersistenceKey(), str), j).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void zzh(FirebaseApp firebaseApp, String str) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().remove(String.format("downloading_model_id_%s_%s", firebaseApp.getPersistenceKey(), str)).remove(String.format("downloading_model_hash_%s_%s", firebaseApp.getPersistenceKey(), str)).remove(String.format("downloading_model_type_%s", zzc(firebaseApp, str))).remove(String.format("downloading_begin_time_%s_%s", firebaseApp.getPersistenceKey(), str)).remove(String.format("model_first_use_time_%s_%s", firebaseApp.getPersistenceKey(), str)).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void zzi(FirebaseApp firebaseApp, String str) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().remove(String.format("current_model_hash_%s_%s", firebaseApp.getPersistenceKey(), str)).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void zza(FirebaseApp firebaseApp, String str, String str2) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putString(String.format("current_model_hash_%s_%s", firebaseApp.getPersistenceKey(), str), str2).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void zza(FirebaseApp firebaseApp, long j, zzop zzopVar) {
|
||
|
synchronized (zzoa.class) {
|
||
|
String modelName = zzopVar.getModelName();
|
||
|
String zzmd = zzopVar.zzmd();
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putString(String.format("downloading_model_hash_%s_%s", firebaseApp.getPersistenceKey(), modelName), zzmd).putLong(String.format("downloading_model_id_%s_%s", firebaseApp.getPersistenceKey(), modelName), j).putString(String.format("downloading_model_type_%s", zzmd), zzopVar.zzme().name()).putLong(String.format("downloading_begin_time_%s_%s", firebaseApp.getPersistenceKey(), modelName), SystemClock.elapsedRealtime()).apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void zza(FirebaseApp firebaseApp, String str, String str2, String str3) {
|
||
|
synchronized (zzoa.class) {
|
||
|
firebaseApp.getApplicationContext().getSharedPreferences("com.google.firebase.ml.internal", 0).edit().putString(String.format("bad_hash_%s_%s", firebaseApp.getPersistenceKey(), str), str2).putString("app_version", str3).apply();
|
||
|
}
|
||
|
}
|
||
|
}
|