- 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
323 lines
13 KiB
Java
323 lines
13 KiB
Java
package com.singular.sdk.internal;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.database.Cursor;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.util.DisplayMetrics;
|
|
import android.webkit.WebSettings;
|
|
import com.ironsource.tj;
|
|
import com.ironsource.v8;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class DeviceInfo {
|
|
public static final SingularLog logger = SingularLog.getLogger(DeviceInfo.class.getSimpleName());
|
|
public String abi;
|
|
public String aifa;
|
|
public String andi;
|
|
public String apiLevel;
|
|
public String appName;
|
|
public String appVersion;
|
|
public String buildProduct;
|
|
public String country;
|
|
public String customUserId;
|
|
public String deviceBrand;
|
|
public String deviceBuild;
|
|
public String deviceManufacturer;
|
|
public String deviceModel;
|
|
public String deviceType;
|
|
public String deviceUserAgent;
|
|
public String displayHeight;
|
|
public String displayWidth;
|
|
public String fbAttributionId;
|
|
public String fcmRegId;
|
|
public long firstInstallTime;
|
|
public String gcmProcessId;
|
|
public String gcmRegId;
|
|
public String hardwareName;
|
|
public String imei;
|
|
public String installSource;
|
|
public boolean isGooglePlayServicesAvailable;
|
|
public boolean isLimitedTrackingEnabled;
|
|
public String language;
|
|
public long lastUpdateTime;
|
|
public Locale locale;
|
|
public String osVersion;
|
|
public String packageName;
|
|
public String platform;
|
|
public String preloadCampaign;
|
|
public String preloadGroup;
|
|
public String preloadSource;
|
|
public String screenDensity;
|
|
public String screenFormat;
|
|
public String screenSize;
|
|
public String sdkVersion;
|
|
|
|
public final String getDeviceType(int i) {
|
|
int i2 = i & 15;
|
|
if (i2 == 1 || i2 == 2) {
|
|
return "phone";
|
|
}
|
|
if (i2 == 3 || i2 == 4) {
|
|
return "tablet";
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final String getScreenFormat(int i) {
|
|
int i2 = i & 48;
|
|
if (i2 == 16) {
|
|
return "normal";
|
|
}
|
|
if (i2 != 32) {
|
|
return null;
|
|
}
|
|
return "long";
|
|
}
|
|
|
|
public final String getScreenSize(int i) {
|
|
int i2 = i & 15;
|
|
if (i2 == 1) {
|
|
return "small";
|
|
}
|
|
if (i2 == 2) {
|
|
return "normal";
|
|
}
|
|
if (i2 == 3) {
|
|
return "large";
|
|
}
|
|
if (i2 != 4) {
|
|
return null;
|
|
}
|
|
return "xlarge";
|
|
}
|
|
|
|
public void setCustomUserId(String str) {
|
|
this.customUserId = str;
|
|
}
|
|
|
|
public void setFcmRegId(String str) {
|
|
this.fcmRegId = str;
|
|
}
|
|
|
|
public void setGcmRegId(String str) {
|
|
this.gcmRegId = str;
|
|
}
|
|
|
|
public DeviceInfo(Context context) {
|
|
setAppInfo(context);
|
|
setPreloadCampaign(context);
|
|
Resources resources = context.getResources();
|
|
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
|
|
Configuration configuration = resources.getConfiguration();
|
|
Locale locale = Utils.getLocale(configuration);
|
|
this.locale = locale;
|
|
this.language = locale.getLanguage();
|
|
this.country = this.locale.getCountry();
|
|
int i = configuration.screenLayout;
|
|
this.screenSize = getScreenSize(i);
|
|
this.screenFormat = getScreenFormat(i);
|
|
this.deviceType = getDeviceType(i);
|
|
this.screenDensity = getScreenDensity(displayMetrics);
|
|
this.displayWidth = getDisplayWidth(displayMetrics);
|
|
this.displayHeight = getDisplayHeight(displayMetrics);
|
|
boolean isGooglePlayServicesAvailable = Utils.isGooglePlayServicesAvailable();
|
|
this.isGooglePlayServicesAvailable = isGooglePlayServicesAvailable;
|
|
if (isGooglePlayServicesAvailable) {
|
|
this.isLimitedTrackingEnabled = Utils.isLimitedTrackingEnabled(context);
|
|
this.aifa = Utils.getPlayStoreAdId(context);
|
|
}
|
|
if (Utils.isEmptyOrNull(this.aifa)) {
|
|
this.aifa = Utils.getPlayStoreAdIdByBackupMethod(context);
|
|
}
|
|
this.andi = Utils.getAndroidId(context);
|
|
this.installSource = getInstallSource(context);
|
|
this.fbAttributionId = getFacebookAttributionId(context);
|
|
setFcmRegId(context.getSharedPreferences("singular-pref-session", 0).getString("fcm_device_token_key", ""));
|
|
setGcmRegId(context.getSharedPreferences("singular-pref-session", 0).getString("gcm_device_token_key", ""));
|
|
getInstallTimestamps(context);
|
|
setCustomUserId(context.getSharedPreferences("singular-pref-session", 0).getString("custom_user_id", ""));
|
|
this.deviceUserAgent = getDeviceUserAgent(context);
|
|
log();
|
|
}
|
|
|
|
public final void setAppInfo(Context context) {
|
|
this.abi = getABI();
|
|
this.deviceBrand = Build.BRAND;
|
|
this.deviceBuild = Build.DEVICE;
|
|
this.packageName = context.getPackageName();
|
|
this.deviceManufacturer = Build.MANUFACTURER;
|
|
this.deviceModel = Build.MODEL;
|
|
this.platform = v8.d;
|
|
this.buildProduct = Build.PRODUCT;
|
|
this.osVersion = Build.VERSION.RELEASE;
|
|
this.hardwareName = Build.DISPLAY;
|
|
this.sdkVersion = Constants.SDK_VERSION;
|
|
this.appName = getAppName(context);
|
|
this.appVersion = getAppVersion(context);
|
|
this.apiLevel = String.format("%d", Integer.valueOf(Build.VERSION.SDK_INT));
|
|
}
|
|
|
|
public final String getAppVersion(Context context) {
|
|
try {
|
|
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
|
return TextUtils.isEmpty(packageInfo.versionName) ? "unknown" : packageInfo.versionName;
|
|
} catch (Exception unused) {
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
public final String getInstallSource(Context context) {
|
|
try {
|
|
String installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
|
|
this.installSource = installerPackageName;
|
|
return installerPackageName;
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final String getAppName(Context context) {
|
|
try {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(context.getPackageName(), 128)).toString();
|
|
} catch (Exception unused) {
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
public final String getScreenDensity(DisplayMetrics displayMetrics) {
|
|
int i = displayMetrics.densityDpi;
|
|
if (i == 0) {
|
|
return null;
|
|
}
|
|
return i < 140 ? "low" : i > 200 ? "high" : "medium";
|
|
}
|
|
|
|
public final String getDisplayWidth(DisplayMetrics displayMetrics) {
|
|
return String.valueOf(displayMetrics.widthPixels);
|
|
}
|
|
|
|
public final String getDisplayHeight(DisplayMetrics displayMetrics) {
|
|
return String.valueOf(displayMetrics.heightPixels);
|
|
}
|
|
|
|
public final String getFacebookAttributionId(Context context) {
|
|
try {
|
|
Cursor query = context.getContentResolver().query(Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider"), new String[]{tj.b}, null, null, null);
|
|
if (query == null) {
|
|
return null;
|
|
}
|
|
if (!query.moveToFirst()) {
|
|
query.close();
|
|
return null;
|
|
}
|
|
String string = query.getString(query.getColumnIndex(tj.b));
|
|
query.close();
|
|
return string;
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final String getABI() {
|
|
String[] supportedAbis = Utils.getSupportedAbis();
|
|
if (supportedAbis == null || supportedAbis.length == 0) {
|
|
return Utils.getCpuAbi();
|
|
}
|
|
return supportedAbis[0];
|
|
}
|
|
|
|
public final String getDeviceUserAgent(Context context) {
|
|
String property = System.getProperty("http.agent", "");
|
|
if (!TextUtils.isEmpty(property)) {
|
|
return property;
|
|
}
|
|
try {
|
|
Class.forName("android.os.AsyncTask");
|
|
return WebSettings.getDefaultUserAgent(context);
|
|
} catch (Exception | VerifyError unused) {
|
|
return property;
|
|
}
|
|
}
|
|
|
|
public boolean hasPreloadCampaign() {
|
|
return (Utils.isEmptyOrNull(this.preloadCampaign) || Utils.isEmptyOrNull(this.preloadGroup) || Utils.isEmptyOrNull(this.preloadSource)) ? false : true;
|
|
}
|
|
|
|
public final void setPreloadCampaign(Context context) {
|
|
try {
|
|
Bundle bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData;
|
|
this.preloadCampaign = bundle.getString("SINGULAR_PRELOAD_CAMPAIGN");
|
|
this.preloadGroup = bundle.getString("SINGULAR_PRELOAD_GROUP");
|
|
this.preloadSource = bundle.getString("SINGULAR_PRELOAD_SOURCE");
|
|
} catch (Exception e) {
|
|
logger.error("error in setPreloadCampaign()", e);
|
|
}
|
|
}
|
|
|
|
public final void getInstallTimestamps(Context context) {
|
|
try {
|
|
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
|
this.firstInstallTime = packageInfo.firstInstallTime;
|
|
this.lastUpdateTime = packageInfo.lastUpdateTime;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
} catch (RuntimeException e) {
|
|
logger.error("getInstallDates failed", e);
|
|
}
|
|
}
|
|
|
|
public void log() {
|
|
SingularLog singularLog = logger;
|
|
if (singularLog.isDebugEnabled()) {
|
|
singularLog.debug("DeviceInfo ----> ");
|
|
singularLog.debug("\t andi : %s", this.andi);
|
|
singularLog.debug("\t aifa : %s", this.aifa);
|
|
singularLog.debug("\t isGooglePlayServicesAvailable : %b", Boolean.valueOf(this.isGooglePlayServicesAvailable));
|
|
singularLog.debug("\t isLimitedTrackingEnabled : %b", Boolean.valueOf(this.isLimitedTrackingEnabled));
|
|
singularLog.debug("\t appVersion : %s", this.appVersion);
|
|
singularLog.debug("\t sdkVersion : %s", this.sdkVersion);
|
|
singularLog.debug("\t packageName : %s", this.packageName);
|
|
singularLog.debug("\t appName : %s", this.appName);
|
|
singularLog.debug("\t preloadCampaign : %s", this.preloadCampaign);
|
|
singularLog.debug("\t preloadGroup : %s", this.preloadGroup);
|
|
singularLog.debug("\t preloadSource : %s", this.preloadSource);
|
|
singularLog.debug("\t installSource : %s", this.installSource);
|
|
singularLog.debug("\t fbAttributionId : %s", this.fbAttributionId);
|
|
singularLog.debug("\t abi : %s", this.abi);
|
|
singularLog.debug("\t deviceBrand : %s", this.deviceBrand);
|
|
singularLog.debug("\t deviceBuild : %s", this.deviceBuild);
|
|
singularLog.debug("\t deviceManufacturer : %s", this.deviceManufacturer);
|
|
singularLog.debug("\t deviceModel : %s", this.deviceModel);
|
|
singularLog.debug("\t platform : %s", this.platform);
|
|
singularLog.debug("\t buildProduct : %s", this.buildProduct);
|
|
singularLog.debug("\t osVersion : %s", this.osVersion);
|
|
singularLog.debug("\t apiLevel : %s", this.apiLevel);
|
|
singularLog.debug("\t hardwareName : %s", this.hardwareName);
|
|
singularLog.debug("\t locale : %s", this.locale);
|
|
singularLog.debug("\t language : %s", this.language);
|
|
singularLog.debug("\t country : %s", this.country);
|
|
singularLog.debug("\t screenSize : %s", this.screenSize);
|
|
singularLog.debug("\t screenFormat : %s", this.screenFormat);
|
|
singularLog.debug("\t screenDensity : %s", this.screenDensity);
|
|
singularLog.debug("\t displayWidth : %s", this.displayWidth);
|
|
singularLog.debug("\t displayHeight : %s", this.displayHeight);
|
|
singularLog.debug("\t gcmProcessId : %s", this.gcmProcessId);
|
|
singularLog.debug("\t gcmRegId : %s", this.gcmRegId);
|
|
singularLog.debug("\t fcmRegId : %s", this.fcmRegId);
|
|
singularLog.debug("\t firstInstallTime : %d", Long.valueOf(this.firstInstallTime));
|
|
singularLog.debug("\t lastUpdateTime : %d", Long.valueOf(this.lastUpdateTime));
|
|
singularLog.debug("\t deviceType : %s", this.deviceType);
|
|
singularLog.debug("\t customUserId : %s", this.customUserId);
|
|
singularLog.debug("\t deviceUserAgent: %s", this.deviceUserAgent);
|
|
}
|
|
}
|
|
}
|