- 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
200 lines
8.2 KiB
Java
200 lines
8.2 KiB
Java
package com.tapjoy;
|
|
|
|
import android.app.UiModeManager;
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.graphics.Insets;
|
|
import android.media.AudioManager;
|
|
import android.os.BatteryManager;
|
|
import android.os.Build;
|
|
import android.provider.Settings;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.Display;
|
|
import android.view.WindowInsets;
|
|
import android.view.WindowManager;
|
|
import android.view.WindowMetrics;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class TJDeviceInfo {
|
|
public static final TJDeviceInfo INSTANCE = new TJDeviceInfo();
|
|
|
|
public final Float getBatteryLevel(Context context) {
|
|
Object systemService = context != null ? context.getSystemService("batterymanager") : null;
|
|
if ((systemService instanceof BatteryManager ? (BatteryManager) systemService : null) == null) {
|
|
return null;
|
|
}
|
|
return Float.valueOf(r3.getIntProperty(4) / 100.0f);
|
|
}
|
|
|
|
public final Float getBrightness(Context context) {
|
|
ContentResolver contentResolver;
|
|
if (context != null) {
|
|
try {
|
|
contentResolver = context.getContentResolver();
|
|
} catch (Settings.SettingNotFoundException e) {
|
|
TapjoyLog.e("TJDeviceInfo", e.getLocalizedMessage());
|
|
return null;
|
|
}
|
|
} else {
|
|
contentResolver = null;
|
|
}
|
|
if (contentResolver == null) {
|
|
return null;
|
|
}
|
|
return Float.valueOf(new BigDecimal(Settings.System.getInt(contentResolver, "screen_brightness") / 255.0f).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
}
|
|
|
|
public final Integer getDeviceScreenLayoutSize(Context context) {
|
|
Resources resources;
|
|
Configuration configuration = (context == null || (resources = context.getResources()) == null) ? null : resources.getConfiguration();
|
|
if (configuration == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
return Integer.valueOf(configuration.screenLayout & 15);
|
|
} catch (Exception e) {
|
|
TapjoyLog.e("TJDeviceInfo", "Error getting screen density/dimensions/layout: " + e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final Integer getScreenHeight(Context context) {
|
|
Object systemService;
|
|
Resources resources;
|
|
WindowMetrics currentWindowMetrics;
|
|
WindowInsets windowInsets;
|
|
int statusBars;
|
|
Insets insets;
|
|
int i;
|
|
DisplayMetrics displayMetrics;
|
|
if (context != null) {
|
|
try {
|
|
systemService = context.getSystemService("window");
|
|
} catch (Exception e) {
|
|
TapjoyLog.d("TJDeviceInfo", e.getMessage());
|
|
return null;
|
|
}
|
|
} else {
|
|
systemService = null;
|
|
}
|
|
WindowManager windowManager = systemService instanceof WindowManager ? (WindowManager) systemService : null;
|
|
if (windowManager == null) {
|
|
return null;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 30) {
|
|
currentWindowMetrics = windowManager.getCurrentWindowMetrics();
|
|
Intrinsics.checkNotNullExpressionValue(currentWindowMetrics, "getCurrentWindowMetrics(...)");
|
|
windowInsets = currentWindowMetrics.getWindowInsets();
|
|
statusBars = WindowInsets.Type.statusBars();
|
|
insets = windowInsets.getInsets(statusBars);
|
|
i = insets.top;
|
|
Resources resources2 = context.getResources();
|
|
if (resources2 == null || (displayMetrics = resources2.getDisplayMetrics()) == null) {
|
|
return null;
|
|
}
|
|
return Integer.valueOf(displayMetrics.heightPixels - i);
|
|
}
|
|
DisplayMetrics displayMetrics2 = new DisplayMetrics();
|
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
|
if (defaultDisplay != null) {
|
|
defaultDisplay.getMetrics(displayMetrics2);
|
|
}
|
|
int i2 = 0;
|
|
try {
|
|
Resources resources3 = context.getResources();
|
|
int identifier = resources3 != null ? resources3.getIdentifier("status_bar_height", "dimen", "android") : 0;
|
|
if (identifier > 0 && (resources = context.getResources()) != null) {
|
|
i2 = resources.getDimensionPixelSize(identifier);
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
int i3 = displayMetrics2.heightPixels - i2;
|
|
displayMetrics2.heightPixels = i3;
|
|
return Integer.valueOf(i3);
|
|
}
|
|
|
|
public final String getTheme(Context context) {
|
|
Object systemService = context != null ? context.getSystemService("uimode") : null;
|
|
UiModeManager uiModeManager = systemService instanceof UiModeManager ? (UiModeManager) systemService : null;
|
|
Integer valueOf = uiModeManager != null ? Integer.valueOf(uiModeManager.getNightMode()) : null;
|
|
return (valueOf != null && valueOf.intValue() == 2) ? TapjoyConstants.TJC_THEME_DARK : TapjoyConstants.TJC_THEME_LIGHT;
|
|
}
|
|
|
|
public final Float getVolume(Context context) {
|
|
Object systemService;
|
|
if (context != null) {
|
|
try {
|
|
systemService = context.getSystemService("audio");
|
|
} catch (Exception unused) {
|
|
TapjoyLog.e("TJDeviceInfo", "Unable to fetch volume");
|
|
return null;
|
|
}
|
|
} else {
|
|
systemService = null;
|
|
}
|
|
if ((systemService instanceof AudioManager ? (AudioManager) systemService : null) == null) {
|
|
return null;
|
|
}
|
|
return Float.valueOf(new BigDecimal(r4.getStreamVolume(3) / r4.getStreamMaxVolume(3)).setScale(2, RoundingMode.HALF_UP).floatValue());
|
|
}
|
|
|
|
public final Integer getScreenDPI(Context context) {
|
|
Resources resources;
|
|
DisplayMetrics displayMetrics;
|
|
try {
|
|
if (Build.VERSION.SDK_INT >= 30) {
|
|
if (context == null || (resources = context.getResources()) == null || (displayMetrics = resources.getDisplayMetrics()) == null) {
|
|
return null;
|
|
}
|
|
return Integer.valueOf(displayMetrics.densityDpi);
|
|
}
|
|
Object systemService = context != null ? context.getSystemService("window") : null;
|
|
WindowManager windowManager = systemService instanceof WindowManager ? (WindowManager) systemService : null;
|
|
if (windowManager == null) {
|
|
return null;
|
|
}
|
|
DisplayMetrics displayMetrics2 = new DisplayMetrics();
|
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
|
if (defaultDisplay != null) {
|
|
defaultDisplay.getMetrics(displayMetrics2);
|
|
}
|
|
return Integer.valueOf(displayMetrics2.densityDpi);
|
|
} catch (Exception e) {
|
|
TapjoyLog.d("TJDeviceInfo", e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final Integer getScreenWidth(Context context) {
|
|
Resources resources;
|
|
DisplayMetrics displayMetrics;
|
|
try {
|
|
if (Build.VERSION.SDK_INT >= 30) {
|
|
if (context == null || (resources = context.getResources()) == null || (displayMetrics = resources.getDisplayMetrics()) == null) {
|
|
return null;
|
|
}
|
|
return Integer.valueOf(displayMetrics.widthPixels);
|
|
}
|
|
Object systemService = context != null ? context.getSystemService("window") : null;
|
|
WindowManager windowManager = systemService instanceof WindowManager ? (WindowManager) systemService : null;
|
|
if (windowManager == null) {
|
|
return null;
|
|
}
|
|
DisplayMetrics displayMetrics2 = new DisplayMetrics();
|
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
|
if (defaultDisplay != null) {
|
|
defaultDisplay.getMetrics(displayMetrics2);
|
|
}
|
|
return Integer.valueOf(displayMetrics2.widthPixels);
|
|
} catch (Exception e) {
|
|
TapjoyLog.d("TJDeviceInfo", e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
}
|