mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 01:17:17 +01:00
107 lines
5 KiB
Java
107 lines
5 KiB
Java
package com.google.android.gms.security;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.SystemClock;
|
|
import android.util.Log;
|
|
import androidx.annotation.GuardedBy;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.gms.common.GoogleApiAvailabilityLight;
|
|
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
|
import com.google.android.gms.common.GooglePlayServicesUtilLight;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.dynamite.DynamiteModule;
|
|
import com.google.android.gms.internal.common.zzh;
|
|
import com.google.android.gms.internal.common.zzi;
|
|
import com.google.android.gms.internal.common.zzj;
|
|
import java.lang.reflect.Method;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public class ProviderInstaller {
|
|
|
|
@NonNull
|
|
public static final String PROVIDER_NAME = "GmsCore_OpenSSL";
|
|
private static final GoogleApiAvailabilityLight zza = GoogleApiAvailabilityLight.getInstance();
|
|
private static final Object zzb = new Object();
|
|
|
|
@Nullable
|
|
@GuardedBy("ProviderInstaller.lock")
|
|
private static Method zzc = null;
|
|
|
|
@GuardedBy("ProviderInstaller.lock")
|
|
private static boolean zzd = false;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public interface ProviderInstallListener {
|
|
void onProviderInstallFailed(int i, @Nullable Intent intent);
|
|
|
|
void onProviderInstalled();
|
|
}
|
|
|
|
public static void installIfNeeded(@NonNull Context context) throws GooglePlayServicesRepairableException, GooglePlayServicesNotAvailableException {
|
|
Context context2;
|
|
Preconditions.checkNotNull(context, "Context must not be null");
|
|
zza.verifyGooglePlayServicesIsAvailable(context, 11925000);
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
synchronized (zzb) {
|
|
Context context3 = null;
|
|
if (!zzd) {
|
|
try {
|
|
context2 = DynamiteModule.load(context, DynamiteModule.PREFER_HIGHEST_OR_LOCAL_VERSION_NO_FORCE_STAGING, "com.google.android.gms.providerinstaller.dynamite").getModuleContext();
|
|
} catch (DynamiteModule.LoadingException e) {
|
|
Log.w("ProviderInstaller", "Failed to load providerinstaller module: ".concat(String.valueOf(e.getMessage())));
|
|
context2 = null;
|
|
}
|
|
if (context2 != null) {
|
|
zzb(context2, context, "com.google.android.gms.providerinstaller.ProviderInstallerImpl");
|
|
return;
|
|
}
|
|
}
|
|
boolean z = zzd;
|
|
Context remoteContext = GooglePlayServicesUtilLight.getRemoteContext(context);
|
|
if (remoteContext != null) {
|
|
zzd = true;
|
|
if (!z) {
|
|
try {
|
|
zzj.zzb("com.google.android.gms.common.security.ProviderInstallerImpl", "reportRequestStats2", remoteContext.getClassLoader(), zzi.zzb(Context.class, context), zzh.zza(uptimeMillis), zzh.zza(SystemClock.uptimeMillis()));
|
|
} catch (Exception e2) {
|
|
Log.w("ProviderInstaller", "Failed to report request stats: ".concat(e2.toString()));
|
|
}
|
|
}
|
|
context3 = remoteContext;
|
|
}
|
|
if (context3 != null) {
|
|
zzb(context3, context, "com.google.android.gms.common.security.ProviderInstallerImpl");
|
|
} else {
|
|
Log.e("ProviderInstaller", "Failed to get remote context");
|
|
throw new GooglePlayServicesNotAvailableException(8);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void installIfNeededAsync(@NonNull Context context, @NonNull ProviderInstallListener providerInstallListener) {
|
|
Preconditions.checkNotNull(context, "Context must not be null");
|
|
Preconditions.checkNotNull(providerInstallListener, "Listener must not be null");
|
|
Preconditions.checkMainThread("Must be called on the UI thread");
|
|
new zza(context, providerInstallListener).execute(new Void[0]);
|
|
}
|
|
|
|
@GuardedBy("ProviderInstaller.lock")
|
|
private static void zzb(Context context, Context context2, String str) throws GooglePlayServicesNotAvailableException {
|
|
try {
|
|
if (zzc == null) {
|
|
zzc = context.getClassLoader().loadClass(str).getMethod("insertProvider", Context.class);
|
|
}
|
|
zzc.invoke(null, context);
|
|
} catch (Exception e) {
|
|
Throwable cause = e.getCause();
|
|
if (Log.isLoggable("ProviderInstaller", 6)) {
|
|
Log.e("ProviderInstaller", "Failed to install provider: ".concat(String.valueOf(cause == null ? e.toString() : cause.toString())));
|
|
}
|
|
throw new GooglePlayServicesNotAvailableException(8);
|
|
}
|
|
}
|
|
}
|