- 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
147 lines
5.6 KiB
Java
147 lines
5.6 KiB
Java
package com.tapjoy;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.pm.ActivityInfo;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Resources;
|
|
import android.graphics.Insets;
|
|
import android.os.Build;
|
|
import android.os.Environment;
|
|
import android.os.StatFs;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.Display;
|
|
import android.view.WindowInsets;
|
|
import android.view.WindowManager;
|
|
import android.view.WindowMetrics;
|
|
import androidx.core.hardware.display.DisplayManagerCompat;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class TJDeviceUtils {
|
|
public static final TJDeviceUtils INSTANCE = new TJDeviceUtils();
|
|
|
|
public final long getAvailableDiskSpace() {
|
|
return new StatFs(Environment.getDataDirectory().getPath()).getFreeBytes() / 1000000;
|
|
}
|
|
|
|
public final float getDensity(Context context) {
|
|
Resources resources;
|
|
DisplayMetrics displayMetrics;
|
|
if (context == null || (resources = context.getResources()) == null || (displayMetrics = resources.getDisplayMetrics()) == null) {
|
|
return 1.0f;
|
|
}
|
|
return displayMetrics.density;
|
|
}
|
|
|
|
public final String getOrientationString(int i, int i2) {
|
|
return i > i2 ? "landscape" : "portrait";
|
|
}
|
|
|
|
public final int getScreenHeight(Context context) {
|
|
Display display;
|
|
if (context == null || (display = DisplayManagerCompat.getInstance(context).getDisplay(0)) == null) {
|
|
return 0;
|
|
}
|
|
return context.createDisplayContext(display).getResources().getDisplayMetrics().heightPixels;
|
|
}
|
|
|
|
public final int getScreenOrientation(Activity activity) {
|
|
PackageInfo packageInfo = null;
|
|
PackageManager packageManager = activity != null ? activity.getPackageManager() : null;
|
|
if (packageManager == null) {
|
|
return -1;
|
|
}
|
|
try {
|
|
packageInfo = packageManager.getPackageInfo(activity.getPackageName(), 1);
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
TapjoyLog.e("TJDeviceInfo", e.getMessage());
|
|
}
|
|
if (packageInfo != null) {
|
|
ActivityInfo[] activities = packageInfo.activities;
|
|
Intrinsics.checkNotNullExpressionValue(activities, "activities");
|
|
if (activities.length != 0) {
|
|
return packageInfo.activities[0].screenOrientation;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public final int getScreenRotation(Context context, int i, int i2) {
|
|
if (context == null) {
|
|
return 0;
|
|
}
|
|
Display display = DisplayManagerCompat.getInstance(context).getDisplay(0);
|
|
int rotation = display != null ? display.getRotation() : 0;
|
|
if (((rotation == 0 || rotation == 2) && i2 > i) || ((rotation == 1 || rotation == 3) && i > i2)) {
|
|
if (rotation != 1) {
|
|
if (rotation != 2) {
|
|
if (rotation != 3) {
|
|
TapjoyLog.w("TJDeviceInfo", "Unknown screen orientation. Defaulting to landscape.");
|
|
return 0;
|
|
}
|
|
return 90;
|
|
}
|
|
return 180;
|
|
}
|
|
return 270;
|
|
}
|
|
if (rotation != 0) {
|
|
if (rotation == 1) {
|
|
return 0;
|
|
}
|
|
if (rotation != 2) {
|
|
if (rotation != 3) {
|
|
TapjoyLog.w("TJDeviceInfo", "Unknown screen orientation. Defaulting to landscape.");
|
|
return 0;
|
|
}
|
|
return 180;
|
|
}
|
|
return 90;
|
|
}
|
|
return 270;
|
|
}
|
|
|
|
public final int getScreenWidth(Context context) {
|
|
Display display;
|
|
if (context == null || (display = DisplayManagerCompat.getInstance(context).getDisplay(0)) == null) {
|
|
return 0;
|
|
}
|
|
return context.createDisplayContext(display).getResources().getDisplayMetrics().widthPixels;
|
|
}
|
|
|
|
public final long getTotalDiskSpace() {
|
|
return new StatFs(Environment.getDataDirectory().getPath()).getTotalBytes() / 1000000;
|
|
}
|
|
|
|
public final int getStatusBarHeight(Context context) {
|
|
WindowMetrics currentWindowMetrics;
|
|
WindowInsets windowInsets;
|
|
int displayCutout;
|
|
Insets insetsIgnoringVisibility;
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
if (Build.VERSION.SDK_INT <= 34 || context.getApplicationInfo().targetSdkVersion <= 34) {
|
|
return 0;
|
|
}
|
|
Object systemService = context.getSystemService("window");
|
|
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.WindowManager");
|
|
currentWindowMetrics = ((WindowManager) systemService).getCurrentWindowMetrics();
|
|
Intrinsics.checkNotNullExpressionValue(currentWindowMetrics, "getCurrentWindowMetrics(...)");
|
|
windowInsets = currentWindowMetrics.getWindowInsets();
|
|
displayCutout = WindowInsets.Type.displayCutout();
|
|
insetsIgnoringVisibility = windowInsets.getInsetsIgnoringVisibility(displayCutout);
|
|
Intrinsics.checkNotNullExpressionValue(insetsIgnoringVisibility, "getInsetsIgnoringVisibility(...)");
|
|
i = insetsIgnoringVisibility.left;
|
|
i2 = insetsIgnoringVisibility.top;
|
|
double max = Math.max(i, i2);
|
|
i3 = insetsIgnoringVisibility.right;
|
|
i4 = insetsIgnoringVisibility.bottom;
|
|
return (int) (((int) Math.max(max, Math.max(i3, i4))) / (context.getResources().getDisplayMetrics().densityDpi / 160.0f));
|
|
}
|
|
}
|