Files
rr3-apk/decompiled/sources/com/firemonkeys/cloudcellapi/util/GetInfo.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

316 lines
12 KiB
Java

package com.firemonkeys.cloudcellapi.util;
import android.Manifest;
import android.app.Activity;
import android.app.UiModeManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.media.AudioManager;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import com.firemonkeys.cloudcellapi.CC_Component;
import com.firemonkeys.cloudcellapi.Logging;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
import org.apache.http.conn.util.InetAddressUtils;
/* loaded from: classes2.dex */
public class GetInfo {
private static final String CLASSNAME = "GetInfo";
private static final int MAX_RETRIES = 5;
static Boolean bShouldUseLegacyExternalFilesDir = null;
protected static ArrayList<String> m_systemPermissions = null;
static boolean ms_bAdvertisingEnabled = false;
static boolean ms_bInitialized = false;
static String ms_sAdvertisingIdentifier = "";
public static boolean GetAdvertisingEnabled() {
return ms_bAdvertisingEnabled;
}
public static String GetAdvertisingID() {
return ms_sAdvertisingIdentifier;
}
public static int GetApiLevel() {
return Build.VERSION.SDK_INT;
}
public static String GetImei() {
return "";
}
public static boolean IsInitialized() {
return ms_bInitialized;
}
public static void Initialize(final Activity activity) {
if (activity == null) {
Logging.CC_ERROR(CLASSNAME, "Invalid Activity passed to GetInfo.Initialize. AdvertisingId will NOT be set!");
} else {
ms_bAdvertisingEnabled = true;
new Thread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.util.GetInfo.1
@Override // java.lang.Runnable
public void run() {
Logging.CC_INFO(GetInfo.CLASSNAME, "Initialize()");
for (int i = 0; i < 5; i++) {
try {
GetInfo.ms_sAdvertisingIdentifier = AdvertisingIdClient.getAdvertisingIdInfo(activity).getId();
GetInfo.ms_bAdvertisingEnabled = !r2.isLimitAdTrackingEnabled();
break;
} catch (GooglePlayServicesNotAvailableException e) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "GooglePlayServicesNotAvailableException" + e.getMessage());
try {
Thread.sleep(1000L);
} catch (InterruptedException e2) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "InterruptedException" + e2.getMessage());
}
} catch (GooglePlayServicesRepairableException e3) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "GooglePlayServicesRepairableException" + e3.getMessage());
Thread.sleep(1000L);
} catch (IOException e4) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "IOException" + e4.getMessage());
Thread.sleep(1000L);
} catch (IllegalStateException e5) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "IllegalStateException" + e5.getMessage());
Thread.sleep(1000L);
}
}
Logging.CC_INFO(GetInfo.CLASSNAME, "AdvertisingIdentifier: " + GetInfo.ms_sAdvertisingIdentifier);
Logging.CC_INFO(GetInfo.CLASSNAME, "AdvertisingEnabled: " + GetInfo.ms_bAdvertisingEnabled);
GetInfo.ms_bInitialized = true;
}
}).start();
}
}
public static boolean GetIsTablet() {
return (CC_Component.GetActivity().getApplicationContext().getResources().getConfiguration().screenLayout & 15) >= 3;
}
public static boolean GetIsRunningOnTv() {
return ((UiModeManager) CC_Component.GetActivity().getSystemService("uimode")).getCurrentModeType() == 4;
}
public static String GetDeviceCode() {
return Build.DEVICE;
}
public static String GetDeviceName() {
return Build.MANUFACTURER + " " + Build.MODEL;
}
public static String GetDeviceManufacturer() {
return Build.MANUFACTURER;
}
public static String GetDeviceModel() {
return Build.MODEL;
}
public static String GetDeviceBrand() {
return Build.BRAND;
}
public static String GetDeviceFirmwareVersion() {
return Build.VERSION.RELEASE;
}
public static String GetBuildVersion() {
try {
Activity GetActivity = CC_Component.GetActivity();
return GetActivity.getPackageManager().getPackageInfo(GetActivity.getPackageName(), 0).versionName;
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetBuildVersion() error: " + e.toString());
return "1.0.0";
}
}
public static String GetDeviceMacAddress() {
try {
return ((WifiManager) CC_Component.GetActivity().getSystemService("wifi")).getConnectionInfo().getMacAddress();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetDeviceMacAddress() error: " + e.toString());
return "";
}
}
public static String GetPackageName() {
try {
return CC_Component.GetActivity().getPackageName();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetPackageName() error: " + e.toString());
return "";
}
}
public static boolean GetIsAmazonDevice() {
return GetDeviceManufacturer().toLowerCase().contains("amazon");
}
public static boolean GetIsChinaBuild() {
return GetPackageName().endsWith("_cn");
}
public static String GetDeviceUID() {
return Settings.Secure.getString(CC_Component.GetActivity().getApplicationContext().getContentResolver(), "android_id");
}
public static String GetLocalIp() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress nextElement = inetAddresses.nextElement();
if (nextElement.isLoopbackAddress() || (!InetAddressUtils.isIPv4Address(nextElement.getHostAddress().toString()) && !InetAddressUtils.isIPv6Address(nextElement.getHostAddress().toString()))) {
}
return nextElement.getHostAddress().toString();
}
}
return "";
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetLocalIp() error: " + e.toString());
return "";
}
}
public static String GetDeviceCountry() {
try {
return Locale.getDefault().getISO3Country();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetDeviceCountry() error: " + e.toString());
return "";
}
}
public static String GetDeviceLanguage() {
return Locale.getDefault().getLanguage();
}
public static int GetVolume() {
return ((AudioManager) CC_Component.GetActivity().getSystemService("audio")).getStreamVolume(3);
}
public static boolean DoesPackageExist(String str) {
try {
return CC_Component.GetActivity().getPackageManager().getApplicationInfo(str, 0) != null;
} catch (Exception unused) {
return false;
}
}
public static String[] GetRequestedPermissions() {
String[] strArr = new String[0];
try {
Activity GetActivity = CC_Component.GetActivity();
return GetActivity.getPackageManager().getPackageInfo(GetActivity.getPackageName(), 4096).requestedPermissions;
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetRequestedPermissions() error: " + e.toString());
return strArr;
}
}
public static boolean IsValidPermission(String str) {
try {
PermissionInfo permissionInfo = CC_Component.GetActivity().getPackageManager().getPermissionInfo(str, 128);
if (permissionInfo == null) {
return false;
}
int i = permissionInfo.protectionLevel;
return i == 1 || i == 0;
} catch (Exception unused) {
return false;
}
}
public static ArrayList<String> GetSystemPermissions() {
String str;
try {
if (m_systemPermissions == null) {
m_systemPermissions = new ArrayList<>();
for (Field field : Manifest.permission.class.getDeclaredFields()) {
if (field.getType().isAssignableFrom(String.class) && (str = (String) field.get(null)) != null) {
m_systemPermissions.add(str);
}
}
}
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "Initialising System Permissions exception: " + e.toString());
}
return m_systemPermissions;
}
public static boolean IsSystemPermission(String str) {
Iterator<String> it = GetSystemPermissions().iterator();
while (it.hasNext()) {
if (it.next().equals(str)) {
return true;
}
}
return false;
}
public static boolean IsPackageEnabled(String str) {
try {
ApplicationInfo applicationInfo = CC_Component.GetActivity().getPackageManager().getApplicationInfo(str, 0);
if (applicationInfo != null) {
return applicationInfo.enabled;
}
return false;
} catch (Exception unused) {
return false;
}
}
public static long getAppInstallTime() {
try {
Context applicationContext = CC_Component.GetActivity().getApplicationContext();
return applicationContext.getPackageManager().getPackageInfo(applicationContext.getPackageName(), 0).lastUpdateTime;
} catch (PackageManager.NameNotFoundException unused) {
return 0L;
}
}
public static Boolean ShouldUseLegacyExternalFilesDir() {
if (bShouldUseLegacyExternalFilesDir == null) {
bShouldUseLegacyExternalFilesDir = Boolean.valueOf(new File(getLegacyExternalStorageDirPath() + "/.depot/").exists());
}
return bShouldUseLegacyExternalFilesDir;
}
public static String getLegacyExternalStorageDirPath() {
File externalStorageDirectory = Environment.getExternalStorageDirectory();
if (externalStorageDirectory == null) {
return "";
}
return externalStorageDirectory.getAbsolutePath() + "/Android/data/" + CC_Component.GetActivity().getApplicationContext().getPackageName();
}
public static String getExternalStorageDir() {
if (ShouldUseLegacyExternalFilesDir().booleanValue()) {
return getLegacyExternalStorageDirPath();
}
File externalFilesDir = CC_Component.GetActivity().getApplicationContext().getExternalFilesDir(null);
return externalFilesDir != null ? externalFilesDir.getAbsolutePath() : "";
}
public static void DEBUG_DoJavaException() {
throw new RuntimeException("DEBUG Throwing an exception in DEBUG_DoJavaException");
}
}