- 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
1519 lines
60 KiB
Java
1519 lines
60 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.app.Activity;
|
|
import android.app.ActivityManager;
|
|
import android.app.AlertDialog;
|
|
import android.content.ActivityNotFoundException;
|
|
import android.content.ClipData;
|
|
import android.content.ClipboardManager;
|
|
import android.content.ContentResolver;
|
|
import android.content.ContentValues;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.content.pm.PackageManager;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.BitmapFactory;
|
|
import android.graphics.Matrix;
|
|
import android.graphics.Rect;
|
|
import android.media.AudioManager;
|
|
import android.media.MediaScannerConnection;
|
|
import android.net.ConnectivityManager;
|
|
import android.net.NetworkInfo;
|
|
import android.net.Uri;
|
|
import android.net.wifi.WifiManager;
|
|
import android.opengl.GLUtils;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Debug;
|
|
import android.os.Environment;
|
|
import android.os.storage.StorageManager;
|
|
import android.provider.MediaStore;
|
|
import android.provider.Settings;
|
|
import android.telephony.TelephonyManager;
|
|
import android.text.TextUtils;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.Log;
|
|
import android.view.WindowMetrics;
|
|
import androidx.work.Data;
|
|
import com.applovin.exoplayer2.common.base.Ascii;
|
|
import com.applovin.sdk.AppLovinEventTypes;
|
|
import com.facebook.internal.security.CertificateUtil;
|
|
import com.firemonkeys.cloudcellapi.util.GetInfo;
|
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
import com.ironsource.v8;
|
|
import com.mbridge.msdk.foundation.tools.SameMD5;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
|
|
import com.singular.sdk.Singular;
|
|
import com.singular.sdk.SingularConfig;
|
|
import java.io.BufferedReader;
|
|
import java.io.BufferedWriter;
|
|
import java.io.Closeable;
|
|
import java.io.File;
|
|
import java.io.FileDescriptor;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileReader;
|
|
import java.io.FileWriter;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.io.PrintWriter;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.ByteOrder;
|
|
import java.security.MessageDigest;
|
|
import java.util.Enumeration;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.zip.ZipEntry;
|
|
import java.util.zip.ZipFile;
|
|
import javax.microedition.khronos.opengles.GL10;
|
|
import org.apache.http.HttpStatus;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class Platform {
|
|
public static final int ASSET_DOWNLOAD_PROGRESS_NOTIFICATION_ID = 2;
|
|
public static final int ASSET_DOWNLOAD_REMINDER_NOTIFICATION_ID = 1;
|
|
public static final int BUY_DRIVER_XP = 14;
|
|
public static final int CAR_DELIVERY = 6;
|
|
public static final int CAR_REPAIR = 5;
|
|
public static final int CAR_TUNING = 13;
|
|
public static final int CAR_UPGRADE = 4;
|
|
public static final int DAILY_RACE_BONUS = 7;
|
|
public static final int DEFAULT_NOTIFICATION_ID = -2;
|
|
static final int EXTERNAL_MOUNTED_READ_ONLY = 1;
|
|
static final int EXTERNAL_MOUNTED_READ_WRITE = 2;
|
|
static final int EXTERNAL_NOT_MOUNTED = 0;
|
|
public static final int INTERNET_CONNECTION_DELAY = 3600;
|
|
public static final int LAPSED_REWARD = 9;
|
|
public static final int LIMITED_TIME_SERIES_NOTIF = 11;
|
|
public static final int NETWORK_TYPE_EHRPD = 14;
|
|
public static final int NETWORK_TYPE_EVDO_B = 12;
|
|
public static final int NETWORK_TYPE_HSPAP = 15;
|
|
public static final int NETWORK_TYPE_IDEN = 11;
|
|
public static final int NETWORK_TYPE_LTE = 13;
|
|
public static final int QUESTS = 3;
|
|
public static final int REPEAT_REMINDER_MAX = 2;
|
|
public static final int SALE_STARTED = 10;
|
|
public static final int TWO_DAY_DELAY_SEC = 172800;
|
|
public static final int ULTIMATE_DRIVER = 8;
|
|
static Boolean bShouldUseLegacyExternalFilesDir;
|
|
protected static final char[] hexArray = "0123456789abcdef".toCharArray();
|
|
static PendingImageToSave m_PendingImageToSave;
|
|
|
|
public static void SingularLimitDataSharing(boolean z) {
|
|
}
|
|
|
|
public static int getApiLevel() {
|
|
return Build.VERSION.SDK_INT;
|
|
}
|
|
|
|
private static int getNextPOT(int i) {
|
|
int i2 = 1;
|
|
while (i2 < i) {
|
|
i2 *= 2;
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
public static Boolean ShouldUseLegacyExternalFilesDir(Context context) {
|
|
if (bShouldUseLegacyExternalFilesDir == null) {
|
|
bShouldUseLegacyExternalFilesDir = Boolean.valueOf(new File(getLegacyExternalStorageDirPath(context) + "/.depot/").exists());
|
|
}
|
|
return bShouldUseLegacyExternalFilesDir;
|
|
}
|
|
|
|
public static String getAmazonAdvertisingId() throws Exception {
|
|
if (!GetInfo.GetIsAmazonDevice()) {
|
|
throw new Exception("Attempting to call an Amazon only function on a non Amazon device");
|
|
}
|
|
return Settings.Secure.getString(AppProxy.GetContext().getContentResolver(), "advertising_id");
|
|
}
|
|
|
|
public static String getDeviceUID() {
|
|
return Settings.Secure.getString(AppProxy.GetContext().getContentResolver(), "android_id");
|
|
}
|
|
|
|
public static boolean IsInForeground() {
|
|
MainActivity mainActivity = MainActivity.instance;
|
|
return mainActivity != null && mainActivity.hasWindowFocus();
|
|
}
|
|
|
|
public static String getModelID() {
|
|
return Build.MODEL;
|
|
}
|
|
|
|
public static String getModelName() {
|
|
return Build.PRODUCT;
|
|
}
|
|
|
|
public static String getBuildDevice() {
|
|
return Build.DEVICE;
|
|
}
|
|
|
|
public static String getBuildManufacturer() {
|
|
return Build.MANUFACTURER;
|
|
}
|
|
|
|
public static String getCpuName() {
|
|
Pattern compile = Pattern.compile("Hardware\\s*:\\s*(.+)");
|
|
Pattern compile2 = Pattern.compile("model\\s+name\\s*:\\s*(.+)");
|
|
String str = "";
|
|
BufferedReader bufferedReader = null;
|
|
try {
|
|
try {
|
|
BufferedReader bufferedReader2 = new BufferedReader(new FileReader(new File("/proc/cpuinfo")));
|
|
while (true) {
|
|
try {
|
|
String readLine = bufferedReader2.readLine();
|
|
if (readLine == null) {
|
|
break;
|
|
}
|
|
Matcher matcher = compile.matcher(readLine);
|
|
if (matcher.matches()) {
|
|
str = matcher.group(1);
|
|
break;
|
|
}
|
|
Matcher matcher2 = compile2.matcher(readLine);
|
|
if (matcher2.matches()) {
|
|
str = matcher2.group(1);
|
|
break;
|
|
}
|
|
} catch (IOException unused) {
|
|
bufferedReader = bufferedReader2;
|
|
bufferedReader.close();
|
|
return str;
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
bufferedReader = bufferedReader2;
|
|
try {
|
|
bufferedReader.close();
|
|
} catch (Exception unused2) {
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
bufferedReader2.close();
|
|
} catch (Exception unused3) {
|
|
}
|
|
} catch (IOException unused4) {
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public static String getScreenDensityName() {
|
|
switch (getScreenDPI()) {
|
|
case 120:
|
|
return "ldpi";
|
|
case 160:
|
|
return "mdpi";
|
|
case 213:
|
|
return "tvdpi";
|
|
case PsExtractor.VIDEO_STREAM_MASK /* 240 */:
|
|
return "hdpi";
|
|
case 260:
|
|
case 280:
|
|
case 300:
|
|
case WEBVIEW_ERROR_VALUE:
|
|
return "xhigh";
|
|
case 340:
|
|
case 360:
|
|
case 400:
|
|
case HttpStatus.SC_METHOD_FAILURE /* 420 */:
|
|
case 440:
|
|
case 480:
|
|
return "xxhigh";
|
|
case 560:
|
|
case 640:
|
|
return "xxxhdpi";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static int getScreenSize() {
|
|
return AppProxy.GetContext().getResources().getConfiguration().screenLayout & 15;
|
|
}
|
|
|
|
public static String getScreenSizeName() {
|
|
int screenSize = getScreenSize();
|
|
return screenSize != 1 ? screenSize != 2 ? screenSize != 3 ? screenSize != 4 ? "" : "xlarge" : "large" : "normal" : "small";
|
|
}
|
|
|
|
public static String getSupportedAbis() {
|
|
StringBuilder sb = new StringBuilder();
|
|
if (MainActivity.IsAtLeastAPI(21)) {
|
|
int length = Build.SUPPORTED_ABIS.length;
|
|
for (int i = 0; i < length; i++) {
|
|
if (i != 0) {
|
|
sb.append(";");
|
|
}
|
|
sb.append(Build.SUPPORTED_ABIS[i]);
|
|
}
|
|
} else {
|
|
sb.append(Build.CPU_ABI);
|
|
String str = Build.CPU_ABI2;
|
|
if (!TextUtils.isEmpty(str)) {
|
|
sb.append(";");
|
|
sb.append(str);
|
|
}
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public static int getCpuCount() {
|
|
if (MainActivity.IsAtLeastAPI(17)) {
|
|
return Runtime.getRuntime().availableProcessors();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public static int getCpuSpeed() {
|
|
int cpuCount = getCpuCount();
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < cpuCount; i2++) {
|
|
try {
|
|
int readCpuSpeed = readCpuSpeed("/sys/devices/system/cpu/cpu" + i2 + "/cpufreq/cpuinfo_max_freq");
|
|
if (readCpuSpeed > i) {
|
|
i = readCpuSpeed;
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
return i;
|
|
}
|
|
|
|
private static int readCpuSpeed(String str) throws IOException, NumberFormatException {
|
|
BufferedReader bufferedReader = null;
|
|
try {
|
|
BufferedReader bufferedReader2 = new BufferedReader(new FileReader(new File(str)));
|
|
try {
|
|
int parseInt = Integer.parseInt(bufferedReader2.readLine());
|
|
try {
|
|
bufferedReader2.close();
|
|
} catch (Exception unused) {
|
|
}
|
|
return parseInt;
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
bufferedReader = bufferedReader2;
|
|
try {
|
|
bufferedReader.close();
|
|
} catch (Exception unused2) {
|
|
}
|
|
throw th;
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
}
|
|
}
|
|
|
|
public static String getPackageName() {
|
|
return AppProxy.GetContext().getPackageName().toString();
|
|
}
|
|
|
|
public static String getAppName() {
|
|
try {
|
|
Context GetContext = AppProxy.GetContext();
|
|
PackageManager packageManager = GetContext.getPackageManager();
|
|
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(GetContext.getPackageName(), 0)).toString();
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static String getAppVersion() {
|
|
try {
|
|
Context GetContext = AppProxy.GetContext();
|
|
return GetContext.getPackageManager().getPackageInfo(GetContext.getPackageName(), 0).versionName;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static long getAppInstallTime() {
|
|
try {
|
|
Context GetContext = AppProxy.GetContext();
|
|
return GetContext.getPackageManager().getPackageInfo(GetContext.getPackageName(), 0).lastUpdateTime;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return 0L;
|
|
}
|
|
}
|
|
|
|
public static String getAppPath() {
|
|
try {
|
|
Context GetContext = AppProxy.GetContext();
|
|
return GetContext.getPackageManager().getApplicationInfo(GetContext.getPackageName(), 0).sourceDir;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static float getSystemMediaVolume() {
|
|
AudioManager audioManager = (AudioManager) MainActivity.instance.getSystemService("audio");
|
|
return audioManager.getStreamVolume(3) / audioManager.getStreamMaxVolume(3);
|
|
}
|
|
|
|
public static String getOsVersion() {
|
|
return Build.VERSION.RELEASE;
|
|
}
|
|
|
|
public static String GetDeviceHardware() {
|
|
return Build.HARDWARE;
|
|
}
|
|
|
|
public static String getStringExtra(String str) {
|
|
Intent intent = MainActivity.instance.getIntent();
|
|
if (intent != null) {
|
|
return intent.getStringExtra(str);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static int getExternalStorageState() {
|
|
String externalStorageState = Environment.getExternalStorageState();
|
|
if (externalStorageState.equals("mounted")) {
|
|
return 2;
|
|
}
|
|
return externalStorageState.equals("mounted_ro") ? 1 : 0;
|
|
}
|
|
|
|
public static String getLegacyExternalStorageDirPath(Context context) {
|
|
File externalStorageDirectory = Environment.getExternalStorageDirectory();
|
|
if (externalStorageDirectory == null) {
|
|
return "";
|
|
}
|
|
return externalStorageDirectory.getAbsolutePath() + "/Android/data/" + context.getPackageName();
|
|
}
|
|
|
|
public static String getExternalStorageDir() {
|
|
return getExternalStorageDir(AppProxy.GetContext());
|
|
}
|
|
|
|
public static String getExternalStorageDir(Context context) {
|
|
File externalFilesDir;
|
|
if (ShouldUseLegacyExternalFilesDir(context).booleanValue()) {
|
|
return getLegacyExternalStorageDirPath(context);
|
|
}
|
|
return (context == null || (externalFilesDir = context.getExternalFilesDir(null)) == null) ? "" : externalFilesDir.getAbsolutePath();
|
|
}
|
|
|
|
public static int getScreenRotation() {
|
|
return MainActivity.instance.getScreenRotation();
|
|
}
|
|
|
|
public static Object getAssetManager() {
|
|
return MainActivity.instance.getAssets();
|
|
}
|
|
|
|
public static boolean saveToImageGalleryImpl(int[] iArr, int i, int i2, int i3, String str, FileDescriptor fileDescriptor) {
|
|
Bitmap.CompressFormat compressFormat;
|
|
String str2;
|
|
OutputStream fileOutputStream;
|
|
MainActivity.logi("Saving to gallery: " + str);
|
|
if (MainActivity.IsAtLeastAPI(29) && fileDescriptor != null) {
|
|
MainActivity.logi("fileDescriptor should be null on Android 10 and above.");
|
|
}
|
|
if (str.endsWith(".png") || str.endsWith(".PNG")) {
|
|
compressFormat = Bitmap.CompressFormat.PNG;
|
|
str2 = "image/png";
|
|
} else {
|
|
if (!str.endsWith(".jpg") && !str.endsWith(".JPG")) {
|
|
MainActivity.loge("Error: Unrecognised image file extension on filename: " + str);
|
|
return false;
|
|
}
|
|
compressFormat = Bitmap.CompressFormat.JPEG;
|
|
str2 = "image/jpeg";
|
|
}
|
|
for (int i4 = 0; i4 < i; i4++) {
|
|
try {
|
|
int i5 = iArr[i4];
|
|
iArr[i4] = ((i5 & 16711680) >> 16) | ((-16711936) & i5) | ((i5 & 255) << 16);
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Error: ");
|
|
sb.append(e.toString());
|
|
return false;
|
|
}
|
|
}
|
|
Bitmap createBitmap = Bitmap.createBitmap(iArr, i - i2, -i2, i2, i3, Bitmap.Config.ARGB_8888);
|
|
createBitmap.setHasAlpha(false);
|
|
if (MainActivity.IsAtLeastAPI(29)) {
|
|
ContentResolver contentResolver = AppProxy.GetContext().getContentResolver();
|
|
ContentValues contentValues = new ContentValues();
|
|
contentValues.put("_display_name", str);
|
|
contentValues.put("mime_type", str2);
|
|
contentValues.put("relative_path", Environment.DIRECTORY_PICTURES + File.separator + AppProxy.GetContext().getString(R.string.screenshot_folder_name));
|
|
fileOutputStream = contentResolver.openOutputStream(contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues));
|
|
} else {
|
|
fileOutputStream = new FileOutputStream(fileDescriptor);
|
|
}
|
|
createBitmap.compress(compressFormat, 100, fileOutputStream);
|
|
fileOutputStream.flush();
|
|
fileOutputStream.close();
|
|
MediaScannerConnection.scanFile(AppProxy.GetContext(), new String[]{str}, null, new MediaScannerConnection.OnScanCompletedListener() { // from class: com.firemint.realracing.Platform.1
|
|
@Override // android.media.MediaScannerConnection.OnScanCompletedListener
|
|
public void onScanCompleted(String str3, Uri uri) {
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("Scanned ");
|
|
sb2.append(str3);
|
|
sb2.append(CertificateUtil.DELIMITER);
|
|
StringBuilder sb3 = new StringBuilder();
|
|
sb3.append("-> uri=");
|
|
sb3.append(uri);
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
|
|
public static void StoragePermissionUpdated(int i, Intent intent) {
|
|
if (i == 0) {
|
|
PendingImageToSave pendingImageToSave = m_PendingImageToSave;
|
|
if (pendingImageToSave != null) {
|
|
boolean SaveImage = pendingImageToSave.SaveImage(intent);
|
|
m_PendingImageToSave = null;
|
|
if (SaveImage) {
|
|
return;
|
|
}
|
|
}
|
|
} else if (i == -1) {
|
|
m_PendingImageToSave = null;
|
|
} else {
|
|
MainActivity.logw("Warning: Platform.java received an unknown storage permission value");
|
|
}
|
|
DisplayImageSaveErrorMessage();
|
|
}
|
|
|
|
public static void RequestPhotoDirectoryWriteAccess() {
|
|
MainActivity.instance.startActivityForResult(((StorageManager) MainActivity.instance.getSystemService(v8.a.j)).getPrimaryStorageVolume().createAccessIntent(Environment.DIRECTORY_PICTURES), 1);
|
|
}
|
|
|
|
public static void requestExactNotifications() {
|
|
Intent intent = new Intent();
|
|
intent.setAction("android.settings.REQUEST_SCHEDULE_EXACT_ALARM");
|
|
MainActivity.instance.startActivity(intent);
|
|
}
|
|
|
|
public static boolean hasCameraPermission() {
|
|
return MainActivity.instance.IsPermissionGranted("android.permission.CAMERA");
|
|
}
|
|
|
|
public static void requestCameraPermission() {
|
|
MainActivity.instance.RequestPermission("android.permission.CAMERA", 2);
|
|
}
|
|
|
|
public static void requestPostNotificationsPermission() {
|
|
MainActivity.instance.RequestPermission("android.permission.POST_NOTIFICATIONS", 3);
|
|
}
|
|
|
|
public static boolean isNotificationPermissionGranted() {
|
|
return MainActivity.instance.IsPermissionGranted("android.permission.POST_NOTIFICATIONS");
|
|
}
|
|
|
|
public static boolean saveToImageGallery(int[] iArr, int i, int i2, int i3, String str) {
|
|
m_PendingImageToSave = new PendingImageToSave(iArr, i, i2, i3, str, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES));
|
|
if (MainActivity.IsBelowAPI(29)) {
|
|
if (MainActivity.IsAtLeastAPI(24)) {
|
|
RequestPhotoDirectoryWriteAccess();
|
|
return false;
|
|
}
|
|
if (!MainActivity.instance.IsPermissionGranted("android.permission.WRITE_EXTERNAL_STORAGE")) {
|
|
MainActivity.instance.RequestPermission("android.permission.WRITE_EXTERNAL_STORAGE", 0);
|
|
return false;
|
|
}
|
|
}
|
|
if (m_PendingImageToSave.SaveImage(null)) {
|
|
m_PendingImageToSave = null;
|
|
return true;
|
|
}
|
|
DisplayImageSaveErrorMessage();
|
|
return false;
|
|
}
|
|
|
|
public static void DisplayImageSaveErrorMessage() {
|
|
AppProxy.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemint.realracing.Platform.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity mainActivity = MainActivity.instance;
|
|
new AlertDialog.Builder(mainActivity).setTitle(mainActivity.getResources().getString(R.string.IMAGE_SAVE_FAILURE_TITLE)).setMessage(mainActivity.getResources().getString(R.string.IMAGE_SAVE_FAILURE_MESSAGE)).setPositiveButton(mainActivity.getResources().getString(R.string.CONTINUE), (DialogInterface.OnClickListener) null).show();
|
|
}
|
|
});
|
|
}
|
|
|
|
public static TextureInfo loadTextureFromMemory(byte[] bArr, int i) {
|
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
|
options.inPreferredConfig = Bitmap.Config.RGB_565;
|
|
Bitmap decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, i, options);
|
|
if (decodeByteArray == null) {
|
|
return null;
|
|
}
|
|
TextureInfo textureInfo = new TextureInfo();
|
|
textureInfo.width = decodeByteArray.getWidth();
|
|
textureInfo.height = decodeByteArray.getHeight();
|
|
textureInfo.texWidth = getNextPOT(textureInfo.width);
|
|
textureInfo.texHeight = getNextPOT(textureInfo.height);
|
|
Matrix matrix = new Matrix();
|
|
matrix.setScale(1.0f, -1.0f);
|
|
matrix.postTranslate(0.0f, textureInfo.height);
|
|
Bitmap createBitmap = Bitmap.createBitmap(decodeByteArray, 0, 0, textureInfo.width, textureInfo.height, matrix, false);
|
|
int[] iArr = new int[1];
|
|
GL10 gl10 = (GL10) MainActivity.instance.getGLView().getGLContext().getGL();
|
|
gl10.glGenTextures(1, iArr, 0);
|
|
int i2 = iArr[0];
|
|
textureInfo.texId = i2;
|
|
gl10.glBindTexture(3553, i2);
|
|
gl10.glTexParameterf(3553, 10241, 9729.0f);
|
|
gl10.glTexParameterf(3553, Data.MAX_DATA_BYTES, 9729.0f);
|
|
gl10.glTexParameterf(3553, 10242, 10497.0f);
|
|
gl10.glTexParameterf(3553, 10243, 10497.0f);
|
|
gl10.glTexImage2D(3553, 0, GLUtils.getInternalFormat(createBitmap), textureInfo.texWidth, textureInfo.texHeight, 0, GLUtils.getInternalFormat(createBitmap), GLUtils.getType(createBitmap), null);
|
|
GLUtils.texSubImage2D(3553, 0, 0, textureInfo.texHeight - textureInfo.height, createBitmap);
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("loadTextureFromMemory() U=");
|
|
sb.append(textureInfo.width);
|
|
sb.append(" V=");
|
|
sb.append(textureInfo.height);
|
|
sb.append(" W=");
|
|
sb.append(textureInfo.texWidth);
|
|
sb.append(" H=");
|
|
sb.append(textureInfo.texHeight);
|
|
return textureInfo;
|
|
}
|
|
|
|
public static void toggleIdleMode(boolean z) {
|
|
if (z) {
|
|
AppProxy.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemint.realracing.Platform.3
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.instance.getWindow().clearFlags(128);
|
|
}
|
|
});
|
|
} else {
|
|
AppProxy.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemint.realracing.Platform.4
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.instance.getWindow().addFlags(128);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public static void memoryProbe() {
|
|
Log.e("RealRacing3", "Memory probing now...");
|
|
System.gc();
|
|
System.gc();
|
|
Runtime runtime = Runtime.getRuntime();
|
|
long nativeHeapSize = Debug.getNativeHeapSize();
|
|
long nativeHeapAllocatedSize = Debug.getNativeHeapAllocatedSize();
|
|
long nativeHeapFreeSize = Debug.getNativeHeapFreeSize();
|
|
long maxMemory = runtime.maxMemory();
|
|
long j = runtime.totalMemory();
|
|
long freeMemory = runtime.freeMemory();
|
|
Log.e("RealRacing3", String.format("Native max memory: %s", humanByteSize(nativeHeapSize)));
|
|
Log.e("RealRacing3", String.format("Native alloc memory: %s", humanByteSize(nativeHeapAllocatedSize)));
|
|
Log.e("RealRacing3", String.format("Native free memory: %s", humanByteSize(nativeHeapFreeSize)));
|
|
Log.e("RealRacing3", String.format("Max memory: %s", humanByteSize(maxMemory)));
|
|
Log.e("RealRacing3", String.format("Total memory: %s", humanByteSize(j)));
|
|
Log.e("RealRacing3", String.format("Free memory: %s", humanByteSize(freeMemory)));
|
|
ActivityManager activityManager = (ActivityManager) MainActivity.instance.getSystemService("activity");
|
|
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
|
activityManager.getMemoryInfo(memoryInfo);
|
|
Log.e("RealRacing3", String.format("TOTAL Available memory: %s", humanByteSize(memoryInfo.availMem)));
|
|
Log.e("RealRacing3", String.format("TOTAL Low memory threshold: %s", humanByteSize(memoryInfo.threshold)));
|
|
Object[] objArr = new Object[1];
|
|
objArr[0] = memoryInfo.lowMemory ? "TRUE" : "false";
|
|
Log.e("RealRacing3", String.format("TOTAL Low memory flag: %s", objArr));
|
|
Log.e("RealRacing3", "Memory probing DONE.");
|
|
}
|
|
|
|
public static int GetAudioFramesPerBuffer() {
|
|
if (getApiLevel() >= 17) {
|
|
return Integer.parseInt(((AudioManager) MainActivity.instance.getSystemService("audio")).getProperty("android.media.property.OUTPUT_FRAMES_PER_BUFFER"));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public static int GetAudioSampleRate() {
|
|
if (getApiLevel() >= 17) {
|
|
return Integer.parseInt(((AudioManager) MainActivity.instance.getSystemService("audio")).getProperty("android.media.property.OUTPUT_SAMPLE_RATE"));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public static String humanByteSize(long j) {
|
|
if (j < 1000) {
|
|
return j + " B";
|
|
}
|
|
double d = j;
|
|
double d2 = 1000;
|
|
int log = (int) (Math.log(d) / Math.log(d2));
|
|
return String.format("%.1f %sB", Double.valueOf(d / Math.pow(d2, log)), "kMGTPE".charAt(log - 1) + "");
|
|
}
|
|
|
|
public static long getAppMemoryUsage() {
|
|
return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + Debug.getNativeHeapAllocatedSize();
|
|
}
|
|
|
|
public static long getAppMemoryFree() {
|
|
return Runtime.getRuntime().freeMemory() + Debug.getNativeHeapFreeSize();
|
|
}
|
|
|
|
/* JADX WARN: Can't wrap try/catch for region: R(16:(33:89|90|91|92|93|94|95|(1:8)(1:88)|9|10|11|(3:77|78|(19:80|(1:82)|73|21|22|23|(1:25)|26|27|28|30|31|33|34|36|37|38|39|40))|13|70|71|72|73|21|22|23|(0)|26|27|28|30|31|33|34|36|37|38|39|40)|22|23|(0)|26|27|28|30|31|33|34|36|37|38|39|40) */
|
|
/* JADX WARN: Can't wrap try/catch for region: R(33:0|1|(1:3)|4|(33:89|90|91|92|93|94|95|(1:8)(1:88)|9|10|11|(3:77|78|(19:80|(1:82)|73|21|22|23|(1:25)|26|27|28|30|31|33|34|36|37|38|39|40))|13|70|71|72|73|21|22|23|(0)|26|27|28|30|31|33|34|36|37|38|39|40)|6|(0)(0)|9|10|11|(0)|13|70|71|72|73|21|22|23|(0)|26|27|28|30|31|33|34|36|37|38|39|40|(1:(0))) */
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:0x01bf, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:45:0x01c0, code lost:
|
|
|
|
r10 = r1;
|
|
r8 = r2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:46:0x01c9, code lost:
|
|
|
|
android.util.Log.e("RealRacing3", "extractAssets: Exception when saving new zip checksum " + r10.getAbsolutePath() + "\n" + r0.getMessage());
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:47:0x01eb, code lost:
|
|
|
|
closeStream(r11);
|
|
closeStream(r8);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:48:0x01bc, code lost:
|
|
|
|
r0 = th;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:49:0x01bd, code lost:
|
|
|
|
r8 = r2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:50:0x01f2, code lost:
|
|
|
|
closeStream(r11);
|
|
closeStream(r8);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:51:0x01f8, code lost:
|
|
|
|
throw r0;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:52:0x01c5, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:53:0x01c6, code lost:
|
|
|
|
r10 = r1;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:54:0x01c8, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:75:0x0146, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:76:0x0144, code lost:
|
|
|
|
r0 = th;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:84:0x014c, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:85:0x014d, code lost:
|
|
|
|
r12 = 0;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:86:0x0148, code lost:
|
|
|
|
r0 = th;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:87:0x0149, code lost:
|
|
|
|
r12 = 0;
|
|
*/
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Removed duplicated region for block: B:25:0x0184 */
|
|
/* JADX WARN: Removed duplicated region for block: B:77:0x0117 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:88:0x00f4 */
|
|
/* JADX WARN: Removed duplicated region for block: B:8:0x00ab */
|
|
/* JADX WARN: Type inference failed for: r12v1 */
|
|
/* JADX WARN: Type inference failed for: r12v10 */
|
|
/* JADX WARN: Type inference failed for: r12v11, types: [java.io.FileOutputStream] */
|
|
/* JADX WARN: Type inference failed for: r12v12 */
|
|
/* JADX WARN: Type inference failed for: r12v2 */
|
|
/* JADX WARN: Type inference failed for: r12v3, types: [java.io.Closeable] */
|
|
/* JADX WARN: Type inference failed for: r12v5, types: [java.io.Closeable] */
|
|
/* JADX WARN: Type inference failed for: r12v7 */
|
|
/* JADX WARN: Type inference failed for: r12v8 */
|
|
/* JADX WARN: Type inference failed for: r12v9 */
|
|
/* JADX WARN: Type inference failed for: r2v7, types: [java.io.Closeable, java.io.FileOutputStream] */
|
|
/* JADX WARN: Type inference failed for: r9v0 */
|
|
/* JADX WARN: Type inference failed for: r9v1 */
|
|
/* JADX WARN: Type inference failed for: r9v2 */
|
|
/* JADX WARN: Type inference failed for: r9v3, types: [java.io.Closeable] */
|
|
/* JADX WARN: Type inference failed for: r9v4, types: [java.io.BufferedReader, java.io.Closeable] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public static boolean extractRes(java.lang.String r16, java.lang.String r17, android.content.Context r18) {
|
|
/*
|
|
Method dump skipped, instructions count: 586
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.firemint.realracing.Platform.extractRes(java.lang.String, java.lang.String, android.content.Context):boolean");
|
|
}
|
|
|
|
private static Map<String, String> LoadAssetCacheList(String str) {
|
|
HashMap hashMap = new HashMap();
|
|
File file = new File(str);
|
|
if (file.exists()) {
|
|
try {
|
|
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
|
while (true) {
|
|
String readLine = bufferedReader.readLine();
|
|
if (readLine == null) {
|
|
break;
|
|
}
|
|
int indexOf = readLine.indexOf(9);
|
|
if (indexOf >= 0) {
|
|
hashMap.put(readLine.substring(readLine.charAt(0) == '/' ? 1 : 0, indexOf), readLine);
|
|
}
|
|
}
|
|
bufferedReader.close();
|
|
} catch (Exception e) {
|
|
Log.e("RealRacing3", "Exception when Loading asset cache list" + e.getMessage());
|
|
}
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
private static void deleteResAndRemoveEntriesFromCache(String str, Map<String, String> map) {
|
|
RemoveEntriesFromPath(new File(str), "", map, true);
|
|
}
|
|
|
|
private static void RemoveEntriesFromPath(File file, String str, Map<String, String> map, boolean z) {
|
|
if (file.isDirectory()) {
|
|
if (!z) {
|
|
str = str + file.getName() + "/";
|
|
}
|
|
File[] listFiles = file.listFiles();
|
|
if (listFiles != null) {
|
|
for (File file2 : listFiles) {
|
|
RemoveEntriesFromPath(file2, str, map, false);
|
|
}
|
|
}
|
|
} else {
|
|
map.remove(str + file.getName());
|
|
}
|
|
file.delete();
|
|
}
|
|
|
|
private static void removeAPKAssetsFromCache(String str, ZipFile zipFile, Map<String, String> map) {
|
|
int i;
|
|
String str2 = str + "/.depot";
|
|
String str3 = str2 + "/asset_list_base.txtCache.txt";
|
|
HashMap hashMap = new HashMap();
|
|
try {
|
|
MessageDigest messageDigest = MessageDigest.getInstance(SameMD5.TAG);
|
|
byte[] bArr = new byte[8192];
|
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
|
while (true) {
|
|
i = 0;
|
|
if (!entries.hasMoreElements()) {
|
|
break;
|
|
}
|
|
ZipEntry nextElement = entries.nextElement();
|
|
String name = nextElement.getName();
|
|
if (name.startsWith("res/")) {
|
|
String substring = name.substring(4);
|
|
if (!substring.isEmpty() && !nextElement.isDirectory()) {
|
|
File file = new File(str2 + "/" + substring);
|
|
if (file.exists()) {
|
|
file.delete();
|
|
}
|
|
if (!substring.startsWith("asset_list")) {
|
|
messageDigest.reset();
|
|
try {
|
|
InputStream inputStream = zipFile.getInputStream(nextElement);
|
|
while (true) {
|
|
int read = inputStream.read(bArr);
|
|
if (read == -1) {
|
|
break;
|
|
} else {
|
|
messageDigest.update(bArr, 0, read);
|
|
}
|
|
}
|
|
inputStream.close();
|
|
} catch (IOException e) {
|
|
Log.e("RealRacing3", "Exception when reading zipfile" + e.getMessage());
|
|
}
|
|
byte[] digest = messageDigest.digest();
|
|
char[] cArr = new char[digest.length * 2];
|
|
while (i < digest.length) {
|
|
byte b = digest[i];
|
|
int i2 = i * 2;
|
|
char[] cArr2 = hexArray;
|
|
cArr[i2] = cArr2[(b & 255) >>> 4];
|
|
cArr[i2 + 1] = cArr2[b & Ascii.SI];
|
|
i++;
|
|
}
|
|
hashMap.put(substring, '/' + substring + '\t' + String.valueOf(cArr));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
Map<String, String> FixSpaTrackFolderName = FixSpaTrackFolderName(str2, map);
|
|
FixSpaTrackFolderName.putAll(hashMap);
|
|
ByteBuffer allocate = ByteBuffer.allocate(8);
|
|
allocate.order(ByteOrder.LITTLE_ENDIAN);
|
|
allocate.putInt((int) 2767647645L);
|
|
allocate.putInt(4);
|
|
File file2 = new File(str3);
|
|
FileOutputStream fileOutputStream = new FileOutputStream(file2);
|
|
fileOutputStream.write(allocate.array());
|
|
fileOutputStream.write("0000\n".getBytes());
|
|
fileOutputStream.flush();
|
|
fileOutputStream.close();
|
|
PrintWriter printWriter = new PrintWriter(new BufferedWriter(new FileWriter(file2, true)));
|
|
Iterator<String> it = FixSpaTrackFolderName.values().iterator();
|
|
while (it.hasNext()) {
|
|
printWriter.println(it.next());
|
|
}
|
|
printWriter.close();
|
|
} catch (IOException e2) {
|
|
Log.e("RealRacing3", "updateResources: Exception when accessing '" + str3 + "'\n" + e2.getMessage());
|
|
}
|
|
File[] listFiles = new File(str2).listFiles();
|
|
if (listFiles != null) {
|
|
while (i < listFiles.length) {
|
|
File file3 = listFiles[i];
|
|
String name2 = file3.getName();
|
|
if (name2.startsWith("asset_list") && !name2.startsWith("asset_list_updates") && !name2.equals("asset_list_base.txtCache.txt")) {
|
|
file3.delete();
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
} catch (Exception e3) {
|
|
Log.e("RealRacing3", "Exception when creating MessageDigest" + e3.getMessage());
|
|
}
|
|
}
|
|
|
|
private static Map<String, String> FixSpaTrackFolderName(String str, Map<String, String> map) {
|
|
try {
|
|
File file = new File(str + "/Tracks");
|
|
if (!file.isDirectory()) {
|
|
return map;
|
|
}
|
|
for (String str2 : file.list()) {
|
|
if (str2.equals("Spa")) {
|
|
File file2 = new File(file, str2);
|
|
if (!file2.isDirectory()) {
|
|
return map;
|
|
}
|
|
File file3 = new File(file, "spa-tmp");
|
|
if (!file2.renameTo(file3) || !file3.renameTo(new File(file, "spa"))) {
|
|
return map;
|
|
}
|
|
HashMap hashMap = new HashMap();
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
hashMap.put(entry.getKey(), entry.getValue().replaceFirst("/Tracks/Spa/", "/Tracks/spa/"));
|
|
}
|
|
return hashMap;
|
|
}
|
|
}
|
|
return map;
|
|
} catch (Exception e) {
|
|
Log.e("RealRacing3", "Exception when attempting to rename spa folder: " + e.getMessage());
|
|
return map;
|
|
}
|
|
}
|
|
|
|
private static void extractResZipFile(ZipFile zipFile, String str, boolean z, String str2) {
|
|
FileOutputStream fileOutputStream;
|
|
InputStream inputStream;
|
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
|
while (entries.hasMoreElements()) {
|
|
ZipEntry nextElement = entries.nextElement();
|
|
String name = nextElement.getName();
|
|
if (!name.isEmpty()) {
|
|
File file = new File(str + "/" + name);
|
|
if (nextElement.isDirectory()) {
|
|
if (!file.exists()) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str2);
|
|
sb.append(": creating directory '");
|
|
sb.append(name);
|
|
sb.append("'");
|
|
file.mkdirs();
|
|
}
|
|
} else if (z || !file.exists() || file.length() != nextElement.getSize()) {
|
|
File parentFile = file.getParentFile();
|
|
if (!parentFile.exists()) {
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append(str2);
|
|
sb2.append(": creating directory '");
|
|
sb2.append(parentFile.getPath());
|
|
sb2.append("'");
|
|
parentFile.mkdirs();
|
|
}
|
|
StringBuilder sb3 = new StringBuilder();
|
|
sb3.append(str2);
|
|
sb3.append(": extracting file '");
|
|
sb3.append(name);
|
|
sb3.append("'");
|
|
InputStream inputStream2 = null;
|
|
try {
|
|
inputStream = zipFile.getInputStream(nextElement);
|
|
try {
|
|
fileOutputStream = new FileOutputStream(file);
|
|
} catch (Exception e) {
|
|
e = e;
|
|
fileOutputStream = null;
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
fileOutputStream = null;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
fileOutputStream = null;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
fileOutputStream = null;
|
|
}
|
|
try {
|
|
saveStream(inputStream, fileOutputStream);
|
|
closeStream(inputStream);
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
inputStream2 = inputStream;
|
|
try {
|
|
Log.e("RealRacing3", str2 + ": Exception when extracting '" + name + "'\n" + e.getMessage());
|
|
closeStream(inputStream2);
|
|
closeStream(fileOutputStream);
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
closeStream(inputStream2);
|
|
closeStream(fileOutputStream);
|
|
throw th;
|
|
}
|
|
} catch (Throwable th4) {
|
|
th = th4;
|
|
inputStream2 = inputStream;
|
|
closeStream(inputStream2);
|
|
closeStream(fileOutputStream);
|
|
throw th;
|
|
}
|
|
closeStream(fileOutputStream);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static boolean deleteDir(File file, boolean z) {
|
|
File[] listFiles;
|
|
if (file.isDirectory() && (listFiles = file.listFiles()) != null) {
|
|
for (File file2 : listFiles) {
|
|
if (!deleteDir(file2, false)) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
if (z) {
|
|
return true;
|
|
}
|
|
return file.delete();
|
|
}
|
|
|
|
public static boolean deleteDirectory(String str) {
|
|
return deleteDir(new File(str), false);
|
|
}
|
|
|
|
private static void saveStream(InputStream inputStream, FileOutputStream fileOutputStream) throws IOException {
|
|
byte[] bArr = new byte[8192];
|
|
while (true) {
|
|
int read = inputStream.read(bArr);
|
|
if (read == -1) {
|
|
return;
|
|
} else {
|
|
fileOutputStream.write(bArr, 0, read);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void closeStream(Closeable closeable) {
|
|
if (closeable != null) {
|
|
try {
|
|
closeable.close();
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void openURL(String str) {
|
|
Log.e("RealRacing3", "Opening URL '" + str + "'");
|
|
try {
|
|
AppProxy.GetContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse(str)));
|
|
} catch (ActivityNotFoundException unused) {
|
|
MainActivity.logi("openURL failed as there is no activity to handle it");
|
|
} catch (SecurityException unused2) {
|
|
MainActivity.logi("openURL failed because of a security exception");
|
|
}
|
|
}
|
|
|
|
public static int getScreenWidth() {
|
|
WindowMetrics currentWindowMetrics;
|
|
Rect bounds;
|
|
if (MainActivity.IsAtLeastAPI(30)) {
|
|
currentWindowMetrics = AppProxy.GetActivity().getWindowManager().getCurrentWindowMetrics();
|
|
bounds = currentWindowMetrics.getBounds();
|
|
return bounds.width();
|
|
}
|
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
AppProxy.GetActivity().getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
|
|
return displayMetrics.widthPixels;
|
|
}
|
|
|
|
public static int getScreenHeight() {
|
|
WindowMetrics currentWindowMetrics;
|
|
Rect bounds;
|
|
if (Build.VERSION.SDK_INT >= 30) {
|
|
currentWindowMetrics = AppProxy.GetActivity().getWindowManager().getCurrentWindowMetrics();
|
|
bounds = currentWindowMetrics.getBounds();
|
|
return bounds.height();
|
|
}
|
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
AppProxy.GetActivity().getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
|
|
return displayMetrics.heightPixels;
|
|
}
|
|
|
|
public static int getScreenDPI() {
|
|
return AppProxy.GetContext().getResources().getConfiguration().densityDpi;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:13:0x003b, code lost:
|
|
|
|
r1 = r1[1].trim().split(" ");
|
|
r4 = r1[0];
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x0049, code lost:
|
|
|
|
r2 = java.lang.Integer.parseInt(r1[0].trim()) / 1024;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:19:0x0058, code lost:
|
|
|
|
r1 = move-exception;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:20:0x0059, code lost:
|
|
|
|
r1.toString();
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public static int getTotalMemory() {
|
|
/*
|
|
java.io.File r0 = new java.io.File
|
|
java.lang.String r1 = "/proc/meminfo"
|
|
r0.<init>(r1)
|
|
boolean r1 = r0.exists()
|
|
r2 = 0
|
|
if (r1 == 0) goto L77
|
|
java.io.FileReader r1 = new java.io.FileReader // Catch: java.lang.Exception -> L56
|
|
r1.<init>(r0) // Catch: java.lang.Exception -> L56
|
|
java.io.BufferedReader r3 = new java.io.BufferedReader // Catch: java.lang.Exception -> L56
|
|
r3.<init>(r1) // Catch: java.lang.Exception -> L56
|
|
L18:
|
|
java.lang.String r1 = r3.readLine() // Catch: java.lang.Exception -> L56
|
|
if (r1 == 0) goto L5c
|
|
java.lang.String r4 = ":"
|
|
java.lang.String[] r1 = r1.split(r4) // Catch: java.lang.Exception -> L56
|
|
r4 = r1[r2] // Catch: java.lang.Exception -> L56
|
|
r4 = 1
|
|
r5 = r1[r4] // Catch: java.lang.Exception -> L56
|
|
r5 = r1[r2] // Catch: java.lang.Exception -> L56
|
|
java.lang.String r5 = r5.trim() // Catch: java.lang.Exception -> L56
|
|
java.lang.String r5 = r5.toLowerCase() // Catch: java.lang.Exception -> L56
|
|
java.lang.String r6 = "memtotal"
|
|
boolean r5 = r5.equals(r6) // Catch: java.lang.Exception -> L56
|
|
if (r5 == 0) goto L18
|
|
r1 = r1[r4] // Catch: java.lang.Exception -> L56
|
|
java.lang.String r1 = r1.trim() // Catch: java.lang.Exception -> L56
|
|
java.lang.String r4 = " "
|
|
java.lang.String[] r1 = r1.split(r4) // Catch: java.lang.Exception -> L56
|
|
r4 = r1[r2] // Catch: java.lang.Exception -> L56
|
|
r1 = r1[r2] // Catch: java.lang.Exception -> L56 java.lang.NumberFormatException -> L58
|
|
java.lang.String r1 = r1.trim() // Catch: java.lang.Exception -> L56 java.lang.NumberFormatException -> L58
|
|
int r1 = java.lang.Integer.parseInt(r1) // Catch: java.lang.Exception -> L56 java.lang.NumberFormatException -> L58
|
|
int r2 = r1 / 1024
|
|
goto L5c
|
|
L56:
|
|
r1 = move-exception
|
|
goto L60
|
|
L58:
|
|
r1 = move-exception
|
|
r1.toString() // Catch: java.lang.Exception -> L56
|
|
L5c:
|
|
r3.close() // Catch: java.lang.Exception -> L56
|
|
goto L77
|
|
L60:
|
|
java.lang.String r0 = r0.getAbsolutePath()
|
|
java.lang.String r1 = r1.getMessage()
|
|
java.lang.Object[] r0 = new java.lang.Object[]{r0, r1}
|
|
java.lang.String r1 = "Error reading system file: %s (%s)"
|
|
java.lang.String r0 = java.lang.String.format(r1, r0)
|
|
java.lang.String r1 = "RealRacing3"
|
|
android.util.Log.e(r1, r0)
|
|
L77:
|
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
|
r0.<init>()
|
|
java.lang.String r1 = "totalmemory="
|
|
r0.append(r1)
|
|
r0.append(r2)
|
|
return r2
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.firemint.realracing.Platform.getTotalMemory():int");
|
|
}
|
|
|
|
public static void exitApp() {
|
|
final Activity GetActivity = AppProxy.GetActivity();
|
|
if (GetActivity != null) {
|
|
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemint.realracing.Platform.5
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
GetActivity.moveTaskToBack(true);
|
|
GetActivity.finish();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public static String getLocale() {
|
|
String locale = Locale.getDefault().toString();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("locale = ");
|
|
sb.append(locale);
|
|
return locale;
|
|
}
|
|
|
|
public static String getCountry() {
|
|
return Locale.getDefault().getCountry();
|
|
}
|
|
|
|
public enum NetworkType {
|
|
Carrier(1),
|
|
Wifi(2),
|
|
Ethernet(4),
|
|
Unmetered(8),
|
|
Any(-1);
|
|
|
|
int value;
|
|
|
|
NetworkType(int i) {
|
|
this.value = i;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x002c, code lost:
|
|
|
|
if (r0.isAvailable() != false) goto L12;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:20:0x0044, code lost:
|
|
|
|
if (r0.getType() != 9) goto L13;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:24:0x0052, code lost:
|
|
|
|
if (r0.getType() == 1) goto L25;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:25:0x0054, code lost:
|
|
|
|
r1 = true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:27:?, code lost:
|
|
|
|
return r1 & true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x0062, code lost:
|
|
|
|
if (r0.getType() == 9) goto L25;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public static boolean isNetworkAvailable(int r5) {
|
|
/*
|
|
android.content.Context r0 = com.firemint.realracing.AppProxy.GetContext()
|
|
r1 = 0
|
|
if (r0 == 0) goto L74
|
|
android.content.Context r0 = com.firemint.realracing.AppProxy.GetContext()
|
|
java.lang.String r2 = "connectivity"
|
|
java.lang.Object r0 = r0.getSystemService(r2)
|
|
android.net.ConnectivityManager r0 = (android.net.ConnectivityManager) r0
|
|
android.net.NetworkInfo r0 = r0.getActiveNetworkInfo()
|
|
if (r0 == 0) goto L74
|
|
com.firemint.realracing.Platform$NetworkType r2 = com.firemint.realracing.Platform.NetworkType.Any
|
|
int r2 = r2.value
|
|
r3 = r5 & r2
|
|
r4 = 1
|
|
if (r3 != r2) goto L31
|
|
boolean r5 = r0.isConnected()
|
|
if (r5 == 0) goto L2f
|
|
boolean r5 = r0.isAvailable()
|
|
if (r5 == 0) goto L2f
|
|
L2e:
|
|
r1 = r4
|
|
L2f:
|
|
r1 = r1 & r4
|
|
goto L74
|
|
L31:
|
|
com.firemint.realracing.Platform$NetworkType r2 = com.firemint.realracing.Platform.NetworkType.Unmetered
|
|
int r2 = r2.value
|
|
r2 = r2 & r5
|
|
r3 = 9
|
|
if (r2 == 0) goto L47
|
|
int r5 = r0.getType()
|
|
if (r5 == r4) goto L2e
|
|
int r5 = r0.getType()
|
|
if (r5 != r3) goto L2f
|
|
goto L2e
|
|
L47:
|
|
com.firemint.realracing.Platform$NetworkType r2 = com.firemint.realracing.Platform.NetworkType.Wifi
|
|
int r2 = r2.value
|
|
r2 = r2 & r5
|
|
if (r2 == 0) goto L57
|
|
int r5 = r0.getType()
|
|
if (r5 != r4) goto L55
|
|
L54:
|
|
r1 = r4
|
|
L55:
|
|
r1 = r1 & r4
|
|
goto L74
|
|
L57:
|
|
com.firemint.realracing.Platform$NetworkType r2 = com.firemint.realracing.Platform.NetworkType.Ethernet
|
|
int r2 = r2.value
|
|
r2 = r2 & r5
|
|
if (r2 == 0) goto L65
|
|
int r5 = r0.getType()
|
|
if (r5 != r3) goto L55
|
|
goto L54
|
|
L65:
|
|
com.firemint.realracing.Platform$NetworkType r0 = com.firemint.realracing.Platform.NetworkType.Carrier
|
|
int r0 = r0.value
|
|
r5 = r5 & r0
|
|
if (r5 == 0) goto L73
|
|
boolean r5 = isMobileDataAvailable()
|
|
r1 = r5 & 1
|
|
goto L74
|
|
L73:
|
|
r1 = r4
|
|
L74:
|
|
return r1
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.firemint.realracing.Platform.isNetworkAvailable(int):boolean");
|
|
}
|
|
|
|
public static String GetWifiSSID() {
|
|
return isNetworkAvailable(NetworkType.Wifi.value) ? ((WifiManager) AppProxy.GetContext().getSystemService("wifi")).getConnectionInfo().getSSID() : "";
|
|
}
|
|
|
|
public static boolean isMobileDataAvailable() {
|
|
if (AppProxy.GetContext() == null) {
|
|
return false;
|
|
}
|
|
ConnectivityManager connectivityManager = (ConnectivityManager) AppProxy.GetContext().getSystemService("connectivity");
|
|
connectivityManager.getNetworkInfo(0);
|
|
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
|
boolean z = activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
|
|
if (z && activeNetworkInfo.getType() != 6) {
|
|
switch (activeNetworkInfo.getSubtype()) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 4:
|
|
case 5:
|
|
case 6:
|
|
case 7:
|
|
case 8:
|
|
case 9:
|
|
case 10:
|
|
case 11:
|
|
case 12:
|
|
case 13:
|
|
case 14:
|
|
case 15:
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public static String getMobileDataType() {
|
|
String str;
|
|
if (AppProxy.GetContext() != null) {
|
|
ConnectivityManager connectivityManager = (ConnectivityManager) AppProxy.GetContext().getSystemService("connectivity");
|
|
connectivityManager.getNetworkInfo(0);
|
|
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
|
if (activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting() && activeNetworkInfo.getType() != 6) {
|
|
str = activeNetworkInfo.getSubtypeName();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("getMobileDataType subtype=");
|
|
sb.append(str);
|
|
return str;
|
|
}
|
|
}
|
|
str = "";
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("getMobileDataType subtype=");
|
|
sb2.append(str);
|
|
return str;
|
|
}
|
|
|
|
public static void showMessage(String str, String str2, String str3, String str4, String str5, long j, long j2, long j3) {
|
|
MainActivity mainActivity = MainActivity.instance;
|
|
if (mainActivity != null) {
|
|
mainActivity.showMessage(str, str2, str3, str4, str5, j, j2, j3);
|
|
}
|
|
}
|
|
|
|
public static void dismissMessage() {
|
|
MainActivity mainActivity = MainActivity.instance;
|
|
if (mainActivity != null) {
|
|
mainActivity.dismissMessage();
|
|
}
|
|
}
|
|
|
|
public static void openNetworkSettings() {
|
|
if (MainActivity.instance != null) {
|
|
MainActivity.m_WIFISettingsShown = true;
|
|
MainActivity.instance.startActivityForResult(new Intent("android.settings.WIFI_SETTINGS"), 329418467);
|
|
}
|
|
}
|
|
|
|
public static boolean isNetworkSettingsShown() {
|
|
return MainActivity.m_WIFISettingsShown;
|
|
}
|
|
|
|
public static String getCarrier() {
|
|
return ((TelephonyManager) AppProxy.GetContext().getSystemService("phone")).getNetworkOperatorName();
|
|
}
|
|
|
|
public static void setCrashlyticsInt(int i, String str) {
|
|
FirebaseCrashlytics.getInstance().setCustomKey(str, i);
|
|
}
|
|
|
|
public static void setCrashlyticsFloat(float f, String str) {
|
|
FirebaseCrashlytics.getInstance().setCustomKey(str, f);
|
|
}
|
|
|
|
public static void setCrashlyticsString(String str, String str2) {
|
|
FirebaseCrashlytics.getInstance().setCustomKey(str2, str);
|
|
}
|
|
|
|
public static void addCrashlyticsLogEvent(String str) {
|
|
FirebaseCrashlytics.getInstance().log(str);
|
|
}
|
|
|
|
public static void addAnalyticsLogEvent(String str, String[] strArr, String[] strArr2) {
|
|
int length;
|
|
Bundle bundle = new Bundle();
|
|
if (strArr.length != strArr2.length) {
|
|
length = strArr.length > strArr2.length ? strArr2.length : strArr.length;
|
|
} else {
|
|
length = strArr.length;
|
|
}
|
|
for (int i = 0; i < length; i++) {
|
|
bundle.putString(strArr[i], strArr2[i]);
|
|
}
|
|
MainActivity.instance.getFirebaseAnalyticsInstance().logEvent(str, bundle);
|
|
}
|
|
|
|
public static void addLevelAnalyticsLogEvent(int i, int i2, int i3) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putInt("Driver_Level", i);
|
|
bundle.putInt("Spender_Level", i2);
|
|
bundle.putInt("Game_Version", i3);
|
|
MainActivity.instance.getFirebaseAnalyticsInstance().logEvent("RR3_Game_Level", bundle);
|
|
Bundle bundle2 = new Bundle();
|
|
bundle2.putString("character", "Driver_Level");
|
|
bundle2.putLong(AppLovinEventTypes.USER_COMPLETED_LEVEL, i);
|
|
MainActivity.instance.getFirebaseAnalyticsInstance().logEvent("level_up", bundle2);
|
|
}
|
|
|
|
public static void testCrashlyticsCrash() {
|
|
throw new RuntimeException("This is a crash");
|
|
}
|
|
|
|
public static String getCarrierName() {
|
|
return AppProxy.GetContext().getString(R.string.carrier);
|
|
}
|
|
|
|
public static String getCloudcellEnvironment() {
|
|
return AppProxy.GetContext().getString(R.string.cc_server_env);
|
|
}
|
|
|
|
public static String getStarlightEnvironment() {
|
|
return AppProxy.GetContext().getString(R.string.starlight_env);
|
|
}
|
|
|
|
public static void OnLegalOptOutChanged(boolean z) {
|
|
MainActivity.instance.OnLegalOptOutChanged(z);
|
|
}
|
|
|
|
public static void InitialiseSingular(String str, String str2) {
|
|
Singular.init(AppProxy.GetContext(), new SingularConfig(str, str2));
|
|
}
|
|
|
|
public static void SetSingularCustomUserId(String str) {
|
|
Singular.setCustomUserId(str);
|
|
}
|
|
|
|
public static void UnsetSingularCustomUserId() {
|
|
Singular.unsetCustomUserId();
|
|
}
|
|
|
|
public static void SingularEvent(String str) {
|
|
Singular.event(str);
|
|
}
|
|
|
|
public static void SingularRevenue(String str, double d) {
|
|
Singular.revenue(str, d);
|
|
}
|
|
|
|
public static void SingularRevenueWithProductDetails(String str, double d, String str2, String str3, String str4, int i, double d2) {
|
|
Singular.revenue(str, d, str2, str3, str4, i, d2);
|
|
}
|
|
|
|
public static void SingularRevenueWithPurchaseReceipt(String str, double d, Object obj) {
|
|
Singular.revenue(str, d, obj);
|
|
}
|
|
|
|
public static void SetClipboardText(String str) {
|
|
Context GetContext = AppProxy.GetContext();
|
|
((ClipboardManager) GetContext.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText(GetContext.getResources().getString(R.string.app_name), str));
|
|
}
|
|
|
|
public static float GetFloatValueFromRemoteConfig(String str) {
|
|
return (float) MainActivity.instance.getFirebaseRemoteConfigInstance().getDouble(str);
|
|
}
|
|
|
|
public static String GetStringValueFromRemoteConfig(String str) {
|
|
return MainActivity.instance.getFirebaseRemoteConfigInstance().getString(str);
|
|
}
|
|
|
|
public static boolean GetBooleanValueFromRemoteConfig(String str) {
|
|
return MainActivity.instance.getFirebaseRemoteConfigInstance().getBoolean(str);
|
|
}
|
|
}
|