package com.vinfast.companion.map.wrapper.support;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
@kotlin.Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0005\u0018\u0000 \u00102\u00020\u0001:\u0001\u0011B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0015\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0007\u0010\bJ\u001d\u0010\u000e\u001a\u00020\r2\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000b¢\u0006\u0004\b\u000e\u0010\u000f¨\u0006\u0012"}, d2 = {"Lcom/vinfast/companion/map/wrapper/support/GnssSupporter;", "", "<init>", "()V", "Landroid/location/LocationManager;", "locationManager", "", "c", "(Landroid/location/LocationManager;)Z", "Landroidx/fragment/app/Fragment;", "fragment", "Lcom/google/android/gms/location/LocationRequest;", "lq", "", "d", "(Landroidx/fragment/app/Fragment;Lcom/google/android/gms/location/LocationRequest;)V", "a", "Companion", "hereSdk_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class GnssSupporter {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    public static final com.vinfast.companion.map.wrapper.support.GnssSupporter.Companion INSTANCE = new com.vinfast.companion.map.wrapper.support.GnssSupporter.Companion(null);
    private static final com.google.android.gms.location.LocationRequest b;
    private static final com.google.android.gms.location.LocationRequest c;

    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003R\u0017\u0010\u0005\u001a\u00020\u00048\u0006¢\u0006\f\n\u0004\b\u0005\u0010\u0006\u001a\u0004\b\u0007\u0010\b¨\u0006\t"}, d2 = {"Lcom/vinfast/companion/map/wrapper/support/GnssSupporter$Companion;", "", "<init>", "()V", "Lcom/google/android/gms/location/LocationRequest;", "HIGH_ACCURACY", "Lcom/google/android/gms/location/LocationRequest;", "a", "()Lcom/google/android/gms/location/LocationRequest;", "hereSdk_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
    public static final class Companion {
        public /* synthetic */ Companion(kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final com.google.android.gms.location.LocationRequest a() {
            return com.vinfast.companion.map.wrapper.support.GnssSupporter.b;
        }

        private Companion() {
        }
    }

    static {
        com.google.android.gms.location.LocationRequest locationRequestCreate = com.google.android.gms.location.LocationRequest.create();
        kotlin.jvm.internal.Intrinsics.k(locationRequestCreate, "create(...)");
        locationRequestCreate.setPriority(100);
        java.util.concurrent.TimeUnit timeUnit = java.util.concurrent.TimeUnit.SECONDS;
        locationRequestCreate.setInterval(timeUnit.toMillis(30L));
        locationRequestCreate.setFastestInterval(timeUnit.toMillis(2L));
        b = locationRequestCreate;
        com.google.android.gms.location.LocationRequest locationRequestCreate2 = com.google.android.gms.location.LocationRequest.create();
        kotlin.jvm.internal.Intrinsics.k(locationRequestCreate2, "create(...)");
        locationRequestCreate2.setPriority(104);
        java.util.concurrent.TimeUnit timeUnit2 = java.util.concurrent.TimeUnit.MINUTES;
        locationRequestCreate2.setInterval(timeUnit2.toMillis(60L));
        locationRequestCreate2.setFastestInterval(timeUnit2.toMillis(5L));
        c = locationRequestCreate2;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void e(androidx.fragment.app.Fragment fragment, java.lang.Exception exc) {
        kotlin.jvm.internal.Intrinsics.l(exc, "failure");
        int statusCode = ((com.google.android.gms.common.api.ApiException) exc).getStatusCode();
        if (statusCode != 6) {
            if (statusCode != 8502) {
                return;
            }
            timber.log.Timber.a.c("Location settings are inadequate, and cannot be fixed here. Fix in Settings.", new java.lang.Object[0]);
        } else {
            try {
                ((com.google.android.gms.common.api.ResolvableApiException) exc).startResolutionForResult(fragment.requireActivity(), 50);
            } catch (android.content.IntentSender.SendIntentException unused) {
                timber.log.Timber.a.a("PendingIntent unable to execute request.", new java.lang.Object[0]);
            }
        }
    }

    public final boolean c(android.location.LocationManager locationManager) {
        kotlin.jvm.internal.Intrinsics.l(locationManager, "locationManager");
        return locationManager.isProviderEnabled("gps");
    }

    public final void d(final androidx.fragment.app.Fragment fragment, com.google.android.gms.location.LocationRequest lq) {
        kotlin.jvm.internal.Intrinsics.l(fragment, "fragment");
        kotlin.jvm.internal.Intrinsics.l(lq, "lq");
        com.google.android.gms.location.LocationSettingsRequest locationSettingsRequestBuild = new com.google.android.gms.location.LocationSettingsRequest.Builder().addLocationRequest(lq).setAlwaysShow(true).build();
        kotlin.jvm.internal.Intrinsics.k(locationSettingsRequestBuild, "build(...)");
        com.google.android.gms.location.LocationServices.getSettingsClient(fragment.requireContext()).checkLocationSettings(locationSettingsRequestBuild).addOnFailureListener(new com.google.android.gms.tasks.OnFailureListener() { // from class: p4.a
            public final void onFailure(java.lang.Exception exc) {
                com.vinfast.companion.map.wrapper.support.GnssSupporter.e(fragment, exc);
            }
        });
    }
}
