Files
rr3-apk/decompiled-community/sources/com/ea/nimble/ApplicationEnvironmentImpl.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- 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
2026-02-18 15:48:36 -08:00

1115 lines
62 KiB
Java

package com.ea.nimble;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import com.android.installreferrer.api.InstallReferrerClient;
import com.android.installreferrer.api.InstallReferrerStateListener;
import com.android.installreferrer.api.ReferrerDetails;
import com.ea.nimble.Error;
import com.ea.nimble.IApplicationEnvironment;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.ea.nimble.Persistence;
import com.ea.nimble.SynergyRequest;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.tasks.OnCanceledListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.play.core.integrity.IntegrityManagerFactory;
import com.google.android.play.core.integrity.IntegrityTokenRequest;
import com.google.android.play.core.integrity.IntegrityTokenResponse;
import com.ironsource.v8;
import com.ironsource.x8;
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
import com.unity3d.services.ads.gmascar.utils.ScarConstants;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Currency;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class ApplicationEnvironmentImpl extends Component implements IApplicationEnvironment, LogSource {
private static final String KEY_GAME_PLAYER_ID = "gamePlayerId";
private static final int MILLIS_IN_AN_HOUR = 3600000;
private static final String NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID = "nimble_applicationenvironment_game_specified_id";
private static final String OVERRIDE_BUNDLE_ID_KEY = "NimbleBundleIdOverride";
private static final String PERSISTENCE_AGE_REQUIREMENTS = "ageRequirement";
private static final String PERSISTENCE_ATTRIBUTION_DATA = "attributionData";
private static final String PERSISTENCE_LANGUAGE = "language";
private static final String PERSISTENCE_TIME_RETRIEVED = "timeRetrieved";
private static final String SUPERUSER_APK_LOCATION = "/system/app/Superuser.apk";
private static final String SYNERGY_API_GET_AGE_REQUIREMENTS = "/rest/agerequirements/ip";
private static boolean isMainApplicationActive;
private static boolean isMainApplicationRunning;
private static Activity s_currentActivity;
private List<IApplicationEnvironment.AdvertisingIdCalback> m_advertisingIdCallbacks;
private String m_androidId;
private BroadcastReceiver m_attributionDataNetworkListener;
private Context m_context;
private final BaseCore m_core;
private String m_language;
private BroadcastReceiver m_networkListener;
private String m_packageId;
private final Map<String, String> m_parameters;
private final Map<String, String> m_playerIdMap;
private InstallReferrerClient m_referrerClient;
private String m_version;
private String m_advertisingId = null;
private boolean m_limitAdTrackingEnabled = true;
public static Activity getCurrentActivity() {
return s_currentActivity;
}
public static boolean isMainApplicationActive() {
return isMainApplicationActive;
}
public static boolean isMainApplicationRunning() {
return isMainApplicationRunning;
}
public static void setCurrentActivity(Activity activity) {
isMainApplicationRunning = true;
s_currentActivity = activity;
}
@Override // com.ea.nimble.IApplicationEnvironment
public Context getApplicationContext() {
return this.m_context;
}
@Override // com.ea.nimble.Component
public String getComponentId() {
return ApplicationEnvironment.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "AppEnv";
}
public ApplicationEnvironmentImpl(BaseCore baseCore) {
Activity activity = s_currentActivity;
if (activity == null) {
throw new AssertionError("Cannot create a ApplicationEnvironment without a valid current activity");
}
this.m_core = baseCore;
this.m_context = activity.getApplicationContext();
this.m_language = null;
this.m_playerIdMap = new ConcurrentHashMap();
this.m_parameters = generateParameterDictionary();
String documentPath = getDocumentPath();
File file = documentPath != null ? new File(documentPath) : null;
File file2 = new File(getTempPath());
if (file == null || ((!file.exists() && !file.mkdirs()) || (!file2.exists() && !file2.mkdirs()))) {
throw new AssertionError("APP_ENV: Cannot create necessary folder");
}
File[] listFiles = file2.listFiles();
if (listFiles != null) {
for (File file3 : listFiles) {
if (file3.delete()) {
StringBuilder sb = new StringBuilder();
sb.append("APP_ENV: Delete temp file ");
sb.append(file3.getName());
}
}
}
this.m_androidId = Settings.Secure.getString(this.m_context.getContentResolver(), "android_id");
}
private Map<String, String> generateParameterDictionary() {
Log.Helper.LOGFUNC(this);
HashMap<String, String> hashMap = new HashMap<>();
if (!Utility.validString(this.m_androidId)) {
this.m_androidId = Utility.safeString(Settings.Secure.getString(this.m_context.getContentResolver(), "android_id"));
}
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, this.m_androidId);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_NAME, v8.d);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_VERSION, Build.VERSION.RELEASE);
hashMap.put("platform", "android");
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_CODENAME, Build.DEVICE);
hashMap.put("deviceModel", Build.MODEL);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_PRODUCT, Build.PRODUCT);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_BRAND, Build.BRAND);
hashMap.put("deviceManufacturer", Build.MANUFACTURER);
ActivityManager activityManager = (ActivityManager) this.m_context.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_MEMORY, String.valueOf(memoryInfo.totalMem));
hashMap.put("deviceLanguage", Utility.safeString(Locale.getDefault().getLanguage()));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Utility.safeString(Locale.getDefault().toString()));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_ABIS, TextUtils.join(",", Build.SUPPORTED_ABIS));
hashMap.put("cpuCoreCount", String.valueOf(Runtime.getRuntime().availableProcessors()));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_CPU_CHIPSET, Build.BOARD);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_COUNTRY_CODE, Utility.safeString(Locale.getDefault().getCountry()));
setDisplayParameters(hashMap);
return hashMap;
}
private void setDisplayParameters(HashMap<String, String> hashMap) {
Display defaultDisplay = ((WindowManager) this.m_context.getSystemService("window")).getDefaultDisplay();
DisplayMetrics displayMetrics = this.m_context.getResources().getDisplayMetrics();
defaultDisplay.getRealMetrics(displayMetrics);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DISPLAY_WIDTH, String.valueOf(displayMetrics.widthPixels));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DISPLAY_HEIGHT, String.valueOf(displayMetrics.heightPixels));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DISPLAY_DENSITY, String.valueOf(displayMetrics.density));
}
@Override // com.ea.nimble.Component
public void setup() {
Log.Helper.LOGD(this, "Setting application to active in setup", new Object[0]);
isMainApplicationActive = true;
this.m_context = s_currentActivity.getApplicationContext();
retrieveAdvertisingIdImpl(null);
}
@Override // com.ea.nimble.Component
public void resume() {
Log.Helper.LOGD(this, "Setting application to active in resume", new Object[0]);
isMainApplicationActive = true;
retrieveAdvertisingIdImpl(null);
}
@Override // com.ea.nimble.Component
public void restore() {
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent == null) {
setApplicationLanguageCode(getDeviceLanguage(), true);
Log.Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't read Game Specified Player ID or Language from Persistence", new Object[0]);
} else {
String stringValue = persistenceForNimbleComponent.getStringValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID);
if (Utility.validString(stringValue)) {
Log.Helper.LOGDS("ApplicationEnvironment", "Current game specified player ID is empty, reload from persistence", new Object[0]);
setPlayerId(KEY_GAME_PLAYER_ID, stringValue);
}
String stringValue2 = persistenceForNimbleComponent.getStringValue(PERSISTENCE_LANGUAGE);
if (Utility.validString(stringValue2)) {
this.m_language = stringValue2;
Log.Helper.LOGD(this, "Restored language %s from persistence.", stringValue2);
} else {
Log.Helper.LOGD(this, "Unable to restore language from persistence. Setting language to device language.", new Object[0]);
setApplicationLanguageCode(getDeviceLanguage(), true);
}
}
requestAttributionData();
}
@Override // com.ea.nimble.Component
public void suspend() {
Log.Helper.LOGD(this, "Setting application to NOT active in suspend", new Object[0]);
isMainApplicationActive = false;
this.m_advertisingId = null;
}
@Override // com.ea.nimble.Component
public void teardown() {
Log.Helper.LOGD(this, "Setting application to NOT active in teardown", new Object[0]);
this.m_context = null;
isMainApplicationActive = false;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getApplicationVersion() {
PackageInfo packageInfo;
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_version == null && (packageInfo = Utility.getPackageInfo(0)) != null) {
this.m_version = packageInfo.versionName;
}
return this.m_version;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getApplicationLanguageCode() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_language;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getShortApplicationLanguageCode() {
int indexOf;
Log.Helper.LOGPUBLICFUNC(this);
String str = this.m_language;
return (str == null || (indexOf = str.indexOf(45)) == -1) ? this.m_language : this.m_language.substring(0, indexOf);
}
private String validatedLanguageCode(String str, boolean z) {
Log.Helper.LOGFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGI(this, "AppEnv: Language parameter is null or empty; keeping language at previous value.", new Object[0]);
return null;
}
String replace = str.replace('_', '-');
Matcher matcher = Pattern.compile("^([a-z]{2,3})?(-([A-Z][a-z]{3}))?(-([A-Z]{2}))?(-.*)*$").matcher(replace);
if (matcher.find()) {
String group = matcher.group(1);
if (Utility.validString(group)) {
if (group.equals("iw")) {
group = "he";
} else if (group.equals(ScarConstants.IN_SIGNAL_KEY)) {
group = "id";
} else if (group.equals("ji")) {
group = "yi";
}
if (!Arrays.asList(Locale.getISOLanguages()).contains(group)) {
Log.Helper.LOGE(this, "Unknown language code " + group + " in language code " + replace + "; backend system will likely treat it as en-US.", new Object[0]);
}
}
String group2 = matcher.group(5);
if (Utility.validString(group2) && !Arrays.asList(Locale.getISOCountries()).contains(group2)) {
Log.Helper.LOGE(this, "Unknown region code " + group2 + " in language code " + replace + "; backend system will likely treat it as en-US.", new Object[0]);
}
return replace;
}
Log.Helper.LOGE(this, "Malformed language code " + replace + " cannot be validated; backend system will likely treat it as en-US.", new Object[0]);
return replace;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void setApplicationLanguageCode(String str) {
Log.Helper.LOGPUBLICFUNC(this);
setApplicationLanguageCode(str, false);
}
private void setApplicationLanguageCode(String str, boolean z) {
Log.Helper.LOGFUNC(this);
String validatedLanguageCode = validatedLanguageCode(str, z);
if (validatedLanguageCode == null) {
return;
}
String str2 = this.m_language;
if (str2 == null || !str2.equals(validatedLanguageCode)) {
this.m_language = validatedLanguageCode;
Log.Helper.LOGI(this, "Successfully set language to %s.", validatedLanguageCode);
Utility.sendBroadcast(Global.NOTIFICATION_LANGUAGE_CHANGE);
} else if (z) {
Log.Helper.LOGD(this, "Setting the same language %s, skipping assignment", this.m_language);
return;
}
if (z) {
return;
}
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent != null) {
Log.Helper.LOGD(this, "Saving language data to persistence.", new Object[0]);
persistenceForNimbleComponent.setValue(PERSISTENCE_LANGUAGE, this.m_language);
} else {
Log.Helper.LOGE(this, "Could not get application environment persistence object to save to.", new Object[0]);
}
}
private String getDeviceLanguage() {
Log.Helper.LOGFUNC(this);
return Locale.getDefault().toString();
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDocumentPath() {
String path;
Log.Helper.LOGPUBLICFUNC(this);
Context applicationContext = getApplicationContext();
if (applicationContext == null) {
path = System.getProperty("user.dir") + File.separator + "doc";
} else {
File filesDir = applicationContext.getFilesDir();
if (filesDir != null) {
path = filesDir.getPath();
} else {
Log.Helper.LOGE(this, "Could not build files path", new Object[0]);
return null;
}
}
StringBuilder sb = new StringBuilder();
sb.append(path);
String str = File.separator;
sb.append(str);
sb.append(Global.NIMBLE_ID);
sb.append(str);
sb.append(this.m_core.getConfiguration().toString());
return sb.toString();
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getCachePath() {
String path;
Log.Helper.LOGPUBLICFUNC(this);
Context applicationContext = getApplicationContext();
if (applicationContext == null) {
path = System.getProperty("user.dir") + File.separator + "cache";
} else {
File cacheDir = applicationContext.getCacheDir();
if (cacheDir != null) {
path = cacheDir.getPath();
} else {
Log.Helper.LOGE(this, "Could not build cache path", new Object[0]);
return null;
}
}
StringBuilder sb = new StringBuilder();
sb.append(path);
String str = File.separator;
sb.append(str);
sb.append(Global.NIMBLE_ID);
sb.append(str);
sb.append(this.m_core.getConfiguration().toString());
return sb.toString();
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getTempPath() {
Log.Helper.LOGPUBLICFUNC(this);
return getCachePath() + File.separator + x8.D;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getCarrier() {
Log.Helper.LOGPUBLICFUNC(this);
Context applicationContext = getApplicationContext();
if (applicationContext == null) {
return null;
}
TelephonyManager telephonyManager = (TelephonyManager) applicationContext.getSystemService("phone");
if (telephonyManager != null) {
return telephonyManager.getNetworkOperator();
}
Log.Helper.LOGE(this, "Could not retrieve telephony service", new Object[0]);
return null;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getApplicationBundleId() {
Context applicationContext;
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_packageId == null && (applicationContext = getApplicationContext()) != null) {
this.m_packageId = applicationContext.getPackageName();
if (NimbleApplicationConfiguration.configValueExists(OVERRIDE_BUNDLE_ID_KEY)) {
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(OVERRIDE_BUNDLE_ID_KEY);
if (!configValueAsString.isEmpty()) {
this.m_packageId = configValueAsString;
}
}
}
return this.m_packageId;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceString() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.MANUFACTURER + Build.MODEL;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceCodename() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.DEVICE;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceManufacturer() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.MANUFACTURER;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceModel() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.MODEL;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceBrand() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.BRAND;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getDeviceFingerprint() {
Log.Helper.LOGPUBLICFUNC(this);
return Build.FINGERPRINT;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getOsVersion() {
Log.Helper.LOGPUBLICFUNC(this);
return String.valueOf(Build.VERSION.SDK_INT);
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getApplicationName() {
PackageManager packageManager;
Log.Helper.LOGPUBLICFUNC(this);
Context applicationContext = getApplicationContext();
if (applicationContext == null || (packageManager = applicationContext.getPackageManager()) == null) {
return null;
}
return packageManager.getApplicationLabel(applicationContext.getApplicationInfo()).toString();
}
@Override // com.ea.nimble.IApplicationEnvironment
public boolean isAppCracked() {
Log.Helper.LOGPUBLICFUNC(this);
Log.Helper.LOGDS("FraudDetection", "Returning false for isAppCracked() since it hasn't been implemented yet", new Object[0]);
return false;
}
@Override // com.ea.nimble.IApplicationEnvironment
public boolean isDeviceRooted() {
Log.Helper.LOGPUBLICFUNC(this);
String str = Build.TAGS;
if ((str == null || !str.contains("test-keys")) && !new File(SUPERUSER_APK_LOCATION).exists()) {
return commandExists("su");
}
return true;
}
private static boolean commandExists(String str) {
Log.Helper.LOGFUNCS("BaseCore");
String str2 = System.getenv(AndroidStaticDeviceInfoDataSource.ENVIRONMENT_VARIABLE_PATH);
if (str2 == null) {
return false;
}
for (String str3 : str2.split(Pattern.quote(File.pathSeparator))) {
if (new File(str3, str).exists()) {
return true;
}
}
return false;
}
@Override // com.ea.nimble.IApplicationEnvironment
public int getAgeCompliance() {
Serializable serializable;
Log.Helper.LOGPUBLICFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
serializable = persistenceForNimbleComponent.getValue(PERSISTENCE_TIME_RETRIEVED);
} else {
Log.Helper.LOGE(this, "Could not get persistence object", new Object[0]);
serializable = null;
}
if (serializable != null) {
if (((int) (new Date().getTime() - ((Long) serializable).longValue())) / MILLIS_IN_AN_HOUR > 24) {
Log.Helper.LOGI(this, "getAgeCompliance- Stored value is older than 24 hours. Call refreshAgeCompliance to retrieve minAgeCompliance", null);
return -1;
}
return ((Integer) persistenceForNimbleComponent.getValue(PERSISTENCE_AGE_REQUIREMENTS)).intValue();
}
Log.Helper.LOGI(this, "getAgeCompliance- No stored value in persistance. Call refreshAgeCompliance to retrieve minAgeCompliance.", null);
return -1;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void refreshAgeCompliance() {
Log.Helper.LOGPUBLICFUNC(this);
if (Network.getComponent().getStatus() != Network.Status.OK) {
Log.Helper.LOGD(this, "Adding network observer for age compliance refresh", new Object[0]);
if (this.m_networkListener == null) {
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.1
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
Utility.unregisterReceiver(ApplicationEnvironmentImpl.this.m_networkListener);
ApplicationEnvironmentImpl.this.m_networkListener = null;
ApplicationEnvironmentImpl.this.refreshAgeCompliance();
}
};
this.m_networkListener = broadcastReceiver;
Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, broadcastReceiver);
return;
}
return;
}
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.2
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
synergyRequest.baseUrl = "geoip.url";
synergyRequest.send();
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.3
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
HashMap hashMap = new HashMap();
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
Map<String, Object> jsonData = synergyNetworkConnectionHandle.getResponse().getJsonData();
Integer num = (Integer) jsonData.get("code");
if (num != null && num.intValue() > 0) {
String str = (String) jsonData.get("message");
Log.Helper.LOGD(this, "LOG_CALLBACK_ERROR : %s", str);
hashMap.put("result", "0");
hashMap.put("error", new Exception(str));
} else {
int intValue = ((Integer) ((Map) jsonData.get("agerequirements")).get("minLegalRegAge")).intValue();
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
persistenceForNimbleComponent.setValue(ApplicationEnvironmentImpl.PERSISTENCE_TIME_RETRIEVED, Long.valueOf(new Date().getTime()));
persistenceForNimbleComponent.setValue(ApplicationEnvironmentImpl.PERSISTENCE_AGE_REQUIREMENTS, Integer.valueOf(intValue));
} else {
Log.Helper.LOGE(this, "Could not get persistence object", new Object[0]);
}
hashMap.put("result", "1");
}
} else {
Log.Helper.LOGD(this, "LOG_CALLBACK_ERROR : %s", synergyNetworkConnectionHandle.getResponse().getError().getMessage());
hashMap.put("result", "0");
hashMap.put("error", synergyNetworkConnectionHandle.getResponse().getError());
}
Utility.sendBroadcastSerializable(ApplicationEnvironment.NOTIFICATION_AGE_COMPLIANCE_REFRESHED, hashMap);
}
};
SynergyNetwork.getComponent().sendRequest(new SynergyRequest(SYNERGY_API_GET_AGE_REQUIREMENTS, IHttpRequest.Method.GET, synergyRequestPreparingCallback), synergyNetworkConnectionCallback);
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getCurrencyCode() {
Log.Helper.LOGPUBLICFUNC(this);
try {
Currency currency = Currency.getInstance(Locale.getDefault());
return currency != null ? currency.toString() : "";
} catch (IllegalArgumentException unused) {
return "";
}
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getAdvertisingId() {
Log.Helper.LOGFUNC(this);
return this.m_advertisingId;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getGoogleAdvertisingId() {
Log.Helper.LOGFUNC(this);
return getAdvertisingId();
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getAndroidId() {
Log.Helper.LOGFUNC(this);
return this.m_androidId;
}
@Override // com.ea.nimble.IApplicationEnvironment
public boolean isLimitAdTrackingEnabled() {
Log.Helper.LOGFUNC(this);
return this.m_limitAdTrackingEnabled;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void retrieveAdvertisingId(IApplicationEnvironment.AdvertisingIdCalback advertisingIdCalback) {
String str;
boolean z;
Log.Helper.LOGFUNC(this);
synchronized (this) {
str = this.m_advertisingId;
z = this.m_limitAdTrackingEnabled;
}
if (str == null) {
retrieveAdvertisingIdImpl(advertisingIdCalback);
} else if (advertisingIdCalback != null) {
advertisingIdCalback.onCallback(str, z);
}
}
private void retrieveAdvertisingIdImpl(IApplicationEnvironment.AdvertisingIdCalback advertisingIdCalback) {
Log.Helper.LOGFUNC(this);
try {
int i = GooglePlayServicesNotAvailableException.$r8$clinit;
synchronized (this) {
try {
List<IApplicationEnvironment.AdvertisingIdCalback> list = this.m_advertisingIdCallbacks;
if (list != null) {
if (advertisingIdCalback != null) {
list.add(advertisingIdCalback);
}
return;
}
ArrayList arrayList = new ArrayList();
this.m_advertisingIdCallbacks = arrayList;
if (advertisingIdCalback != null) {
arrayList.add(advertisingIdCalback);
}
try {
new Thread(new Runnable() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.4
@Override // java.lang.Runnable
public void run() {
List list2;
ApplicationEnvironmentImpl applicationEnvironmentImpl = ApplicationEnvironmentImpl.this;
Log.Helper.LOGV(applicationEnvironmentImpl, "Running thread to get Google Advertising ID", new Object[0]);
String str = ApplicationEnvironmentImpl.this.m_advertisingId;
boolean z = ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled;
try {
try {
try {
try {
if (ApplicationEnvironment.getCurrentActivity() != null) {
AdvertisingIdClient.Info advertisingIdInfo = (!ApplicationEnvironment.isMainApplicationRunning() || ApplicationEnvironment.getCurrentActivity() == null) ? null : AdvertisingIdClient.getAdvertisingIdInfo(ApplicationEnvironment.getCurrentActivity());
if (advertisingIdInfo != null) {
Log.Helper.LOGD(applicationEnvironmentImpl, "Setting values for Google Advertising ID and isLimitAdTrackingEnabled flag", new Object[0]);
str = advertisingIdInfo.getId();
z = advertisingIdInfo.isLimitAdTrackingEnabled();
} else {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - AdvertisingIdInfo is null", new Object[0]);
}
} else {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID because there is no current activity", new Object[0]);
}
synchronized (applicationEnvironmentImpl) {
try {
list2 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
} finally {
}
}
if (list2 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it = list2.iterator();
while (it.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it.next()).onCallback(str, z);
}
} catch (Throwable th) {
synchronized (applicationEnvironmentImpl) {
try {
List list3 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list3 != null) {
Iterator it2 = list3.iterator();
while (it2.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it2.next()).onCallback(str, z);
}
} else {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
}
throw th;
} finally {
}
}
}
} catch (IOException unused) {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Unrecoverable error connecting to Google Play Services", new Object[0]);
synchronized (applicationEnvironmentImpl) {
try {
List list4 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list4 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it3 = list4.iterator();
while (it3.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it3.next()).onCallback(str, z);
}
} finally {
}
}
}
} catch (IllegalStateException e) {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Illegal State Exception " + e.getMessage(), new Object[0]);
synchronized (applicationEnvironmentImpl) {
try {
List list5 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list5 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it4 = list5.iterator();
while (it4.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it4.next()).onCallback(str, z);
}
} finally {
}
}
} catch (Exception e2) {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - General Exception " + e2.getMessage(), new Object[0]);
synchronized (applicationEnvironmentImpl) {
try {
List list6 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list6 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it5 = list6.iterator();
while (it5.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it5.next()).onCallback(str, z);
}
} finally {
}
}
}
} catch (GooglePlayServicesNotAvailableException unused2) {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Google Play Services not available on this device", new Object[0]);
synchronized (applicationEnvironmentImpl) {
try {
List list7 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list7 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it6 = list7.iterator();
while (it6.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it6.next()).onCallback(str, z);
}
} finally {
}
}
} catch (GooglePlayServicesRepairableException unused3) {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Recoverable error connecting to Google Play Services", new Object[0]);
synchronized (applicationEnvironmentImpl) {
try {
List list8 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
if (Utility.validString(str) && str != "00000000-0000-0000-0000-000000000000") {
ApplicationEnvironmentImpl.this.m_advertisingId = str;
}
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put("gaid", Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? "true" : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
if (list8 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
return;
}
Iterator it7 = list8.iterator();
while (it7.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it7.next()).onCallback(str, z);
}
} finally {
}
}
}
}
}).start();
} catch (Throwable unused) {
Log.Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported", new Object[0]);
synchronized (this) {
this.m_advertisingId = "";
boolean z = this.m_limitAdTrackingEnabled;
List<IApplicationEnvironment.AdvertisingIdCalback> list2 = this.m_advertisingIdCallbacks;
this.m_advertisingIdCallbacks = null;
if (list2 == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after trying to refresh advertising ID, something is wrong", new Object[0]);
return;
}
Iterator<IApplicationEnvironment.AdvertisingIdCalback> it = list2.iterator();
while (it.hasNext()) {
it.next().onCallback("", z);
}
}
}
} catch (Throwable th) {
throw th;
}
}
} catch (ClassNotFoundException unused2) {
Log.Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not using google play services", new Object[0]);
this.m_advertisingId = "";
if (advertisingIdCalback != null) {
advertisingIdCalback.onCallback("", this.m_limitAdTrackingEnabled);
}
}
}
@Override // com.ea.nimble.IApplicationEnvironment
public Map<String, String> getPlayerIdMap() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_playerIdMap;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void setPlayerId(String str, String str2) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGW(this, "setPlayerId: Empty/Null key", new Object[0]);
return;
}
String safeString = Utility.safeString(this.m_playerIdMap.get(str));
String safeString2 = Utility.safeString(str2);
if (!safeString.equals(safeString2)) {
if (Utility.validString(safeString2)) {
this.m_playerIdMap.put(str, safeString2);
Log.Helper.LOGV(this, "setPlayerId: [" + str + " = " + str2 + "] success.", new Object[0]);
} else {
Log.Helper.LOGV(this, "setPlayerId: Empty value. Removed entry for key " + str, new Object[0]);
this.m_playerIdMap.remove(str);
}
Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_PLAYERIDMAP_CHANGE);
return;
}
Log.Helper.LOGV(this, "setPlayerId: [" + str + " = " + str2 + "] skipped. Same key/value exists or the new value is empty!", new Object[0]);
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getGameSpecifiedPlayerId() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, String> map = this.m_playerIdMap;
if (map != null) {
return map.get(KEY_GAME_PLAYER_ID);
}
return null;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void setGameSpecifiedPlayerId(String str) {
Log.Helper.LOGPUBLICFUNC(this);
setPlayerId(KEY_GAME_PLAYER_ID, str);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent == null) {
Log.Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't save Game Specified Player ID to Persistence", new Object[0]);
} else {
persistenceForNimbleComponent.setValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID, str);
}
}
@Override // com.ea.nimble.IApplicationEnvironment
public boolean getIadAttribution() {
Log.Helper.LOGPUBLICFUNC(this);
return false;
}
@Override // com.ea.nimble.IApplicationEnvironment
public String getParameter(String str) {
String str2;
Log.Helper.LOGPUBLICFUNC(this);
synchronized (this) {
str2 = this.m_parameters.get(str);
}
return str2;
}
@Override // com.ea.nimble.IApplicationEnvironment
public void requestIntegrityToken(String str, final IApplicationEnvironment.IntegrityTokenCallback integrityTokenCallback) {
Log.Helper.LOGPUBLICFUNC(this);
try {
IntegrityManagerFactory.create(getApplicationContext()).requestIntegrityToken(IntegrityTokenRequest.builder().setNonce(Base64.encodeToString(str.getBytes(), 10)).build()).addOnSuccessListener(new OnSuccessListener<IntegrityTokenResponse>() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.7
@Override // com.google.android.gms.tasks.OnSuccessListener
public void onSuccess(IntegrityTokenResponse integrityTokenResponse) {
Log.Helper.LOGV(this, "IntegrityTokenRequest is successful", new Object[0]);
integrityTokenCallback.onCallback(integrityTokenResponse.token(), null);
}
}).addOnFailureListener(new OnFailureListener() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.6
@Override // com.google.android.gms.tasks.OnFailureListener
public void onFailure(@NonNull Exception exc) {
Log.Helper.LOGE(this, "IntegrityTokenRequest failed with exception:\n " + exc.getMessage(), new Object[0]);
integrityTokenCallback.onCallback(null, new Error(Error.Code.UNKNOWN, String.format("requestIntegrityToken Request failed\nCause:%s", exc.getMessage()), exc));
}
}).addOnCanceledListener(new OnCanceledListener() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.5
@Override // com.google.android.gms.tasks.OnCanceledListener
public void onCanceled() {
Log.Helper.LOGE(this, "IntegrityTokenRequest canceled by the service", new Object[0]);
integrityTokenCallback.onCallback(null, new Error(Error.Code.UNKNOWN, "IntegrityTokenRequest canceled by the service"));
}
});
} catch (Exception e) {
Log.Helper.LOGW(this, "requestIntegrityToken() resulted in exception\nCause:%s", e.getMessage());
integrityTokenCallback.onCallback(null, new Error(Error.Code.NOT_AVAILABLE, String.format("requestIntegrityToken() resulted in exception\nCause:%s", e.getMessage()), e));
}
}
/* JADX INFO: Access modifiers changed from: private */
public void requestAttributionData() {
Log.Helper.LOGFUNC(this);
String stringValue = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).getStringValue("attributionData");
if (stringValue != null) {
Log.Helper.LOGD(this, "requestAttributionData(): Google Play Referrer data found in persistance.\nData = " + stringValue, new Object[0]);
this.m_parameters.put("attributionData", stringValue);
return;
}
if (Network.getComponent().getStatus() != Network.Status.OK) {
Log.Helper.LOGV(this, "requestAttributionData(): NetworkStatus is NOT OK. We'll retry later.", new Object[0]);
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.8
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if (Network.getComponent().getStatus() == Network.Status.OK) {
Utility.unregisterReceiver(ApplicationEnvironmentImpl.this.m_attributionDataNetworkListener);
ApplicationEnvironmentImpl.this.m_attributionDataNetworkListener = null;
ApplicationEnvironmentImpl.this.requestAttributionData();
}
}
};
this.m_attributionDataNetworkListener = broadcastReceiver;
Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, broadcastReceiver);
return;
}
try {
InstallReferrerClient build = InstallReferrerClient.newBuilder(this.m_context).build();
this.m_referrerClient = build;
build.startConnection(new InstallReferrerStateListener() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.9
/* JADX WARN: Unreachable blocks removed: 2, instructions: 3 */
/* JADX WARN: Unreachable blocks removed: 2, instructions: 4 */
@Override // com.android.installreferrer.api.InstallReferrerStateListener
public void onInstallReferrerSetupFinished(int i) {
String str;
String str2;
String str3;
long j = 0;
String str4 = "";
long j2 = 0;
if (i == -1) {
str = "SERVICE_DISCONNECTED";
} else {
if (i == 0) {
try {
try {
ReferrerDetails installReferrer = ApplicationEnvironmentImpl.this.m_referrerClient.getInstallReferrer();
str4 = installReferrer.getInstallReferrer();
j2 = installReferrer.getInstallBeginTimestampSeconds();
j = installReferrer.getReferrerClickTimestampSeconds();
str2 = "ok";
str3 = str4;
long j3 = j2;
long j4 = j;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str2, str3, j3, j4);
} catch (Exception e) {
Log.Helper.LOGW(this, "requestAttributionData(): Failed with exception.\n" + e.toString(), new Object[0]);
String obj = e.toString();
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(obj, str4, j2, 0L);
return;
}
} catch (Throwable th) {
String str5 = str4;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData("ok", str5, j2, 0L);
throw th;
}
}
if (i == 1) {
str = "SERVICE_UNAVAILABLE";
} else if (i == 2) {
str = "FEATURE_NOT_SUPPORTED";
} else {
if (i != 3) {
str2 = "";
str3 = str2;
long j32 = j2;
long j42 = j;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str2, str3, j32, j42);
}
str = "DEVELOPER_ERROR";
}
}
str2 = str;
str3 = str4;
long j322 = j2;
long j422 = j;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str2, str3, j322, j422);
}
@Override // com.android.installreferrer.api.InstallReferrerStateListener
public void onInstallReferrerServiceDisconnected() {
Log.Helper.LOGV(this, "requestAttributionData(): Google Play Install Referrer client disconnected.", new Object[0]);
}
});
} catch (Exception e) {
Log.Helper.LOGW(this, "requestAttributionData(): Failed to start Install Referrer connection.\n", e.toString());
setAttributionData(e.getMessage(), "", 0L, 0L);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void setAttributionData(String str, String str2, long j, long j2) {
String jSONObject;
JSONObject jSONObject2 = new JSONObject();
try {
try {
jSONObject2.put("status", Utility.safeString(str));
jSONObject2.put("referrer", Utility.safeString(str2));
jSONObject2.put("install_begin_time", j);
jSONObject2.put("referrer_click_time", j2);
jSONObject = jSONObject2.toString();
Log.Helper.LOGD(this, "setAttributionData(): Attribution Data = " + jSONObject, new Object[0]);
} catch (Exception e) {
Log.Helper.LOGE(this, "setAttributionData(): Failed with exception. " + e.toString(), new Object[0]);
jSONObject = jSONObject2.toString();
Log.Helper.LOGD(this, "setAttributionData(): Attribution Data = " + jSONObject, new Object[0]);
}
this.m_parameters.put("attributionData", jSONObject);
PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).setValue("attributionData", jSONObject);
Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE);
} catch (Throwable th) {
String jSONObject3 = jSONObject2.toString();
Log.Helper.LOGD(this, "setAttributionData(): Attribution Data = " + jSONObject3, new Object[0]);
this.m_parameters.put("attributionData", jSONObject3);
PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).setValue("attributionData", jSONObject3);
Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE);
throw th;
}
}
}