what-the-bank/sources/com/google/android/libraries/places/internal/zzfc.java

142 lines
5.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.libraries.places.internal;
import android.location.Location;
import android.text.TextUtils;
import com.airbnb.deeplinkdispatch.base.MatchIndex;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.libraries.places.api.model.LocationBias;
import com.google.android.libraries.places.api.model.LocationRestriction;
import com.google.android.libraries.places.api.model.RectangularBounds;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/* loaded from: classes2.dex */
public final class zzfc {
private static final zzjb zza;
static {
zzja zzjaVar = new zzja();
zzjaVar.zza(zzck.NONE, "NONE");
zzjaVar.zza(zzck.PSK, "WPA_PSK");
zzjaVar.zza(zzck.EAP, "WPA_EAP");
zzjaVar.zza(zzck.OTHER, "SECURED_NONE");
zza = zzjaVar.zzb();
}
public static Integer zza(Location location) {
if (location == null) {
return null;
}
float accuracy = location.getAccuracy();
if (!location.hasAccuracy() || accuracy <= BitmapDescriptorFactory.HUE_RED) {
return null;
}
return Integer.valueOf(Math.round(accuracy * 100.0f));
}
public static String zzb(List list) {
StringBuilder sb = new StringBuilder();
Iterator it = list.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
String str = (String) it.next();
String concat = TextUtils.isEmpty(str) ? null : "country:".concat(String.valueOf(str.toLowerCase(Locale.US)));
if (concat != null) {
if (sb.length() != 0) {
sb.append(MatchIndex.ALLOWED_VALUES_SEPARATOR);
}
sb.append(concat);
}
}
if (sb.length() == 0) {
return null;
}
return sb.toString();
}
public static String zzc(Location location) {
if (location == null) {
return null;
}
return zzh(location.getLatitude(), location.getLongitude());
}
public static String zzd(LatLng latLng) {
if (latLng == null) {
return null;
}
return zzh(latLng.latitude, latLng.longitude);
}
public static String zze(LocationBias locationBias) {
if (locationBias == null) {
return null;
}
if (locationBias instanceof RectangularBounds) {
return zzi((RectangularBounds) locationBias);
}
throw new AssertionError("Unknown LocationBias type.");
}
public static String zzf(LocationRestriction locationRestriction) {
if (locationRestriction == null) {
return null;
}
if (locationRestriction instanceof RectangularBounds) {
return zzi((RectangularBounds) locationRestriction);
}
throw new AssertionError("Unknown LocationRestriction type.");
}
public static String zzg(zziy zziyVar, int i) {
StringBuilder sb = new StringBuilder();
int size = zziyVar.size();
for (int i2 = 0; i2 < size; i2++) {
zzcl zzclVar = (zzcl) zziyVar.get(i2);
int length = sb.length();
zzja zzjaVar = new zzja();
zzjaVar.zza("mac", zzclVar.zzd());
zzjaVar.zza("strength_dbm", Integer.valueOf(zzclVar.zzb()));
zzjaVar.zza("wifi_auth_type", zza.get(zzclVar.zzc()));
zzjaVar.zza("is_connected", Boolean.valueOf(zzclVar.zze()));
zzjaVar.zza("frequency_mhz", Integer.valueOf(zzclVar.zza()));
zzjb zzb = zzjaVar.zzb();
zzib zzc = zzib.zzc(",");
Iterator<E> it = zzb.entrySet().iterator();
StringBuilder sb2 = new StringBuilder();
try {
zzia.zza(sb2, it, zzc, ContainerUtils.KEY_VALUE_DELIMITER);
String obj = sb2.toString();
int length2 = sb.length();
String concat = (length > 0 ? HiAnalyticsConstant.REPORT_VAL_SEPARATOR : "").concat(obj);
if (length2 + concat.length() > 4000) {
break;
}
sb.append(concat);
} catch (IOException e) {
throw new AssertionError(e);
}
}
return sb.toString();
}
private static String zzh(double d, double d2) {
return String.format(Locale.US, "%.15f,%.15f", Double.valueOf(d), Double.valueOf(d2));
}
private static String zzi(RectangularBounds rectangularBounds) {
LatLng southwest = rectangularBounds.getSouthwest();
double d = southwest.latitude;
double d2 = southwest.longitude;
LatLng northeast = rectangularBounds.getNortheast();
return String.format(Locale.US, "rectangle:%.15f,%.15f|%.15f,%.15f", Double.valueOf(d), Double.valueOf(d2), Double.valueOf(northeast.latitude), Double.valueOf(northeast.longitude));
}
}