- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
189 lines
7.0 KiB
Java
189 lines
7.0 KiB
Java
package com.helpshift.core;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.net.ConnectivityManager;
|
|
import android.net.NetworkInfo;
|
|
import android.os.Build;
|
|
import android.os.Environment;
|
|
import android.os.LocaleList;
|
|
import android.os.StatFs;
|
|
import android.telephony.TelephonyManager;
|
|
import android.util.Base64;
|
|
import com.applovin.sdk.AppLovinEventTypes;
|
|
import com.facebook.internal.AnalyticsEvents;
|
|
import com.facebook.internal.security.CertificateUtil;
|
|
import com.helpshift.log.HSLogger;
|
|
import com.helpshift.platform.Device;
|
|
import com.helpshift.storage.HSPersistentStorage;
|
|
import com.helpshift.util.Utils;
|
|
import com.helpshift.util.ValuePair;
|
|
import java.util.Locale;
|
|
import java.util.UUID;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class AndroidDevice implements Device {
|
|
public final Context context;
|
|
public HSPersistentStorage persistentStorage;
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getOsType() {
|
|
return "android";
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getSDKVersion() {
|
|
return "10.2.2";
|
|
}
|
|
|
|
public AndroidDevice(Context context, HSPersistentStorage hSPersistentStorage) {
|
|
this.context = context;
|
|
this.persistentStorage = hSPersistentStorage;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getAppVersion() {
|
|
try {
|
|
return this.context.getPackageManager().getPackageInfo(getAppIdentifier(), 0).versionName;
|
|
} catch (Exception e) {
|
|
HSLogger.d("Device", "Error getting app version", e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getAppName() {
|
|
String str;
|
|
try {
|
|
str = this.context.getPackageManager().getApplicationLabel(this.context.getApplicationInfo()).toString();
|
|
} catch (Exception e) {
|
|
HSLogger.d("Device", "Error getting application name", e);
|
|
str = null;
|
|
}
|
|
return str == null ? "Support" : str;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getAppIdentifier() {
|
|
return this.context.getPackageName();
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getDeviceModel() {
|
|
return Build.MODEL;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getBatteryLevel() {
|
|
if (this.context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED")) == null) {
|
|
return "";
|
|
}
|
|
return ((int) ((r0.getIntExtra(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1) / r0.getIntExtra("scale", -1)) * 100.0f)) + "%";
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getBatteryStatus() {
|
|
Intent registerReceiver = this.context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
|
if (registerReceiver == null) {
|
|
return "Not charging";
|
|
}
|
|
int intExtra = registerReceiver.getIntExtra("status", -1);
|
|
return (intExtra == 2 || intExtra == 5) ? "Charging" : "Not charging";
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public ValuePair getDiskSpace() {
|
|
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
|
|
return new ValuePair((Math.round(((statFs.getBlockCountLong() * statFs.getBlockSizeLong()) / 1.073741824E9d) * 100.0d) / 100.0d) + " GB", (Math.round(((statFs.getAvailableBlocksLong() * statFs.getBlockSizeLong()) / 1.073741824E9d) * 100.0d) / 100.0d) + " GB");
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getOSVersion() {
|
|
return Build.VERSION.RELEASE;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getCarrierName() {
|
|
TelephonyManager telephonyManager = (TelephonyManager) this.context.getSystemService("phone");
|
|
return telephonyManager == null ? "" : telephonyManager.getNetworkOperatorName();
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getNetworkType() {
|
|
NetworkInfo activeNetworkInfo;
|
|
String str = null;
|
|
try {
|
|
ConnectivityManager connectivityManager = (ConnectivityManager) this.context.getSystemService("connectivity");
|
|
if (connectivityManager != null && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null) {
|
|
str = activeNetworkInfo.getTypeName();
|
|
}
|
|
} catch (SecurityException unused) {
|
|
}
|
|
return str == null ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN : str;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getCountryCode() {
|
|
TelephonyManager telephonyManager = (TelephonyManager) this.context.getSystemService("phone");
|
|
return telephonyManager == null ? "" : telephonyManager.getSimCountryIso();
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getRom() {
|
|
return System.getProperty("os.version") + CertificateUtil.DELIMITER + Build.FINGERPRINT;
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getLanguage() {
|
|
String languageTag;
|
|
LocaleList applicationLocales;
|
|
try {
|
|
if (Build.VERSION.SDK_INT >= 33) {
|
|
applicationLocales = AndroidDevice$$ExternalSyntheticApiModelOutline1.m(this.context.getSystemService(AndroidDevice$$ExternalSyntheticApiModelOutline0.m())).getApplicationLocales();
|
|
if (applicationLocales != null && !applicationLocales.isEmpty()) {
|
|
languageTag = applicationLocales.get(0).toLanguageTag();
|
|
} else {
|
|
languageTag = Locale.getDefault().toLanguageTag();
|
|
}
|
|
} else {
|
|
languageTag = Locale.getDefault().toLanguageTag();
|
|
}
|
|
return languageTag;
|
|
} catch (Exception e) {
|
|
HSLogger.e("Device", "Error getting app language", e);
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public boolean isOnline() {
|
|
try {
|
|
NetworkInfo activeNetworkInfo = ((ConnectivityManager) this.context.getSystemService("connectivity")).getActiveNetworkInfo();
|
|
if (activeNetworkInfo != null) {
|
|
return activeNetworkInfo.isConnected();
|
|
}
|
|
return false;
|
|
} catch (Exception e) {
|
|
HSLogger.e("Device", "Exception while getting system connectivity service", e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String encodeBase64(String str) {
|
|
return Base64.encodeToString(str.getBytes(), 2);
|
|
}
|
|
|
|
@Override // com.helpshift.platform.Device
|
|
public String getDeviceId() {
|
|
String hsDeviceId = this.persistentStorage.getHsDeviceId();
|
|
if (!Utils.isEmpty(hsDeviceId)) {
|
|
return hsDeviceId;
|
|
}
|
|
String uuid = UUID.randomUUID().toString();
|
|
this.persistentStorage.setHsDeviceId(uuid);
|
|
return uuid;
|
|
}
|
|
}
|