Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package com.ea.eadp.deviceid;
/* loaded from: classes2.dex */
public interface DeviceIdService {
String getDeviceId();
}

View File

@@ -0,0 +1,38 @@
package com.ea.eadp.http.models;
import java.net.URL;
/* loaded from: classes2.dex */
public interface HttpRequest {
HttpResponse delete();
void deleteAsync(HttpRequestListener httpRequestListener);
HttpResponse get();
void getAsync(HttpRequestListener httpRequestListener);
URL getResource();
String getValueForHeader(String str);
HttpResponse post();
void postAsync(HttpRequestListener httpRequestListener);
HttpResponse put();
void putAsync(HttpRequestListener httpRequestListener);
HttpRequest setBody(String str);
HttpRequest setBody(String str, String str2);
HttpRequest setHeader(String str, String str2);
HttpRequest setJsonBody(String str);
HttpRequest setJsonBody(String str, String str2);
HttpRequest setResource(URL url);
}

View File

@@ -0,0 +1,6 @@
package com.ea.eadp.http.models;
/* loaded from: classes2.dex */
public interface HttpRequestListener {
void onComplete(HttpResponse httpResponse);
}

View File

@@ -0,0 +1,26 @@
package com.ea.eadp.http.models;
import java.util.Map;
/* loaded from: classes2.dex */
public interface HttpResponse {
String getBody();
int getCode();
Map<String, String> getHeaders();
String getMessage();
String getUrl();
void setBody(String str);
void setCode(int i);
void setHeaders(Map<String, String> map);
void setMessage(String str);
void setUrl(String str);
}

View File

@@ -0,0 +1,9 @@
package com.ea.eadp.http.services;
import com.ea.eadp.http.models.HttpRequest;
import java.io.IOException;
/* loaded from: classes2.dex */
public interface HttpService {
HttpRequest getResource(String str) throws IOException;
}

View File

@@ -0,0 +1,30 @@
package com.ea.eadp.pushnotification.forwarding;
import android.content.ComponentName;
import android.content.Intent;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.pushtng.PushNotification;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
/* loaded from: classes2.dex */
public class FCMMessageReceiver extends FirebaseMessagingService {
@Override // com.google.firebase.messaging.FirebaseMessagingService
public final void onMessageReceived(RemoteMessage remoteMessage) {
ComponentName componentName = new ComponentName(getApplicationContext().getPackageName(), getIntentServiceName());
Intent intent = remoteMessage.toIntent();
intent.setComponent(componentName);
FCMMessageService.enqueueWork(getApplicationContext(), getIntentServiceName(), intent);
}
@Override // com.google.firebase.messaging.FirebaseMessagingService
public final void onNewToken(String str) {
if (ApplicationEnvironment.isMainApplicationActive()) {
PushNotification.getComponent().updateToken(str);
}
}
public String getIntentServiceName() {
return FCMMessageService.class.getName();
}
}

View File

@@ -0,0 +1,5 @@
package com.ea.eadp.pushnotification.forwarding;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class FCMMessageService$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package com.ea.eadp.pushnotification.forwarding;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class FCMMessageService$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,248 @@
package com.ea.eadp.pushnotification.forwarding;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import androidx.core.app.NotificationCompat;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
import com.ea.eadp.pushnotification.services.IPushService;
import com.ea.nimble.Global;
import com.ea.nimble.Log;
import com.ea.nimble.Utility;
import com.facebook.internal.NativeProtocol;
import java.util.List;
/* loaded from: classes2.dex */
public class FCMMessageService extends JobIntentService {
protected static final int JOB_ID = 5566;
private static final String LOG_TAG = "FCMMessageService";
private IPushService pushManager;
public interface EnsEventFlags {
public static final int ALL_DISABLED = 0;
public static final int ALL_ENABLED = 3;
public static final int CLICK_ENABLED = 1;
public static final int RECEIVED_ENABLED = 2;
}
public interface PushIntentExtraKeys {
public static final String ALERT = "alert";
public static final String COLLAPSE_KEY = "collapse_key";
public static final String DEEP_LINK_URL = "deepLinkUrl";
public static final String ENS_EVENTS = "ensEvents";
public static final String PN_TYPE = "pnType";
public static final String PUSH_ID = "pushId";
}
public boolean displayNotification(Bundle bundle) {
return true;
}
public HttpService getHttpService() {
return null;
}
public static void enqueueWork(Context context, String str, Intent intent) {
try {
JobIntentService.enqueueWork(context, Class.forName(str), JOB_ID, intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
@Override // androidx.core.app.JobIntentService
public void onHandleWork(@NonNull Intent intent) {
if (intent.getExtras() == null) {
Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
} else {
onHandleMessage(intent);
}
}
/* JADX WARN: Removed duplicated region for block: B:14:0x0051 */
/* JADX WARN: Removed duplicated region for block: B:27:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onHandleMessage(android.content.Intent r5) {
/*
r4 = this;
android.os.Bundle r5 = r5.getExtras()
r0 = 0
if (r5 != 0) goto Lf
java.lang.String r5 = "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle."
java.lang.Object[] r0 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGE(r4, r5, r0)
return
Lf:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
java.lang.String r2 = "Message received: "
r1.append(r2)
r1.append(r5)
java.lang.String r1 = r1.toString()
java.lang.Object[] r2 = new java.lang.Object[r0]
java.lang.String r3 = "FCMMessageService"
com.ea.nimble.Log.Helper.LOGIS(r3, r1, r2)
boolean r1 = r4.displayNotification(r5)
if (r1 == 0) goto L34
android.content.Context r1 = r4.getApplicationContext()
r4.postNotification(r1, r5)
L34:
java.lang.String r1 = "ensEvents"
java.lang.String r1 = r5.getString(r1)
if (r1 == 0) goto L48
int r0 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L41
goto L49
L41:
java.lang.String r1 = "ensEvents flag found but not parseable as integer"
java.lang.Object[] r0 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGWS(r3, r1, r0)
L48:
r0 = 3
L49:
java.lang.String r1 = "pushId"
boolean r2 = r5.containsKey(r1)
if (r2 == 0) goto L8e
r2 = 2
if (r0 >= r2) goto L56
if (r0 >= 0) goto L8e
L56:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
if (r0 != 0) goto L69
com.ea.eadp.pushnotification.services.AndroidPushService r0 = new com.ea.eadp.pushnotification.services.AndroidPushService
android.content.Context r2 = r4.getApplicationContext()
com.ea.eadp.http.services.HttpService r3 = r4.getHttpService()
r0.<init>(r2, r3)
r4.pushManager = r0
L69:
boolean r0 = com.ea.nimble.ApplicationEnvironment.isMainApplicationRunning()
java.lang.String r2 = "NOTIFICATION_RECEIVED"
java.lang.String r3 = "pnType"
if (r0 == 0) goto L81
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r5.getString(r1)
java.lang.String r5 = r5.getString(r3)
r0.sendTrackingEvent(r1, r5, r2)
goto L8e
L81:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r5.getString(r1)
java.lang.String r5 = r5.getString(r3)
r0.persistTrackingEvent(r1, r5, r2)
L8e:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.eadp.pushnotification.forwarding.FCMMessageService.onHandleMessage(android.content.Intent):void");
}
@SuppressLint({"InlinedApi"})
private void postNotification(Context context, Bundle bundle) {
Intent intent = new Intent();
intent.addFlags(32);
intent.putExtras(bundle);
intent.setPackage(context.getPackageName());
ComponentName broadcastForwarderComponent = getBroadcastForwarderComponent();
if (isInForeground()) {
if (broadcastForwarderComponent != null) {
intent.setComponent(broadcastForwarderComponent);
sendBroadcast(intent);
return;
} else {
Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not sending broadcast", new Object[0]);
return;
}
}
String string = bundle.getString(PushIntentExtraKeys.PUSH_ID);
int hashCode = string != null ? string.hashCode() : 0;
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, (applicationInfo == null || !applicationInfo.metaData.containsKey(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) ? Global.NOTIFICATION_CHANNEL_DEFAULT_ID : applicationInfo.metaData.getString(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY));
if (broadcastForwarderComponent != null) {
String string2 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
if (string2 != null && !string2.equalsIgnoreCase("do_not_collapse")) {
intent.putExtra(PushIntentExtraKeys.COLLAPSE_KEY, string2);
}
intent.setComponent(broadcastForwarderComponent);
customizeNotification(builder, bundle);
intent.putExtra("notification", builder.build());
PendingIntent broadcast = PendingIntent.getBroadcast(context, hashCode, intent, 201326592);
if (broadcast != null) {
builder.setContentIntent(broadcast);
try {
broadcast.send();
return;
} catch (PendingIntent.CanceledException e) {
Log.Helper.LOGE(LOG_TAG, "[CanceledException] Could not launch PendingIntent for PN " + e, new Object[0]);
return;
}
}
Log.Helper.LOGE(LOG_TAG, "Unable to query PendingIntent", new Object[0]);
return;
}
Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not setting ContentIntent", new Object[0]);
customizeNotification(builder, bundle);
NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
if (notificationManager != null) {
String string3 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
if (string3 != null && !string3.equalsIgnoreCase("do_not_collapse")) {
notificationManager.notify(string3, 0, builder.build());
return;
} else {
notificationManager.notify(hashCode, builder.build());
return;
}
}
Log.Helper.LOGE(this, "Notification Manager is not available or is inaccessible. Skipping Notification formatting.", new Object[0]);
}
public boolean isInForeground() {
return PushLifecycleCallbacks.inForeground;
}
public void customizeNotification(NotificationCompat.Builder builder, Bundle bundle) {
String string = bundle.getString(PushIntentExtraKeys.ALERT);
Resources resources = getApplicationContext().getResources();
String packageName = getApplicationContext().getPackageName();
String string2 = getApplicationContext().getResources().getString(resources.getIdentifier(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, "string", packageName));
try {
builder.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
} catch (Exception e) {
Log.Helper.LOGE(LOG_TAG, "PN NOT DISPLAYED: Unable to set application icon due to exception: " + e, new Object[0]);
}
builder.setContentTitle(string2).setStyle(new NotificationCompat.BigTextStyle().bigText(string)).setContentText(string).setAutoCancel(true).setDefaults(getApplicationContext().checkCallingOrSelfPermission("android.permission.VIBRATE") == 0 ? 7 : 5);
}
public ComponentName getBroadcastForwarderComponent() {
List<ResolveInfo> queryBroadcastReceivers;
PackageManager.ResolveInfoFlags of;
Log.Helper.LOGFUNC(this);
PackageManager packageManager = getApplicationContext().getPackageManager();
Intent intent = new Intent("com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST");
intent.setPackage(getApplicationContext().getPackageName());
if (Build.VERSION.SDK_INT >= 33) {
of = PackageManager.ResolveInfoFlags.of(0L);
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, of);
} else {
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
}
if (queryBroadcastReceivers.isEmpty()) {
return null;
}
ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
return new ComponentName(activityInfo.packageName, activityInfo.name);
}
}

View File

@@ -0,0 +1,5 @@
package com.ea.eadp.pushnotification.forwarding;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class PushBroadcastForwarder$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,161 @@
package com.ea.eadp.pushnotification.forwarding;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
import com.ea.eadp.pushnotification.services.IPushService;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class PushBroadcastForwarder extends BroadcastReceiver {
private static final String LOG_TAG = "PushBroadcastForwarder";
private IPushService pushManager;
public HttpService getHttpService() {
return null;
}
/* JADX WARN: Removed duplicated region for block: B:17:0x003a */
/* JADX WARN: Removed duplicated region for block: B:20:0x0053 */
/* JADX WARN: Removed duplicated region for block: B:21:0x0061 */
@Override // android.content.BroadcastReceiver
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void onReceive(android.content.Context r5, android.content.Intent r6) {
/*
r4 = this;
android.os.Bundle r6 = r6.getExtras()
r0 = 0
if (r6 != 0) goto Lf
java.lang.String r5 = "Unable to get extras from Intent"
java.lang.Object[] r6 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGE(r4, r5, r6)
return
Lf:
java.lang.String r1 = "ensEvents"
java.lang.String r1 = r6.getString(r1)
r2 = 3
if (r1 == 0) goto L26
int r0 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L1d
goto L27
L1d:
java.lang.String r1 = "ensEvents flag found but not parseable as integer"
java.lang.Object[] r0 = new java.lang.Object[r0]
java.lang.String r3 = "PushBroadcastForwarder"
com.ea.nimble.Log.Helper.LOGWS(r3, r1, r0)
L26:
r0 = r2
L27:
java.lang.String r1 = "pushId"
boolean r3 = r6.containsKey(r1)
if (r3 == 0) goto L6e
if (r0 >= r2) goto L36
r2 = 1
if (r0 == r2) goto L36
if (r0 >= 0) goto L6e
L36:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
if (r0 != 0) goto L49
com.ea.eadp.pushnotification.services.AndroidPushService r0 = new com.ea.eadp.pushnotification.services.AndroidPushService
android.content.Context r2 = r5.getApplicationContext()
com.ea.eadp.http.services.HttpService r3 = r4.getHttpService()
r0.<init>(r2, r3)
r4.pushManager = r0
L49:
boolean r0 = com.ea.nimble.ApplicationEnvironment.isMainApplicationRunning()
java.lang.String r2 = "NOTIFICATION_OPENED"
java.lang.String r3 = "pnType"
if (r0 == 0) goto L61
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r6.getString(r1)
java.lang.String r3 = r6.getString(r3)
r0.sendTrackingEvent(r1, r3, r2)
goto L6e
L61:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r6.getString(r1)
java.lang.String r3 = r6.getString(r3)
r0.persistTrackingEvent(r1, r3, r2)
L6e:
r4.handleNewPushNotification(r5, r6)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder.onReceive(android.content.Context, android.content.Intent):void");
}
public void handleNewPushNotification(Context context, Bundle bundle) {
Intent intent;
Notification notification;
Object parcelable;
String string = bundle.getString("deepLinkUrl");
if (string != null) {
intent = new Intent("android.intent.action.VIEW", Uri.parse(string));
Log.Helper.LOGIS(LOG_TAG, "Push notification clicked with URL: " + string, new Object[0]);
} else {
String pushTargetActivity = getPushTargetActivity(context);
Log.Helper.LOGIS(LOG_TAG, "Push notification clicked with target activity: " + pushTargetActivity, new Object[0]);
try {
intent = new Intent(context, Class.forName(pushTargetActivity));
} catch (ClassNotFoundException e) {
Log.Helper.LOGES(LOG_TAG, String.format("Could not launch target activity: %s, exception: %s", pushTargetActivity, e), new Object[0]);
return;
}
}
intent.putExtras(bundle);
intent.setFlags(603979776);
if (Build.VERSION.SDK_INT >= 33) {
parcelable = bundle.getParcelable("notification", Notification.class);
notification = (Notification) parcelable;
} else {
notification = (Notification) bundle.getParcelable("notification");
}
String string2 = bundle.getString(FCMMessageService.PushIntentExtraKeys.PUSH_ID);
int hashCode = string2 != null ? string2.hashCode() : 0;
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1140850688);
if (notification == null) {
Log.Helper.LOGE(this, "Unable to create Push Notification", new Object[0]);
return;
}
if (activity != null) {
notification.contentIntent = activity;
NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
if (notificationManager != null) {
String string3 = bundle.getString(FCMMessageService.PushIntentExtraKeys.COLLAPSE_KEY);
if (string3 != null && !string3.equalsIgnoreCase("do_not_collapse")) {
notificationManager.notify(string3, 0, notification);
return;
} else {
notificationManager.notify(hashCode, notification);
return;
}
}
Log.Helper.LOGE(this, "Notification Manager is not available or is inaccessible. Skipping Notification formatting.", new Object[0]);
return;
}
Log.Helper.LOGE(this, "Unable to create PendingIntent", new Object[0]);
}
public String getPushTargetActivity(Context context) {
Intent launchIntentForPackage;
ComponentName resolveActivity;
Context applicationContext = context.getApplicationContext();
PackageManager packageManager = applicationContext.getPackageManager();
if (packageManager != null && (launchIntentForPackage = packageManager.getLaunchIntentForPackage(applicationContext.getPackageName())) != null && (resolveActivity = launchIntentForPackage.resolveActivity(applicationContext.getPackageManager())) != null) {
return resolveActivity.getClassName();
}
Log.Helper.LOGE(this, "PackageManager service is unable or is inaccessible. Unable to get PushTargetActivity.", new Object[0]);
return "";
}
}

View File

@@ -0,0 +1,44 @@
package com.ea.eadp.pushnotification.lifecycles;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
/* loaded from: classes2.dex */
public class PushLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
public static boolean inForeground = false;
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
inForeground = false;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
inForeground = false;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
inForeground = false;
}
}

View File

@@ -0,0 +1,12 @@
package com.ea.eadp.pushnotification.listeners;
/* loaded from: classes2.dex */
public interface IPushListener {
void onConnectionError(int i, String str);
void onGetInAppSuccess(int i, String str);
void onRegistrationSuccess(int i, String str);
void onTrackingSuccess(int i, String str);
}

View File

@@ -0,0 +1,162 @@
package com.ea.eadp.pushnotification.models;
import android.os.Build;
import java.util.Locale;
import java.util.TimeZone;
/* loaded from: classes2.dex */
public class PushNotificationConfig {
private String appId;
private String appVersion;
private String country;
private String dateOfBirth;
private String deviceIdentifier;
private boolean disabled;
private String disabledReason;
private String registrationIdentifier;
private Integer silentIntervalEnd;
private Integer silentIntervalStart;
private String userAlias;
private String manufacturer = Build.MANUFACTURER;
private String operatingSystem = Build.VERSION.RELEASE;
private String model = Build.MODEL;
private String deviceType = "android";
private String locale = Locale.getDefault().toString();
private TimeZone timezone = TimeZone.getDefault();
public String getAppId() {
return this.appId;
}
public String getAppVersion() {
return this.appVersion;
}
public String getCountry() {
return this.country;
}
public String getDateOfBirth() {
return this.dateOfBirth;
}
public String getDeviceIdentifier() {
return this.deviceIdentifier;
}
public String getDeviceType() {
return this.deviceType;
}
public String getDisabledReason() {
return this.disabledReason;
}
public String getLocale() {
return this.locale;
}
public String getManufacturer() {
return this.manufacturer;
}
public String getModel() {
return this.model;
}
public String getOperatingSystem() {
return this.operatingSystem;
}
public String getRegistrationIdentifier() {
return this.registrationIdentifier;
}
public Integer getSilentIntervalEnd() {
return this.silentIntervalEnd;
}
public Integer getSilentIntervalStart() {
return this.silentIntervalStart;
}
public TimeZone getTimezone() {
return this.timezone;
}
public String getUserAlias() {
return this.userAlias;
}
public boolean isDisabled() {
return this.disabled;
}
public void setAppId(String str) {
this.appId = str;
}
public void setAppVersion(String str) {
this.appVersion = str;
}
public void setCountry(String str) {
this.country = str;
}
public void setDateOfBirth(String str) {
this.dateOfBirth = str;
}
public void setDeviceIdentifier(String str) {
this.deviceIdentifier = str;
}
public void setDeviceType(String str) {
this.deviceType = str;
}
public void setDisabled(boolean z) {
this.disabled = z;
}
public void setDisabledReason(String str) {
this.disabledReason = str;
}
public void setLocale(String str) {
this.locale = str;
}
public void setManufacturer(String str) {
this.manufacturer = str;
}
public void setModel(String str) {
this.model = str;
}
public void setOperatingSystem(String str) {
this.operatingSystem = str;
}
public void setRegistrationIdentifier(String str) {
this.registrationIdentifier = str;
}
public void setSilentIntervalEnd(Integer num) {
this.silentIntervalEnd = num;
}
public void setSilentIntervalStart(Integer num) {
this.silentIntervalStart = num;
}
public void setTimezone(TimeZone timeZone) {
this.timezone = timeZone;
}
public void setUserAlias(String str) {
this.userAlias = str;
}
}

View File

@@ -0,0 +1,451 @@
package com.ea.eadp.pushnotification.services;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Base64;
import androidx.annotation.NonNull;
import com.ea.eadp.deviceid.DeviceIdService;
import com.ea.eadp.http.models.HttpRequest;
import com.ea.eadp.http.models.HttpRequestListener;
import com.ea.eadp.http.models.HttpResponse;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
import com.ea.eadp.pushnotification.listeners.IPushListener;
import com.ea.eadp.pushnotification.models.PushNotificationConfig;
import com.ea.nimble.Log;
import com.ea.nimble.pushtng.PushNotification;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.Timer;
import java.util.TimerTask;
/* loaded from: classes2.dex */
public final class AndroidPushService implements IPushService {
private static final String API_KEY_KEY = "apiKey";
private static final String API_SECRET_KEY = "apiSecret";
public static final String AUTHORIZATION = "Authorization";
private static final String DEVICE_ID_KEY = "deviceId";
private static final String EVENT_LIST_KEY = "eventListKey";
private static final String GAME_ID_KEY = "gameId";
private static final String LOG_TAG = "PushManager";
private static final String PUSH_SERVER_URL_KEY = "pushNotificationServerUrl";
private static final String SHARED_PREFS_FILENAME = "PushManagerConfigurationData";
private static final String TRACKING_PREFS_FILENAME = "PushManagerTrackingData";
private static final String TRACKING_STATE_KEY = "state";
private final String apiKey;
private final String apiSecret;
private String appId;
private final Context context;
private PushNotificationConfig currentConfig;
private DeviceIdService deviceIdService;
private final String gameId;
private final HttpService httpService;
private long inAppNotificationInterval;
private Timer inAppTimer;
private IPushListener pushListener;
private final String pushNotificationServerUrl;
private String startClientToken;
private PushNotificationConfig startConfig;
@Override // com.ea.eadp.pushnotification.services.IPushService
public IPushListener getPushListener() {
return this.pushListener;
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void setPushListener(IPushListener iPushListener) {
this.pushListener = iPushListener;
}
public AndroidPushService(HttpService httpService, DeviceIdService deviceIdService, Context context, IPushListener iPushListener, String str, String str2, String str3, String str4, String str5, int i) {
Log.Helper.LOGIS(LOG_TAG, "Instantiating new push mgr", new Object[0]);
this.httpService = httpService;
this.deviceIdService = deviceIdService;
this.context = context;
this.pushListener = iPushListener;
this.pushNotificationServerUrl = str;
this.gameId = str2;
this.appId = str3;
this.apiKey = str4;
this.apiSecret = str5;
this.inAppNotificationInterval = i * 1000;
}
public AndroidPushService(Context context, HttpService httpService) {
this.context = context;
this.httpService = httpService;
this.pushNotificationServerUrl = loadConfigData(PUSH_SERVER_URL_KEY);
this.gameId = loadConfigData("gameId");
this.apiKey = loadConfigData(API_KEY_KEY);
this.apiSecret = loadConfigData(API_SECRET_KEY);
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void startWithConfig(final PushNotificationConfig pushNotificationConfig, final String str) {
Log.Helper.LOGPUBLICFUNC(this);
if (pushNotificationConfig == null) {
Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
IPushListener iPushListener = this.pushListener;
if (iPushListener != null) {
iPushListener.onConnectionError(0, "Config data is null");
return;
}
return;
}
if (this.inAppNotificationInterval > 0) {
Timer timer = new Timer();
this.inAppTimer = timer;
TimerTask timerTask = new TimerTask() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.1
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
AndroidPushService.this.getInAppNotifications(pushNotificationConfig.getUserAlias(), str);
}
};
long j = this.inAppNotificationInterval;
timer.schedule(timerTask, j, j);
}
if (pushNotificationConfig.isDisabled()) {
registerDevice(pushNotificationConfig);
} else {
new Thread(new Runnable() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.2
@Override // java.lang.Runnable
public void run() {
if (AndroidPushService.this.checkPlayServices()) {
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Attempt to register device with FCM", new Object[0]);
try {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.2.1
@Override // com.google.android.gms.tasks.OnCompleteListener
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to get firebase instance id: %s", task.getException().getLocalizedMessage());
pushNotificationConfig.setDisabled(true);
pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
} else {
String result = task.getResult();
pushNotificationConfig.setRegistrationIdentifier(result);
pushNotificationConfig.setDisabled(false);
pushNotificationConfig.setDisabledReason(null);
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registered on FCM. Registration id: %s", result), new Object[0]);
try {
((Application) AndroidPushService.this.context.getApplicationContext()).registerActivityLifecycleCallbacks(new PushLifecycleCallbacks());
} catch (Exception e) {
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to register activity lifecycle callbacks: %s", e.getLocalizedMessage());
}
}
AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
AndroidPushService.this.registerDevice(pushNotificationConfig);
}
});
return;
} catch (Exception e) {
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to get registration ID from FCM: %s", e.getLocalizedMessage());
pushNotificationConfig.setDisabled(true);
pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
AndroidPushService.this.registerDevice(pushNotificationConfig);
return;
}
}
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to find appropriate Google Play Service SDK on device.", new Object[0]);
pushNotificationConfig.setDisabled(true);
pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
AndroidPushService.this.registerDevice(pushNotificationConfig);
}
}, "startWithConfig thread").start();
}
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void updateToken(String str) {
PushNotificationConfig pushNotificationConfig = this.currentConfig;
if (pushNotificationConfig != null) {
pushNotificationConfig.setRegistrationIdentifier(str);
registerDevice(this.currentConfig);
}
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void registerDevice(final PushNotificationConfig pushNotificationConfig) {
this.currentConfig = pushNotificationConfig;
if (pushNotificationConfig == null) {
Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
IPushListener iPushListener = this.pushListener;
if (iPushListener != null) {
iPushListener.onConnectionError(0, "Config data is null");
return;
}
return;
}
if (pushNotificationConfig.getDeviceIdentifier() == null) {
pushNotificationConfig.setDeviceIdentifier(this.deviceIdService.getDeviceId());
}
Log.Helper.LOGIS(LOG_TAG, "Attempt to register device with EADP push notification service", new Object[0]);
try {
try {
HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/devices", this.pushNotificationServerUrl, this.gameId));
resource.setHeader("Authorization", createAuthorizationHeader());
pushNotificationConfig.setAppId(this.appId);
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(TimeZone.class, new TimeZoneSerializer());
resource.setJsonBody(gsonBuilder.create().toJson(pushNotificationConfig));
resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.3
@Override // com.ea.eadp.http.models.HttpRequestListener
public void onComplete(HttpResponse httpResponse) {
int code = httpResponse.getCode();
String body = httpResponse.getBody();
if (code >= 200 && code < 300) {
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Registration request successful!", new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]);
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registration with server complete. Registered id: %s", pushNotificationConfig.getRegistrationIdentifier()), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onRegistrationSuccess(code, body);
return;
}
return;
}
String format = String.format("Registration request failed! Status: %s, Message: %s", Integer.valueOf(code), httpResponse.getMessage());
Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onConnectionError(code, format);
}
}
});
} catch (Exception e) {
String format = String.format("Failed to register device with Exception: %s", e.getLocalizedMessage());
Log.Helper.LOGES(LOG_TAG, format, new Object[0]);
IPushListener iPushListener2 = this.pushListener;
if (iPushListener2 != null) {
iPushListener2.onConnectionError(0, format);
}
}
} finally {
saveConfigData(pushNotificationConfig);
}
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void sendTrackingEvent(String str, String str2, String str3) {
try {
HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/events", this.pushNotificationServerUrl, this.gameId));
TrackingEvent trackingEvent = new TrackingEvent(str, str2, str3, loadConfigData(DEVICE_ID_KEY));
resource.setHeader("Authorization", createAuthorizationHeader());
resource.setJsonBody(new Gson().toJson(trackingEvent));
resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.4
@Override // com.ea.eadp.http.models.HttpRequestListener
public void onComplete(HttpResponse httpResponse) {
int code = httpResponse.getCode();
if (code >= 200 && code < 300) {
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Tracking request successful!", new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onTrackingSuccess(code, httpResponse.getBody());
return;
}
return;
}
String format = String.format("Tracking request failed! Status: %s, Message: %s", Integer.valueOf(httpResponse.getCode()), httpResponse.getMessage());
Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onConnectionError(code, format);
}
}
});
} catch (Exception e) {
String format = String.format("Tracking request failed with Exception: %s", e.getMessage());
Log.Helper.LOGES(LOG_TAG, format, new Object[0]);
IPushListener iPushListener = this.pushListener;
if (iPushListener != null) {
iPushListener.onConnectionError(0, format);
}
}
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void persistTrackingEvent(String str, String str2, String str3) {
List arrayList;
SharedPreferences sharedPreferences = this.context.getApplicationContext().getSharedPreferences(TRACKING_PREFS_FILENAME, 0);
String string = sharedPreferences.getString(EVENT_LIST_KEY, null);
if (string != null) {
arrayList = (List) new Gson().fromJson(string, List.class);
} else {
arrayList = new ArrayList();
}
HashMap hashMap = new HashMap();
hashMap.put(FCMMessageService.PushIntentExtraKeys.PUSH_ID, str);
hashMap.put(FCMMessageService.PushIntentExtraKeys.PN_TYPE, str2);
hashMap.put("state", str3);
if (arrayList == null) {
Log.Helper.LOGE(this, "Unexpected Event List. Skipping Tracking event persistence.", new Object[0]);
return;
}
arrayList.add(hashMap);
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString(EVENT_LIST_KEY, new Gson().toJson(arrayList));
edit.apply();
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void sendPendingTrackingRequests() {
Gson gson = new Gson();
SharedPreferences sharedPreferences = this.context.getSharedPreferences(TRACKING_PREFS_FILENAME, 0);
String string = sharedPreferences.getString(EVENT_LIST_KEY, null);
if (string != null) {
List<Map> list = (List) gson.fromJson(string, List.class);
if (list == null) {
Log.Helper.LOGE(this, "Event List from Json is null!", new Object[0]);
return;
}
for (Map map : list) {
if (map != null && !map.isEmpty()) {
sendTrackingEvent((String) map.get(FCMMessageService.PushIntentExtraKeys.PUSH_ID), (String) map.get(FCMMessageService.PushIntentExtraKeys.PN_TYPE), (String) map.get("state"));
}
}
}
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.clear();
edit.apply();
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void getInAppNotifications(final String str, final String str2) {
if (str != null) {
new Thread(new Runnable() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.5
@Override // java.lang.Runnable
public void run() {
int i;
HttpResponse httpResponse;
try {
HttpRequest resource = AndroidPushService.this.httpService.getResource(String.format("%s/games/%s/users/%s/inapp", AndroidPushService.this.pushNotificationServerUrl, AndroidPushService.this.gameId, str));
if (str2 != null) {
resource.setHeader("Authorization", "Bearer " + str2);
}
httpResponse = resource.get();
i = httpResponse.getCode();
} catch (Exception e) {
e = e;
i = 0;
}
try {
if (i >= 200 && i < 300) {
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Get In-App Notification request successful!", new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, "response: " + httpResponse.getBody(), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onGetInAppSuccess(i, httpResponse.getBody());
}
} else {
String format = String.format("Get In-App Notification request failed! Status: %s, Message: %s", Integer.valueOf(httpResponse.getCode()), httpResponse.getMessage());
Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]);
Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onConnectionError(i, format);
}
}
} catch (Exception e2) {
e = e2;
String format2 = String.format("In-App Notification request failed with Exception: %s", e.getMessage());
Log.Helper.LOGES(AndroidPushService.LOG_TAG, format2, new Object[0]);
if (AndroidPushService.this.pushListener != null) {
AndroidPushService.this.pushListener.onConnectionError(i, format2);
}
}
}
}, "getInAppNotifications thread").start();
return;
}
IPushListener iPushListener = this.pushListener;
if (iPushListener != null) {
iPushListener.onConnectionError(0, "UserAlias is null");
}
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void onRestart() {
if (this.inAppTimer == null || this.inAppNotificationInterval <= 0) {
return;
}
Timer timer = new Timer();
this.inAppTimer = timer;
TimerTask timerTask = new TimerTask() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.6
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
AndroidPushService androidPushService = AndroidPushService.this;
androidPushService.getInAppNotifications(androidPushService.startConfig.getUserAlias(), AndroidPushService.this.startClientToken);
}
};
long j = this.inAppNotificationInterval;
timer.schedule(timerTask, j, j);
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void onStop() {
Timer timer = this.inAppTimer;
if (timer != null) {
timer.cancel();
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean checkPlayServices() {
return GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(this.context) == 0;
}
private void saveConfigData(PushNotificationConfig pushNotificationConfig) {
SharedPreferences.Editor edit = this.context.getApplicationContext().getSharedPreferences(SHARED_PREFS_FILENAME, 0).edit();
if (pushNotificationConfig.getDeviceIdentifier() != null && !pushNotificationConfig.getDeviceIdentifier().equals("")) {
edit.putString(DEVICE_ID_KEY, pushNotificationConfig.getDeviceIdentifier());
}
String str = this.pushNotificationServerUrl;
if (str != null && !str.equals("")) {
edit.putString(PUSH_SERVER_URL_KEY, this.pushNotificationServerUrl);
}
String str2 = this.gameId;
if (str2 != null && !str2.equals("")) {
edit.putString("gameId", this.gameId);
}
String str3 = this.apiKey;
if (str3 != null && !str3.equals("")) {
edit.putString(API_KEY_KEY, this.apiKey);
}
String str4 = this.apiSecret;
if (str4 != null && !str4.equals("")) {
edit.putString(API_SECRET_KEY, this.apiSecret);
}
edit.apply();
}
private String loadConfigData(String str) {
return this.context.getApplicationContext().getSharedPreferences(SHARED_PREFS_FILENAME, 0).getString(str, null);
}
private String createAuthorizationHeader() {
return String.format("Basic %s", Base64.encodeToString((this.apiKey + ':' + this.apiSecret).getBytes(StandardCharsets.UTF_8), 10));
}
public static class TimeZoneSerializer implements JsonSerializer<TimeZone> {
private TimeZoneSerializer() {
}
@Override // com.google.gson.JsonSerializer
public JsonElement serialize(TimeZone timeZone, Type type, JsonSerializationContext jsonSerializationContext) {
return new JsonPrimitive(timeZone.getID());
}
}
}

View File

@@ -0,0 +1,32 @@
package com.ea.eadp.pushnotification.services;
import com.ea.eadp.pushnotification.listeners.IPushListener;
import com.ea.eadp.pushnotification.models.PushNotificationConfig;
/* loaded from: classes2.dex */
public interface IPushService {
public static final String NOTIFICATION_TYPE_OPENED = "NOTIFICATION_OPENED";
public static final String NOTIFICATION_TYPE_RECEIVED = "NOTIFICATION_RECEIVED";
void getInAppNotifications(String str, String str2);
IPushListener getPushListener();
void onRestart();
void onStop();
void persistTrackingEvent(String str, String str2, String str3);
void registerDevice(PushNotificationConfig pushNotificationConfig);
void sendPendingTrackingRequests();
void sendTrackingEvent(String str, String str2, String str3);
void setPushListener(IPushListener iPushListener);
void startWithConfig(PushNotificationConfig pushNotificationConfig, String str);
void updateToken(String str);
}

View File

@@ -0,0 +1,29 @@
package com.ea.eadp.pushnotification.services;
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
import com.google.gson.annotations.Expose;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
class TrackingEvent {
@Expose
private final String name;
@Expose
private final Map<String, String> parameters;
public TrackingEvent(String str, String str2, String str3, String str4) {
this.name = str3;
HashMap hashMap = new HashMap();
this.parameters = hashMap;
hashMap.put(FCMMessageService.PushIntentExtraKeys.PUSH_ID, str);
hashMap.put(FCMMessageService.PushIntentExtraKeys.PN_TYPE, str2);
hashMap.put("deviceType", "android");
hashMap.put("deviceIdentifier", str4);
hashMap.put("timestamp", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()));
}
}

View File

@@ -0,0 +1,21 @@
package com.ea.fuel.metrics;
import android.content.Context;
/* loaded from: classes2.dex */
public abstract class FuelMetrics {
public static Context context;
private static native void NativeShutdown();
private static native void NativeStartup();
public static void Startup(Context context2) {
context = context2.getApplicationContext();
NativeStartup();
}
public static void Shutdown() {
NativeShutdown();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
package com.ea.ironmonkey.components;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.SurfaceHolder;
/* loaded from: classes2.dex */
public abstract class GameComponent implements SurfaceHolder.Callback {
public void onBackPressed() {
}
public void onConfigurationChanged(Configuration configuration) {
}
public void onNewIntent(Intent intent) {
}
public void onRestart() {
}
public Object onRetainNonConfigurationInstance() {
return null;
}
public void onSaveInstanceState(Bundle bundle) {
}
public void onWindowFocusChanged(boolean z) {
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceCreated(SurfaceHolder surfaceHolder) {
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
}
}

View File

@@ -0,0 +1,52 @@
package com.ea.nimble;
import android.app.Activity;
/* loaded from: classes2.dex */
public class ApplicationEnvironment {
public static final String COMPONENT_ID = "com.ea.nimble.applicationEnvironment";
public static final String NIMBLE_PARAMETER_ANDROID_ID = "androidId";
public static final String NIMBLE_PARAMETER_ATTRIBUTION_DATA = "attributionData";
public static final String NIMBLE_PARAMETER_COUNTRY_CODE = "countryCode";
public static final String NIMBLE_PARAMETER_CPU_CHIPSET = "cpuChipset";
public static final String NIMBLE_PARAMETER_CPU_CORE_COUNT = "cpuCoreCount";
public static final String NIMBLE_PARAMETER_DEVICE_ABIS = "deviceAbis";
public static final String NIMBLE_PARAMETER_DEVICE_BRAND = "deviceBrand";
public static final String NIMBLE_PARAMETER_DEVICE_CODENAME = "deviceCodename";
public static final String NIMBLE_PARAMETER_DEVICE_LANGUAGE = "deviceLanguage";
public static final String NIMBLE_PARAMETER_DEVICE_LOCALE = "deviceLocale";
public static final String NIMBLE_PARAMETER_DEVICE_MANUFACTURER = "deviceManufacturer";
public static final String NIMBLE_PARAMETER_DEVICE_MEMORY = "deviceMemory";
public static final String NIMBLE_PARAMETER_DEVICE_MODEL = "deviceModel";
public static final String NIMBLE_PARAMETER_DEVICE_PRODUCT = "deviceProduct";
public static final String NIMBLE_PARAMETER_DISPLAY_DENSITY = "displayDensity";
public static final String NIMBLE_PARAMETER_DISPLAY_HEIGHT = "displayHeight";
public static final String NIMBLE_PARAMETER_DISPLAY_WIDTH = "displayWidth";
public static final String NIMBLE_PARAMETER_FB_ATTR_ID = "fbAttrId";
public static final String NIMBLE_PARAMETER_GAID = "gaid";
public static final String NIMBLE_PARAMETER_LIMIT_AD_TRACKING = "limitAdTracking";
public static final String NIMBLE_PARAMETER_PLATFORM = "platform";
public static final String NIMBLE_PARAMETER_SYSTEM_NAME = "systemName";
public static final String NIMBLE_PARAMETER_SYSTEM_VERSION = "systemVersion";
public static final String NOTIFICATION_AGE_COMPLIANCE_REFRESHED = "nimble.notification.age_compliance_refreshed";
public static IApplicationEnvironment getComponent() {
return BaseCore.getInstance().getApplicationEnvironment();
}
public static Activity getCurrentActivity() {
return ApplicationEnvironmentImpl.getCurrentActivity();
}
public static void setCurrentActivity(Activity activity) {
ApplicationEnvironmentImpl.setCurrentActivity(activity);
}
public static boolean isMainApplicationRunning() {
return ApplicationEnvironmentImpl.isMainApplicationRunning();
}
public static boolean isMainApplicationActive() {
return ApplicationEnvironmentImpl.isMainApplicationActive();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes2.dex */
public class ApplicationLifecycle {
public static final String COMPONENT_ID = "com.ea.nimble.applicationlifecycle";
public static IApplicationLifecycle getComponent() {
return BaseCore.getInstance().getApplicationLifecycle();
}
public static void onActivityCreate(Bundle bundle, Activity activity) {
ApplicationEnvironment.setCurrentActivity(activity);
getComponent().notifyActivityCreate(bundle, activity);
}
public static void onActivityRestart(Activity activity) {
getComponent().notifyActivityRestart(activity);
}
public static void onActivityStart(Activity activity) {
getComponent().notifyActivityStart(activity);
}
public static void onActivityRestoreInstanceState(Bundle bundle, Activity activity) {
getComponent().notifyActivityRestoreInstanceState(bundle, activity);
}
public static void onActivityPause(Activity activity) {
getComponent().notifyActivityPause(activity);
}
public static void onActivityResume(Activity activity) {
getComponent().notifyActivityResume(activity);
}
public static void onActivitySaveInstanceState(Bundle bundle, Activity activity) {
getComponent().notifyActivitySaveInstanceState(bundle, activity);
}
public static void onActivityStop(Activity activity) {
getComponent().notifyActivityStop(activity);
}
public static void onActivityDestroy(Activity activity) {
getComponent().notifyActivityDestroy(activity);
}
public static void onActivityResult(int i, int i2, Intent intent, Activity activity) {
getComponent().notifyActivityResult(i, i2, intent, activity);
}
public static void onActivityWindowFocusChanged(boolean z, Activity activity) {
getComponent().notifyActivityWindowFocusChanged(z, activity);
}
public static void onNewIntent(Intent intent, Activity activity) {
getComponent().notifyActivityOnNewIntent(intent, activity);
}
public static boolean onBackPressed() {
return getComponent().handleBackPressed();
}
public static void onActivityRetainNonConfigurationInstance() {
getComponent().notifyActivityRetainNonConfigurationInstance();
}
}

View File

@@ -0,0 +1,392 @@
package com.ea.nimble;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.ea.nimble.IApplicationLifecycle;
import com.ea.nimble.Log;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes2.dex */
class ApplicationLifecycleImpl extends Component implements IApplicationLifecycle, LogSource {
private final BaseCore m_core;
private State m_state = State.INIT;
private int m_createdActivityCount = 0;
private int m_runningActivityCount = 0;
private final ArrayList<IApplicationLifecycle.ActivityLifecycleCallbacks> m_activityLifecycleCallbacks = new ArrayList<>();
private final ArrayList<IApplicationLifecycle.ActivityEventCallbacks> m_activityEventCallbacks = new ArrayList<>();
private final ArrayList<IApplicationLifecycle.ApplicationLifecycleCallbacks> m_applicationLifecycleCallbacks = new ArrayList<>();
public enum State {
INIT,
LAUNCH,
RESUME,
RUN,
PAUSE,
SUSPEND,
QUIT,
CONFIG_CHANGE
}
@Override // com.ea.nimble.Component
public String getComponentId() {
return ApplicationLifecycle.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "AppLifecycle";
}
public ApplicationLifecycleImpl(BaseCore baseCore) {
this.m_core = baseCore;
}
@Override // com.ea.nimble.Component
public void teardown() {
this.m_activityLifecycleCallbacks.clear();
this.m_activityEventCallbacks.clear();
this.m_applicationLifecycleCallbacks.clear();
}
@Override // com.ea.nimble.IApplicationLifecycle
public void registerActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) {
this.m_activityLifecycleCallbacks.add(activityLifecycleCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void unregisterActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) {
this.m_activityLifecycleCallbacks.remove(activityLifecycleCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void registerActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) {
this.m_activityEventCallbacks.add(activityEventCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void unregisterActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) {
this.m_activityEventCallbacks.remove(activityEventCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void registerApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) {
this.m_applicationLifecycleCallbacks.add(applicationLifecycleCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void unregisterApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) {
this.m_applicationLifecycleCallbacks.remove(applicationLifecycleCallbacks);
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityCreate(Bundle bundle, Activity activity) {
Log.Helper.LOGV(this, "Activity %s CREATE", activity.getLocalClassName());
State state = this.m_state;
if (state == State.INIT || state == State.QUIT) {
Log.Helper.LOGD(this, "Activity created clearly with state %s", state.toString());
this.m_core.onApplicationLaunch(activity.getIntent());
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityCreated(activity, bundle);
}
notifyApplicationLaunch(activity.getIntent());
this.m_createdActivityCount = 1;
this.m_state = State.LAUNCH;
int i = this.m_runningActivityCount;
if (i != 0) {
Log.Helper.LOGE(this, "Invalid running activity count %d", Integer.valueOf(i));
this.m_runningActivityCount = 0;
}
} else if (state == State.CONFIG_CHANGE) {
if (ApplicationEnvironment.getCurrentActivity() != activity) {
Log.Helper.LOGE(this, "Activity created with state CONFIG_CHANGE but different activity %s and %s", ApplicationEnvironment.getCurrentActivity().getLocalClassName(), activity.getLocalClassName());
} else {
Log.Helper.LOGD(this, "Activity created from CONFIG_CHANGE, activity configuration changed", new Object[0]);
}
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it2 = this.m_activityLifecycleCallbacks.iterator();
while (it2.hasNext()) {
it2.next().onActivityCreated(activity, bundle);
}
int i2 = this.m_runningActivityCount;
if (i2 != 0) {
Log.Helper.LOGE(this, "Invalid running activity count %d", Integer.valueOf(i2));
this.m_runningActivityCount = 0;
}
} else if (state == State.PAUSE) {
Log.Helper.LOGD(this, "Activity created from PAUSE, normal activity switch", new Object[0]);
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it3 = this.m_activityLifecycleCallbacks.iterator();
while (it3.hasNext()) {
it3.next().onActivityCreated(activity, bundle);
}
this.m_createdActivityCount++;
} else if (state == State.SUSPEND) {
Log.Helper.LOGD(this, "Activity created from SUSPEND, external activity switch; (new) app restart", new Object[0]);
this.m_core.onApplicationResume();
this.m_state = State.RESUME;
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it4 = this.m_activityLifecycleCallbacks.iterator();
while (it4.hasNext()) {
it4.next().onActivityCreated(activity, bundle);
}
this.m_createdActivityCount++;
int i3 = this.m_runningActivityCount;
if (i3 != 0) {
Log.Helper.LOGE(this, "Invalid running activity count %d", Integer.valueOf(i3));
this.m_runningActivityCount = 0;
}
} else {
Log.Helper.LOGE(this, "Activity created with %s state, shouldn't happen", state.toString());
}
Log.Helper.LOGV(this, "State after created %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityRestart(Activity activity) {
Log.Helper.LOGV(this, "Activity %s RESTART", activity.getLocalClassName());
ApplicationEnvironment.setCurrentActivity(activity);
State state = this.m_state;
if (state == State.PAUSE) {
Log.Helper.LOGD(this, "Activity restart from PAUSE, normal activity switch", new Object[0]);
} else if (state == State.SUSPEND) {
this.m_core.onApplicationResume();
this.m_state = State.RESUME;
Log.Helper.LOGD(this, "Activity restart from SUSPEND, external activity switch; (new) app restart", new Object[0]);
} else {
Log.Helper.LOGE(this, "Activity restart with invalid state %s", state.toString());
}
Log.Helper.LOGV(this, "State after restart %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityStart(Activity activity) {
Log.Helper.LOGV(this, "Activity %s START", activity.getLocalClassName());
ApplicationEnvironment.setCurrentActivity(activity);
State state = this.m_state;
if (state == State.LAUNCH) {
this.m_state = State.PAUSE;
Log.Helper.LOGD(this, "Activity start with LAUNCH state, normal app start", new Object[0]);
} else if (state == State.RESUME) {
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityStarted(activity);
}
notifyApplicationResume(activity.getIntent());
this.m_state = State.PAUSE;
Log.Helper.LOGD(this, "Activity start with RESUME state, set to PAUSE", new Object[0]);
} else if (state == State.CONFIG_CHANGE) {
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it2 = this.m_activityLifecycleCallbacks.iterator();
while (it2.hasNext()) {
it2.next().onActivityStarted(activity);
}
this.m_state = State.PAUSE;
Log.Helper.LOGD(this, "Activity start with CONFIG_CHANGE state, set to PAUSE", new Object[0]);
} else if (state == State.PAUSE) {
Log.Helper.LOGD(this, "Activity start with PAUSE state, normal activity switch", new Object[0]);
} else {
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it3 = this.m_activityLifecycleCallbacks.iterator();
while (it3.hasNext()) {
it3.next().onActivityStarted(activity);
}
Log.Helper.LOGE(this, "Activity start with invalid state %s", this.m_state.toString());
}
this.m_runningActivityCount++;
Log.Helper.LOGV(this, "State after start %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityRestoreInstanceState(Bundle bundle, Activity activity) {
Log.Helper.LOGV(this, "Activity %s RESTORE_STATE", activity.getLocalClassName());
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityResume(Activity activity) {
Log.Helper.LOGV(this, "Activity %s RESUME", activity.getLocalClassName());
ApplicationEnvironment.setCurrentActivity(activity);
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityResumed(activity);
}
State state = this.m_state;
if (state != State.PAUSE) {
Log.Helper.LOGE(this, "Activity resume on invalid state %s", state.toString());
Log.Helper.LOGE(this, "<NOTE>Please double check if the game's activity hooks ApplicationLifecycle.onActivityRestart() correctly.", new Object[0]);
}
State state2 = State.RUN;
this.m_state = state2;
Log.Helper.LOGV(this, "State after resume %s (%d, %d)", state2.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityPause(Activity activity) {
Log.Helper.LOGV(this, "Activity %s PAUSE", activity.getLocalClassName());
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityPaused(activity);
}
if (this.m_state != State.RUN) {
Log.Helper.LOGE(this, "Activity pause on invalid state %s", activity.getLocalClassName());
}
State state = State.PAUSE;
this.m_state = state;
Log.Helper.LOGV(this, "State after pause %s (%d, %d)", state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivitySaveInstanceState(Bundle bundle, Activity activity) {
Log.Helper.LOGV(this, "Activity %s SAVE_STATE", activity.getLocalClassName());
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivitySaveInstanceState(activity, bundle);
}
}
@Override // com.ea.nimble.IApplicationLifecycle
@SuppressLint({"NewApi"})
public void notifyActivityStop(Activity activity) {
Log.Helper.LOGV(this, "Activity %s STOP", activity.getLocalClassName());
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityStopped(activity);
}
this.m_runningActivityCount--;
if (activity.isChangingConfigurations()) {
this.m_state = State.CONFIG_CHANGE;
} else if (this.m_runningActivityCount == 0) {
State state = this.m_state;
if (state != State.PAUSE && state != State.SUSPEND) {
Log.Helper.LOGW(this, "Interesting case %s, HIGHLIGHT!!", state);
}
this.m_state = State.SUSPEND;
if (!activity.isFinishing()) {
notifyApplicationSuspend();
this.m_core.onApplicationSuspend();
}
} else {
State state2 = this.m_state;
if (state2 == State.PAUSE) {
this.m_state = State.SUSPEND;
if (!activity.isFinishing()) {
Log.Helper.LOGW(this, "running activity count may be messed", new Object[0]);
notifyApplicationSuspend();
this.m_core.onApplicationSuspend();
}
} else if (state2 != State.RUN) {
Log.Helper.LOGE(this, "Activity stop on invalid state %s", state2.toString());
}
}
Log.Helper.LOGV(this, "State after stop %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityDestroy(Activity activity) {
Log.Helper.LOGV(this, "Activity %s DESTROY", activity.getLocalClassName());
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it = this.m_activityLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityDestroyed(activity);
}
State state = this.m_state;
if (state != State.CONFIG_CHANGE) {
if (state != State.SUSPEND && state != State.RUN) {
Log.Helper.LOGE(this, "Activity destroy on invalid state %s", state.toString());
}
int i = this.m_createdActivityCount - 1;
this.m_createdActivityCount = i;
if (i == 0) {
this.m_state = State.QUIT;
notifyApplicationQuit();
this.m_core.onApplicationQuit();
ApplicationEnvironment.setCurrentActivity(null);
}
}
Log.Helper.LOGV(this, "State after destroy %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount));
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityResult(int i, int i2, Intent intent, Activity activity) {
Iterator<IApplicationLifecycle.ActivityEventCallbacks> it = this.m_activityEventCallbacks.iterator();
while (it.hasNext()) {
it.next().onActivityResult(activity, i, i2, intent);
}
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityWindowFocusChanged(boolean z, Activity activity) {
Iterator<IApplicationLifecycle.ActivityEventCallbacks> it = this.m_activityEventCallbacks.iterator();
while (it.hasNext()) {
it.next().onWindowFocusChanged(z);
}
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityOnNewIntent(Intent intent, Activity activity) {
Iterator<IApplicationLifecycle.ActivityEventCallbacks> it = this.m_activityEventCallbacks.iterator();
while (it.hasNext()) {
it.next().onNewIntent(activity, intent);
}
}
@Override // com.ea.nimble.IApplicationLifecycle
public boolean handleBackPressed() {
Iterator<IApplicationLifecycle.ActivityEventCallbacks> it = this.m_activityEventCallbacks.iterator();
boolean z = true;
while (it.hasNext()) {
if (!it.next().onBackPressed()) {
z = false;
}
}
return z;
}
@Override // com.ea.nimble.IApplicationLifecycle
public void notifyActivityRetainNonConfigurationInstance() {
Log.Helper.LOGFUNC(this);
}
private void deleteConsumedDataFromIntent(Intent intent) {
if (intent != null) {
if (intent.getData() != null && intent.getDataString().startsWith("ea://socialsharing")) {
intent.removeExtra("key");
intent.setData(null);
}
if (intent.getStringExtra("PushNotification") != null) {
intent.removeExtra("PushNotification");
}
}
}
private void notifyApplicationLaunch(Intent intent) {
Log.Helper.LOGFUNC(this);
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> it = this.m_applicationLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onApplicationLaunch(intent);
}
deleteConsumedDataFromIntent(intent);
}
private void notifyApplicationSuspend() {
Log.Helper.LOGFUNC(this);
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> it = this.m_applicationLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onApplicationSuspend();
}
}
private void notifyApplicationResume(Intent intent) {
Log.Helper.LOGFUNC(this);
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> it = this.m_applicationLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onApplicationResume();
}
deleteConsumedDataFromIntent(intent);
}
private void notifyApplicationQuit() {
Log.Helper.LOGFUNC(this);
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> it = this.m_applicationLifecycleCallbacks.iterator();
while (it.hasNext()) {
it.next().onApplicationQuit();
}
}
}

View File

@@ -0,0 +1,19 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes2.dex */
public class AuthResultActivity extends Activity {
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
String dataString = getIntent().getDataString();
Intent intent = new Intent(this, (Class<?>) CustomTabActivity.class);
intent.setAction(Constants.CUSTOM_TAB_REDIRECT_ACTION);
intent.putExtra(Constants.EXTRA_URL, dataString);
intent.addFlags(603979776);
startActivityForResult(intent, 100);
}
}

View File

@@ -0,0 +1,72 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class BackgroundNetworkConnection extends NetworkConnection {
@Override // com.ea.nimble.NetworkConnection
public void cancelForAppSuspend() {
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ void cancel() {
super.cancel();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ NetworkConnectionCallback getCompletionCallback() {
return super.getCompletionCallback();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ NetworkConnectionCallback getHeaderCallback() {
return super.getHeaderCallback();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.LogSource
public /* bridge */ /* synthetic */ String getLogSourceTitle() {
return super.getLogSourceTitle();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ NetworkConnectionCallback getProgressCallback() {
return super.getProgressCallback();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ HttpRequest getRequest() {
return super.getRequest();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ HttpResponse getResponse() {
return super.getResponse();
}
@Override // com.ea.nimble.NetworkConnection, java.lang.Runnable
public /* bridge */ /* synthetic */ void run() {
super.run();
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback) {
super.setCompletionCallback(networkConnectionCallback);
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback) {
super.setHeaderCallback(networkConnectionCallback);
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ void setProgressCallback(NetworkConnectionCallback networkConnectionCallback) {
super.setProgressCallback(networkConnectionCallback);
}
@Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle
public /* bridge */ /* synthetic */ void waitOn() {
super.waitOn();
}
public BackgroundNetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) {
super(networkImpl, httpRequest, iOperationalTelemetryDispatch);
}
}

View File

@@ -0,0 +1,52 @@
package com.ea.nimble;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class Base {
public static void setupNimble() {
Log.Helper.LOGPUBLICFUNCS("Base");
BaseCore.getInstance().setup();
}
public static void teardownNimble() {
Log.Helper.LOGPUBLICFUNCS("Base");
BaseCore.getInstance().teardown();
}
public static void registerComponent(Component component, String str) {
Log.Helper.LOGFUNCS("Base");
BaseCore.getInstance().getComponentManager().registerComponent(component, str);
}
public static Component getComponent(String str) {
Log.Helper.LOGFUNCS("Base");
BaseCore activeValidate = BaseCore.getInstance().activeValidate();
if (activeValidate == null) {
return null;
}
return activeValidate.getComponentManager().getComponent(str);
}
public static Component[] getComponentList(String str) {
Log.Helper.LOGFUNCS("Base");
BaseCore activeValidate = BaseCore.getInstance().activeValidate();
if (activeValidate == null) {
return null;
}
return activeValidate.getComponentManager().getComponentList(str);
}
public static NimbleConfiguration getConfiguration() {
Log.Helper.LOGFUNCS("Base");
return BaseCore.getInstance().getConfiguration();
}
public static void restartWithConfiguration(NimbleConfiguration nimbleConfiguration) {
Log.Helper.LOGPUBLICFUNCS("Base");
BaseCore activeValidate = BaseCore.getInstance().activeValidate();
if (activeValidate != null) {
activeValidate.restartWithConfiguration(nimbleConfiguration);
}
}
}

View File

@@ -0,0 +1,441 @@
package com.ea.nimble;
import android.content.Intent;
import android.content.pm.Signature;
import android.content.pm.SigningInfo;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import com.ea.nimble.IApplicationLifecycle;
import com.ea.nimble.Log;
import com.ea.nimble.bridge.NimbleCppApplicationLifeCycle;
import com.ea.nimble.bridge.NimbleCppComponentRegistrar;
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
import com.unity3d.services.ads.gmascar.bridges.mobileads.MobileAdsBridgeBase;
import java.io.ByteArrayInputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Map;
import javax.security.auth.x500.X500Principal;
/* loaded from: classes2.dex */
class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
public static final String NIMBLE_LOG_SETTING = "setting::log";
public static final String NIMBLE_SERVER_CONFIG = "com.ea.nimble.configuration";
protected ApplicationEnvironmentImpl m_applicationEnvironment;
protected IApplicationLifecycle m_applicationLifecycle;
protected ComponentManager m_componentManager;
protected NimbleConfiguration m_configuration;
protected LogImpl m_log;
protected PersistenceServiceImpl m_persistenceService;
protected State m_state;
public static final String[] NIMBLE_COMPONENTS = {"com.ea.nimble.tracking.Tracking", "com.ea.nimble.tracking.NimbleTrackingSynergyComponent", "com.ea.nimble.tracking.TrackingEventWrangler", "com.ea.nimble.identity.NimbleIdentityImpl", "com.ea.nimble.identity.AuthenticatorOrigin", "com.ea.nimble.identity.AuthenticatorFacebook", "com.ea.nimble.identity.AuthenticatorAnonymous", "com.ea.nimble.friends.NimbleFriendsImpl", "com.ea.nimble.friends.NimbleOriginFriendsServiceImpl", "com.ea.nimble.origin.Origin", "com.ea.nimble.Facebook", "com.ea.nimble.NimbleAndroidFacebook", "com.ea.nimble.NimbleAndroidGoogleServiceImpl", "com.ea.nimble.mtx.googleplay.GooglePlay", "com.ea.nimble.mtx.amazon.AmazonStore", "com.ea.nimble.pushtng.PushNotification", NimbleCppApplicationLifeCycle.COMPONENT_ID, NimbleCppComponentRegistrar.COMPONENT_ID};
protected static BaseCore s_core = null;
protected static boolean s_coreDestroyed = false;
public enum State {
INACTIVE,
AUTO_SETUP,
MANUAL_SETUP,
MANUAL_TEARDOWN,
QUITTING,
DESTROY,
FAKE_DESTROY
}
public IApplicationEnvironment getApplicationEnvironment() {
return this.m_applicationEnvironment;
}
public IApplicationLifecycle getApplicationLifecycle() {
return this.m_applicationLifecycle;
}
public ComponentManager getComponentManager() {
return this.m_componentManager;
}
public NimbleConfiguration getConfiguration() {
return this.m_configuration;
}
public ILog getLog() {
return this.m_log;
}
public IPersistenceService getPersistenceService() {
return this.m_persistenceService;
}
private void initialize() {
this.m_state = State.INACTIVE;
loadConfiguration();
this.m_componentManager = new ComponentManager();
this.m_applicationLifecycle = new ApplicationLifecycleImpl(this);
this.m_applicationEnvironment = new ApplicationEnvironmentImpl(this);
LogImpl logImpl = (LogImpl) Log.getComponent();
this.m_log = logImpl;
logImpl.connectToCore(this);
this.m_persistenceService = new PersistenceServiceImpl();
NetworkImpl networkImpl = new NetworkImpl();
SynergyEnvironmentImpl synergyEnvironmentImpl = new SynergyEnvironmentImpl(this);
SynergyNetworkImpl synergyNetworkImpl = new SynergyNetworkImpl();
SynergyIdManagerImpl synergyIdManagerImpl = new SynergyIdManagerImpl();
OperationalTelemetryDispatchImpl operationalTelemetryDispatchImpl = new OperationalTelemetryDispatchImpl();
NimbleLocalNotificationsImpl nimbleLocalNotificationsImpl = new NimbleLocalNotificationsImpl();
this.m_componentManager.registerComponent(this.m_applicationEnvironment, ApplicationEnvironment.COMPONENT_ID);
this.m_componentManager.registerComponent(this.m_log, Log.COMPONENT_ID);
this.m_componentManager.registerComponent(this.m_persistenceService, PersistenceService.COMPONENT_ID);
this.m_componentManager.registerComponent(networkImpl, "com.ea.nimble.network");
this.m_componentManager.registerComponent(synergyIdManagerImpl, SynergyIdManager.COMPONENT_ID);
this.m_componentManager.registerComponent(synergyEnvironmentImpl, SynergyEnvironment.COMPONENT_ID);
this.m_componentManager.registerComponent(synergyNetworkImpl, SynergyNetwork.COMPONENT_ID);
this.m_componentManager.registerComponent(operationalTelemetryDispatchImpl, OperationalTelemetryDispatch.COMPONENT_ID);
this.m_componentManager.registerComponent(nimbleLocalNotificationsImpl, NimbleLocalNotifications.COMPONENT_ID);
for (String str : NIMBLE_COMPONENTS) {
try {
Method declaredMethod = Class.forName(str).getDeclaredMethod(MobileAdsBridgeBase.initializeMethodName, new Class[0]);
declaredMethod.setAccessible(true);
declaredMethod.invoke(null, new Object[0]);
} catch (ClassNotFoundException unused) {
Log.Helper.LOGD(this, "Component " + str + " not found", new Object[0]);
} catch (IllegalAccessException unused2) {
Log.Helper.LOGE(this, "Method " + str + ".initialize() is not accessible", new Object[0]);
} catch (IllegalArgumentException unused3) {
Log.Helper.LOGE(this, "Method " + str + ".initialize() should take no arguments", new Object[0]);
} catch (NoSuchMethodException unused4) {
Log.Helper.LOGE(this, "No method " + str + ".initialize()", new Object[0]);
} catch (NullPointerException unused5) {
Log.Helper.LOGE(this, "Method " + str + ".initialize() should be static", new Object[0]);
} catch (InvocationTargetException e) {
Log.Helper.LOGE(this, "Method " + str + ".initialize() threw an exception", new Object[0]);
e.printStackTrace();
}
}
if (isAppSigned()) {
return;
}
android.util.Log.e(Global.NIMBLE_ID, "This application is NOT signed with a valid certificate. MTX may not work correctly with this application");
}
public Map<String, String> getSettings(String str) {
Log.Helper.LOGPUBLICFUNC(this);
if (!str.equals(NIMBLE_LOG_SETTING)) {
return null;
}
int identifier = ApplicationEnvironment.getComponent().getApplicationContext().getResources().getIdentifier("nimble_log", "xml", ApplicationEnvironment.getCurrentActivity().getPackageName());
if (identifier == 0) {
return null;
}
return Utility.parseXmlFile(identifier);
}
public static synchronized BaseCore getInstance() {
BaseCore baseCore;
synchronized (BaseCore.class) {
try {
if (s_core == null) {
if (s_coreDestroyed) {
throw new AssertionError("Cannot revive destroyed BaseCore, please utilizesetupNimble() and tearDownNimble() explicitly to extend longevity to match your expectation.");
}
String.format("NIMBLE VERSION %s (Build %s)", Global.NIMBLE_RELEASE_VERSION, Global.NIMBLE_SDK_VERSION);
BaseCore baseCore2 = new BaseCore();
s_core = baseCore2;
baseCore2.initialize();
}
baseCore = s_core;
} catch (Throwable th) {
throw th;
}
}
return baseCore;
}
/* renamed from: com.ea.nimble.BaseCore$2, reason: invalid class name */
public static /* synthetic */ class AnonymousClass2 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$BaseCore$State;
static {
int[] iArr = new int[State.values().length];
$SwitchMap$com$ea$nimble$BaseCore$State = iArr;
try {
iArr[State.INACTIVE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.MANUAL_TEARDOWN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.DESTROY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.AUTO_SETUP.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.MANUAL_SETUP.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.QUITTING.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$ea$nimble$BaseCore$State[State.FAKE_DESTROY.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
public BaseCore activeValidate() {
Log.Helper.LOGFUNC(this);
int i = AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()];
if (i == 1) {
Log.Helper.LOGF(this, "Access NimbleBaseCore before setup, call setupNimble() explicitly to activate it.", new Object[0]);
return null;
}
if (i == 2) {
Log.Helper.LOGF(this, "Access NimbleBaseCore after clean up, call setupNimble() explicitly again to activate it.", new Object[0]);
return null;
}
if (i != 3) {
return this;
}
Log.Helper.LOGF(this, "Accessing component after destroy, only static components are available right now.", new Object[0]);
return null;
}
public void setup() {
Log.Helper.LOGPUBLICFUNC(this);
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
case 1:
case 2:
this.m_componentManager.setup();
this.m_state = State.MANUAL_SETUP;
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED);
this.m_componentManager.restore();
break;
case 3:
case 5:
case 6:
case 7:
Log.Helper.LOGF(this, "Multiple setupNimble() calls without teardownNimble().", new Object[0]);
break;
case 4:
this.m_state = State.MANUAL_SETUP;
break;
}
}
public void teardown() {
Log.Helper.LOGPUBLICFUNC(this);
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
case 1:
case 4:
Log.Helper.LOGF(this, "Cannot teardownNimble() before setupNimble().", new Object[0]);
break;
case 2:
case 3:
Log.Helper.LOGF(this, "Multiple teardownNimble() calls without setupNibmle().", new Object[0]);
break;
case 5:
this.m_componentManager.cleanup();
this.m_state = State.MANUAL_TEARDOWN;
this.m_componentManager.teardown();
break;
case 6:
case 7:
this.m_componentManager.cleanup();
this.m_state = State.MANUAL_TEARDOWN;
this.m_componentManager.teardown();
destroy();
break;
}
}
public void restartWithConfiguration(final NimbleConfiguration nimbleConfiguration) {
Log.Helper.LOGPUBLICFUNC(this);
Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]);
Log.Helper.LOGE(this, "restartWithConfiguration should not be used in an integration. This function is for QA testing purposes.", new Object[0]);
Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]);
if (nimbleConfiguration == NimbleConfiguration.UNKNOWN) {
Log.Helper.LOGE(this, "Cannot restart nimble with unknown configuration", new Object[0]);
} else {
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.ea.nimble.BaseCore.1
@Override // java.lang.Runnable
public void run() {
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[BaseCore.this.m_state.ordinal()]) {
case 1:
case 2:
case 3:
Log.Helper.LOGF(this, "Should not happen, getInstance should ensure active instance", new Object[0]);
break;
case 4:
case 5:
BaseCore.this.m_componentManager.cleanup();
BaseCore.this.m_componentManager.teardown();
BaseCore baseCore = BaseCore.this;
baseCore.m_configuration = nimbleConfiguration;
baseCore.m_componentManager.setup();
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED);
BaseCore.this.m_componentManager.restore();
break;
case 6:
case 7:
Log.Helper.LOGF(this, "Cannot restart Nimble when app is quiting", new Object[0]);
break;
}
}
});
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationLaunch(Intent intent) {
State state = this.m_state;
if (state == State.INACTIVE || state == State.DESTROY) {
this.m_componentManager.setup();
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED);
this.m_state = State.AUTO_SETUP;
try {
this.m_componentManager.restore();
return;
} catch (AssertionError e) {
this.m_state = State.INACTIVE;
throw e;
}
}
if (state == State.FAKE_DESTROY) {
this.m_componentManager.resume();
this.m_state = State.AUTO_SETUP;
} else if (state == State.QUITTING) {
this.m_componentManager.resume();
this.m_state = State.MANUAL_SETUP;
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationSuspend() {
State state = this.m_state;
if (state == State.MANUAL_SETUP || state == State.AUTO_SETUP) {
this.m_componentManager.suspend();
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationResume() {
State state = this.m_state;
if (state == State.MANUAL_SETUP || state == State.AUTO_SETUP) {
this.m_componentManager.resume();
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationQuit() {
int i = AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()];
if (i == 1) {
Log.Helper.LOGF(this, "No app start before app quit, something must be wrong.", new Object[0]);
return;
}
if (i != 3) {
if (i == 4) {
this.m_componentManager.suspend();
this.m_state = State.FAKE_DESTROY;
return;
} else if (i == 5) {
this.m_componentManager.suspend();
this.m_state = State.QUITTING;
return;
} else if (i != 6) {
return;
}
}
Log.Helper.LOGF(this, "Double app quit, something must be wrong.", new Object[0]);
}
public static void injectMock(BaseCore baseCore) {
Log.Helper.LOGFUNCS("BaseCore");
if (baseCore == null) {
s_core = null;
s_coreDestroyed = false;
} else {
s_core = baseCore;
s_coreDestroyed = false;
}
}
private void destroy() {
Log.Helper.LOGD(this, "NIMBLE DESTROY for Android will keep Core and Static components alive", new Object[0]);
}
private void loadConfiguration() {
Log.Helper.LOGFUNCS("BaseCore");
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(NIMBLE_SERVER_CONFIG);
if (Utility.validString(configValueAsString)) {
NimbleConfiguration fromName = NimbleConfiguration.fromName(configValueAsString);
this.m_configuration = fromName;
if (fromName != NimbleConfiguration.UNKNOWN && fromName != NimbleConfiguration.CUSTOMIZED) {
return;
}
}
android.util.Log.e(Global.NIMBLE_ID, "WARNING! Cannot find valid NimbleConfiguration from AndroidManifest.xml");
this.m_configuration = NimbleConfiguration.LIVE;
}
/* JADX WARN: Multi-variable type inference failed */
private boolean isAppSigned() {
boolean z;
Signature[] signatureArr;
SigningInfo signingInfo;
X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
int i = 0;
try {
if (Build.VERSION.SDK_INT >= 33) {
signingInfo = Utility.getPackageInfo(134217728).signingInfo;
signatureArr = signingInfo.getApkContentsSigners();
} else {
signatureArr = Utility.getPackageInfo(64).signatures;
}
int length = signatureArr.length;
z = 0;
while (i < length) {
try {
z = ((X509Certificate) CertificateFactory.getInstance(AndroidStaticDeviceInfoDataSource.CERTIFICATE_TYPE_X509).generateCertificate(new ByteArrayInputStream(signatureArr[i].toByteArray()))).getSubjectX500Principal().equals(x500Principal);
if (z != 0) {
break;
}
i++;
z = z;
} catch (CertificateException e) {
e = e;
i = z ? 1 : 0;
e.printStackTrace();
z = i;
return !z;
} catch (Exception e2) {
e = e2;
i = z ? 1 : 0;
e.printStackTrace();
z = i;
return !z;
}
}
} catch (CertificateException e3) {
e = e3;
} catch (Exception e4) {
e = e4;
}
return !z;
}
public boolean isActive() {
Log.Helper.LOGPUBLICFUNCS("BaseCore");
State state = this.m_state;
return state == State.AUTO_SETUP || state == State.MANUAL_SETUP;
}
}

View File

@@ -0,0 +1,303 @@
package com.ea.nimble;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
/* loaded from: classes2.dex */
public class ByteBufferIOStream {
protected static final int SEGMENT_SIZE = 4096;
protected int m_availableSegment;
protected LinkedList<byte[]> m_buffer;
protected boolean m_closed;
protected ByteBufferInputStream m_input;
protected ByteBufferOutputStream m_output;
protected int m_readPosition;
protected int m_writePosition;
public void clear() {
this.m_closed = false;
this.m_availableSegment = 0;
this.m_writePosition = 0;
this.m_readPosition = 0;
}
public void closeIOStream() {
this.m_closed = true;
}
public InputStream getInputStream() {
return this.m_input;
}
public OutputStream getOutputStream() {
return this.m_output;
}
public ByteBufferIOStream() {
this(1);
}
public ByteBufferIOStream(int i) {
this.m_closed = false;
this.m_availableSegment = 0;
this.m_writePosition = 0;
this.m_readPosition = 0;
this.m_buffer = new LinkedList<>();
this.m_input = new ByteBufferInputStream();
this.m_output = new ByteBufferOutputStream();
int i2 = (((i <= 0 ? 1 : i) - 1) / 4096) + 1;
for (int i3 = 0; i3 < i2; i3++) {
this.m_buffer.add(new byte[4096]);
}
}
public int available() throws IOException {
return this.m_input.available();
}
public byte[] prepareSegment() {
if (this.m_availableSegment + 1 >= this.m_buffer.size()) {
return new byte[4096];
}
if (this.m_buffer.size() == 0) {
return null;
}
return this.m_buffer.removeLast();
}
public void appendSegmentToBuffer(byte[] bArr, int i) throws IOException {
if (this.m_writePosition == 0 && bArr.length == 4096) {
ListIterator<byte[]> listIterator = this.m_buffer.listIterator();
for (int i2 = 0; i2 < this.m_availableSegment; i2++) {
listIterator.next();
}
listIterator.add(bArr);
if (i != 4096) {
this.m_writePosition = i;
return;
} else {
this.m_availableSegment++;
return;
}
}
getOutputStream().write(bArr, 0, i);
}
public byte[] growBufferBySegment() throws IOException {
if (this.m_writePosition != 0) {
throw new IOException("Bad location to grow buffer");
}
ListIterator<byte[]> listIterator = this.m_buffer.listIterator();
for (int i = 0; i < this.m_availableSegment; i++) {
listIterator.next();
}
byte[] bArr = new byte[4096];
listIterator.add(bArr);
this.m_availableSegment++;
return bArr;
}
public class ByteBufferInputStream extends InputStream {
@Override // java.io.InputStream
public boolean markSupported() {
return false;
}
public ByteBufferInputStream() {
}
@Override // java.io.InputStream
public int available() throws IOException {
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
if (byteBufferIOStream.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
return ((byteBufferIOStream.m_availableSegment * 4096) + byteBufferIOStream.m_writePosition) - byteBufferIOStream.m_readPosition;
}
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
ByteBufferIOStream.this.closeIOStream();
}
@Override // java.io.InputStream
public int read(byte[] bArr) throws IOException {
return read(bArr, 0, bArr.length);
}
@Override // java.io.InputStream
public int read() throws IOException {
if (available() <= 0) {
throw new IOException("Nothing to read in ByteBufferIOStream");
}
byte[] first = ByteBufferIOStream.this.m_buffer.getFirst();
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
int i = byteBufferIOStream.m_readPosition;
byte b = first[i];
int i2 = i + 1;
byteBufferIOStream.m_readPosition = i2;
if (i2 >= 4096) {
LinkedList<byte[]> linkedList = byteBufferIOStream.m_buffer;
linkedList.add(linkedList.poll());
ByteBufferIOStream.this.m_readPosition = 0;
r1.m_availableSegment--;
}
return b;
}
@Override // java.io.InputStream
public int read(byte[] bArr, int i, int i2) throws IOException {
if (i < 0 || i2 < 0 || i + i2 > bArr.length) {
throw new IndexOutOfBoundsException("The reading range of out of buffer boundary.");
}
int available = available();
if (available <= 0) {
return -1;
}
if (i2 > available) {
i2 = available;
}
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
int i3 = 4096 - byteBufferIOStream.m_readPosition;
if (i2 < i3) {
System.arraycopy(byteBufferIOStream.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i2);
ByteBufferIOStream.this.m_readPosition += i2;
} else {
System.arraycopy(byteBufferIOStream.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i3);
LinkedList<byte[]> linkedList = ByteBufferIOStream.this.m_buffer;
linkedList.add(linkedList.poll());
int i4 = i2 - i3;
int i5 = i + i3;
int i6 = i4 / 4096;
for (int i7 = 0; i7 < i6; i7++) {
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i5, 4096);
LinkedList<byte[]> linkedList2 = ByteBufferIOStream.this.m_buffer;
linkedList2.add(linkedList2.poll());
i4 -= 4096;
i5 += 4096;
}
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i5, i4);
ByteBufferIOStream byteBufferIOStream2 = ByteBufferIOStream.this;
byteBufferIOStream2.m_readPosition = i4;
byteBufferIOStream2.m_availableSegment -= i6 + 1;
}
return i2;
}
@Override // java.io.InputStream
public long skip(long j) throws IOException {
int available = available();
if (available <= 0) {
return 0L;
}
long j2 = available;
if (j > j2) {
j = j2;
}
int i = (int) j;
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
int i2 = byteBufferIOStream.m_readPosition;
int i3 = 4096 - i2;
if (i < i3) {
byteBufferIOStream.m_readPosition = i2 + i;
} else {
LinkedList<byte[]> linkedList = byteBufferIOStream.m_buffer;
linkedList.add(linkedList.poll());
int i4 = i - i3;
int i5 = i4 / 4096;
for (int i6 = 0; i6 < i5; i6++) {
LinkedList<byte[]> linkedList2 = ByteBufferIOStream.this.m_buffer;
linkedList2.add(linkedList2.poll());
i4 -= 4096;
}
ByteBufferIOStream byteBufferIOStream2 = ByteBufferIOStream.this;
byteBufferIOStream2.m_readPosition = i4;
byteBufferIOStream2.m_availableSegment -= i5 + 1;
}
return j;
}
}
public class ByteBufferOutputStream extends OutputStream {
public ByteBufferOutputStream() {
}
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
ByteBufferIOStream.this.closeIOStream();
}
@Override // java.io.OutputStream
public void write(byte[] bArr, int i, int i2) throws IOException {
byte[] bArr2;
if (i < 0 || i2 < 0 || i + i2 > bArr.length) {
throw new IndexOutOfBoundsException("The writing range is out of buffer boundary.");
}
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
if (byteBufferIOStream.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
int i3 = 4096 - byteBufferIOStream.m_writePosition;
Iterator<byte[]> it = byteBufferIOStream.m_buffer.iterator();
for (int i4 = 0; i4 < ByteBufferIOStream.this.m_availableSegment; i4++) {
it.next();
}
if (i2 < i3) {
System.arraycopy(bArr, i, it.next(), ByteBufferIOStream.this.m_writePosition, i2);
ByteBufferIOStream.this.m_writePosition += i2;
return;
}
System.arraycopy(bArr, i, it.next(), ByteBufferIOStream.this.m_writePosition, i3);
int i5 = i2 - i3;
int i6 = i + i3;
ByteBufferIOStream byteBufferIOStream2 = ByteBufferIOStream.this;
byteBufferIOStream2.m_availableSegment++;
byteBufferIOStream2.m_writePosition = 0;
while (i5 > 0) {
if (it.hasNext()) {
bArr2 = it.next();
} else {
bArr2 = new byte[4096];
ByteBufferIOStream.this.m_buffer.add(bArr2);
}
if (i5 < 4096) {
System.arraycopy(bArr, i6, bArr2, 0, i5);
ByteBufferIOStream.this.m_writePosition = i5;
i5 = 0;
} else {
System.arraycopy(bArr, i6, bArr2, 0, 4096);
i5 -= 4096;
i6 += 4096;
ByteBufferIOStream.this.m_availableSegment++;
}
}
}
@Override // java.io.OutputStream
public void write(byte[] bArr) throws IOException {
write(bArr, 0, bArr.length);
}
@Override // java.io.OutputStream
public void write(int i) throws IOException {
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
if (byteBufferIOStream.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
byte[] first = byteBufferIOStream.m_buffer.getFirst();
ByteBufferIOStream byteBufferIOStream2 = ByteBufferIOStream.this;
int i2 = byteBufferIOStream2.m_writePosition;
first[i2] = (byte) i;
int i3 = i2 + 1;
byteBufferIOStream2.m_writePosition = i3;
if (i3 == 4096) {
byteBufferIOStream2.m_writePosition = 0;
byteBufferIOStream2.m_availableSegment++;
}
}
}
}

View File

@@ -0,0 +1,24 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract class Component {
public void cleanup() {
}
public abstract String getComponentId();
public void restore() {
}
public void resume() {
}
public void setup() {
}
public void suspend() {
}
public void teardown() {
}
}

View File

@@ -0,0 +1,133 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.ListIterator;
import java.util.Map;
/* loaded from: classes2.dex */
class ComponentManager implements LogSource {
private Map<String, Component> m_components = new LinkedHashMap();
private Stage m_stage = Stage.CREATE;
public enum Stage {
CREATE,
SETUP,
READY,
SUSPEND
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "Component";
}
public Stage getStage() {
return this.m_stage;
}
public void registerComponent(Component component, String str) {
Log.Helper.LOGFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGF(this, "Cannot register component without valid componentId", new Object[0]);
return;
}
if (component == null) {
Log.Helper.LOGF(this, "Try to register invalid component with id: " + str, new Object[0]);
return;
}
Component component2 = this.m_components.get(str);
if (component2 == null) {
Log.Helper.LOGI(this, "Register module: " + str, new Object[0]);
} else {
Log.Helper.LOGI(this, "Register module(overwrite): " + str, new Object[0]);
}
this.m_components.put(str, component);
Stage stage = this.m_stage;
Stage stage2 = Stage.SETUP;
if (stage.compareTo(stage2) < 0) {
return;
}
if (component2 != null) {
if (this.m_stage.compareTo(stage2) >= 0) {
if (this.m_stage.compareTo(Stage.SUSPEND) >= 0) {
component2.resume();
}
component2.cleanup();
}
component2.teardown();
}
component.setup();
if (this.m_stage.compareTo(Stage.READY) >= 0) {
component.restore();
if (this.m_stage.compareTo(Stage.SUSPEND) >= 0) {
component.suspend();
}
}
}
public Component getComponent(String str) {
return this.m_components.get(str);
}
public Component[] getComponentList(String str) {
Log.Helper.LOGFUNC(this);
ArrayList arrayList = new ArrayList(this.m_components.size());
for (Map.Entry<String, Component> entry : this.m_components.entrySet()) {
if (entry.getKey().startsWith(str)) {
arrayList.add(entry.getValue());
}
}
return (Component[]) arrayList.toArray(new Component[arrayList.size()]);
}
public void setup() {
this.m_stage = Stage.SETUP;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().setup();
}
}
public void restore() {
this.m_stage = Stage.READY;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().restore();
}
}
public void suspend() {
ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size());
this.m_stage = Stage.SUSPEND;
while (listIterator.hasPrevious()) {
((Component) listIterator.previous()).suspend();
}
}
public void resume() {
this.m_stage = Stage.READY;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().resume();
}
}
public void cleanup() {
ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size());
this.m_stage = Stage.CREATE;
while (listIterator.hasPrevious()) {
((Component) listIterator.previous()).cleanup();
}
}
public void teardown() {
ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size());
this.m_stage = Stage.CREATE;
while (listIterator.hasPrevious()) {
((Component) listIterator.previous()).teardown();
}
}
}

View File

@@ -0,0 +1,11 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
class Constants {
public static final int CUSTOM_TAB_REQUEST_CODE = 100;
public static final int RESULT_ERROR = 10;
public static final String EXTRA_URL = Constants.class.getSimpleName() + ".url";
public static final String EXTRA_REDIRECT_URL = Constants.class.getSimpleName() + ".redirect_url";
public static final String EXTRA_ERROR = Constants.class.getSimpleName() + ".error";
public static final String CUSTOM_TAB_REDIRECT_ACTION = Constants.class.getSimpleName() + ".customTabRedirectAction";
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class CustomTabActivity$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,108 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsService;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public class CustomTabActivity extends Activity {
private static final String[] CHROME_PACKAGES = {"com.android.chrome", "com.chrome.beta", "com.chrome.dev"};
private static final String LOG_TAG = "NimbleCustomTabActivity";
private static String sCustomTabPackageNameToUse;
private boolean mShouldCloseCustomTab = true;
public static String getCustomTabsPackageToUse(Context context) {
List<ResolveInfo> queryIntentServices;
PackageManager.ResolveInfoFlags of;
String str = sCustomTabPackageNameToUse;
if (str != null) {
return str;
}
PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
if (Build.VERSION.SDK_INT >= 33) {
of = PackageManager.ResolveInfoFlags.of(0L);
queryIntentServices = packageManager.queryIntentServices(intent, of);
} else {
queryIntentServices = packageManager.queryIntentServices(intent, 0);
}
if (queryIntentServices != null) {
List asList = Arrays.asList(CHROME_PACKAGES);
Iterator<ResolveInfo> it = queryIntentServices.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ResolveInfo next = it.next();
ServiceInfo serviceInfo = next.serviceInfo;
if (serviceInfo != null && asList.contains(serviceInfo.packageName)) {
sCustomTabPackageNameToUse = next.serviceInfo.packageName;
break;
}
}
}
StringBuilder sb = new StringBuilder();
sb.append("CustomTabsPackageToUse : ");
sb.append(sCustomTabPackageNameToUse);
return sCustomTabPackageNameToUse;
}
public static boolean isCustomTabSupported(Context context) {
return getCustomTabsPackageToUse(context) != null;
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
String string = getIntent().getExtras().getString(Constants.EXTRA_URL, "");
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(WebView.getCustomTabServiceSession());
builder.setUrlBarHidingEnabled(true);
builder.setShareState(2);
CustomTabsIntent build = builder.build();
build.intent.setPackage(sCustomTabPackageNameToUse);
try {
StringBuilder sb = new StringBuilder();
sb.append("[onCreate] URL: ");
sb.append(string);
build.launchUrl(this, Uri.parse(string));
this.mShouldCloseCustomTab = false;
} catch (Exception e) {
System.out.println(e);
setResult(10, getIntent().putExtra(Constants.EXTRA_ERROR, e.getMessage()));
finish();
}
}
@Override // android.app.Activity
public void onResume() {
super.onResume();
if (this.mShouldCloseCustomTab) {
setResult(0);
finish();
}
this.mShouldCloseCustomTab = true;
}
@Override // android.app.Activity
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
StringBuilder sb = new StringBuilder();
sb.append("[onNewIntent] Action: ");
sb.append(intent.getAction());
if (Constants.CUSTOM_TAB_REDIRECT_ACTION.equals(intent.getAction())) {
setResult(-1, intent);
finish();
}
}
}

View File

@@ -0,0 +1,126 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/* loaded from: classes2.dex */
class Encryptor {
private static int ENCRYPTION_KEY_LENGTH = 256;
private static int ENCRYPTION_KEY_ROUND = 997;
private static final byte[] ENCRYPTOR_VERSION_1 = {78, 69, 86, 49};
private static final byte[] ENCRYPTOR_VERSION_2 = {78, 69, 86, 50};
private SecretKey getKeyV1(byte[] bArr) throws GeneralSecurityException {
try {
return new SecretKeySpec(SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1").generateSecret(new PBEKeySpec(ApplicationEnvironment.getComponent().getApplicationBundleId().toCharArray(), bArr, ENCRYPTION_KEY_ROUND, ENCRYPTION_KEY_LENGTH)).getEncoded(), "AES");
} catch (GeneralSecurityException e) {
Log.Helper.LOGFS(null, "Can't initialize Encryptor: " + e.toString(), new Object[0]);
throw e;
}
}
private SecretKey getKeyV2() throws GeneralSecurityException {
try {
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
return new SecretKeySpec(SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1").generateSecret(new PBEKeySpec(component.getAndroidId().toCharArray(), Utility.SHA256Hash(component.getApplicationBundleId()), ENCRYPTION_KEY_ROUND, ENCRYPTION_KEY_LENGTH)).getEncoded(), "AES");
} catch (GeneralSecurityException e) {
Log.Helper.LOGFS(null, "Can't initialize Encryptor: " + e.toString(), new Object[0]);
throw e;
}
}
public ObjectOutputStream encryptOutputStream(OutputStream outputStream) throws IOException, GeneralSecurityException {
SecretKey keyV2 = getKeyV2();
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(1, keyV2);
byte[] bArr = ENCRYPTOR_VERSION_2;
outputStream.write(bArr, 0, bArr.length);
byte[] iv = ((IvParameterSpec) cipher.getParameters().getParameterSpec(IvParameterSpec.class)).getIV();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
objectOutputStream.writeInt(iv.length);
objectOutputStream.write(iv, 0, iv.length);
objectOutputStream.flush();
return new ObjectOutputStream(new CipherOutputStream(outputStream, cipher));
}
public ObjectInputStream decryptInputStream(InputStream inputStream) throws IOException, GeneralSecurityException {
if (!inputStream.markSupported()) {
Log.Helper.LOGWS("Encryptor", "decryptInputStream() : InputStream doesn't support stream mark()", new Object[0]);
}
byte[] bArr = ENCRYPTOR_VERSION_2;
int length = bArr.length;
inputStream.mark(length);
byte[] bArr2 = new byte[length];
if (inputStream.read(bArr2, 0, length) < length || !Arrays.equals(bArr, bArr2)) {
inputStream.reset();
return decryptV1InputStream(inputStream);
}
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
int readInt = objectInputStream.readInt();
byte[] bArr3 = new byte[readInt];
objectInputStream.read(bArr3, 0, readInt);
SecretKey keyV2 = getKeyV2();
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(2, keyV2, new IvParameterSpec(bArr3));
return new ObjectInputStream(new CipherInputStream(inputStream, cipher));
}
private ObjectInputStream decryptV1InputStream(InputStream inputStream) throws IOException, GeneralSecurityException {
byte[] bArr = ENCRYPTOR_VERSION_1;
int length = bArr.length;
inputStream.mark(length);
byte[] bArr2 = new byte[length];
if (inputStream.read(bArr2, 0, length) < length || !Arrays.equals(bArr, bArr2)) {
inputStream.reset();
return decryptLegacyInputStream(inputStream);
}
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
int readInt = objectInputStream.readInt();
byte[] bArr3 = new byte[readInt];
objectInputStream.read(bArr3, 0, readInt);
int readInt2 = objectInputStream.readInt();
byte[] bArr4 = new byte[readInt2];
objectInputStream.read(bArr4, 0, readInt2);
SecretKey keyV1 = getKeyV1(bArr3);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(2, keyV1, new IvParameterSpec(bArr4));
return new ObjectInputStream(new CipherInputStream(inputStream, cipher));
}
private ObjectInputStream decryptLegacyInputStream(InputStream inputStream) throws IOException, GeneralSecurityException {
String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId();
byte[] bytes = "02:00:00:00:00:00".getBytes();
byte[] bArr = new byte[8];
int i = 0;
int i2 = 0;
while (i < 8) {
int i3 = i2 + 1;
if (i3 % 3 == 0) {
i2 = i3;
}
bArr[i] = bytes[i2];
i++;
i2++;
}
SecretKey generateSecret = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(applicationBundleId.toCharArray(), bArr, ENCRYPTION_KEY_ROUND, ENCRYPTION_KEY_LENGTH));
PBEParameterSpec pBEParameterSpec = new PBEParameterSpec(bArr, ENCRYPTION_KEY_ROUND);
Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
cipher.init(2, generateSecret, pBEParameterSpec);
return new ObjectInputStream(new CipherInputStream(inputStream, cipher));
}
}

View File

@@ -0,0 +1,330 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
class EnvironmentDataContainer implements ISynergyEnvironment, Externalizable, LogSource {
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_OK = 0;
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_RECOMMENDED = 1;
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_REQUIRED = 2;
private String m_eaDeviceId;
private Long m_lastDirectorResponseTimestamp;
private Map<String, String> m_serverUrls;
private String m_synergyAnonymousId;
private Map<String, String> m_overrideUrls = new HashMap();
private Map<String, Object> m_getDirectionResponseDictionary = new HashMap();
private String m_applicationLanguageCode = "en";
public Map<String, Object> getGetDirectionResponseDictionary() {
return this.m_getDirectionResponseDictionary;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyEnv";
}
public Map<String, String> getServerUrls() {
return this.m_serverUrls;
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getEADeviceId() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_eaDeviceId;
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSynergyId() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_synergyAnonymousId;
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSellId() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get(SynergyCatalog.MTX_INFO_KEY_SELLID);
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getProductId() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get(InAppPurchaseMetaData.KEY_PRODUCT_ID);
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getEAHardwareId() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("hwId");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientId() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("clientId");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientSecret() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("clientSecret");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getGosMdmAppKey() {
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("mdmAppKey");
}
@Override // com.ea.nimble.ISynergyEnvironment
public Error setServerUrl(String str, String str2) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "Provided override URL key is not a valid string, unable to set URL", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Provided override URL key is not a valid string, unable to set URL");
}
if (!Utility.validString(str2)) {
Log.Helper.LOGD(this, "Empty or null value provided for key \"" + str + "\", removing key from map", new Object[0]);
if (this.m_overrideUrls.remove(str) != null) {
return null;
}
Log.Helper.LOGW(this, "No matching key found in override URLs", new Object[0]);
return null;
}
this.m_overrideUrls.put(str, str2);
Log.Helper.LOGD(this, "Successfully set Override URL pair: (%s,%s)", str, this.m_overrideUrls.get(str));
return null;
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getServerUrlWithKey(String str) {
Log.Helper.LOGPUBLICFUNC(this);
String str2 = this.m_overrideUrls.get(str);
return str2 != null ? str2 : this.m_serverUrls.get(str);
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) {
Log.Helper.LOGPUBLICFUNC(this);
return SynergyEnvironment.getComponent().getSynergyDirectorServerUrl(nimbleConfiguration);
}
@Override // com.ea.nimble.ISynergyEnvironment
public int getLatestAppVersionCheckResult() {
int parseInt;
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty()) {
return -1;
}
Object obj = this.m_getDirectionResponseDictionary.get("appUpgrade");
if (obj instanceof Integer) {
parseInt = ((Integer) obj).intValue();
} else {
parseInt = obj instanceof String ? Integer.parseInt((String) obj) : 0;
}
if (parseInt == 0) {
return 0;
}
int i = 1;
if (parseInt != 1) {
i = 2;
if (parseInt != 2) {
return 0;
}
}
return i;
}
@Override // com.ea.nimble.ISynergyEnvironment
public int getTrackingPostInterval() {
Integer num;
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || map.isEmpty() || (num = (Integer) this.m_getDirectionResponseDictionary.get("telemetryFreq")) == null) {
return -1;
}
return num.intValue();
}
public void setGetDirectionResponseDictionary(Map<String, Object> map) {
Log.Helper.LOGFUNC(this);
if (map != null) {
map.put(SynergyCatalog.MTX_INFO_KEY_SELLID, ((Integer) map.get(SynergyCatalog.MTX_INFO_KEY_SELLID)).toString());
map.put(InAppPurchaseMetaData.KEY_PRODUCT_ID, ((Integer) map.get(InAppPurchaseMetaData.KEY_PRODUCT_ID)).toString());
map.put("hwId", ((Integer) map.get("hwId")).toString());
this.m_getDirectionResponseDictionary = map;
return;
}
this.m_getDirectionResponseDictionary = new HashMap();
}
public void setServerUrls(Map<String, String> map) {
Log.Helper.LOGFUNC(this);
this.m_serverUrls = map;
}
public void setEADeviceId(String str) {
Log.Helper.LOGFUNC(this);
this.m_eaDeviceId = str;
}
public String getSynergyAnonymousId() {
Log.Helper.LOGFUNC(this);
return this.m_synergyAnonymousId;
}
public void setSynergyAnonymousId(String str) {
Log.Helper.LOGFUNC(this);
this.m_synergyAnonymousId = str;
}
public Long getMostRecentDirectorResponseTimestamp() {
Log.Helper.LOGFUNC(this);
return this.m_lastDirectorResponseTimestamp;
}
public void setMostRecentDirectorResponseTimestamp(Long l) {
Log.Helper.LOGFUNC(this);
this.m_lastDirectorResponseTimestamp = l;
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
Map<String, Object> map = (Map) objectInput.readObject();
this.m_getDirectionResponseDictionary = map;
if (map.isEmpty()) {
this.m_getDirectionResponseDictionary = null;
}
Map<String, String> map2 = (Map) objectInput.readObject();
this.m_serverUrls = map2;
if (map2.isEmpty()) {
this.m_serverUrls = null;
}
String str = (String) objectInput.readObject();
this.m_eaDeviceId = str;
if (str.length() == 0) {
this.m_eaDeviceId = null;
}
String str2 = (String) objectInput.readObject();
this.m_synergyAnonymousId = str2;
if (str2.length() == 0) {
this.m_synergyAnonymousId = null;
}
Long valueOf = Long.valueOf(objectInput.readLong());
this.m_lastDirectorResponseTimestamp = valueOf;
if (valueOf.longValue() == 0) {
this.m_lastDirectorResponseTimestamp = null;
}
String str3 = (String) objectInput.readObject();
this.m_applicationLanguageCode = str3;
if (str3.length() == 0) {
this.m_applicationLanguageCode = null;
}
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
Object obj = this.m_getDirectionResponseDictionary;
if (obj == null) {
obj = new HashMap();
}
objectOutput.writeObject(obj);
Object obj2 = this.m_serverUrls;
if (obj2 == null) {
obj2 = new HashMap();
}
objectOutput.writeObject(obj2);
String str = this.m_eaDeviceId;
if (str == null) {
str = "";
}
objectOutput.writeObject(str);
String str2 = this.m_synergyAnonymousId;
if (str2 == null) {
str2 = "";
}
objectOutput.writeObject(str2);
Long l = this.m_lastDirectorResponseTimestamp;
objectOutput.writeLong(l == null ? 0L : l.longValue());
String str3 = this.m_applicationLanguageCode;
objectOutput.writeObject(str3 != null ? str3 : "");
}
/* JADX WARN: Removed duplicated region for block: B:48:0x0167 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:50:0x0168 A[RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public java.util.Set<java.lang.String> getKeysOfDifferences(com.ea.nimble.ISynergyEnvironment r13) {
/*
Method dump skipped, instructions count: 362
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.EnvironmentDataContainer.getKeysOfDifferences(com.ea.nimble.ISynergyEnvironment):java.util.Set");
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isDataAvailable() {
Log.Helper.LOGPUBLICFUNC(this);
return true;
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isUpdateInProgress() {
Log.Helper.LOGPUBLICFUNC(this);
return false;
}
@Override // com.ea.nimble.ISynergyEnvironment
public Error checkAndInitiateSynergyEnvironmentUpdate() {
Log.Helper.LOGPUBLICFUNC(this);
return null;
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isFeatureDisabled(String str) {
List list;
Log.Helper.LOGPUBLICFUNC(this);
Map<String, Object> map = this.m_getDirectionResponseDictionary;
if (map == null || (list = (List) map.get("disabledFeatures")) == null) {
return false;
}
return list.contains(str);
}
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class Error$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,192 @@
package com.ea.nimble;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.PrintWriter;
import java.io.StringWriter;
/* loaded from: classes2.dex */
public class Error extends Exception implements Parcelable, Externalizable {
public static final Parcelable.Creator<Error> CREATOR = new Parcelable.Creator<Error>() { // from class: com.ea.nimble.Error.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Error createFromParcel(Parcel parcel) {
return new Error(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Error[] newArray(int i) {
return new Error[i];
}
};
public static final String ERROR_DOMAIN = "NimbleError";
private static final long serialVersionUID = 1;
private int m_code;
private String m_domain;
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public int getCode() {
return this.m_code;
}
public String getDomain() {
return this.m_domain;
}
public enum Code {
UNKNOWN(0),
SYSTEM_UNEXPECTED(100),
NOT_READY(101),
UNSUPPORTED(102),
NOT_AVAILABLE(103),
NOT_IMPLEMENTED(104),
INVALID_ARGUMENT(300),
MISSING_CALLBACK(301),
NETWORK_UNSUPPORTED_CONNECTION_TYPE(1001),
NETWORK_NO_CONNECTION(1002),
NETWORK_UNREACHABLE(1003),
NETWORK_OVERSIZE_DATA(1004),
NETWORK_OPERATION_CANCELLED(1005),
NETWORK_INVALID_SERVER_RESPONSE(1006),
NETWORK_TIMEOUT(1007),
NETWORK_CONNECTION_ERROR(1010),
SYNERGY_SERVER_FULL(2001),
SYNERGY_GET_DIRECTION_TIMEOUT(2002),
SYNERGY_GET_EA_DEVICE_ID_FAILURE(2003),
SYNERGY_VALIDATE_EA_DEVICE_ID_FAILURE(2004),
SYNERGY_GET_ANONYMOUS_ID_FAILURE(2005),
SYNERGY_ENVIRONMENT_UPDATE_FAILURE(2006),
SYNERGY_PURCHASE_VERIFICATION_FAILURE(2007),
SYNERGY_GET_NONCE_FAILURE(2008),
SYNERGY_GET_AGE_COMPLIANCE_FAILURE(2009);
private final int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public Error(String str, int i, String str2, Throwable th) {
super(str2, th);
this.m_domain = str;
this.m_code = i;
}
public Error(String str, int i, String str2) {
this(str, i, str2, null);
}
public Error(Code code, String str, Throwable th) {
this(ERROR_DOMAIN, code.intValue(), str, th);
}
public Error(Code code, String str) {
this(code, str, (Throwable) null);
}
public Error() {
}
public boolean isError(Code code) {
return this.m_code == code.intValue();
}
@Override // java.lang.Throwable
public String toString() {
StringBuilder sb = new StringBuilder();
String str = this.m_domain;
if (str != null && str.length() > 0) {
sb.append(this.m_domain);
sb.append("(");
} else {
sb.append("Error");
sb.append("(");
}
sb.append(this.m_code);
sb.append(")");
String localizedMessage = getLocalizedMessage();
if (localizedMessage != null && localizedMessage.length() > 0) {
sb.append(": ");
sb.append(localizedMessage);
}
Throwable cause = getCause();
if (cause != null) {
sb.append("\nCaused by: ");
StringWriter stringWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stringWriter));
sb.append(stringWriter);
} else {
sb.append("\nCaused by: null");
}
return sb.toString();
}
public Error(Parcel parcel) {
readFromParcel(parcel);
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
String str = this.m_domain;
if (str != null && str.length() > 0) {
parcel.writeString(this.m_domain);
} else {
parcel.writeString("");
}
parcel.writeInt(this.m_code);
Throwable cause = getCause();
if (cause != null) {
parcel.writeSerializable(cause);
} else {
parcel.writeSerializable("");
}
}
public void readFromParcel(Parcel parcel) {
Throwable th;
Object readSerializable;
this.m_domain = parcel.readString();
this.m_code = parcel.readInt();
if (Build.VERSION.SDK_INT >= 33) {
readSerializable = parcel.readSerializable(null, Throwable.class);
th = (Throwable) readSerializable;
} else {
th = (Throwable) parcel.readSerializable();
}
initCause(th);
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
this.m_domain = objectInput.readUTF();
this.m_code = objectInput.readInt();
initCause((Throwable) objectInput.readObject());
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
String str = this.m_domain;
if (str != null && str.length() > 0) {
objectOutput.writeUTF(this.m_domain);
} else {
objectOutput.writeUTF("");
}
objectOutput.writeInt(this.m_code);
objectOutput.writeObject(getCause());
}
}

View File

@@ -0,0 +1,38 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class Global {
public static final String NIMBLE_AUTHENTICATOR_ANONYMOUS = "anonymous";
public static final String NIMBLE_AUTHENTICATOR_FACEBOOK = "facebook";
public static final String NIMBLE_AUTHENTICATOR_ORIGIN = "origin";
public static final String NIMBLE_DOMAIN = "com.ea.nimble";
public static final String NIMBLE_ID = "Nimble";
public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID = "authenticatorId";
public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_PIDMAP_ID = "pidMapId";
public static final String NIMBLE_NOTIFICATION_AGE_COMPLIANCE_DOB_UPDATE = "nimble.notification.ageCompliance.dobUpdate";
public static final String NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE = "nimble.notification.attributionDataAvailable";
public static final String NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE = "nimble.notification.identity.authentication.update";
public static final String NIMBLE_NOTIFICATION_IDENTITY_MAIN_AUTHENTICATOR_CHANGE = "nimble.notification.identity.main.authenticator.change";
public static final String NIMBLE_NOTIFICATION_IDENTITY_PERSONA_INFO_UPDATE = "nimble.notification.identity.authenticator.persona.info.update";
public static final String NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE = "nimble.notification.identity.authenticator.pid.info.update";
public static final String NIMBLE_NOTIFICATION_IDENTITY_STOP_PROCESS_STATUS_UPDATE = "nimble.notification.identity.stopProcessStatusUpdate";
public static final String NIMBLE_NOTIFICATION_IDENTITY_USER_INFO_UPDATE = "nimble.notification.identity.authenticator.user.info.update";
public static final String NIMBLE_NOTIFICATION_PLAYERIDMAP_CHANGE = "nimble.notification.playerIdMapChange";
public static final String NIMBLE_RELEASE_VERSION = "1.63.0.2";
public static final String NIMBLE_SDK_VERSION = "1.63.0.2.0923";
public static final String NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY = "com.ea.nimble.pushtng.channel.description";
public static final String NOTIFICATION_CHANNEL_DEFAULT_ID = "nimble_default";
public static final String NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY = "com.ea.nimble.pushtng.channel.name";
public static final String NOTIFICATION_CHANNEL_DEFAULT_NAME_VALUE = "Default";
public static final String NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY = "com.ea.nimble.NimbleLocalNotifications.channel.id";
public static final String NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY = "com.ea.nimble.pushtng.channel.id";
public static final String NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED = "nimble.notification.componentIndependentSetupFinished";
public static final String NOTIFICATION_DICTIONARY_KEY_DETAIL_ERROR = "detailError";
public static final String NOTIFICATION_DICTIONARY_KEY_ERROR = "error";
public static final String NOTIFICATION_DICTIONARY_KEY_RESULT = "result";
public static final String NOTIFICATION_DICTIONARY_RESULT_FAIL = "0";
public static final String NOTIFICATION_DICTIONARY_RESULT_SUCCESS = "1";
public static final String NOTIFICATION_LANGUAGE_CHANGE = "nimble.notification.languageChange";
public static final String NOTIFICATION_LOGIN_STATUS_CHANGE = "nimble.notification.loginStatusChange";
public static final String NOTIFICATION_NETWORK_STATUS_CHANGE = "nimble.notification.networkStatusChange";
}

View File

@@ -0,0 +1,15 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class HttpError extends Error {
public static final String ERROR_DOMAIN = "HttpError";
private static final long serialVersionUID = 1;
public HttpError(int i, String str, Throwable th) {
super(ERROR_DOMAIN, i, str, th);
}
public HttpError(int i, String str) {
super(ERROR_DOMAIN, i, str, null);
}
}

View File

@@ -0,0 +1,75 @@
package com.ea.nimble;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.util.HashMap;
/* loaded from: classes2.dex */
public class HttpRequest implements IHttpRequest {
private static int DEFAULT_NETWORK_TIMEOUT = 30;
public ByteArrayOutputStream data;
public HashMap<String, String> headers;
public IHttpRequest.Method method;
public boolean runInBackground;
public String targetFilePath;
public double timeout;
public URL url;
public HttpRequest() {
this.url = null;
this.method = IHttpRequest.Method.GET;
this.data = new ByteArrayOutputStream();
this.headers = new HashMap<>();
this.timeout = DEFAULT_NETWORK_TIMEOUT;
this.targetFilePath = null;
}
public HttpRequest(URL url) {
this();
this.url = url;
}
@Override // com.ea.nimble.IHttpRequest
public URL getUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.url;
}
@Override // com.ea.nimble.IHttpRequest
public IHttpRequest.Method getMethod() {
Log.Helper.LOGPUBLICFUNC(this);
return this.method;
}
@Override // com.ea.nimble.IHttpRequest
public byte[] getData() {
Log.Helper.LOGPUBLICFUNC(this);
return this.data.toByteArray();
}
@Override // com.ea.nimble.IHttpRequest
public HashMap<String, String> getHeaders() {
Log.Helper.LOGPUBLICFUNC(this);
return this.headers;
}
@Override // com.ea.nimble.IHttpRequest
public double getTimeout() {
Log.Helper.LOGPUBLICFUNC(this);
return this.timeout;
}
@Override // com.ea.nimble.IHttpRequest
public String getTargetFilePath() {
Log.Helper.LOGPUBLICFUNC(this);
return this.targetFilePath;
}
@Override // com.ea.nimble.IHttpRequest
public boolean getRunInBackground() {
Log.Helper.LOGPUBLICFUNC(this);
return this.runInBackground;
}
}

View File

@@ -0,0 +1,82 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import java.io.InputStream;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class HttpResponse implements IHttpResponse {
public Exception error;
public URL url = null;
public boolean isCompleted = false;
public int statusCode = 0;
public HashMap<String, String> headers = new HashMap<>();
public long expectedContentLength = 0;
public long downloadedContentLength = 0;
public long lastModified = -1;
public ByteBufferIOStream data = new ByteBufferIOStream();
@Override // com.ea.nimble.IHttpResponse
public boolean isCompleted() {
Log.Helper.LOGPUBLICFUNC(this);
return this.isCompleted;
}
@Override // com.ea.nimble.IHttpResponse
public URL getUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.url;
}
@Override // com.ea.nimble.IHttpResponse
public int getStatusCode() {
Log.Helper.LOGPUBLICFUNC(this);
return this.statusCode;
}
@Override // com.ea.nimble.IHttpResponse
public Map<String, String> getHeaders() {
Log.Helper.LOGPUBLICFUNC(this);
return this.headers;
}
@Override // com.ea.nimble.IHttpResponse
public long getExpectedContentLength() {
Log.Helper.LOGPUBLICFUNC(this);
return this.expectedContentLength;
}
@Override // com.ea.nimble.IHttpResponse
public long getDownloadedContentLength() {
Log.Helper.LOGPUBLICFUNC(this);
return this.downloadedContentLength;
}
@Override // com.ea.nimble.IHttpResponse
public Date getLastModified() {
Log.Helper.LOGPUBLICFUNC(this);
long j = this.lastModified;
if (j == 0) {
return new Date();
}
if (j > 0) {
return new Date(this.lastModified);
}
return null;
}
@Override // com.ea.nimble.IHttpResponse
public InputStream getDataStream() {
Log.Helper.LOGPUBLICFUNC(this);
return this.data.getInputStream();
}
@Override // com.ea.nimble.IHttpResponse
public Exception getError() {
Log.Helper.LOGPUBLICFUNC(this);
return this.error;
}
}

View File

@@ -0,0 +1,87 @@
package com.ea.nimble;
import android.content.Context;
import java.util.Map;
/* loaded from: classes2.dex */
public interface IApplicationEnvironment {
public static final String UNAVAILABLE_ADVERTISING_ID = "";
public interface AdvertisingIdCalback {
void onCallback(String str, boolean z);
}
public interface IntegrityTokenCallback {
void onCallback(String str, Error error);
}
String getAdvertisingId();
int getAgeCompliance();
String getAndroidId();
String getApplicationBundleId();
Context getApplicationContext();
String getApplicationLanguageCode();
String getApplicationName();
String getApplicationVersion();
String getCachePath();
String getCarrier();
String getCurrencyCode();
String getDeviceBrand();
String getDeviceCodename();
String getDeviceFingerprint();
String getDeviceManufacturer();
String getDeviceModel();
String getDeviceString();
String getDocumentPath();
String getGameSpecifiedPlayerId();
String getGoogleAdvertisingId();
boolean getIadAttribution();
String getOsVersion();
String getParameter(String str);
Map<String, String> getPlayerIdMap();
String getShortApplicationLanguageCode();
String getTempPath();
boolean isAppCracked();
boolean isDeviceRooted();
boolean isLimitAdTrackingEnabled();
void refreshAgeCompliance();
void requestIntegrityToken(String str, IntegrityTokenCallback integrityTokenCallback);
void retrieveAdvertisingId(AdvertisingIdCalback advertisingIdCalback);
void setApplicationLanguageCode(String str);
void setGameSpecifiedPlayerId(String str);
void setPlayerId(String str, String str2);
}

View File

@@ -0,0 +1,134 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes2.dex */
public interface IApplicationLifecycle {
public interface ActivityEventCallbacks {
void onActivityResult(Activity activity, int i, int i2, Intent intent);
boolean onBackPressed();
void onNewIntent(Activity activity, Intent intent);
void onWindowFocusChanged(boolean z);
}
public static class ActivityEventHandler implements ActivityEventCallbacks {
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
public boolean onBackPressed() {
return true;
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
public void onNewIntent(Activity activity, Intent intent) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
public void onWindowFocusChanged(boolean z) {
}
}
public interface ActivityLifecycleCallbacks {
void onActivityCreated(Activity activity, Bundle bundle);
void onActivityDestroyed(Activity activity);
void onActivityPaused(Activity activity);
void onActivityResumed(Activity activity);
void onActivitySaveInstanceState(Activity activity, Bundle bundle);
void onActivityStarted(Activity activity);
void onActivityStopped(Activity activity);
}
public static class ActivityLifecycleHandler implements ActivityLifecycleCallbacks {
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
}
}
public interface ApplicationLifecycleCallbacks {
void onApplicationLaunch(Intent intent);
void onApplicationQuit();
void onApplicationResume();
void onApplicationSuspend();
}
boolean handleBackPressed();
void notifyActivityCreate(Bundle bundle, Activity activity);
void notifyActivityDestroy(Activity activity);
void notifyActivityOnNewIntent(Intent intent, Activity activity);
void notifyActivityPause(Activity activity);
void notifyActivityRestart(Activity activity);
void notifyActivityRestoreInstanceState(Bundle bundle, Activity activity);
void notifyActivityResult(int i, int i2, Intent intent, Activity activity);
void notifyActivityResume(Activity activity);
void notifyActivityRetainNonConfigurationInstance();
void notifyActivitySaveInstanceState(Bundle bundle, Activity activity);
void notifyActivityStart(Activity activity);
void notifyActivityStop(Activity activity);
void notifyActivityWindowFocusChanged(boolean z, Activity activity);
void registerActivityEventCallbacks(ActivityEventCallbacks activityEventCallbacks);
void registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks activityLifecycleCallbacks);
void registerApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks applicationLifecycleCallbacks);
void unregisterActivityEventCallbacks(ActivityEventCallbacks activityEventCallbacks);
void unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks activityLifecycleCallbacks);
void unregisterApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks applicationLifecycleCallbacks);
}

View File

@@ -0,0 +1,84 @@
package com.ea.nimble;
import java.net.URL;
import java.util.Map;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpPut;
/* loaded from: classes2.dex */
public interface IHttpRequest {
byte[] getData();
Map<String, String> getHeaders();
Method getMethod();
boolean getRunInBackground();
String getTargetFilePath();
double getTimeout();
URL getUrl();
/* renamed from: com.ea.nimble.IHttpRequest$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$IHttpRequest$Method;
static {
int[] iArr = new int[Method.values().length];
$SwitchMap$com$ea$nimble$IHttpRequest$Method = iArr;
try {
iArr[Method.GET.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$IHttpRequest$Method[Method.HEAD.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$IHttpRequest$Method[Method.POST.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$IHttpRequest$Method[Method.PUT.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$IHttpRequest$Method[Method.DELETE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
public enum Method {
GET,
HEAD,
POST,
PUT,
DELETE,
UNRECOGNIZED;
@Override // java.lang.Enum
public String toString() {
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$IHttpRequest$Method[ordinal()];
if (i == 1) {
return "GET";
}
if (i == 2) {
return HttpHead.METHOD_NAME;
}
if (i == 3) {
return "POST";
}
if (i == 4) {
return HttpPut.METHOD_NAME;
}
if (i != 5) {
return null;
}
return HttpDelete.METHOD_NAME;
}
}
}

View File

@@ -0,0 +1,27 @@
package com.ea.nimble;
import java.io.InputStream;
import java.net.URL;
import java.util.Date;
import java.util.Map;
/* loaded from: classes2.dex */
public interface IHttpResponse {
InputStream getDataStream();
long getDownloadedContentLength();
Exception getError();
long getExpectedContentLength();
Map<String, String> getHeaders();
Date getLastModified();
int getStatusCode();
URL getUrl();
boolean isCompleted();
}

View File

@@ -0,0 +1,21 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface ILog {
public interface LogCallback {
void callback(int i, String str, String str2);
}
String getLogFilePath();
int getThresholdLevel();
void setLogCallback(LogCallback logCallback);
void setThresholdLevel(int i);
void writeWithSource(int i, Object obj, String str, Object... objArr);
void writeWithTitle(int i, String str, String str2, Object... objArr);
}

View File

@@ -0,0 +1,24 @@
package com.ea.nimble;
import com.ea.nimble.Network;
import java.net.URL;
import java.util.HashMap;
/* loaded from: classes2.dex */
public interface INetwork {
void forceRedetectNetworkStatus();
Network.Status getStatus();
boolean isNetworkWifi();
NetworkConnectionHandle sendDeleteRequest(URL url, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback);
NetworkConnectionHandle sendGetRequest(URL url, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback);
NetworkConnectionHandle sendPostRequest(URL url, HashMap<String, String> hashMap, byte[] bArr, NetworkConnectionCallback networkConnectionCallback);
NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback);
NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback, IOperationalTelemetryDispatch iOperationalTelemetryDispatch);
}

View File

@@ -0,0 +1,8 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface INimbleBadgeProvider {
int getBadgeCount();
Error setBadgeCount(int i, String str, String str2);
}

View File

@@ -0,0 +1,12 @@
package com.ea.nimble;
import android.app.Notification;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
/* loaded from: classes2.dex */
public interface INimbleLocalNotificationCustomizer {
void customizeLocalNotification(Notification.Builder builder, Bundle bundle);
void customizeLocalNotification(NotificationCompat.Builder builder, Bundle bundle);
}

View File

@@ -0,0 +1,27 @@
package com.ea.nimble;
import java.util.Date;
import java.util.Map;
/* loaded from: classes2.dex */
public interface INimbleLocalNotifications {
void cancelAllNotifications();
void cancelNotification(String str);
int getBadgeCount();
boolean isEnabled();
Error scheduleNotification(String str, String str2, String str3, Date date);
Error scheduleNotification(String str, String str2, String str3, Date date, Map<String, String> map);
Error setBadgeCount(int i, String str, String str2);
void setBadgeProvider(INimbleBadgeProvider iNimbleBadgeProvider);
void setCustomizer(INimbleLocalNotificationCustomizer iNimbleLocalNotificationCustomizer);
void setEnabled(boolean z);
}

View File

@@ -0,0 +1,19 @@
package com.ea.nimble;
import java.util.List;
/* loaded from: classes2.dex */
public interface IOperationalTelemetryDispatch {
public static final String EVENTTYPE_NETWORK_METRICS = "com.ea.nimble.network";
public static final String EVENTTYPE_TRACKING_SYNERGY_PAYLOADS = "com.ea.nimble.trackingimpl.synergy";
public static final int NIMBLE_DEFAULT_MAX_OT_EVENT_COUNT = 100;
public static final String NOTIFICATION_OT_EVENT_THRESHOLD_WARNING = "nimble.notification.ot.eventthresholdwarning";
List<OperationalTelemetryEvent> getEvents(String str);
int getMaxEventCount(String str);
void logEvent(String str, String str2);
void setMaxEventCount(String str, int i);
}

View File

@@ -0,0 +1,17 @@
package com.ea.nimble;
import com.ea.nimble.Persistence;
import com.ea.nimble.PersistenceService;
/* loaded from: classes2.dex */
public interface IPersistenceService {
void cleanPersistenceReference(String str, Persistence.Storage storage);
Persistence getPersistence(String str, Persistence.Storage storage);
void migratePersistence(String str, Persistence.Storage storage, String str2, PersistenceService.PersistenceMergePolicy persistenceMergePolicy);
void removePersistence(String str, Persistence.Storage storage);
void wipeAllDataAndForceTerminate();
}

View File

@@ -0,0 +1,46 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface ISynergyEnvironment {
public static final int NETWORK_CONNECTION_NONE = 1;
public static final int NETWORK_CONNECTION_UNKNOWN = 0;
public static final int NETWORK_CONNECTION_WIFI = 2;
public static final int NETWORK_CONNECTION_WIRELESS = 3;
public static final int SYNERGY_APP_VERSION_OK = 0;
public static final int SYNERGY_APP_VERSION_UPDATE_RECOMMENDED = 1;
public static final int SYNERGY_APP_VERSION_UPDATE_REQUIRED = 2;
Error checkAndInitiateSynergyEnvironmentUpdate();
String getEADeviceId();
String getEAHardwareId();
String getGosMdmAppKey();
int getLatestAppVersionCheckResult();
String getNexusClientId();
String getNexusClientSecret();
String getProductId();
String getSellId();
String getServerUrlWithKey(String str);
String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration);
String getSynergyId();
int getTrackingPostInterval();
boolean isDataAvailable();
boolean isFeatureDisabled(String str);
boolean isUpdateInProgress();
Error setServerUrl(String str, String str2);
}

View File

@@ -0,0 +1,12 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface ISynergyIdManager {
String getAnonymousSynergyId();
String getSynergyId();
SynergyIdManagerError login(String str, String str2);
SynergyIdManagerError logout(String str);
}

View File

@@ -0,0 +1,15 @@
package com.ea.nimble;
import com.ea.nimble.ISynergyRequest;
import java.util.Map;
/* loaded from: classes2.dex */
public interface ISynergyNetwork {
SynergyNetworkConnectionHandle sendGetRequest(String str, String str2, Map<String, String> map, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map<String, String> map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map<String, String> map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback, Map<String, String> map2);
void sendRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
}

View File

@@ -0,0 +1,23 @@
package com.ea.nimble;
import java.util.Map;
/* loaded from: classes2.dex */
public interface ISynergyRequest {
public interface IJsonData {
Object getData();
int size();
}
String getApi();
String getBaseUrl();
IHttpRequest getHttpRequest();
IJsonData getJsonData();
Map<String, String> getUrlParameters();
}

View File

@@ -0,0 +1,14 @@
package com.ea.nimble;
import java.util.Map;
/* loaded from: classes2.dex */
public interface ISynergyResponse {
Exception getError();
IHttpResponse getHttpResponse();
Map<String, Object> getJsonData();
boolean isCompleted();
}

View File

@@ -0,0 +1,117 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class Log {
public static final String COMPONENT_ID = "com.ea.nimble.NimbleLog";
public static final int LEVEL_ALL = 0;
public static final int LEVEL_DEBUG = 200;
public static final int LEVEL_ERROR = 500;
public static final int LEVEL_FATAL = 600;
public static final int LEVEL_INFO = 300;
public static final int LEVEL_SILENT = 700;
public static final int LEVEL_VERBOSE = 100;
public static final int LEVEL_WARN = 400;
private static ILog s_instance;
public static class Helper {
public static void LOGV(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(100, obj, str, objArr);
}
public static void LOGD(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(200, obj, str, objArr);
}
public static void LOGI(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(300, obj, str, objArr);
}
public static void LOGW(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(400, obj, str, objArr);
}
public static void LOGE(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(500, obj, str, objArr);
}
public static void LOGF(Object obj, String str, Object... objArr) {
Log.getComponent().writeWithSource(600, obj, str, objArr);
}
public static void LOGVS(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(100, str, str2, objArr);
}
public static void LOGDS(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(200, str, str2, objArr);
}
public static void LOGIS(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(300, str, str2, objArr);
}
public static void LOGWS(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(400, str, str2, objArr);
}
public static void LOGES(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(500, str, str2, objArr);
}
public static void LOGFS(String str, String str2, Object... objArr) {
Log.getComponent().writeWithTitle(600, str, str2, objArr);
}
public static void LOG(int i, String str, Object... objArr) {
Log.getComponent().writeWithTitle(i, null, str, objArr);
}
private static String getMethodString() {
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[4];
return stackTraceElement.getMethodName() + " [Line " + stackTraceElement.getLineNumber() + "] called...";
}
public static void LOGFUNC(Object obj) {
ILog component = Log.getComponent();
if (component.getThresholdLevel() <= 0) {
component.writeWithSource(0, obj, getMethodString(), new Object[0]);
}
}
public static void LOGPUBLICFUNC(Object obj) {
ILog component = Log.getComponent();
if (component.getThresholdLevel() <= 100) {
component.writeWithSource(100, obj, getMethodString(), new Object[0]);
}
}
public static void LOGFUNCS(String str) {
ILog component = Log.getComponent();
if (component.getThresholdLevel() <= 0) {
component.writeWithTitle(0, str, getMethodString(), new Object[0]);
}
}
public static void LOGPUBLICFUNCS(String str) {
ILog component = Log.getComponent();
if (component.getThresholdLevel() <= 100) {
component.writeWithTitle(100, str, getMethodString(), new Object[0]);
}
}
}
public static synchronized ILog getComponent() {
ILog iLog;
synchronized (Log.class) {
try {
if (s_instance == null) {
s_instance = new LogImpl();
}
iLog = s_instance;
} catch (Throwable th) {
throw th;
}
}
return iLog;
}
}

View File

@@ -0,0 +1,465 @@
package com.ea.nimble;
import android.content.pm.PackageInfo;
import android.os.Environment;
import android.support.v4.media.session.PlaybackStateCompat;
import androidx.core.app.NotificationCompat;
import com.ea.nimble.ILog;
import com.ironsource.u3;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
/* loaded from: classes2.dex */
public class LogImpl extends Component implements ILog {
private static final int DEFAULT_CHECK_INTERVAL = 3600;
private static final int DEFAULT_CONSOLE_OUTPUT_LIMIT = 4000;
private static final int DEFAULT_MESSAGE_LENGTH_LIMIT = 1000;
private static final int DEFAULT_SIZE_LIMIT = 1024;
private int m_messageLengthLimit;
private int m_sizeLimit;
private BaseCore m_core = null;
private int m_level = 0;
private File m_filePath = null;
private FileOutputStream m_logFileStream = null;
private DateFormat m_format = null;
private Timer m_guardTimer = null;
private int m_interval = 0;
private ArrayList<LogRecord> m_cache = new ArrayList<>();
private ILog.LogCallback m_callback = null;
public void disconnectFromCore() {
this.m_core = null;
}
@Override // com.ea.nimble.Component
public String getComponentId() {
return Log.COMPONENT_ID;
}
@Override // com.ea.nimble.ILog
public int getThresholdLevel() {
return this.m_level;
}
@Override // com.ea.nimble.ILog
public void setLogCallback(ILog.LogCallback logCallback) {
this.m_callback = logCallback;
}
@Override // com.ea.nimble.ILog
public void setThresholdLevel(int i) {
this.m_level = i;
}
public class GuardTask implements Runnable {
private GuardTask() {
}
@Override // java.lang.Runnable
public void run() {
if (LogImpl.this.m_filePath == null || LogImpl.this.m_filePath.length() <= LogImpl.this.m_sizeLimit * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) {
return;
}
LogImpl.this.clearLog();
}
}
public static class LogRecord {
public int level;
public String message;
private LogRecord() {
}
}
@Override // com.ea.nimble.Component
public void setup() {
configure();
}
@Override // com.ea.nimble.Component
public void suspend() {
Timer timer = this.m_guardTimer;
if (timer != null) {
timer.pause();
}
}
@Override // com.ea.nimble.Component
public void resume() {
Timer timer = this.m_guardTimer;
if (timer != null) {
timer.fire();
this.m_guardTimer.resume();
}
}
@Override // com.ea.nimble.Component
public void teardown() {
Timer timer = this.m_guardTimer;
if (timer != null) {
timer.cancel();
this.m_guardTimer = null;
}
FileOutputStream fileOutputStream = this.m_logFileStream;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException unused) {
android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't close log file");
}
this.m_logFileStream = null;
}
}
@Override // com.ea.nimble.ILog
public String getLogFilePath() {
File file = this.m_filePath;
if (file != null) {
return file.toString();
}
return null;
}
@Override // com.ea.nimble.ILog
public void writeWithSource(int i, Object obj, String str, Object... objArr) {
String name;
if (obj instanceof LogSource) {
name = ((LogSource) obj).getLogSourceTitle();
} else {
name = obj != null ? obj.getClass().getName() : "";
}
writeWithTitle(i, name, str, objArr);
}
@Override // com.ea.nimble.ILog
public void writeWithTitle(int i, String str, String str2, Object... objArr) {
if (i < this.m_level || !Utility.validString(str2)) {
return;
}
if (objArr.length > 0) {
str2 = String.format(str2, objArr);
}
write(i, str, str2);
ILog.LogCallback logCallback = this.m_callback;
if (logCallback != null) {
logCallback.callback(i, str, str2);
}
}
public void connectToCore(BaseCore baseCore) {
this.m_core = baseCore;
configure();
flushCache();
}
private void configure() {
boolean z = this.m_level == 0;
Map<String, String> settings = this.m_core.getSettings(BaseCore.NIMBLE_LOG_SETTING);
if (settings == null) {
int parseLevel = parseLevel(null);
if (parseLevel != this.m_level) {
this.m_level = parseLevel;
String.format("LOG: Default Log level(%d) without log configuration file", Integer.valueOf(parseLevel));
return;
}
return;
}
int parseLevel2 = parseLevel(settings.get("Level"));
if (parseLevel2 != this.m_level) {
this.m_level = parseLevel2;
String.format("LOG: Log level(%d)", Integer.valueOf(parseLevel2));
}
if (this.m_level <= 100) {
this.m_messageLengthLimit = 0;
} else {
String str = settings.get("MessageLengthLimit");
if (str == null) {
this.m_messageLengthLimit = 1000;
} else {
try {
int parseInt = Integer.parseInt(str);
this.m_messageLengthLimit = parseInt;
if (parseInt < 0) {
this.m_messageLengthLimit = 1000;
}
} catch (NumberFormatException unused) {
this.m_messageLengthLimit = 1000;
}
}
}
String str2 = settings.get("File");
if (!Utility.validString(str2)) {
if (z || this.m_filePath != null) {
this.m_filePath = null;
this.m_logFileStream = null;
this.m_interval = 0;
return;
}
return;
}
String str3 = settings.get("Location");
StringBuilder sb = new StringBuilder();
sb.append(ApplicationEnvironment.getComponent().getCachePath());
String str4 = File.separator;
sb.append(str4);
sb.append(str2);
String sb2 = sb.toString();
if (Utility.validString(str3) && str3.equalsIgnoreCase(u3.e) && Environment.getExternalStorageState().equals("mounted")) {
String name = ApplicationEnvironment.getCurrentActivity().getClass().getPackage().getName();
PackageInfo packageInfo = Utility.getPackageInfo(0);
if (packageInfo != null) {
name = packageInfo.packageName;
}
File file = new File(Environment.getExternalStorageDirectory(), name);
boolean exists = file.exists();
if (!exists) {
exists = file.mkdir();
}
if (exists) {
sb2 = file + str4 + str2;
}
}
File file2 = new File(sb2);
if (file2 != this.m_filePath) {
this.m_filePath = file2;
try {
this.m_logFileStream = new FileOutputStream(this.m_filePath, true);
StringBuilder sb3 = new StringBuilder();
sb3.append("LOG: File path: ");
sb3.append(this.m_filePath.toString());
} catch (FileNotFoundException unused2) {
android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't create log file at " + sb2);
this.m_filePath = null;
return;
}
}
String str5 = settings.get("DateFormat");
if (str5 != null && str5.length() > 0) {
this.m_format = new SimpleDateFormat(str5, Locale.getDefault());
} else {
this.m_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
}
try {
int parseInt2 = Integer.parseInt(settings.get("FileCheckInterval"));
this.m_interval = parseInt2;
if (parseInt2 <= 0) {
this.m_interval = 3600;
}
} catch (NumberFormatException unused3) {
this.m_interval = 3600;
}
try {
int parseInt3 = Integer.parseInt(settings.get("MaxFileSize"));
this.m_sizeLimit = parseInt3;
if (parseInt3 <= 0) {
this.m_sizeLimit = 1024;
}
} catch (NumberFormatException unused4) {
this.m_sizeLimit = 1024;
}
GuardTask guardTask = new GuardTask();
guardTask.run();
Timer timer = new Timer(guardTask);
this.m_guardTimer = timer;
timer.schedule(this.m_interval, true);
}
private void flushCache() {
Iterator<LogRecord> it = this.m_cache.iterator();
while (it.hasNext()) {
LogRecord next = it.next();
int i = next.level;
if (i >= this.m_level) {
writeLine(i, next.message);
}
}
this.m_cache = null;
}
private int parseLevel(String str) {
try {
if (Utility.validString(str)) {
int parseInt = Integer.parseInt(str);
if (parseInt != 0) {
return parseInt;
}
}
} catch (NumberFormatException unused) {
if (str.equalsIgnoreCase("all")) {
return 0;
}
if (str.equalsIgnoreCase("verbose")) {
return 100;
}
if (str.equalsIgnoreCase("debug")) {
return 200;
}
if (str.equalsIgnoreCase("info")) {
return 300;
}
if (str.equalsIgnoreCase("warn")) {
return 400;
}
if (str.equalsIgnoreCase("error")) {
return 500;
}
if (str.equalsIgnoreCase("fatal")) {
return 600;
}
if (str.equalsIgnoreCase(NotificationCompat.GROUP_KEY_SILENT)) {
return 700;
}
}
return (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION || this.m_core.getConfiguration() == NimbleConfiguration.STAGE) ? 100 : 500;
}
/* JADX INFO: Access modifiers changed from: private */
public void clearLog() {
try {
this.m_logFileStream.close();
this.m_logFileStream = new FileOutputStream(this.m_filePath, false);
} catch (IOException unused) {
android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't clear log file");
}
}
private void writeLine(int i, String str) {
int i2 = 0;
if (i == 0) {
String[] formatLine = formatLine("NIM_ALL", str);
int length = formatLine.length;
while (i2 < length) {
outputMessageToFile(formatLine[i2]);
i2++;
}
} else if (i == 100) {
String[] formatLine2 = formatLine("NIM_VERBOSE", str);
int length2 = formatLine2.length;
while (i2 < length2) {
outputMessageToFile(formatLine2[i2]);
i2++;
}
} else if (i == 200) {
String[] formatLine3 = formatLine("NIM_DEBUG", str);
int length3 = formatLine3.length;
while (i2 < length3) {
outputMessageToFile(formatLine3[i2]);
i2++;
}
} else if (i == 300) {
String[] formatLine4 = formatLine("NIM_INFO", str);
int length4 = formatLine4.length;
while (i2 < length4) {
outputMessageToFile(formatLine4[i2]);
i2++;
}
} else if (i == 400) {
String[] formatLine5 = formatLine("NIM_WARN", str);
int length5 = formatLine5.length;
while (i2 < length5) {
String str2 = formatLine5[i2];
android.util.Log.w(Global.NIMBLE_ID, str2);
outputMessageToFile(str2);
i2++;
}
} else if (i == 500) {
String[] formatLine6 = formatLine("NIM_ERROR", str);
int length6 = formatLine6.length;
while (i2 < length6) {
String str3 = formatLine6[i2];
android.util.Log.e(Global.NIMBLE_ID, str3);
outputMessageToFile(str3);
i2++;
}
} else if (i == 600) {
String[] formatLine7 = formatLine("NIM_FATAL", str);
String str4 = formatLine7[0];
while (i2 < formatLine7.length - 1) {
android.util.Log.e(Global.NIMBLE_ID, str4);
outputMessageToFile(str4);
i2++;
str4 = formatLine7[i2];
}
android.util.Log.wtf(Global.NIMBLE_ID, str4);
outputMessageToFile(str4);
} else {
String[] formatLine8 = formatLine(String.format("NIM(%d)", Integer.valueOf(i)), str);
String str5 = formatLine8[0];
while (i2 < formatLine8.length - 1) {
android.util.Log.e(Global.NIMBLE_ID, str5);
outputMessageToFile(str5);
i2++;
str5 = formatLine8[i2];
}
android.util.Log.wtf(Global.NIMBLE_ID, str5);
outputMessageToFile(str5);
}
if (i >= 600) {
if (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION || this.m_core.getConfiguration() == NimbleConfiguration.STAGE) {
throw new AssertionError(str);
}
}
}
private void write(int i, String str, String str2) {
String str3;
if (Utility.validString(str)) {
str3 = str + "> " + str2;
} else {
str3 = " " + str2;
}
if (this.m_cache != null) {
LogRecord logRecord = new LogRecord();
logRecord.level = i;
logRecord.message = str3;
this.m_cache.add(logRecord);
return;
}
writeLine(i, str3);
}
private String[] formatLine(String str, String str2) {
String str3 = str + ">" + str2;
int length = str3.length();
int i = this.m_messageLengthLimit;
int i2 = 0;
if (length > i && i != 0) {
str3 = str3.substring(0, this.m_messageLengthLimit) + String.format("... and %d chars more", Integer.valueOf(length - i));
length = str3.length();
}
String[] strArr = new String[(int) Math.ceil(length / 4000.0d)];
while (i2 < length) {
int i3 = i2 + DEFAULT_CONSOLE_OUTPUT_LIMIT;
if (i3 < length) {
strArr[i2 / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i2, i3);
} else {
strArr[i2 / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i2);
}
i2 = i3;
}
return strArr;
}
private void outputMessageToFile(String str) {
String property = System.getProperty("line.separator");
if (this.m_logFileStream != null) {
try {
this.m_logFileStream.write((this.m_format.format(new Date()) + " " + str + property).getBytes(Charset.forName("UTF-8")));
this.m_logFileStream.flush();
} catch (IOException e) {
android.util.Log.e(Global.NIMBLE_ID, "Error writing to log file: " + e.toString());
}
}
}
}

View File

@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface LogSource {
String getLogSourceTitle();
}

View File

@@ -0,0 +1,129 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import com.facebook.internal.security.CertificateUtil;
import com.ironsource.v8;
import com.unity3d.ads.core.domain.InitializeAndroidBoldSDK;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;
/* loaded from: classes2.dex */
public class Network {
public static final String COMPONENT_ID = "com.ea.nimble.network";
/* renamed from: com.ea.nimble.Network$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$Network$Status;
static {
int[] iArr = new int[Status.values().length];
$SwitchMap$com$ea$nimble$Network$Status = iArr;
try {
iArr[Status.NONE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$Network$Status[Status.DEAD.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$Network$Status[Status.OK.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
public enum Status {
UNKNOWN,
NONE,
DEAD,
OK;
@Override // java.lang.Enum
public String toString() {
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Network$Status[ordinal()];
return i != 1 ? i != 2 ? i != 3 ? "NET UNKNOWN" : "NET OK" : "NET DEAD" : "NET NONE";
}
}
public static INetwork getComponent() {
return (INetwork) Base.getComponent("com.ea.nimble.network");
}
public static String generateParameterString(Map<String, String> map) {
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
if (map == null || map.size() == 0) {
return null;
}
String str = "";
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if ("".equals(key)) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid key", new Object[0]);
} else {
try {
String encode = URLEncoder.encode(key, "UTF-8");
if ("".equals(value)) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid value", new Object[0]);
} else {
try {
String encode2 = URLEncoder.encode(value, "UTF-8");
str = (((str + encode) + v8.i.b) + encode2) + v8.i.c;
} catch (UnsupportedEncodingException unused) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid value", new Object[0]);
}
}
} catch (UnsupportedEncodingException unused2) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid key", new Object[0]);
}
}
}
if (str.length() == 0) {
return null;
}
return str.substring(0, str.length() - 1);
}
public static URL generateURL(String str, Map<String, String> map) {
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
if ("".equals(str)) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "Base url is blank, return null", new Object[0]);
return null;
}
String generateParameterString = generateParameterString(map);
if (generateParameterString == null) {
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "Generated URL with only base url = %s", str);
} else {
str = str + "?" + generateParameterString;
Log.Helper.LOGVS(InitializeAndroidBoldSDK.MSG_NETWORK, "Generated URL = %s", str);
}
try {
return new URL(str);
} catch (MalformedURLException unused) {
Log.Helper.LOGES(InitializeAndroidBoldSDK.MSG_NETWORK, "Malformed URL from %s", str);
return null;
}
}
public static String getHttpProxy() {
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
try {
String property = System.getProperty("http.proxyHost");
if (property == null) {
return null;
}
String property2 = System.getProperty("http.proxyPort");
if (property2 == null) {
return property;
}
return property + CertificateUtil.DELIMITER + property2;
} catch (Exception e) {
Log.Helper.LOGES(InitializeAndroidBoldSDK.MSG_NETWORK, "Unable to get system proxy settings. %s", e.toString());
return null;
}
}
}

View File

@@ -0,0 +1,641 @@
package com.ea.nimble;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.ironsource.nb;
import com.unity3d.ads.core.domain.InitializeAndroidBoldSDK;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
/* loaded from: classes2.dex */
class NetworkConnection implements NetworkConnectionHandle, Runnable, LogSource {
private static final int MAXIMUM_RAW_DATA_LENGTH = 1048576;
static int s_loggingIdCount = 100;
private NetworkConnectionCallback m_completionCallback;
private Date m_connectionStartTimestamp;
private NetworkConnectionCallback m_headerCallback;
private final String m_loggingId;
private final NetworkImpl m_manager;
private IOperationalTelemetryDispatch m_otDispatch;
private NetworkConnectionCallback m_progressCallback;
private final HttpRequest m_request;
private String m_requestDataForLog;
private final HttpResponse m_response;
private StringBuilder m_responseDataForLog;
private Thread m_thread;
public String getLogSourceTitle() {
return InitializeAndroidBoldSDK.MSG_NETWORK;
}
public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest) {
this(networkImpl, httpRequest, null);
}
public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) {
this.m_manager = networkImpl;
this.m_thread = null;
this.m_request = httpRequest;
this.m_response = new HttpResponse();
this.m_headerCallback = null;
this.m_progressCallback = null;
this.m_completionCallback = null;
this.m_connectionStartTimestamp = null;
this.m_otDispatch = iOperationalTelemetryDispatch;
this.m_loggingId = String.valueOf(s_loggingIdCount);
int i = s_loggingIdCount;
s_loggingIdCount = i + 1;
if (i >= 1000) {
s_loggingIdCount = 100;
}
}
@Override // com.ea.nimble.NetworkConnectionHandle
public HttpRequest getRequest() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
return this.m_request;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public HttpResponse getResponse() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
return this.m_response;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public NetworkConnectionCallback getHeaderCallback() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
return this.m_headerCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
this.m_headerCallback = networkConnectionCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public NetworkConnectionCallback getProgressCallback() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
return this.m_progressCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public void setProgressCallback(NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
this.m_progressCallback = networkConnectionCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public NetworkConnectionCallback getCompletionCallback() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
return this.m_completionCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
this.m_completionCallback = networkConnectionCallback;
}
@Override // com.ea.nimble.NetworkConnectionHandle
public void waitOn() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
synchronized (this) {
while (!this.m_response.isCompleted) {
try {
wait();
} catch (InterruptedException unused) {
}
}
}
}
@Override // com.ea.nimble.NetworkConnectionHandle
public void cancel() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
synchronized (this) {
try {
Thread thread = this.m_thread;
if (thread != null) {
thread.interrupt();
} else {
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Network connection " + this + " is cancelled"));
}
} catch (Throwable th) {
throw th;
}
}
}
public void cancelForAppSuspend() {
cancel();
}
public void run() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
try {
try {
try {
try {
if (this.m_response.isCompleted) {
synchronized (this) {
this.m_thread = null;
}
return;
}
if (Thread.interrupted()) {
throw new InterruptedIOException();
}
synchronized (this) {
this.m_thread = Thread.currentThread();
}
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(this.m_request.getUrl().openConnection()));
httpURLConnection.setRequestMethod(this.m_request.method.toString());
httpURLConnection.setConnectTimeout((int) (this.m_request.timeout * 1000.0d));
httpURLConnection.setReadTimeout((int) (this.m_request.timeout * 1000.0d));
httpURLConnection.setRequestProperty(HTTP.CONN_DIRECTIVE, "close");
this.m_requestDataForLog = null;
this.m_responseDataForLog = null;
if (Thread.interrupted()) {
throw new InterruptedIOException();
}
httpSend(httpURLConnection);
if (Thread.interrupted()) {
throw new InterruptedIOException();
}
httpRecv(httpURLConnection);
finish();
synchronized (this) {
this.m_thread = null;
}
} catch (InterruptedIOException e) {
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Connection " + this + " is cancelled", e));
synchronized (this) {
this.m_thread = null;
}
} catch (ClassCastException e2) {
finishWithError(new Error(Error.Code.NETWORK_UNSUPPORTED_CONNECTION_TYPE, "Request " + this + " failed for unsupported connection type" + this.m_request.getUrl().getProtocol(), e2));
synchronized (this) {
this.m_thread = null;
}
}
} catch (SocketTimeoutException e3) {
finishWithError(new Error(Error.Code.NETWORK_TIMEOUT, "Connection " + this + " timed out", e3));
synchronized (this) {
this.m_thread = null;
}
} catch (IOException e4) {
finishWithError(new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Connection " + this + " failed with I/O exception", e4));
synchronized (this) {
this.m_thread = null;
}
}
} catch (Error e5) {
finishWithError(e5);
synchronized (this) {
this.m_thread = null;
}
} catch (UnknownHostException e6) {
Network.Status status = this.m_manager.getStatus();
if (status != Network.Status.OK) {
finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + status.toString(), e6));
} else {
finishWithError(new Error(Error.Code.NETWORK_UNREACHABLE, "Request " + this + " failed for unreachable host", e6));
}
synchronized (this) {
this.m_thread = null;
}
} catch (Exception e7) {
finishWithError(new Error(Error.Code.SYSTEM_UNEXPECTED, "Unexpected error.", e7));
synchronized (this) {
this.m_thread = null;
}
}
} catch (Throwable th) {
synchronized (this) {
this.m_thread = null;
throw th;
}
}
}
private void httpSend(HttpURLConnection httpURLConnection) throws IOException {
Log.Helper.LOGFUNCS("NetworkConnection");
this.m_connectionStartTimestamp = new Date();
HashMap<String, String> hashMap = this.m_request.headers;
if (hashMap != null) {
for (String str : hashMap.keySet()) {
httpURLConnection.setRequestProperty(str, this.m_request.headers.get(str));
}
}
logRequest();
byte[] byteArray = this.m_request.data.toByteArray();
if (byteArray == null || byteArray.length <= 0) {
return;
}
httpURLConnection.setDoOutput(true);
httpURLConnection.setFixedLengthStreamingMode(byteArray.length);
OutputStream outputStream = null;
try {
try {
outputStream = httpURLConnection.getOutputStream();
outputStream.write(byteArray);
} catch (Exception e) {
StringWriter stringWriter = new StringWriter();
e.printStackTrace(new PrintWriter(stringWriter));
Log.Helper.LOGE(this, "Exception in network connection:" + stringWriter.toString(), new Object[0]);
if (outputStream == null) {
return;
}
}
outputStream.close();
} catch (Throwable th) {
if (outputStream != null) {
outputStream.close();
}
throw th;
}
}
private void httpRecv(HttpURLConnection httpURLConnection) throws IOException, Error {
InputStream errorStream;
boolean z;
Log.Helper.LOGFUNCS("NetworkConnection");
try {
try {
errorStream = httpURLConnection.getInputStream();
z = false;
} catch (Exception unused) {
errorStream = httpURLConnection.getErrorStream();
z = true;
}
try {
this.m_response.url = httpURLConnection.getURL();
this.m_response.statusCode = httpURLConnection.getResponseCode();
this.m_response.expectedContentLength = httpURLConnection.getContentLength();
this.m_response.lastModified = httpURLConnection.getLastModified();
for (Map.Entry<String, List<String>> entry : httpURLConnection.getHeaderFields().entrySet()) {
this.m_response.headers.put(entry.getKey(), TextUtils.join(", ", entry.getValue()));
}
boolean z2 = this.m_response.expectedContentLength > PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED;
boolean validString = Utility.validString(this.m_request.targetFilePath);
boolean z3 = this.m_request.getMethod() == IHttpRequest.Method.HEAD;
HttpResponse httpResponse = this.m_response;
int i = httpResponse.statusCode;
boolean z4 = i == 200 || i == 206;
boolean z5 = (z || errorStream == null || !z4) ? false : true;
if (z2 && !z3) {
if (!validString) {
throw new Error(Error.Code.NETWORK_OVERSIZE_DATA, "Request " + this + " is oversize, please provide a local file path to download it as file.");
}
if (!z5) {
throw new Error(Error.Code.NETWORK_OVERSIZE_DATA, "HTTP error for file download with an oversized error response.");
}
}
httpResponse.downloadedContentLength = 0L;
NetworkConnectionCallback networkConnectionCallback = this.m_headerCallback;
if (networkConnectionCallback != null) {
networkConnectionCallback.callback(this);
}
if (!z3) {
if (validString && z5) {
downloadToFile(errorStream);
errorStream = null;
} else {
HttpResponse httpResponse2 = this.m_response;
long j = httpResponse2.expectedContentLength;
if (j != 0) {
ByteBufferIOStream byteBufferIOStream = httpResponse2.data;
if (byteBufferIOStream == null) {
httpResponse2.data = new ByteBufferIOStream((int) j);
} else {
byteBufferIOStream.clear();
}
if (errorStream != null) {
downloadToBuffer(errorStream);
errorStream = null;
} else {
throw new Error(Error.Code.SYSTEM_UNEXPECTED, "Request " + this + " failed because no stream available to read expected response data.");
}
}
if (!z4) {
if (z) {
throw new HttpError(this.m_response.statusCode, "Request " + this + " failed for HTTP error.");
}
throw new HttpError(this.m_response.statusCode, "Request " + this + " failed for HTTP error even the response data is from normal response stream.");
}
if (z) {
throw new Error(Error.Code.SYSTEM_UNEXPECTED, "Request " + this + " failed because response is from error stream even the status code(" + this.m_response.statusCode + "). In some cases, you may ignore this and treat it as success.");
}
}
}
} finally {
if (errorStream != null) {
errorStream.close();
}
logCommunication();
}
} catch (Exception e) {
throw new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Fail to get either input stream or error stream from HTTP connection.", e);
}
}
/* JADX WARN: Removed duplicated region for block: B:68:0x01a3 */
/* JADX WARN: Removed duplicated region for block: B:70:0x01a8 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void downloadToFile(java.io.InputStream r15) throws java.io.IOException {
/*
Method dump skipped, instructions count: 468
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.downloadToFile(java.io.InputStream):void");
}
private void downloadToBuffer(InputStream inputStream) throws IOException {
int read;
Log.Helper.LOGFUNCS("NetworkConnection");
prepareResponseLog();
while (true) {
try {
byte[] prepareSegment = this.m_response.data.prepareSegment();
int i = 0;
if (prepareSegment == null) {
Log.Helper.LOGE(this, "Error preparing segment", new Object[0]);
break;
}
do {
read = inputStream.read(prepareSegment, i, prepareSegment.length - i);
if (!Thread.interrupted()) {
if (read < 0) {
break;
}
if (read == 0) {
Thread.yield();
} else {
prepareResponseLog(prepareSegment, i, read);
i += read;
this.m_response.downloadedContentLength += read;
}
} else {
throw new InterruptedIOException();
}
} while (i < prepareSegment.length);
this.m_response.data.appendSegmentToBuffer(prepareSegment, i);
NetworkConnectionCallback networkConnectionCallback = this.m_progressCallback;
if (networkConnectionCallback != null) {
networkConnectionCallback.callback(this);
}
if (read < 0) {
break;
}
} catch (Throwable th) {
inputStream.close();
throw th;
}
}
inputStream.close();
}
private void finish() {
Log.Helper.LOGFUNCS("NetworkConnection");
this.m_response.isCompleted = true;
logOperationalTelemetryResponse();
NetworkConnectionCallback networkConnectionCallback = this.m_completionCallback;
if (networkConnectionCallback != null) {
networkConnectionCallback.callback(this);
}
synchronized (this) {
notifyAll();
}
this.m_manager.removeConnection(this);
}
public void finishWithError(Exception exc) {
Log.Helper.LOGFUNCS("NetworkConnection");
if (this.m_response.isCompleted) {
Log.Helper.LOGI(this, "Finished connection %s skipped an error %s", toString(), exc.toString());
return;
}
Log.Helper.LOGW(this, "Running connection number %s with name %s failed for error %s", this.m_loggingId, toString(), exc.toString());
this.m_response.error = exc;
finish();
}
private String prepareRequestLog() {
String str;
Log.Helper.LOGFUNCS("NetworkConnection");
ByteArrayOutputStream byteArrayOutputStream = this.m_request.data;
int i = 2048;
if (byteArrayOutputStream != null && byteArrayOutputStream.size() > 0) {
i = 2048 + this.m_request.data.size();
try {
str = this.m_request.data.toString("UTF-8");
} catch (UnsupportedEncodingException unused) {
str = "<-- UNREADABLE -->";
}
} else {
str = (this.m_request.getMethod() == IHttpRequest.Method.POST || this.m_request.getMethod() == IHttpRequest.Method.PUT) ? "<-- EMPTY -->" : null;
}
StringBuilder sb = new StringBuilder(i);
sb.append("REQUEST: ");
sb.append(this.m_request.method.toString());
sb.append(' ');
sb.append(this.m_request.url.toString());
sb.append('\n');
generateHttpHeaderAndBodyLogString(sb, false, this.m_request.headers, str);
return sb.toString();
}
private void prepareResponseLog() {
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100) {
return;
}
long j = this.m_response.expectedContentLength;
this.m_responseDataForLog = new StringBuilder(j > 0 ? (int) j : 4096);
}
private void prepareResponseLog(byte[] bArr, int i, int i2) {
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100 || this.m_responseDataForLog == null) {
return;
}
this.m_responseDataForLog.append(new String(bArr, i, i2, StandardCharsets.UTF_8));
}
private String multiplyStringNTimes(String str, int i) {
Log.Helper.LOGFUNCS("NetworkConnection");
StringBuilder sb = new StringBuilder(str.length() * i);
for (int i2 = 0; i2 < i; i2++) {
sb.append(str);
}
return sb.toString();
}
private String beautifyJSONString(String str) {
String jSONArray;
Log.Helper.LOGFUNCS("NetworkConnection");
if (str == null) {
return str;
}
try {
Object nextValue = new JSONTokener(str).nextValue();
if (nextValue instanceof JSONObject) {
jSONArray = ((JSONObject) nextValue).toString(4);
} else {
jSONArray = nextValue instanceof JSONArray ? ((JSONArray) nextValue).toString(4) : null;
}
return jSONArray != null ? jSONArray : str;
} catch (JSONException unused) {
return str;
}
}
private void logRequest() {
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100) {
return;
}
String prepareRequestLog = prepareRequestLog();
this.m_requestDataForLog = prepareRequestLog;
Log.Helper.LOGD(this, "\n>>>> CONNECTION ID %s BEGIN >>>>>>>>>>>>>>>>>>\n%s<<<< CONNECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<<\n", this.m_loggingId, prepareRequestLog);
}
private void logCommunication() {
String str;
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100) {
return;
}
if (this.m_requestDataForLog == null) {
this.m_requestDataForLog = prepareRequestLog();
}
int length = 4096 + this.m_requestDataForLog.length();
boolean z = this.m_request.targetFilePath != null;
StringBuilder sb = this.m_responseDataForLog;
if (sb == null || sb.length() <= 0) {
str = z ? "<-- FILE -->" : "<-- EMPTY -->";
} else {
try {
str = this.m_responseDataForLog.toString();
} catch (Exception unused) {
str = "<-- UNREADABLE -->";
}
}
StringBuilder sb2 = new StringBuilder(length + str.length());
sb2.append(String.format("%n>>>> CONNECTION ID %s FINISH >>>> REQUEST >>>>%n", this.m_loggingId));
sb2.append(this.m_requestDataForLog);
sb2.append("<<<< REQUEST <<<<<<<< -- >>>>>>>> RESPONSE >>>>\n");
sb2.append("RESP URL: ");
sb2.append(this.m_response.url.toString());
sb2.append('\n');
sb2.append("RESP STATUS: ");
sb2.append(this.m_response.statusCode);
sb2.append('\n');
if (this.m_response.getError() != null) {
sb2.append("RESP ERROR: ");
if (this.m_response.getError().getMessage() != null) {
sb2.append(this.m_response.getError().getMessage());
sb2.append("\n");
} else {
sb2.append("<-- UNKNOWN -->\n");
}
}
if (z) {
sb2.append("RESP FILE: ");
sb2.append(this.m_request.targetFilePath);
sb2.append("\n");
}
generateHttpHeaderAndBodyLogString(sb2, true, this.m_response.headers, str);
sb2.append("<<<< RESPONSE <<<< CONNECTION FINISH <<<<<<<<<<");
Log.Helper.LOGD(this, sb2.toString(), new Object[0]);
}
private void generateHttpHeaderAndBodyLogString(StringBuilder sb, boolean z, Map<String, String> map, String str) {
Log.Helper.LOGFUNCS("NetworkConnection");
String str2 = z ? "RESP" : "REQ";
boolean z2 = false;
if (map != null && map.size() > 0) {
boolean z3 = false;
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
if (key != null || z) {
if (key == null) {
key = "(null)";
}
sb.append(str2);
sb.append(" HEADER: ");
sb.append(key);
String value = entry.getValue();
String str3 = value != null ? value : "(null)";
sb.append(" VALUE: ");
sb.append(str3);
sb.append('\n');
if (key.equals("Content-Type") && (str3.contains(nb.L) || str3.contains("text/json"))) {
z3 = true;
}
} else {
String str4 = map.get(key);
Log.Helper.LOGW("Network request contains a null key with value %s", str4 != null ? str4 : "(null)", new Object[0]);
}
}
z2 = z3;
}
if (str != null) {
sb.append(str2);
sb.append(" BODY:\n");
if (z2) {
str = beautifyJSONString(str);
}
sb.append(str);
sb.append('\n');
}
}
/* JADX WARN: Can't wrap try/catch for region: R(12:14|(2:16|(2:18|19))|20|(1:22)(1:55)|23|(2:25|(12:27|28|29|30|31|(1:45)(1:35)|36|37|38|39|40|41)(3:48|49|50))(1:54)|51|37|38|39|40|41) */
/* JADX WARN: Code restructure failed: missing block: B:44:0x0145, code lost:
com.ea.nimble.Log.Helper.LOGE(r17, "Failed to add " + r13 + " to eventDict.", new java.lang.Object[0]);
*/
/* JADX WARN: Unreachable blocks removed: 1, instructions: 1 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void logOperationalTelemetryResponse() {
/*
Method dump skipped, instructions count: 369
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.logOperationalTelemetryResponse():void");
}
}

View File

@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface NetworkConnectionCallback {
void callback(NetworkConnectionHandle networkConnectionHandle);
}

View File

@@ -0,0 +1,24 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface NetworkConnectionHandle {
void cancel();
NetworkConnectionCallback getCompletionCallback();
NetworkConnectionCallback getHeaderCallback();
NetworkConnectionCallback getProgressCallback();
IHttpRequest getRequest();
IHttpResponse getResponse();
void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback);
void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback);
void setProgressCallback(NetworkConnectionCallback networkConnectionCallback);
void waitOn();
}

View File

@@ -0,0 +1,559 @@
package com.ea.nimble;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.os.Build;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.unity3d.ads.core.domain.InitializeAndroidBoldSDK;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
class NetworkImpl extends Component implements INetwork, LogSource {
private static final String BACKUP_NETWORK_REACHABILITY_CHECK_URL = "https://www.google.com";
private static final int DETECTION_TIMEOUT = 30;
private static final String MAIN_NETWORK_REACHABILITY_CHECK_URL = "https://ping1.tnt-ea.com";
private static final int MAX_CONCURRENT_THREADS = 4;
private static final int[] PING_INTERVAL = {5, 10, 30, 60};
private static final int QUICK_DETECTION_TIMEOUT = 5;
private ExecutorService m_asyncTaskManager;
private ConnectivityReceiver m_connectivityReceiver;
private NetworkConnection m_detectionConnection;
private boolean m_isWifi;
private NetworkCallback m_networkCallback;
private DetectionState m_networkDetectionState;
private int m_pingIndex;
private final List<NetworkConnection> m_queue;
private Network.Status m_status;
private Timer m_timer;
private LinkedList<NetworkConnection> m_waitingToExecuteQueue;
public enum DetectionState {
NONE,
VERIFY_REACHABLE_MAIN,
VERIFY_UNREACHABLE_MAIN,
VERIFY_REACHABLE_BACKUP,
PING
}
@Override // com.ea.nimble.Component
public String getComponentId() {
return "com.ea.nimble.network";
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return InitializeAndroidBoldSDK.MSG_NETWORK;
}
public class ConnectivityReceiver extends BroadcastReceiver {
private ConnectivityReceiver() {
}
public /* synthetic */ ConnectivityReceiver(NetworkImpl networkImpl, AnonymousClass1 anonymousClass1) {
this();
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
Log.Helper.LOGD(this, "Network reachability changed!", new Object[0]);
synchronized (NetworkImpl.this) {
NetworkImpl.this.detect(true);
}
}
}
@TargetApi(28)
public class NetworkCallback extends ConnectivityManager.NetworkCallback {
private NetworkCallback() {
}
public /* synthetic */ NetworkCallback(NetworkImpl networkImpl, AnonymousClass1 anonymousClass1) {
this();
}
@Override // android.net.ConnectivityManager.NetworkCallback
public void onAvailable(android.net.Network network) {
Log.Helper.LOGD(this, "Network reachability changed!", new Object[0]);
super.onAvailable(network);
synchronized (NetworkImpl.this) {
NetworkImpl.this.detect(true);
}
}
@Override // android.net.ConnectivityManager.NetworkCallback
public void onLost(android.net.Network network) {
Log.Helper.LOGD(this, "Network reachability changed!", new Object[0]);
super.onLost(network);
synchronized (NetworkImpl.this) {
NetworkImpl.this.detect(true);
}
}
}
public NetworkImpl() {
Log.Helper.LOGFUNC(this);
this.m_connectivityReceiver = null;
this.m_networkCallback = null;
this.m_status = Network.Status.UNKNOWN;
this.m_detectionConnection = null;
this.m_networkDetectionState = DetectionState.NONE;
this.m_pingIndex = 0;
this.m_queue = new ArrayList();
}
@Override // com.ea.nimble.Component
public void setup() {
Log.Helper.LOGV(this, "setup", new Object[0]);
startWork();
}
@Override // com.ea.nimble.Component
public void suspend() {
synchronized (this) {
stopPing();
unregisterNetworkListener();
synchronized (this) {
try {
Iterator it = new ArrayList(this.m_queue).iterator();
while (it.hasNext()) {
((NetworkConnection) it.next()).cancelForAppSuspend();
}
} catch (Throwable th) {
throw th;
}
}
Log.Helper.LOGV(this, "suspend", new Object[0]);
}
Log.Helper.LOGV(this, "suspend", new Object[0]);
}
@Override // com.ea.nimble.Component
public void resume() {
Log.Helper.LOGV(this, CampaignEx.JSON_NATIVE_VIDEO_RESUME, new Object[0]);
synchronized (this) {
detect(true);
registerNetworkListener();
}
}
@Override // com.ea.nimble.Component
public void cleanup() {
stopWork();
Log.Helper.LOGV(this, "cleanup", new Object[0]);
}
private void registerNetworkListener() {
Log.Helper.LOGFUNC(this);
AnonymousClass1 anonymousClass1 = null;
if (Build.VERSION.SDK_INT < 28) {
if (this.m_connectivityReceiver == null) {
Log.Helper.LOGD(this, "Register network reachability listener.", new Object[0]);
this.m_connectivityReceiver = new ConnectivityReceiver(this, anonymousClass1);
ApplicationEnvironment.getComponent().getApplicationContext().registerReceiver(this.m_connectivityReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
return;
}
return;
}
if (this.m_networkCallback == null) {
ConnectivityManager connectivityManager = (ConnectivityManager) ApplicationEnvironment.getComponent().getApplicationContext().getSystemService("connectivity");
if (connectivityManager == null) {
Log.Helper.LOGE(this, "Can not get ConnectivityManager from context.", new Object[0]);
return;
}
NetworkCallback networkCallback = new NetworkCallback(this, anonymousClass1);
this.m_networkCallback = networkCallback;
connectivityManager.registerDefaultNetworkCallback(networkCallback);
}
}
private void unregisterNetworkListener() {
Log.Helper.LOGFUNC(this);
if (Build.VERSION.SDK_INT < 28) {
if (this.m_connectivityReceiver != null) {
try {
ApplicationEnvironment.getComponent().getApplicationContext().unregisterReceiver(this.m_connectivityReceiver);
} catch (IllegalArgumentException unused) {
Log.Helper.LOGE(this, "Unable to unregister network reachability listener even it does exists", new Object[0]);
}
this.m_connectivityReceiver = null;
return;
}
return;
}
if (this.m_networkCallback != null) {
ConnectivityManager connectivityManager = (ConnectivityManager) ApplicationEnvironment.getComponent().getApplicationContext().getSystemService("connectivity");
if (connectivityManager == null) {
Log.Helper.LOGE(this, "Can not get ConnectivityManager from context.", new Object[0]);
} else {
connectivityManager.unregisterNetworkCallback(this.m_networkCallback);
this.m_networkCallback = null;
}
}
}
@Override // com.ea.nimble.INetwork
public NetworkConnectionHandle sendGetRequest(URL url, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
HttpRequest httpRequest = new HttpRequest(url);
httpRequest.method = IHttpRequest.Method.GET;
httpRequest.headers = hashMap;
return sendRequest(httpRequest, networkConnectionCallback);
}
@Override // com.ea.nimble.INetwork
public NetworkConnectionHandle sendPostRequest(URL url, HashMap<String, String> hashMap, byte[] bArr, NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
HttpRequest httpRequest = new HttpRequest(url);
httpRequest.method = IHttpRequest.Method.POST;
httpRequest.headers = hashMap;
try {
httpRequest.data.write(bArr);
} catch (Exception e) {
e.printStackTrace();
}
return sendRequest(httpRequest, networkConnectionCallback);
}
@Override // com.ea.nimble.INetwork
public NetworkConnectionHandle sendDeleteRequest(URL url, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
HttpRequest httpRequest = new HttpRequest(url);
httpRequest.method = IHttpRequest.Method.DELETE;
httpRequest.headers = hashMap;
return sendRequest(httpRequest, networkConnectionCallback);
}
@Override // com.ea.nimble.INetwork
public NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
return sendRequest(httpRequest, networkConnectionCallback, null);
}
@Override // com.ea.nimble.INetwork
public NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) {
NetworkConnection networkConnection;
Log.Helper.LOGPUBLICFUNC(this);
if (httpRequest.runInBackground) {
networkConnection = new BackgroundNetworkConnection(this, httpRequest, iOperationalTelemetryDispatch);
} else {
networkConnection = new NetworkConnection(this, httpRequest, iOperationalTelemetryDispatch);
}
networkConnection.setCompletionCallback(networkConnectionCallback);
URL url = httpRequest.url;
if (url == null || !Utility.validString(url.toString())) {
networkConnection.finishWithError(new Error(Error.Code.INVALID_ARGUMENT, "Sending request without valid url"));
return networkConnection;
}
if (this.m_status != Network.Status.OK) {
networkConnection.finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + this.m_status.toString()));
return networkConnection;
}
synchronized (this) {
this.m_queue.add(networkConnection);
}
ExecutorService executorService = this.m_asyncTaskManager;
if (executorService == null || executorService.isShutdown()) {
if (this.m_asyncTaskManager != null) {
Log.Helper.LOGW(this, "AsyncTaskManager shutdown. Queueing network connection until AsyncTaskManager is started.", new Object[0]);
} else {
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing network connection until AsyncTaskManager is started.", new Object[0]);
}
if (this.m_waitingToExecuteQueue == null) {
this.m_waitingToExecuteQueue = new LinkedList<>();
}
this.m_waitingToExecuteQueue.add(networkConnection);
} else {
this.m_asyncTaskManager.execute(networkConnection);
}
return networkConnection;
}
@Override // com.ea.nimble.INetwork
public synchronized void forceRedetectNetworkStatus() {
Log.Helper.LOGPUBLICFUNC(this);
detect(true);
}
@Override // com.ea.nimble.INetwork
public Network.Status getStatus() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_status;
}
@Override // com.ea.nimble.INetwork
public boolean isNetworkWifi() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_isWifi;
}
public synchronized void removeConnection(NetworkConnection networkConnection) {
Log.Helper.LOGFUNC(this);
this.m_queue.remove(networkConnection);
}
/* JADX INFO: Access modifiers changed from: private */
public void detect(boolean z) {
Log.Helper.LOGFUNC(this);
NetworkConnection networkConnection = this.m_detectionConnection;
if (networkConnection != null) {
if (!z) {
return;
}
this.m_detectionConnection = null;
networkConnection.cancel();
}
stopPing();
boolean z2 = this.m_isWifi;
if (reachabilityCheck()) {
if (this.m_status != Network.Status.DEAD) {
setStatus(Network.Status.OK, z2 != this.m_isWifi);
}
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_MAIN;
} else {
if (this.m_status == Network.Status.UNKNOWN) {
setStatus(Network.Status.NONE, false);
}
this.m_networkDetectionState = DetectionState.VERIFY_UNREACHABLE_MAIN;
}
verifyReachability(MAIN_NETWORK_REACHABILITY_CHECK_URL, 5.0d);
}
private boolean reachabilityCheck() {
ConnectivityManager connectivityManager;
android.net.Network activeNetwork;
Log.Helper.LOGFUNC(this);
boolean z = false;
if (!BaseCore.getInstance().isActive()) {
Log.Helper.LOGD(this, "BaseCore not active yet. Postpone reachability check.", new Object[0]);
return false;
}
this.m_isWifi = false;
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
if (applicationContext == null || (connectivityManager = (ConnectivityManager) applicationContext.getSystemService("connectivity")) == null || (activeNetwork = connectivityManager.getActiveNetwork()) == null) {
return false;
}
NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork);
if (networkCapabilities != null) {
if (!networkCapabilities.hasCapability(12)) {
return false;
}
z = true;
if (networkCapabilities.hasTransport(1) || networkCapabilities.hasTransport(3)) {
this.m_isWifi = true;
}
}
return z;
}
private void startPing() {
Log.Helper.LOGFUNC(this);
if (this.m_pingIndex >= PING_INTERVAL.length) {
this.m_pingIndex = r1.length - 1;
}
Timer timer = new Timer(new TimerTask(this, null));
this.m_timer = timer;
timer.schedule(r1[this.m_pingIndex], false);
}
private void stopPing() {
Log.Helper.LOGFUNC(this);
Timer timer = this.m_timer;
if (timer != null) {
timer.cancel();
this.m_timer = null;
}
}
public class TimerTask implements Runnable {
private TimerTask() {
}
public /* synthetic */ TimerTask(NetworkImpl networkImpl, AnonymousClass1 anonymousClass1) {
this();
}
@Override // java.lang.Runnable
public void run() {
synchronized (NetworkImpl.this) {
NetworkImpl.this.m_timer = null;
NetworkImpl.this.verifyReachability(NetworkImpl.MAIN_NETWORK_REACHABILITY_CHECK_URL, 30.0d);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void verifyReachability(String str, double d) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest httpRequest = new HttpRequest(new URL(str));
httpRequest.timeout = d;
httpRequest.method = IHttpRequest.Method.HEAD;
NetworkConnection networkConnection = new NetworkConnection(this, httpRequest);
this.m_detectionConnection = networkConnection;
networkConnection.setCompletionCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.NetworkImpl$$ExternalSyntheticLambda0
@Override // com.ea.nimble.NetworkConnectionCallback
public final void callback(NetworkConnectionHandle networkConnectionHandle) {
NetworkImpl.this.lambda$verifyReachability$0(networkConnectionHandle);
}
});
ExecutorService executorService = this.m_asyncTaskManager;
if (executorService == null || executorService.isShutdown()) {
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing network connection until AsyncTaskManager is started.", new Object[0]);
if (this.m_waitingToExecuteQueue == null) {
this.m_waitingToExecuteQueue = new LinkedList<>();
}
this.m_waitingToExecuteQueue.addFirst(this.m_detectionConnection);
return;
}
this.m_asyncTaskManager.execute(this.m_detectionConnection);
} catch (MalformedURLException unused) {
Log.Helper.LOGE(this, "Invalid url: " + str, new Object[0]);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onReachabilityVerification, reason: merged with bridge method [inline-methods] */
public synchronized void lambda$verifyReachability$0(NetworkConnectionHandle networkConnectionHandle) {
Log.Helper.LOGFUNC(this);
Exception error = networkConnectionHandle.getResponse().getError();
if (error == null) {
Log.Helper.LOGD(this, "network verified reachable.", new Object[0]);
setStatus(Network.Status.OK, false);
this.m_detectionConnection = null;
return;
}
if (networkConnectionHandle != this.m_detectionConnection) {
return;
}
this.m_detectionConnection = null;
Log.Helper.LOGD(this, "network verified unreachable, ERROR %s for detection state %s", networkConnectionHandle.getResponse().getError(), this.m_networkDetectionState);
if (error instanceof Error) {
Error error2 = (Error) error;
if (error2.getDomain().equals(Error.ERROR_DOMAIN) && error2.isError(Error.Code.NETWORK_OPERATION_CANCELLED)) {
Log.Helper.LOGW(this, "Network detection verification connection get cancelled for unknown reason (maybe reasonable for Android)", new Object[0]);
}
}
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$NetworkImpl$DetectionState[this.m_networkDetectionState.ordinal()];
if (i == 1) {
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_BACKUP;
verifyReachability(BACKUP_NETWORK_REACHABILITY_CHECK_URL, 30.0d);
} else if (i == 2) {
setStatus(Network.Status.NONE, false);
} else if (i == 3) {
this.m_networkDetectionState = DetectionState.PING;
Network.Status status = this.m_status;
Network.Status status2 = Network.Status.DEAD;
if (status != status2) {
setStatus(status2, false);
this.m_pingIndex = 0;
}
startPing();
} else if (i == 4) {
this.m_pingIndex++;
startPing();
}
}
/* renamed from: com.ea.nimble.NetworkImpl$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NetworkImpl$DetectionState;
static {
int[] iArr = new int[DetectionState.values().length];
$SwitchMap$com$ea$nimble$NetworkImpl$DetectionState = iArr;
try {
iArr[DetectionState.VERIFY_REACHABLE_MAIN.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$NetworkImpl$DetectionState[DetectionState.VERIFY_UNREACHABLE_MAIN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$NetworkImpl$DetectionState[DetectionState.VERIFY_REACHABLE_BACKUP.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$NetworkImpl$DetectionState[DetectionState.PING.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
private void setStatus(Network.Status status, boolean z) {
Log.Helper.LOGI(this, "Status change %s -> %s", this.m_status, status);
if (status != this.m_status || z) {
this.m_status = status;
Utility.sendBroadcast(Global.NOTIFICATION_NETWORK_STATUS_CHANGE);
}
}
private synchronized void startWork() {
try {
Log.Helper.LOGFUNC(this);
if (this.m_asyncTaskManager != null) {
return;
}
detect(true);
registerNetworkListener();
this.m_asyncTaskManager = Executors.newFixedThreadPool(4);
LinkedList<NetworkConnection> linkedList = this.m_waitingToExecuteQueue;
if (linkedList != null && !linkedList.isEmpty()) {
Log.Helper.LOGW(this, "NetworkConnections waiting to execute on new AsyncTaskManager. Executing.", new Object[0]);
while (!this.m_waitingToExecuteQueue.isEmpty()) {
NetworkConnection poll = this.m_waitingToExecuteQueue.poll();
if (poll != null) {
Log.Helper.LOGW(this, "Executing request URL: " + poll.getRequest().url.toString(), new Object[0]);
this.m_asyncTaskManager.execute(poll);
} else {
Log.Helper.LOGE(this, "Could not get queued connection", new Object[0]);
}
}
}
} catch (Throwable th) {
throw th;
}
}
private void stopWork() {
Log.Helper.LOGFUNC(this);
synchronized (this) {
this.m_detectionConnection = null;
stopPing();
unregisterNetworkListener();
}
ExecutorService executorService = this.m_asyncTaskManager;
if (executorService == null) {
return;
}
try {
Iterator<Runnable> it = executorService.shutdownNow().iterator();
while (it.hasNext()) {
((NetworkConnection) it.next()).cancelForAppSuspend();
}
this.m_asyncTaskManager.awaitTermination(60L, TimeUnit.SECONDS);
} catch (InterruptedException unused) {
this.m_asyncTaskManager.shutdownNow();
Thread.currentThread().interrupt();
}
this.m_asyncTaskManager = null;
}
}

View File

@@ -0,0 +1,84 @@
package com.ea.nimble;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class NimbleApplicationConfiguration {
private static final String LOG_TITLE = "AppConfig";
public static boolean configValueExists(String str) {
Bundle bundle;
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
if (applicationInfo == null || (bundle = applicationInfo.metaData) == null) {
return false;
}
return bundle.containsKey(str);
}
public static String getConfigValueAsString(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
return getConfigValueAsString(str, "");
}
public static String getConfigValueAsString(String str, String str2) {
Bundle bundle;
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
if (applicationInfo != null && (bundle = applicationInfo.metaData) != null) {
return bundle.getString(str);
}
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
return str2;
}
public static int getConfigValueAsInt(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
return getConfigValueAsInt(str, 0);
}
public static int getConfigValueAsInt(String str, int i) {
Bundle bundle;
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
if (applicationInfo != null && (bundle = applicationInfo.metaData) != null) {
return bundle.getInt(str);
}
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
return i;
}
public static double getConfigValueAsDouble(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
return getConfigValueAsDouble(str, 0.0d);
}
public static double getConfigValueAsDouble(String str, double d) {
Bundle bundle;
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
if (applicationInfo != null && (bundle = applicationInfo.metaData) != null) {
return bundle.getDouble(str);
}
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
return d;
}
public static boolean getConfigValueAsBoolean(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
return getConfigValueAsBoolean(str, false);
}
public static boolean getConfigValueAsBoolean(String str, boolean z) {
Bundle bundle;
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
if (applicationInfo != null && (bundle = applicationInfo.metaData) != null) {
return bundle.getBoolean(str);
}
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
return z;
}
}

View File

@@ -0,0 +1,55 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import com.ironsource.v8;
/* loaded from: classes2.dex */
public enum NimbleConfiguration {
UNKNOWN,
INTEGRATION,
STAGE,
LIVE,
CUSTOMIZED,
MANUAL;
public static NimbleConfiguration fromName(String str) {
Log.Helper.LOGPUBLICFUNCS("AppConfig");
return str.equals("int") ? INTEGRATION : str.equals(v8.h.q) ? STAGE : str.equals("live") ? LIVE : str.equals("custom") ? CUSTOMIZED : str.equals("manual") ? MANUAL : UNKNOWN;
}
/* renamed from: com.ea.nimble.NimbleConfiguration$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration;
static {
int[] iArr = new int[NimbleConfiguration.values().length];
$SwitchMap$com$ea$nimble$NimbleConfiguration = iArr;
try {
iArr[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.MANUAL.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
@Override // java.lang.Enum
public String toString() {
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$NimbleConfiguration[ordinal()];
return i != 1 ? i != 2 ? i != 3 ? i != 4 ? i != 5 ? "unknown" : "manual" : "custom" : "live" : v8.h.q : "int";
}
}

View File

@@ -0,0 +1,90 @@
package com.ea.nimble;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
import com.ea.nimble.Log;
import java.util.HashMap;
/* loaded from: classes2.dex */
public class NimbleLocalNotificationReceiver extends BroadcastReceiver {
public static final String NIMBLE_LOCAL_NOTIFICATION_RECEIVED = "nimble.notification.localNotificationReceived";
private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent";
@Override // android.content.BroadcastReceiver
public final void onReceive(Context context, Intent intent) {
handleNewLocalNotification(context, intent.getExtras());
}
public void handleNewLocalNotification(Context context, Bundle bundle) {
Intent intent;
Notification notification;
Object parcelable;
String string = bundle.getString(FCMMessageService.PushIntentExtraKeys.PUSH_ID, "");
String string2 = bundle.getString("deepLinkUrl");
if (string2 != null) {
intent = new Intent("android.intent.action.VIEW", Uri.parse(string2));
Log.Helper.LOGI(this, "[handleNewLocalNotification]: Local notification clicked with URL: " + string2, new Object[0]);
} else {
String pushTargetActivity = getPushTargetActivity(context);
Log.Helper.LOGD(this, "[handleNewLocalNotification]: Local notification received with target activity: " + pushTargetActivity, new Object[0]);
try {
intent = new Intent(context, Class.forName(pushTargetActivity));
} catch (ClassNotFoundException e) {
Log.Helper.LOGD(this, String.format("[handleNewLocalNotification]: Could not launch target activity: %s, exception: %s", pushTargetActivity, e.toString()), new Object[0]);
return;
}
}
intent.putExtras(bundle);
intent.putExtra("PushNotification", "true");
intent.setFlags(603979776);
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1140850688);
if (!ApplicationEnvironment.isMainApplicationActive()) {
if (Build.VERSION.SDK_INT >= 33) {
parcelable = bundle.getParcelable("notification", Notification.class);
notification = (Notification) parcelable;
} else {
notification = (Notification) bundle.getParcelable("notification");
}
if (notification == null) {
Log.Helper.LOGE(this, String.format("[handleNewLocalNotification]: Unable to create Local Notification", new Object[0]), new Object[0]);
return;
} else if (activity != null) {
notification.contentIntent = activity;
((NotificationManager) context.getSystemService("notification")).notify(string.hashCode(), notification);
return;
} else {
Log.Helper.LOGE(this, String.format("[handleNewLocalNotification]: Unable to create PendingIntent", new Object[0]), new Object[0]);
return;
}
}
HashMap hashMap = new HashMap();
hashMap.put("en", "message");
Bundle bundle2 = new Bundle();
bundle2.putSerializable("core", hashMap);
bundle2.putString("msg_id", string);
bundle2.putString("type", "pn");
bundle2.putString(NotificationCompat.CATEGORY_SERVICE, "local");
bundle2.putString("status", "received");
bundle2.putString("format", "pn");
Intent intent2 = new Intent();
intent2.setAction(NOTIFICATION_TRACKING2_LOG_EVENT);
intent2.putExtras(bundle2);
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent2);
Utility.sendBroadcast(NIMBLE_LOCAL_NOTIFICATION_RECEIVED, bundle);
}
public String getPushTargetActivity(Context context) {
Context applicationContext = context.getApplicationContext();
return applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName()).resolveActivity(applicationContext.getPackageManager()).getClassName();
}
}

View File

@@ -0,0 +1,21 @@
package com.ea.nimble;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class NimbleLocalNotifications {
public static final String COMPONENT_ID = "com.ea.nimble.base.localNotifications";
public static final String DEEP_LINK_URL = "deepLinkUrl";
static final String KEY_NOTIFICATION_ID = "pushId";
static final String KEY_NOTIFICATION_PN_TYPE = "pnType";
static final String NOTIFICATION_TYPE_LOCAL = "local";
private static void initialize() {
Log.Helper.LOGFUNCS("LocalNotification");
Base.registerComponent(new NimbleLocalNotificationsImpl(), COMPONENT_ID);
}
public static INimbleLocalNotifications getComponent() {
return (INimbleLocalNotifications) Base.getComponent(COMPONENT_ID);
}
}

View File

@@ -0,0 +1,338 @@
package com.ea.nimble;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes2.dex */
public class NimbleLocalNotificationsImpl extends Component implements INimbleLocalNotifications {
private static final String BADGE_ID = "Nimble_BadgeNotification";
private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent";
private static final String PERSISTENCE_ENABLED_KEY = "enabled";
private static final String PERSISTENCE_NOTIFICATION_MAP_KEY = "map";
private static INimbleBadgeProvider m_badgeProvider;
private static INimbleLocalNotificationCustomizer m_notificationCustomizer;
private boolean m_enabled = true;
private HashMap<String, Date> m_notificationMap;
@Override // com.ea.nimble.Component
public String getComponentId() {
return NimbleLocalNotifications.COMPONENT_ID;
}
@Override // com.ea.nimble.INimbleLocalNotifications
public boolean isEnabled() {
return this.m_enabled;
}
@Override // com.ea.nimble.Component
public void restore() {
String str;
Log.Helper.LOGPUBLICFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
if (persistenceForNimbleComponent.hasKey("enabled")) {
this.m_enabled = persistenceForNimbleComponent.getBoolValue("enabled");
} else {
this.m_enabled = true;
}
if (persistenceForNimbleComponent.hasKey(PERSISTENCE_NOTIFICATION_MAP_KEY)) {
HashMap<String, Date> hashMap = (HashMap) persistenceForNimbleComponent.getValue(PERSISTENCE_NOTIFICATION_MAP_KEY);
this.m_notificationMap = hashMap;
Iterator<String> it = hashMap.keySet().iterator();
Date date = new Date();
while (it.hasNext()) {
String next = it.next();
Date date2 = this.m_notificationMap.get(next);
if (date2.before(date)) {
Log.Helper.LOGV(this, "restore(): Removed notification list key " + next + " from map because its date (" + date2 + ") is in the past!", new Object[0]);
it.remove();
}
}
saveNotificationMap();
} else {
this.m_notificationMap = new HashMap<>();
}
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY)) {
return;
}
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY)) {
str = applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY));
} else {
str = "Default";
}
NotificationChannel notificationChannel = new NotificationChannel(Global.NOTIFICATION_CHANNEL_DEFAULT_ID, str, 3);
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY)) {
notificationChannel.setDescription(applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY)));
}
notificationManager.createNotificationChannel(notificationChannel);
}
@Override // com.ea.nimble.INimbleLocalNotifications
public Error scheduleNotification(String str, String str2, String str3, Date date) {
return scheduleNotification(str, str2, str3, date, null);
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
@Override // com.ea.nimble.INimbleLocalNotifications
public Error scheduleNotification(String str, String str2, String str3, Date date, Map<String, String> map) {
char c;
Log.Helper.LOGPUBLICFUNC(this);
Date date2 = new Date();
if (!this.m_enabled) {
Log.Helper.LOGD(this, "scheduleNotification(): Local Notifications are not enabled!", new Object[0]);
return null;
}
Log.Helper.LOGD(this, "[scheduleNotification] Notification requested with: \n- Title : %s\n- Message : %s\n- ID : %s\n- Date : %s\n- Extras : %s", str, str2, str3, date.toString(), map.toString());
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "scheduleNotification(): Invalid title", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Invalid title");
}
if (!Utility.validString(str2)) {
Log.Helper.LOGE(this, "scheduleNotification(): Invalid message", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Invalid message");
}
if (date.before(date2)) {
Log.Helper.LOGE(this, "scheduleNotification(): Expired date", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Expired date");
}
String str4 = Utility.validString(str3) ? str3 : "auto_" + date2.getTime();
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
Resources resources = ApplicationEnvironment.getComponent().getApplicationContext().getResources();
String packageName = ApplicationEnvironment.getComponent().getApplicationContext().getPackageName();
Intent intent = new Intent(applicationContext, (Class<?>) NimbleLocalNotificationReceiver.class);
for (String str5 : map.keySet()) {
str5.hashCode();
switch (str5.hashCode()) {
case -984292776:
if (str5.equals(FCMMessageService.PushIntentExtraKeys.PN_TYPE)) {
c = 0;
break;
}
c = 65535;
break;
case -976922155:
if (str5.equals(FCMMessageService.PushIntentExtraKeys.PUSH_ID)) {
c = 1;
break;
}
c = 65535;
break;
case 595233003:
if (str5.equals("notification")) {
c = 2;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
case 1:
case 2:
Log.Helper.LOGE(this, "scheduleNotification(): Cannot use extra with key : " + str5, new Object[0]);
break;
}
intent.putExtra(str5, map.get(str5));
}
Notification.Builder autoCancel = new Notification.Builder(applicationContext, NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) ? NimbleApplicationConfiguration.getConfigValueAsString(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) : Global.NOTIFICATION_CHANNEL_DEFAULT_ID).setContentTitle(str).setContentText(str2).setStyle(new Notification.BigTextStyle().bigText(str2)).setAutoCancel(true);
try {
autoCancel.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
INimbleLocalNotificationCustomizer iNimbleLocalNotificationCustomizer = m_notificationCustomizer;
if (iNimbleLocalNotificationCustomizer != null) {
iNimbleLocalNotificationCustomizer.customizeLocalNotification(autoCancel, intent.getExtras());
}
Notification build = autoCancel.build();
this.m_notificationMap.put(str4, date);
saveNotificationMap();
intent.putExtra("notification", build);
intent.putExtra(FCMMessageService.PushIntentExtraKeys.PUSH_ID, str4);
intent.putExtra(FCMMessageService.PushIntentExtraKeys.PN_TYPE, "local");
((AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(0, System.currentTimeMillis() + (date.getTime() - date2.getTime()), PendingIntent.getBroadcast(applicationContext, str4 != null ? str4.hashCode() : 0, intent, 201326592));
HashMap hashMap = new HashMap();
hashMap.put("en", "message");
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap);
bundle.putString("msg_id", str4);
bundle.putString("type", "pn");
bundle.putString(NotificationCompat.CATEGORY_SERVICE, "local");
bundle.putString("status", "started");
bundle.putString("format", "pn");
Intent intent2 = new Intent();
intent2.setAction(NOTIFICATION_TRACKING2_LOG_EVENT);
intent2.putExtras(bundle);
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent2);
return null;
} catch (Exception e) {
Log.Helper.LOGE(this, "scheduleNotification(): Not scheduled. Unable to set application icon due to exception: " + e, new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon");
}
}
@Override // com.ea.nimble.INimbleLocalNotifications
public void cancelAllNotifications() {
Iterator it = ((HashMap) this.m_notificationMap.clone()).keySet().iterator();
while (it.hasNext()) {
cancelNotification((String) it.next());
}
}
@Override // com.ea.nimble.INimbleLocalNotifications
public void cancelNotification(String str) {
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
PendingIntent broadcast = PendingIntent.getBroadcast(applicationContext, str.hashCode(), new Intent(applicationContext, (Class<?>) NimbleLocalNotificationReceiver.class), 603979776);
if (broadcast != null) {
broadcast.cancel();
((AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM)).cancel(broadcast);
this.m_notificationMap.remove(str);
saveNotificationMap();
Log.Helper.LOGD(this, "cancelNotification(%s): Successfully canceled", str);
HashMap hashMap = new HashMap();
hashMap.put("en", "message");
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap);
bundle.putString("msg_id", str);
bundle.putString("type", "pn");
bundle.putString(NotificationCompat.CATEGORY_SERVICE, "local");
bundle.putString("status", "canceled");
bundle.putString("format", "pn");
Intent intent = new Intent();
intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT);
intent.putExtras(bundle);
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent);
return;
}
Log.Helper.LOGD(this, "cancelNotification(%s): Not found", str);
}
@Override // com.ea.nimble.INimbleLocalNotifications
public void setEnabled(boolean z) {
if (this.m_enabled != z) {
this.m_enabled = z;
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
persistenceForNimbleComponent.setValue("enabled", Boolean.valueOf(this.m_enabled));
persistenceForNimbleComponent.lambda$new$0();
cancelAllNotifications();
}
}
@Override // com.ea.nimble.INimbleLocalNotifications
public void setCustomizer(INimbleLocalNotificationCustomizer iNimbleLocalNotificationCustomizer) {
Log.Helper.LOGPUBLICFUNC(this);
m_notificationCustomizer = iNimbleLocalNotificationCustomizer;
}
@Override // com.ea.nimble.INimbleLocalNotifications
public void setBadgeProvider(INimbleBadgeProvider iNimbleBadgeProvider) {
Log.Helper.LOGPUBLICFUNC(this);
m_badgeProvider = iNimbleBadgeProvider;
}
@Override // com.ea.nimble.INimbleLocalNotifications
public Error setBadgeCount(int i, String str, String str2) {
Log.Helper.LOGPUBLICFUNC(this);
if (!this.m_enabled) {
Log.Helper.LOGE(this, "setBadgeCount(): Local notifications are disabled, unable to set badge count", new Object[0]);
return new Error(Error.Code.NOT_AVAILABLE, "setBadgeCount(): Local notifications are disabled, unable to set badge count");
}
INimbleBadgeProvider iNimbleBadgeProvider = m_badgeProvider;
if (iNimbleBadgeProvider != null) {
return iNimbleBadgeProvider.setBadgeCount(i, str, str2);
}
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
Resources resources = ApplicationEnvironment.getComponent().getApplicationContext().getResources();
String packageName = ApplicationEnvironment.getComponent().getApplicationContext().getPackageName();
if (i == 0) {
notificationManager.cancel(-1544873096);
return null;
}
if (i < 0 || i > 999999) {
String str3 = "setBadgeCount(): Badge count " + i + "outside [0-999999] range";
Log.Helper.LOGE(this, str3, new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, str3);
}
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "setBadgeCount(): Invalid title", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Invalid title");
}
if (!Utility.validString(str2)) {
Log.Helper.LOGE(this, "setBadgeCount(): Invalid message", new Object[0]);
return new Error(Error.Code.INVALID_ARGUMENT, "Invalid message");
}
Notification.Builder visibility = new Notification.Builder(applicationContext, NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) ? NimbleApplicationConfiguration.getConfigValueAsString(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) : Global.NOTIFICATION_CHANNEL_DEFAULT_ID).setContentTitle(str).setContentText(str2).setAutoCancel(true).setNumber(i).setVisibility(-1);
try {
visibility.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
Notification build = visibility.build();
Context applicationContext2 = applicationContext.getApplicationContext();
String className = applicationContext2.getPackageManager().getLaunchIntentForPackage(applicationContext2.getPackageName()).resolveActivity(applicationContext2.getPackageManager()).getClassName();
try {
Intent intent = new Intent(applicationContext, Class.forName(className));
intent.putExtra(FCMMessageService.PushIntentExtraKeys.PUSH_ID, BADGE_ID);
intent.putExtra(FCMMessageService.PushIntentExtraKeys.PN_TYPE, "local");
intent.setFlags(603979776);
PendingIntent activity = PendingIntent.getActivity(applicationContext, 0, intent, 1140850688);
if (build == null) {
Log.Helper.LOGE(this, "setBadgeCount(): Unable to create Local Notification", new Object[0]);
return new Error(Error.Code.NOT_AVAILABLE, "setBadgeCount(): Unable to create Local Notification");
}
if (activity != null) {
build.contentIntent = activity;
notificationManager.notify(-1544873096, build);
return null;
}
Log.Helper.LOGE(this, "setBadgeCount(): Unable to create PendingIntent", new Object[0]);
return new Error(Error.Code.NOT_AVAILABLE, "setBadgeCount(): Unable to create PendingIntent");
} catch (ClassNotFoundException e) {
String format = String.format("setBadgeCount(): Could not launch target activity: %s, exception: %s", className, e);
Log.Helper.LOGE(this, format, new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, format);
}
} catch (Exception e2) {
Log.Helper.LOGE(this, "setBadgeCount(): Unable to set application icon due to exception: " + e2, new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon");
}
}
@Override // com.ea.nimble.INimbleLocalNotifications
public int getBadgeCount() {
Log.Helper.LOGPUBLICFUNC(this);
INimbleBadgeProvider iNimbleBadgeProvider = m_badgeProvider;
if (iNimbleBadgeProvider != null) {
return iNimbleBadgeProvider.getBadgeCount();
}
for (StatusBarNotification statusBarNotification : ((NotificationManager) ApplicationEnvironment.getComponent().getApplicationContext().getSystemService("notification")).getActiveNotifications()) {
if (statusBarNotification.getId() == -1544873096) {
return statusBarNotification.getNotification().number;
}
}
return 0;
}
private void saveNotificationMap() {
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
persistenceForNimbleComponent.setValue(PERSISTENCE_NOTIFICATION_MAP_KEY, this.m_notificationMap);
persistenceForNimbleComponent.lambda$new$0();
}
}

View File

@@ -0,0 +1,11 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class OperationalTelemetryDispatch {
public static final String COMPONENT_ID = "com.ea.nimble.operationaltelemetrydispatch";
public static final String LOG_TAG = "OTDispatch";
public static IOperationalTelemetryDispatch getComponent() {
return (IOperationalTelemetryDispatch) Base.getComponent(COMPONENT_ID);
}
}

View File

@@ -0,0 +1,247 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import csdk.gluads.Consts;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes2.dex */
class OperationalTelemetryDispatchImpl extends Component implements IOperationalTelemetryDispatch, LogSource {
private Map<String, Integer> m_maxEventQueueSizeDict;
private List<OperationalTelemetryEvent> m_networkMetricsArray = new ArrayList();
private List<OperationalTelemetryEvent> m_networkPayloadsArray = new ArrayList();
@Override // com.ea.nimble.Component
public void cleanup() {
}
@Override // com.ea.nimble.Component
public String getComponentId() {
return OperationalTelemetryDispatch.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return OperationalTelemetryDispatch.LOG_TAG;
}
@Override // com.ea.nimble.Component
public void restore() {
}
@Override // com.ea.nimble.Component
public void resume() {
}
@Override // com.ea.nimble.Component
public void suspend() {
}
public OperationalTelemetryDispatchImpl() {
HashMap hashMap = new HashMap();
this.m_maxEventQueueSizeDict = hashMap;
hashMap.put("com.ea.nimble.network", 100);
this.m_maxEventQueueSizeDict.put(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS, 100);
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public void logEvent(String str, String str2) {
boolean z;
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "logEvent called with null or empty eventType.", new Object[0]);
return;
}
try {
JSONObject jSONObject = new JSONObject(str2);
if (jSONObject.length() == 0) {
Log.Helper.LOGE(this, "logEvent called with null or empty eventDictionary.", new Object[0]);
return;
}
OperationalTelemetryEventImpl operationalTelemetryEventImpl = new OperationalTelemetryEventImpl(str, jSONObject, new Date());
synchronized (this) {
try {
z = true;
if (str.equals("com.ea.nimble.network")) {
if (!canLogEvent(str)) {
trimEventQueue(str);
}
if (canLogEvent(str)) {
this.m_networkMetricsArray.add(operationalTelemetryEventImpl);
}
} else if (str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) {
if (!canLogEvent(str)) {
trimEventQueue(str);
}
if (canLogEvent(str)) {
this.m_networkPayloadsArray.add(operationalTelemetryEventImpl);
}
} else {
z = false;
}
} catch (Throwable th) {
throw th;
}
}
if (!z) {
Log.Helper.LOGE(this, "logEvent, unsupported OT eventType, " + str + Consts.STRING_PERIOD, new Object[0]);
}
updateEventThresholdListeners();
} catch (Exception unused) {
Log.Helper.LOGE(this, "logEvent could not build JSONObject from payload: " + str2, new Object[0]);
}
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public List<OperationalTelemetryEvent> getEvents(String str) {
List<OperationalTelemetryEvent> list;
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "getEvents called with null or empty eventType.", new Object[0]);
return null;
}
synchronized (this) {
try {
if (str.equals("com.ea.nimble.network")) {
list = this.m_networkMetricsArray;
this.m_networkMetricsArray = new ArrayList();
} else if (str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) {
list = this.m_networkPayloadsArray;
this.m_networkPayloadsArray = new ArrayList();
} else {
list = null;
}
} catch (Throwable th) {
throw th;
}
}
if (list == null) {
Log.Helper.LOGE(this, "getEvents, unsupported OT eventType, " + str + Consts.STRING_PERIOD, new Object[0]);
return null;
}
return Collections.unmodifiableList(list);
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public void setMaxEventCount(String str, int i) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "setMaxEventCount called with null or empty eventType.", new Object[0]);
} else {
this.m_maxEventQueueSizeDict.put(str, Integer.valueOf(i));
trimEventQueue(str);
}
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public int getMaxEventCount(String str) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "getMaxEventCount called with null or empty eventType.", new Object[0]);
return 100;
}
Integer num = this.m_maxEventQueueSizeDict.get(str);
if (num == null) {
return 100;
}
return num.intValue();
}
private boolean canLogEvent(String str) {
List<OperationalTelemetryEvent> list;
Log.Helper.LOGFUNC(this);
int maxEventCount = getMaxEventCount(str);
if (str.equals("com.ea.nimble.network")) {
list = this.m_networkMetricsArray;
} else {
if (!str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) {
Log.Helper.LOGE(this, "canLogEvent, unsupported OT eventType, " + str + Consts.STRING_PERIOD, new Object[0]);
return false;
}
list = this.m_networkPayloadsArray;
}
return ((list.size() < maxEventCount) || (maxEventCount < 0)) && !(maxEventCount == 0);
}
private void updateEventThresholdListeners() {
Log.Helper.LOGFUNC(this);
int maxEventCount = getMaxEventCount("com.ea.nimble.network");
if (maxEventCount > 0) {
if (this.m_networkMetricsArray.size() >= ((int) (maxEventCount * 0.75d))) {
HashMap hashMap = new HashMap();
hashMap.put("eventType", "com.ea.nimble.network");
Utility.sendBroadcast(IOperationalTelemetryDispatch.NOTIFICATION_OT_EVENT_THRESHOLD_WARNING, hashMap);
Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.", new Object[0]);
}
}
int maxEventCount2 = getMaxEventCount(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS);
if (maxEventCount2 > 0) {
if (this.m_networkPayloadsArray.size() >= ((int) (maxEventCount2 * 0.75d))) {
HashMap hashMap2 = new HashMap();
hashMap2.put("eventType", IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS);
Utility.sendBroadcast(IOperationalTelemetryDispatch.NOTIFICATION_OT_EVENT_THRESHOLD_WARNING, hashMap2);
Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.", new Object[0]);
}
}
}
private void trimEventQueue(String str) {
List<OperationalTelemetryEvent> list;
Log.Helper.LOGFUNC(this);
int maxEventCount = getMaxEventCount(str);
if (str.equals("com.ea.nimble.network")) {
list = this.m_networkMetricsArray;
} else {
if (!str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) {
Log.Helper.LOGE(this, "trimEventQueue, unsupported OT eventType, " + str + Consts.STRING_PERIOD, new Object[0]);
return;
}
list = this.m_networkPayloadsArray;
}
if (maxEventCount >= 0 && list.size() != 0 && list.size() - maxEventCount >= 0) {
synchronized (this) {
try {
if (maxEventCount == 0) {
list.clear();
} else {
int i = maxEventCount / 2;
Log.Helper.LOGI(this, "trimEventQueues, queue threshold surprassed, purging " + i + " older events ", new Object[0]);
for (int i2 = 0; i2 < i; i2++) {
purgeOldestEvent(list);
}
}
} catch (Throwable th) {
throw th;
}
}
}
}
private void purgeOldestEvent(List<OperationalTelemetryEvent> list) {
Log.Helper.LOGFUNC(this);
synchronized (this) {
try {
if (list.size() == 0) {
Log.Helper.LOGD(this, "purgeOldestEvent called with empty event array.", new Object[0]);
return;
}
OperationalTelemetryEvent operationalTelemetryEvent = null;
for (OperationalTelemetryEvent operationalTelemetryEvent2 : list) {
if (operationalTelemetryEvent == null || operationalTelemetryEvent2.getLoggedTime().before(operationalTelemetryEvent.getLoggedTime())) {
operationalTelemetryEvent = operationalTelemetryEvent2;
}
}
if (operationalTelemetryEvent != null) {
list.remove(operationalTelemetryEvent);
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,15 @@
package com.ea.nimble;
import java.util.Date;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public interface OperationalTelemetryEvent {
JSONObject getEventDictionary();
String getEventDictionaryString();
String getEventType();
Date getLoggedTime();
}

View File

@@ -0,0 +1,41 @@
package com.ea.nimble;
import java.util.Date;
import org.json.JSONObject;
/* loaded from: classes2.dex */
class OperationalTelemetryEventImpl implements OperationalTelemetryEvent {
private JSONObject m_eventDictionary;
private String m_eventType;
private Date m_loggedTime;
@Override // com.ea.nimble.OperationalTelemetryEvent
public JSONObject getEventDictionary() {
return this.m_eventDictionary;
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public String getEventType() {
return this.m_eventType;
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public Date getLoggedTime() {
return this.m_loggedTime;
}
public OperationalTelemetryEventImpl(String str, JSONObject jSONObject, Date date) {
this.m_eventType = str;
this.m_eventDictionary = jSONObject;
this.m_loggedTime = date;
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public String getEventDictionaryString() {
return this.m_eventDictionary.toString();
}
public String toString() {
return String.format("OperationalTelemetryEvent(%s)-(%s) > %s", getEventType(), getLoggedTime(), getEventDictionary());
}
}

View File

@@ -0,0 +1,692 @@
package com.ea.nimble;
import android.app.backup.BackupManager;
import android.content.Context;
import com.ea.nimble.Log;
import com.ea.nimble.PersistenceService;
import com.facebook.internal.security.CertificateUtil;
import com.ironsource.x8;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class Persistence implements LogSource {
private static final int PERSISTENCE_VERSION = 101;
static final Object s_dataLock = new Object();
private boolean m_backUp;
private boolean m_changed;
private Map<String, byte[]> m_content;
private boolean m_encryption;
private final Encryptor m_encryptor;
private final String m_identifier;
private String m_persistencePath;
private final Storage m_storage;
private final Timer m_synchronizeTimer;
public enum Storage {
DOCUMENT,
CACHE,
TEMP
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "Persistence";
}
public Persistence(String str, Storage storage, Encryptor encryptor) {
this.m_persistencePath = null;
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
Persistence.this.lambda$new$0();
}
});
this.m_content = new HashMap();
this.m_identifier = str;
this.m_storage = storage;
this.m_encryptor = encryptor;
this.m_encryption = false;
this.m_backUp = false;
this.m_changed = false;
}
public Persistence(Persistence persistence, String str) {
this.m_persistencePath = null;
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
Persistence.this.lambda$new$0();
}
});
this.m_content = new HashMap(persistence.m_content);
this.m_identifier = str;
this.m_storage = persistence.m_storage;
this.m_encryptor = persistence.m_encryptor;
this.m_encryption = persistence.m_encryption;
this.m_backUp = persistence.m_backUp;
flagChange();
}
public String getIdentifier() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_identifier;
}
public Storage getStorage() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_storage;
}
public boolean getEncryption() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_encryption;
}
public void setEncryption(boolean z) {
Log.Helper.LOGPUBLICFUNC(this);
if (z != this.m_encryption) {
this.m_encryption = z;
flagChange();
}
}
public boolean getBackUp() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_backUp;
}
public void setBackUp(boolean z) {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_storage == Storage.DOCUMENT) {
this.m_backUp = z;
return;
}
Log.Helper.LOGF(this, "Error: Backup flag not supported for storage: " + this.m_storage, new Object[0]);
}
public void merge(Persistence persistence, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
Log.Helper.LOGFUNC(this);
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[persistenceMergePolicy.ordinal()];
if (i == 1) {
this.m_content = new HashMap(persistence.m_content);
return;
}
if (i == 2) {
this.m_content.putAll(persistence.m_content);
return;
}
if (i != 3) {
return;
}
for (String str : persistence.m_content.keySet()) {
if (this.m_content.get(str) == null) {
this.m_content.put(str, persistence.m_content.get(str));
}
}
}
public void restore(boolean z, Context context) {
Log.Helper.LOGFUNC(this);
synchronized (s_dataLock) {
loadPersistenceData(z, context);
}
}
public boolean hasKey(String str) {
boolean z;
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
z = this.m_content.get(str) != null;
}
return z;
}
public void setValue(String str, Serializable serializable) {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
try {
if (!Utility.validString(str)) {
Log.Helper.LOGD(this, "Key " + str + " is an invalid string", new Object[0]);
Log.Helper.LOGE(this, "NimblePersistence cannot accept an invalid string as key", new Object[0]);
return;
}
if (serializable == null) {
if (this.m_content.get(str) != null) {
this.m_content.remove(str);
flagChange();
}
return;
}
try {
putValue(str, serializable);
} catch (IOException unused) {
Log.Helper.LOGD(this, "Value " + serializable + " was unable to be archived", new Object[0]);
Log.Helper.LOGF(this, "NimblePersistence cannot archive value", new Object[0]);
}
} catch (Throwable th) {
throw th;
}
}
}
public Serializable getValue(String str) {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
byte[] bArr = this.m_content.get(str);
if (bArr == null) {
return null;
}
try {
return (Serializable) new ObjectInputStream(new ByteArrayInputStream(bArr)).readObject();
} catch (Exception e) {
Log.Helper.LOGD(this, "PERSIST: Exception getting value, " + str + CertificateUtil.DELIMITER + e, new Object[0]);
return null;
}
}
}
public String getStringValue(String str) {
Log.Helper.LOGPUBLICFUNC(this);
Serializable value = getValue(str);
try {
return (String) value;
} catch (ClassCastException unused) {
Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]);
Log.Helper.LOGF(this, "Invalid value type for getStringValueCall", new Object[0]);
return null;
}
}
public boolean getBoolValue(String str) {
Log.Helper.LOGPUBLICFUNC(this);
Serializable value = getValue(str);
if (value != null) {
try {
return ((Boolean) value).booleanValue();
} catch (ClassCastException unused) {
Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]);
Log.Helper.LOGF(this, "Invalid value type for getBoolValue", new Object[0]);
}
}
return false;
}
public void addEntries(Object... objArr) {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
String str = null;
for (int i = 0; i < objArr.length; i++) {
if (i % 2 == 0) {
try {
str = (String) objArr[i];
if (!Utility.validString(str)) {
throw new RuntimeException("Invalid key");
}
} catch (Exception unused) {
Log.Helper.LOGF(this, "Invalid key in NimblePersistence.addEntries at index %d, not a string", Integer.valueOf(i));
return;
}
} else {
try {
putValue(str, (Serializable) objArr[i]);
} catch (Exception unused2) {
Log.Helper.LOGD(this, "Invalid value for key %s", str);
Log.Helper.LOGF(this, "Invalid value in NimblePersistence.addEntries at index %d", Integer.valueOf(i));
return;
}
}
}
}
}
public void addEntriesFromMap(Map<String, Serializable> map) {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
try {
for (Map.Entry<String, Serializable> entry : map.entrySet()) {
String key = entry.getKey();
if (!Utility.validString(key)) {
Log.Helper.LOGD(this, "Invalid key %s", key);
Log.Helper.LOGE(this, "Invalid key in NimblePersistence.addEntriesInDictionary, not a string, skip it", new Object[0]);
} else {
Serializable value = entry.getValue();
if (value != null) {
try {
putValue(key, value);
} catch (IOException unused) {
}
}
Log.Helper.LOGD(this, "Invalid key %s", key);
Log.Helper.LOGE(this, "Invalid value in NimblePersistence.addEntries for key", new Object[0]);
}
}
} catch (Throwable th) {
throw th;
}
}
}
public void clean() {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
try {
this.m_content.clear();
clearSynchronizeTimer();
String persistencePath = getPersistencePath(null);
if (persistencePath != null) {
File file = new File(persistencePath);
if (file.exists() && !file.delete()) {
Log.Helper.LOGE(this, "Fail to clean persistence file for id[%s] in storage %s", this.m_identifier, this.m_storage.toString());
}
} else {
Log.Helper.LOGE(this, "Could not get path to persistence for id[%s] in storage %s", this.m_identifier, this.m_storage.toString());
}
} catch (Throwable th) {
throw th;
}
}
}
/* renamed from: synchronize, reason: merged with bridge method [inline-methods] */
public void lambda$new$0() {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
try {
if (!this.m_changed) {
Log.Helper.LOGD(this, "Not synchronizing to persistence for id[%s] since there is no change", this.m_identifier);
return;
}
clearSynchronizeTimer();
savePersistenceData();
if (this.m_backUp) {
new BackupManager(ApplicationEnvironment.getComponent().getApplicationContext()).dataChanged();
}
} catch (Throwable th) {
throw th;
}
}
}
private void clearSynchronizeTimer() {
Log.Helper.LOGFUNC(this);
synchronized (s_dataLock) {
this.m_synchronizeTimer.cancel();
}
}
private void flagChange() {
Log.Helper.LOGFUNC(this);
this.m_changed = true;
synchronized (s_dataLock) {
clearSynchronizeTimer();
this.m_synchronizeTimer.schedule(0.5d, false);
}
}
private void putValue(String str, Serializable serializable) throws IOException {
Log.Helper.LOGFUNC(this);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(serializable);
objectOutputStream.close();
byte[] byteArray = byteArrayOutputStream.toByteArray();
if (Arrays.equals(byteArray, this.m_content.get(str))) {
return;
}
this.m_content.put(str, byteArray);
flagChange();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r4v10, types: [boolean] */
/* JADX WARN: Type inference failed for: r4v16, types: [java.lang.String] */
private void loadPersistenceData(boolean z, Context context) {
FileInputStream fileInputStream;
ObjectInputStream objectInputStream;
ObjectInputStream objectInputStream2;
Log.Helper.LOGFUNC(this);
String persistencePath = getPersistencePath(context);
if (persistencePath == null) {
return;
}
File file = new File(persistencePath);
if (!file.exists() || file.length() == 0) {
Log.Helper.LOGD(this, "No persistence file for id[%s] to restore from storage %s", this.m_identifier, this.m_storage.toString());
return;
}
Log.Helper.LOGD(this, "Loading persistence file size %d", Long.valueOf(file.length()));
FileInputStream fileInputStream2 = null;
FileInputStream fileInputStream3 = null;
try {
try {
try {
fileInputStream = new FileInputStream(file);
} catch (Throwable th) {
th = th;
}
} catch (Exception e) {
e = e;
}
try {
objectInputStream = new ObjectInputStream(fileInputStream);
} catch (Exception e2) {
e = e2;
fileInputStream3 = fileInputStream;
Log.Helper.LOGE(this, "Can't read persistence (%s) file, %s: %s", this.m_identifier, persistencePath, e.toString());
e.printStackTrace();
fileInputStream2 = fileInputStream3;
if (fileInputStream3 != null) {
fileInputStream3.close();
fileInputStream2 = fileInputStream3;
}
} catch (Throwable th2) {
th = th2;
fileInputStream2 = fileInputStream;
if (fileInputStream2 != null) {
try {
fileInputStream2.close();
} catch (IOException unused) {
}
}
throw th;
}
if (objectInputStream.readInt() != 101) {
throw new InvalidClassException("com.ea.nimble.Persistence", "Persistence version doesn't match");
}
this.m_encryption = objectInputStream.readBoolean();
?? readBoolean = objectInputStream.readBoolean();
this.m_backUp = readBoolean;
FileInputStream fileInputStream4 = readBoolean;
if (!z) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
if (this.m_encryption) {
objectInputStream2 = this.m_encryptor.decryptInputStream(bufferedInputStream);
} else {
objectInputStream2 = new ObjectInputStream(bufferedInputStream);
}
this.m_content = (Map) objectInputStream2.readObject();
Log.Helper.LOGD(this, "Persistence file for id[%s] restored from storage %s", this.m_identifier, this.m_storage.toString());
objectInputStream2.close();
fileInputStream4 = "Persistence file for id[%s] restored from storage %s";
}
objectInputStream.close();
fileInputStream.close();
fileInputStream2 = fileInputStream4;
} catch (IOException unused2) {
}
}
/* JADX WARN: Code restructure failed: missing block: B:24:0x00b5, code lost:
if (r7 == null) goto L32;
*/
/* JADX WARN: Not initialized variable reg: 7, insn: 0x0043: MOVE (r1 I:??[OBJECT, ARRAY]) = (r7 I:??[OBJECT, ARRAY]), block:B:32:0x0043 */
/* JADX WARN: Removed duplicated region for block: B:35:0x00cc A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void savePersistenceData() {
/*
r13 = this;
java.lang.String r0 = "Fail to save persistence file for id[%s] in storage %s: %s"
com.ea.nimble.Log.Helper.LOGFUNC(r13)
r1 = 0
java.lang.String r2 = r13.getPersistencePath(r1)
if (r2 != 0) goto Ld
return
Ld:
java.io.File r3 = new java.io.File
r3.<init>(r2)
r2 = 3
r4 = 1
r5 = 0
r6 = 2
java.io.FileOutputStream r7 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L72 java.security.GeneralSecurityException -> L74 java.io.IOException -> L79
r7.<init>(r3) // Catch: java.lang.Throwable -> L72 java.security.GeneralSecurityException -> L74 java.io.IOException -> L79
java.io.ObjectOutputStream r1 = new java.io.ObjectOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r1.<init>(r7) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r8 = 101(0x65, float:1.42E-43)
r1.writeInt(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
boolean r8 = r13.m_encryption // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r1.writeBoolean(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
boolean r8 = r13.m_backUp // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r1.writeBoolean(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r1.flush() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
java.io.BufferedOutputStream r8 = new java.io.BufferedOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r8.<init>(r7) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
boolean r9 = r13.m_encryption // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
if (r9 == 0) goto L4a
com.ea.nimble.Encryptor r9 = r13.m_encryptor // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
java.io.ObjectOutputStream r8 = r9.encryptOutputStream(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
goto L50
L42:
r0 = move-exception
r1 = r7
goto Lca
L46:
r1 = move-exception
goto L7e
L48:
r1 = move-exception
goto L9b
L4a:
java.io.ObjectOutputStream r9 = new java.io.ObjectOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r9.<init>(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r8 = r9
L50:
java.util.Map<java.lang.String, byte[]> r9 = r13.m_content // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r8.writeObject(r9) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
java.lang.String r9 = "Synchronize persistence for id[%s] in storage %s"
java.lang.Object[] r10 = new java.lang.Object[r6] // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
java.lang.String r11 = r13.m_identifier // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r10[r5] = r11 // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
com.ea.nimble.Persistence$Storage r11 = r13.m_storage // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
java.lang.String r11 = r11.toString() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r10[r4] = r11 // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
com.ea.nimble.Log.Helper.LOGD(r13, r9, r10) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r8.close() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
r1.close() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
L6e:
r7.close() // Catch: java.io.IOException -> Lb8
goto Lb8
L72:
r0 = move-exception
goto Lca
L74:
r7 = move-exception
r12 = r7
r7 = r1
r1 = r12
goto L7e
L79:
r7 = move-exception
r12 = r7
r7 = r1
r1 = r12
goto L9b
L7e:
java.lang.Object[] r2 = new java.lang.Object[r2] // Catch: java.lang.Throwable -> L42
java.lang.String r8 = r13.m_identifier // Catch: java.lang.Throwable -> L42
r2[r5] = r8 // Catch: java.lang.Throwable -> L42
com.ea.nimble.Persistence$Storage r5 = r13.m_storage // Catch: java.lang.Throwable -> L42
java.lang.String r5 = r5.toString() // Catch: java.lang.Throwable -> L42
r2[r4] = r5 // Catch: java.lang.Throwable -> L42
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L42
r2[r6] = r4 // Catch: java.lang.Throwable -> L42
com.ea.nimble.Log.Helper.LOGE(r13, r0, r2) // Catch: java.lang.Throwable -> L42
r1.printStackTrace() // Catch: java.lang.Throwable -> L42
if (r7 == 0) goto Lb8
goto L6e
L9b:
java.lang.Object[] r2 = new java.lang.Object[r2] // Catch: java.lang.Throwable -> L42
java.lang.String r8 = r13.m_identifier // Catch: java.lang.Throwable -> L42
r2[r5] = r8 // Catch: java.lang.Throwable -> L42
com.ea.nimble.Persistence$Storage r5 = r13.m_storage // Catch: java.lang.Throwable -> L42
java.lang.String r5 = r5.toString() // Catch: java.lang.Throwable -> L42
r2[r4] = r5 // Catch: java.lang.Throwable -> L42
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L42
r2[r6] = r4 // Catch: java.lang.Throwable -> L42
com.ea.nimble.Log.Helper.LOGE(r13, r0, r2) // Catch: java.lang.Throwable -> L42
r1.printStackTrace() // Catch: java.lang.Throwable -> L42
if (r7 == 0) goto Lb8
goto L6e
Lb8:
long r0 = r3.length()
java.lang.Long r0 = java.lang.Long.valueOf(r0)
java.lang.Object[] r0 = new java.lang.Object[]{r0}
java.lang.String r1 = "Saving persistence file size %d"
com.ea.nimble.Log.Helper.LOGD(r13, r1, r0)
return
Lca:
if (r1 == 0) goto Lcf
r1.close() // Catch: java.io.IOException -> Lcf
Lcf:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.savePersistenceData():void");
}
/* renamed from: com.ea.nimble.Persistence$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$Persistence$Storage;
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy;
static {
int[] iArr = new int[Storage.values().length];
$SwitchMap$com$ea$nimble$Persistence$Storage = iArr;
try {
iArr[Storage.DOCUMENT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$Persistence$Storage[Storage.CACHE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$Persistence$Storage[Storage.TEMP.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
int[] iArr2 = new int[PersistenceService.PersistenceMergePolicy.values().length];
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy = iArr2;
try {
iArr2[PersistenceService.PersistenceMergePolicy.OVERWRITE.ordinal()] = 1;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[PersistenceService.PersistenceMergePolicy.SOURCE_FIRST.ordinal()] = 2;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[PersistenceService.PersistenceMergePolicy.TARGET_FIRST.ordinal()] = 3;
} catch (NoSuchFieldError unused6) {
}
}
}
public static File getPersistenceDirectory(Storage storage) {
String documentPath;
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Persistence$Storage[storage.ordinal()];
if (i == 1) {
documentPath = component.getDocumentPath();
} else if (i == 2) {
documentPath = component.getCachePath();
} else if (i == 3) {
documentPath = component.getTempPath();
} else {
Log.Helper.LOGES("Persistence", "Unknown storage type", new Object[0]);
return null;
}
File file = new File(documentPath + File.separator + "persistence");
if (file.isDirectory() || file.mkdirs()) {
return file;
}
Log.Helper.LOGE("Persistence", "Cannot create persistence folder in storage(%s) %s", storage, file.toString());
return null;
}
public static File getPersistenceDirectory(Storage storage, Context context) {
String path;
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Persistence$Storage[storage.ordinal()];
if (i == 1) {
File filesDir = context.getFilesDir();
if (filesDir != null) {
path = filesDir.getPath();
}
path = null;
} else if (i == 2 || i == 3) {
File cacheDir = context.getCacheDir();
if (cacheDir != null) {
path = cacheDir.getPath();
}
path = null;
} else {
android.util.Log.e(Global.NIMBLE_ID, "Persistence : Unknown storage type");
return null;
}
if (path == null) {
Log.Helper.LOGE(Global.NIMBLE_ID, "Persistence : Could not build base path for storage(%s)", storage);
return null;
}
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(BaseCore.NIMBLE_SERVER_CONFIG);
StringBuilder sb = new StringBuilder();
sb.append(path);
String str = File.separator;
sb.append(str);
sb.append(Global.NIMBLE_ID);
sb.append(str);
sb.append(configValueAsString);
sb.append(str);
sb.append("persistence");
String sb2 = sb.toString();
if (storage == Storage.TEMP) {
sb2 = sb2 + str + x8.D;
}
File file = new File(sb2);
if (file.isDirectory() || file.mkdirs()) {
return file;
}
android.util.Log.e(Global.NIMBLE_ID, String.format("Persistence : Cannot create persistence folder in storage(%s) %s", storage, sb2));
return null;
}
public String getPersistencePath(Context context) {
if (this.m_persistencePath == null) {
if (context == null) {
this.m_persistencePath = getPersistencePath(this.m_identifier, this.m_storage);
} else {
this.m_persistencePath = getPersistencePath(this.m_identifier, this.m_storage, context);
}
}
return this.m_persistencePath;
}
public static String getPersistencePath(String str, Storage storage) {
File persistenceDirectory = getPersistenceDirectory(storage);
if (persistenceDirectory == null) {
return null;
}
return persistenceDirectory + File.separator + str + ".dat";
}
public static String getPersistencePath(String str, Storage storage, Context context) {
File persistenceDirectory = getPersistenceDirectory(storage, context);
if (persistenceDirectory == null) {
return null;
}
return persistenceDirectory + File.separator + str + ".dat";
}
}

View File

@@ -0,0 +1,122 @@
package com.ea.nimble;
import android.app.backup.BackupAgent;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import java.io.FileOutputStream;
import java.io.IOException;
/* loaded from: classes2.dex */
public class PersistenceService {
private static final String APPLICATION_PERSISTENCE_ID = "[APPLICATION]";
public static final String COMPONENT_ID = "com.ea.nimble.persistence";
private static final String NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE = "[COMPONENT]%s";
public enum PersistenceMergePolicy {
OVERWRITE,
SOURCE_FIRST,
TARGET_FIRST
}
public static class PersistenceBackupAgent extends BackupAgent {
@Override // android.app.backup.BackupAgent
public void onBackup(ParcelFileDescriptor parcelFileDescriptor, BackupDataOutput backupDataOutput, ParcelFileDescriptor parcelFileDescriptor2) throws IOException {
synchronized (Persistence.s_dataLock) {
PersistenceService.writeBackup(parcelFileDescriptor, backupDataOutput, parcelFileDescriptor2, this);
}
}
@Override // android.app.backup.BackupAgent
public void onRestore(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor) throws IOException {
synchronized (Persistence.s_dataLock) {
PersistenceService.readBackup(backupDataInput, i, parcelFileDescriptor, this);
}
}
}
public static IPersistenceService getComponent() {
return BaseCore.getInstance().getPersistenceService();
}
public static Persistence getAppPersistence(Persistence.Storage storage) {
return getComponent().getPersistence(APPLICATION_PERSISTENCE_ID, storage);
}
public static Persistence getPersistenceForNimbleComponent(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return null;
}
return getComponent().getPersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
public static void removePersistenceForNimbleComponent(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return;
}
getComponent().removePersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
public static void cleanReferenceToPersistence(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return;
}
getComponent().cleanPersistenceReference(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
/* JADX WARN: Removed duplicated region for block: B:6:0x0040 */
/* JADX WARN: Removed duplicated region for block: B:9:0x004a */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void writeBackup(android.os.ParcelFileDescriptor r16, android.app.backup.BackupDataOutput r17, android.os.ParcelFileDescriptor r18, android.content.Context r19) throws java.io.IOException {
/*
Method dump skipped, instructions count: 266
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.PersistenceService.writeBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor, android.content.Context):void");
}
public static void readBackup(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor, Context context) throws IOException {
while (true) {
FileOutputStream fileOutputStream = null;
if (!backupDataInput.readNextHeader()) {
break;
}
String key = backupDataInput.getKey();
int dataSize = backupDataInput.getDataSize();
byte[] bArr = new byte[dataSize];
backupDataInput.readEntityData(bArr, 0, dataSize);
try {
FileOutputStream fileOutputStream2 = new FileOutputStream(Persistence.getPersistencePath(key, Persistence.Storage.DOCUMENT, context));
try {
fileOutputStream2.write(bArr);
fileOutputStream2.close();
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream2;
if (fileOutputStream != null) {
fileOutputStream.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
if (ApplicationEnvironment.isMainApplicationRunning()) {
for (Persistence persistence : ((PersistenceServiceImpl) getComponent()).m_persistences.values()) {
if (persistence.getBackUp()) {
persistence.restore(false, null);
}
}
}
}
}

View File

@@ -0,0 +1,200 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import com.ea.nimble.PersistenceService;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* loaded from: classes2.dex */
public class PersistenceServiceImpl extends Component implements IPersistenceService, LogSource {
private Encryptor m_encryptor;
protected ConcurrentMap<String, Persistence> m_persistences;
@Override // com.ea.nimble.Component
public String getComponentId() {
return PersistenceService.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "Persistence";
}
@Override // com.ea.nimble.Component
public void setup() {
this.m_persistences = new ConcurrentHashMap();
this.m_encryptor = new Encryptor();
}
@Override // com.ea.nimble.Component
public void suspend() {
synchronize();
}
@Override // com.ea.nimble.Component
public void teardown() {
synchronize();
synchronized (Persistence.s_dataLock) {
this.m_persistences = null;
this.m_encryptor = null;
}
}
@Override // com.ea.nimble.IPersistenceService
public Persistence getPersistence(String str, Persistence.Storage storage) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]);
return null;
}
synchronized (Persistence.s_dataLock) {
try {
Persistence loadPersistenceById = loadPersistenceById(str, storage);
if (loadPersistenceById != null) {
return loadPersistenceById;
}
Persistence persistence = new Persistence(str, storage, this.m_encryptor);
this.m_persistences.put(str + "-" + storage.toString(), persistence);
return persistence;
} catch (Throwable th) {
throw th;
}
}
}
@Override // com.ea.nimble.IPersistenceService
public void removePersistence(String str, Persistence.Storage storage) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]);
return;
}
cleanPersistenceReference(str, storage);
}
@Override // com.ea.nimble.IPersistenceService
public void cleanPersistenceReference(String str, Persistence.Storage storage) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str)) {
Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]);
return;
}
synchronized (Persistence.s_dataLock) {
this.m_persistences.remove(str + "-" + storage.toString());
}
}
@Override // com.ea.nimble.IPersistenceService
public void wipeAllDataAndForceTerminate() {
Log.Helper.LOGPUBLICFUNC(this);
String documentPath = ApplicationEnvironment.getComponent().getDocumentPath();
String tempPath = ApplicationEnvironment.getComponent().getTempPath();
String cachePath = ApplicationEnvironment.getComponent().getCachePath();
BaseCore.getInstance().onApplicationQuit();
try {
Log.Helper.LOGW(this, "!!! Wipe begin !!!", new Object[0]);
Log.Helper.LOGD(this, "Clearing DOC folder", new Object[0]);
if (deletePath(documentPath)) {
Log.Helper.LOGD(this, "Successfully deleted doc directory", new Object[0]);
} else {
Log.Helper.LOGE(this, "Failed to delete doc directory", new Object[0]);
}
Log.Helper.LOGD(this, "Clearing TEMP folder", new Object[0]);
if (deletePath(tempPath)) {
Log.Helper.LOGD(this, "Successfully deleted temp directory", new Object[0]);
} else {
Log.Helper.LOGE(this, "Failed to delete temp directory", new Object[0]);
}
Log.Helper.LOGD(this, "Clearing CACHE folder", new Object[0]);
if (deletePath(cachePath)) {
Log.Helper.LOGD(this, "Successfully deleted cache directory", new Object[0]);
} else {
Log.Helper.LOGE(this, "Failed to delete cache directory", new Object[0]);
}
Log.Helper.LOGW(this, "!!! Wipe complete. Force terminating the application !!!", new Object[0]);
} catch (Exception e) {
Log.Helper.LOGE(this, "!!! Wipe exception !!!\n" + e.toString(), new Object[0]);
}
System.exit(0);
}
@Override // com.ea.nimble.IPersistenceService
public void migratePersistence(String str, Persistence.Storage storage, String str2, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
Log.Helper.LOGPUBLICFUNC(this);
if (!Utility.validString(str) || !Utility.validString(str2)) {
Log.Helper.LOGF(this, "Invalid identifiers " + str + " or " + str2 + " for component persistence", new Object[0]);
return;
}
synchronized (Persistence.s_dataLock) {
try {
String str3 = str2 + "-" + storage.toString();
Persistence loadPersistenceById = loadPersistenceById(str, storage);
if (loadPersistenceById == null) {
if (persistenceMergePolicy == PersistenceService.PersistenceMergePolicy.OVERWRITE) {
this.m_persistences.remove(str3);
String persistencePath = Persistence.getPersistencePath(str2, storage);
File file = persistencePath != null ? new File(persistencePath) : null;
if (file == null || !file.delete()) {
Log.Helper.LOGE(this, "Could not delete file: " + persistencePath, new Object[0]);
}
}
return;
}
Persistence loadPersistenceById2 = loadPersistenceById(str2, storage);
if (loadPersistenceById2 == null) {
Persistence persistence = new Persistence(loadPersistenceById, str2);
this.m_persistences.put(str3, persistence);
persistence.lambda$new$0();
} else {
loadPersistenceById2.merge(loadPersistenceById, persistenceMergePolicy);
}
} catch (Throwable th) {
throw th;
}
}
}
private void synchronize() {
Log.Helper.LOGFUNC(this);
Iterator<Persistence> it = this.m_persistences.values().iterator();
while (it.hasNext()) {
it.next().lambda$new$0();
}
}
private Persistence loadPersistenceById(String str, Persistence.Storage storage) {
Log.Helper.LOGFUNC(this);
synchronized (Persistence.s_dataLock) {
try {
String str2 = str + "-" + storage.toString();
Persistence persistence = this.m_persistences.get(str2);
if (persistence != null) {
return persistence;
}
String persistencePath = Persistence.getPersistencePath(str, storage);
File file = persistencePath != null ? new File(persistencePath) : null;
if (file != null && file.exists()) {
Persistence persistence2 = new Persistence(str, storage, this.m_encryptor);
persistence2.restore(false, null);
this.m_persistences.put(str2, persistence2);
return persistence2;
}
return null;
} finally {
}
}
}
private boolean deletePath(String str) {
File file = new File(str);
if (file.isDirectory()) {
for (String str2 : file.list()) {
deletePath(new File(file, str2).getPath());
}
}
return file.delete();
}
}

View File

@@ -0,0 +1,10 @@
package com.ea.nimble;
import com.ea.nimble.Persistence;
/* loaded from: classes2.dex */
public class QA {
public static String getPersistencePath(String str, Persistence.Storage storage) {
return Persistence.getPersistencePath(str, storage);
}
}

View File

@@ -0,0 +1,14 @@
package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class ReferrerReceiver extends BroadcastReceiver {
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
Log.Helper.LOGES("ReferrerReceiver", "ReferrerReceiver has been deprecated. Please remove \"com.ea.nimble.ReferrerReceiver\" receiver block from your AndroidManifest.xml file.", new Object[0]);
}
}

View File

@@ -0,0 +1,30 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class SynergyEnvironment {
public static final String COMPONENT_ID = "com.ea.nimble.synergyEnvironment";
public static final int INVALID_INT_VALUE = -1;
public static final String NOTIFICATION_APP_VERSION_CHECK_FINISHED = "nimble.environment.notification.app_version_check_finished";
public static final String NOTIFICATION_RESTORED_FROM_PERSISTENT = "nimble.environment.notification.restored_from_persistent";
public static final String NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED = "nimble.environment.notification.startup_environment_data_changed";
public static final String NOTIFICATION_STARTUP_REQUESTS_FINISHED = "nimble.environment.notification.startup_requests_finished";
public static final String NOTIFICATION_STARTUP_REQUESTS_STARTED = "nimble.environment.notification.startup_requests_started";
public static final String SERVER_URL_KEY_ANTELOPE_GROUPS = "antelope.groups.url";
public static final String SERVER_URL_KEY_ANTELOPE_REAL_TIME_MESSAGING = "antelope.rtm.host";
public static final String SERVER_URL_KEY_ANTELOPE_REST_MESSAGING = "antelope.rtm.url";
public static final String SERVER_URL_KEY_ARUBA = "aruba.url";
public static final String SERVER_URL_KEY_EADP_FRIENDS_HOST = "eadp.friends.host";
public static final String SERVER_URL_KEY_ENS = "ens.url";
public static final String SERVER_URL_KEY_IDENTITY_CONNECT = "nexus.connect";
public static final String SERVER_URL_KEY_IDENTITY_PORTAL = "nexus.portal";
public static final String SERVER_URL_KEY_IDENTITY_PROXY = "nexus.proxy";
public static final String SERVER_URL_KEY_SYNERGY_DRM = "synergy.drm";
public static final String SERVER_URL_KEY_SYNERGY_PRODUCT = "synergy.product";
public static final String SERVER_URL_KEY_SYNERGY_S2S = "synergy.s2s";
public static final String SERVER_URL_KEY_SYNERGY_TRACKING = "synergy.tracking";
public static final String SERVER_URL_KEY_SYNERGY_USER = "synergy.user";
public static ISynergyEnvironment getComponent() {
return (ISynergyEnvironment) Base.getComponent(COMPONENT_ID);
}
}

View File

@@ -0,0 +1,490 @@
package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.ea.nimble.Persistence;
import com.ea.nimble.SynergyEnvironmentUpdater;
import java.io.Serializable;
import java.util.HashMap;
/* loaded from: classes2.dex */
public class SynergyEnvironmentImpl extends Component implements ISynergyEnvironment, LogSource {
private static final String PERSISTENCE_DATA_ID = "environmentData";
public static final int SYNERGY_APP_VERSION_OK = 0;
public static final int SYNERGY_APP_VERSION_UPDATE_RECOMMENDED = 1;
public static final int SYNERGY_APP_VERSION_UPDATE_REQUIRED = 2;
private static final String SYNERGY_INT_SERVER_URL = "https://director-int.sn.eamobile.com";
private static final String SYNERGY_LIVE_SERVER_URL = "https://syn-dir.sn.eamobile.com";
private static final String SYNERGY_STAGE_SERVER_URL = "https://director-stage.sn.eamobile.com";
public static final double SYNERGY_UPDATE_RATE_LIMIT_PERIOD_IN_SECONDS = 60.0d;
public static final double SYNERGY_UPDATE_REFRESH_PERIOD_IN_SECONDS = 300.0d;
private BaseCore m_core;
private EnvironmentDataContainer m_environmentDataContainer;
private EnvironmentDataContainer m_previousValidEnvironmentDataContainer;
private Long m_synergyEnvironmentUpdateRateLimitTriggerTimestamp;
private SynergyEnvironmentUpdater m_synergyStartupObject;
private BroadcastReceiver m_networkStatusChangeReceiver = null;
private boolean m_dataLoadedOnComponentSetup = false;
private boolean m_pendingStartupFinishedNotification = false;
@Override // com.ea.nimble.Component
public String getComponentId() {
return SynergyEnvironment.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyEnv";
}
public SynergyEnvironmentImpl(BaseCore baseCore) {
this.m_core = baseCore;
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getEADeviceId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getEADeviceId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSynergyId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getSynergyId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSellId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getSellId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getProductId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getProductId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getEAHardwareId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getEAHardwareId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public Error setServerUrl(String str, String str2) {
return this.m_environmentDataContainer.setServerUrl(str, str2);
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getServerUrlWithKey(String str) {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getServerUrlWithKey(str);
}
@Override // com.ea.nimble.ISynergyEnvironment
public int getLatestAppVersionCheckResult() {
Log.Helper.LOGPUBLICFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return 0;
}
return environmentDataContainer.getLatestAppVersionCheckResult();
}
@Override // com.ea.nimble.ISynergyEnvironment
public int getTrackingPostInterval() {
Log.Helper.LOGPUBLICFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return -1;
}
return environmentDataContainer.getTrackingPostInterval();
}
/* renamed from: com.ea.nimble.SynergyEnvironmentImpl$3, reason: invalid class name */
public static /* synthetic */ class AnonymousClass3 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration;
static {
int[] iArr = new int[NimbleConfiguration.values().length];
$SwitchMap$com$ea$nimble$NimbleConfiguration = iArr;
try {
iArr[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) {
Log.Helper.LOGPUBLICFUNC(this);
int i = AnonymousClass3.$SwitchMap$com$ea$nimble$NimbleConfiguration[nimbleConfiguration.ordinal()];
if (i == 1) {
return SYNERGY_INT_SERVER_URL;
}
if (i == 2) {
return SYNERGY_STAGE_SERVER_URL;
}
if (i == 3) {
return SYNERGY_LIVE_SERVER_URL;
}
if (i == 4) {
return NimbleApplicationConfiguration.getConfigValueAsString("NimbleCustomizedSynergyServerEndpointUrl", SYNERGY_LIVE_SERVER_URL);
}
Log.Helper.LOGF(this, "Request for Synergy Director server URL with unknown NimbleConfiguration, %d.", nimbleConfiguration);
return SYNERGY_LIVE_SERVER_URL;
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isDataAvailable() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_environmentDataContainer != null;
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isUpdateInProgress() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_synergyStartupObject != null;
}
@Override // com.ea.nimble.ISynergyEnvironment
public Error checkAndInitiateSynergyEnvironmentUpdate() {
Log.Helper.LOGPUBLICFUNC(this);
if (isUpdateInProgress()) {
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Update in progress.");
}
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer != null && environmentDataContainer.getMostRecentDirectorResponseTimestamp() != null) {
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Environment data already cached.");
}
if (isInSynergyEnvironmentUpdateRateLimitingPeriod()) {
Log.Helper.LOGD(this, "Attempt to re-initiate Synergy environment update blocked by rate limiting. %.2f seconds of rate limiting left", Double.valueOf(60.0d - ((System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue()) / 1000.0d)));
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Synergy environment update rate limit in effect.");
}
startSynergyEnvironmentUpdate();
return null;
}
@Override // com.ea.nimble.ISynergyEnvironment
public boolean isFeatureDisabled(String str) {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
return environmentDataContainer != null && environmentDataContainer.isFeatureDisabled(str);
}
@Override // com.ea.nimble.Component
public void setup() {
Log.Helper.LOGFUNC(this);
this.m_dataLoadedOnComponentSetup = restoreEnvironmentDataFromPersistent(true);
}
@Override // com.ea.nimble.Component
public void restore() {
Log.Helper.LOGFUNC(this);
if (this.m_dataLoadedOnComponentSetup) {
this.m_dataLoadedOnComponentSetup = false;
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT);
} else {
restoreEnvironmentDataFromPersistent(false);
}
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null || environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue()) / 1000.0d > 300.0d) {
startSynergyEnvironmentUpdate();
} else {
checkAndInitiateSynergyEnvironmentUpdate();
}
}
@Override // com.ea.nimble.Component
public void suspend() {
Log.Helper.LOGFUNC(this);
SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject;
if (synergyEnvironmentUpdater != null) {
synergyEnvironmentUpdater.cancel();
this.m_synergyStartupObject = null;
}
BroadcastReceiver broadcastReceiver = this.m_networkStatusChangeReceiver;
if (broadcastReceiver != null) {
Utility.unregisterReceiver(broadcastReceiver);
this.m_networkStatusChangeReceiver = null;
}
saveEnvironmentDataToPersistent();
}
@Override // com.ea.nimble.Component
public void resume() {
Log.Helper.LOGFUNC(this);
clearSynergyEnvironmentUpdateRateLimiting();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null || environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue()) / 1000.0d > 300.0d) {
startSynergyEnvironmentUpdate();
}
if (this.m_pendingStartupFinishedNotification) {
this.m_pendingStartupFinishedNotification = false;
HashMap hashMap = new HashMap();
hashMap.put("result", "1");
Log.Helper.LOGD(this, "App is running in forground, sending delayed the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap);
}
}
@Override // com.ea.nimble.Component
public void cleanup() {
Log.Helper.LOGFUNC(this);
SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject;
if (synergyEnvironmentUpdater != null) {
synergyEnvironmentUpdater.cancel();
this.m_synergyStartupObject = null;
}
BroadcastReceiver broadcastReceiver = this.m_networkStatusChangeReceiver;
if (broadcastReceiver != null) {
Utility.unregisterReceiver(broadcastReceiver);
this.m_networkStatusChangeReceiver = null;
}
saveEnvironmentDataToPersistent();
this.m_environmentDataContainer = null;
}
@Override // com.ea.nimble.Component
public void teardown() {
Log.Helper.LOGFUNC(this);
this.m_environmentDataContainer = null;
}
private void startSynergyEnvironmentUpdate() {
SynergyEnvironmentUpdater synergyEnvironmentUpdater;
Log.Helper.LOGFUNC(this);
synchronized (this) {
try {
if (this.m_synergyStartupObject == null) {
synergyEnvironmentUpdater = new SynergyEnvironmentUpdater(this.m_core);
this.m_synergyStartupObject = synergyEnvironmentUpdater;
} else {
synergyEnvironmentUpdater = null;
}
} catch (Throwable th) {
throw th;
}
}
if (synergyEnvironmentUpdater == null) {
Log.Helper.LOGD(this, "Attempt made to start Synergy environment update while a previous one is active. Exiting.", new Object[0]);
return;
}
if (Network.getComponent().getStatus() == Network.Status.OK) {
startSynergyEnvironmentUpdateImpl(synergyEnvironmentUpdater);
} else if (this.m_networkStatusChangeReceiver == null) {
this.m_networkStatusChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.SynergyEnvironmentImpl.1
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Global.NOTIFICATION_NETWORK_STATUS_CHANGE) && Network.getComponent().getStatus() == Network.Status.OK) {
Log.Helper.LOGD(this, "Network restored. Starting Synergy environment update.", new Object[0]);
Utility.unregisterReceiver(SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver);
SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver = null;
SynergyEnvironmentImpl synergyEnvironmentImpl = SynergyEnvironmentImpl.this;
synergyEnvironmentImpl.startSynergyEnvironmentUpdateImpl(synergyEnvironmentImpl.m_synergyStartupObject);
}
}
};
Log.Helper.LOGD(this, "Network not available to perform environment update. Setting receiver to listen for network status change.", new Object[0]);
Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkStatusChangeReceiver);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void startSynergyEnvironmentUpdateImpl(final SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
Log.Helper.LOGFUNC(this);
if (synergyEnvironmentUpdater == null) {
Log.Helper.LOGD(this, "Synergy Environment Update canceled before it could start", new Object[0]);
return;
}
this.m_previousValidEnvironmentDataContainer = this.m_environmentDataContainer;
HashMap hashMap = new HashMap();
hashMap.put("result", "1");
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_STARTED, hashMap);
synergyEnvironmentUpdater.startSynergyStartupSequence(this.m_previousValidEnvironmentDataContainer, new SynergyEnvironmentUpdater.CompletionCallback() { // from class: com.ea.nimble.SynergyEnvironmentImpl.2
@Override // com.ea.nimble.SynergyEnvironmentUpdater.CompletionCallback
public void callback(Exception exc) {
if (exc == null) {
if (SynergyEnvironmentImpl.this.m_synergyStartupObject != null && synergyEnvironmentUpdater.getEnvironmentDataContainer() != null) {
SynergyEnvironmentImpl.this.m_environmentDataContainer = synergyEnvironmentUpdater.getEnvironmentDataContainer();
SynergyEnvironmentImpl.this.saveEnvironmentDataToPersistent();
if (SynergyEnvironmentImpl.this.m_environmentDataContainer.getKeysOfDifferences(SynergyEnvironmentImpl.this.m_previousValidEnvironmentDataContainer) != null) {
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED);
}
HashMap hashMap2 = new HashMap();
hashMap2.put("result", "1");
if (ApplicationEnvironment.isMainApplicationActive()) {
Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap2);
} else {
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
SynergyEnvironmentImpl.this.m_pendingStartupFinishedNotification = true;
}
} else {
Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. Update was canceled", new Object[0]);
}
} else {
Log.Helper.LOGE(this, "StartupError(%s)", exc);
if (!(exc instanceof Error)) {
if (SynergyEnvironmentImpl.this.m_synergyStartupObject == null || synergyEnvironmentUpdater.getEnvironmentDataContainer() == null) {
Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. More than one update was being peroformed", new Object[0]);
}
} else {
Error error = (Error) exc;
if (error.isError(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT) || error.isError(Error.Code.SYNERGY_SERVER_FULL)) {
Log.Helper.LOGD(this, "GetDirection request timed out or ServerUnavailable signal received. Start rate limiting of /getDirection call.", new Object[0]);
SynergyEnvironmentImpl.this.startSynergyEnvironmentUpdateRateLimiting();
}
}
HashMap hashMap3 = new HashMap();
hashMap3.put("result", "0");
hashMap3.put("error", exc.toString());
if (ApplicationEnvironment.isMainApplicationActive()) {
Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap3);
} else {
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
}
}
SynergyEnvironmentImpl.this.m_synergyStartupObject = null;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void startSynergyEnvironmentUpdateRateLimiting() {
Log.Helper.LOGFUNC(this);
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = Long.valueOf(System.currentTimeMillis());
}
private boolean isInSynergyEnvironmentUpdateRateLimitingPeriod() {
Log.Helper.LOGFUNC(this);
return this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp != null && ((double) (System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue())) <= 60000.0d;
}
private void clearSynergyEnvironmentUpdateRateLimiting() {
Log.Helper.LOGFUNC(this);
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = null;
}
private boolean restoreEnvironmentDataFromPersistent(boolean z) {
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
Serializable value = persistenceForNimbleComponent.getValue(PERSISTENCE_DATA_ID);
if (value == null) {
Log.Helper.LOGD(this, "Environment persistence data value not found in persistence object. Probably first install.", new Object[0]);
} else {
try {
EnvironmentDataContainer environmentDataContainer = (EnvironmentDataContainer) value;
this.m_environmentDataContainer = environmentDataContainer;
Log.Helper.LOGD(this, "Restored environment data from persistent. Restored data timestamp, %s", environmentDataContainer.getMostRecentDirectorResponseTimestamp());
if (!z) {
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT);
}
return true;
} catch (ClassCastException unused) {
Log.Helper.LOGE(this, "Environment persistence data value is not the expected type.", new Object[0]);
}
}
} else {
Log.Helper.LOGE(this, "Could not get environment persistence object to restore from", new Object[0]);
}
this.m_environmentDataContainer = null;
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public void saveEnvironmentDataToPersistent() {
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
Log.Helper.LOGD(this, "Saving environment data to persistent.", new Object[0]);
persistenceForNimbleComponent.setValue(PERSISTENCE_DATA_ID, this.m_environmentDataContainer);
persistenceForNimbleComponent.lambda$new$0();
return;
}
Log.Helper.LOGE(this, "Could not get environment persistence object to save to.", new Object[0]);
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientId() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getNexusClientId();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientSecret() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getNexusClientSecret();
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getGosMdmAppKey() {
Log.Helper.LOGPUBLICFUNC(this);
checkAndInitiateSynergyEnvironmentUpdate();
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
if (environmentDataContainer == null) {
return null;
}
return environmentDataContainer.getGosMdmAppKey();
}
}

View File

@@ -0,0 +1,384 @@
package com.ea.nimble;
import android.content.Context;
import android.content.res.Resources;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.ironsource.f5;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes2.dex */
class SynergyEnvironmentUpdater implements LogSource {
private static final int GET_ANONUID_MAX_RETRY_ATTEMPTS = 3;
private static final int GET_DIRECTION_MAX_RETRY_ATTEMPTS = 3;
private static final int GET_EADEVICEID_MAX_RETRY_ATTEMPTS = 3;
private static final int SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL = -70002;
private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID = -20094;
private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED = -20093;
private static final int VALIDATE_EADEVICEID_MAX_RETRY_ATTEMPTS = 3;
private BaseCore m_core;
private long m_getAnonUIDRetryCount;
private long m_getDirectionRetryCount;
private EnvironmentDataContainer m_environmentForSynergyStartUp = new EnvironmentDataContainer();
private CompletionCallback m_completionCallback = null;
private EnvironmentDataContainer m_previousValidEnvironmentData = null;
private SynergyNetworkConnectionHandle m_synergyNetworkConnectionHandle = null;
private long m_validateEADeviceIDRetryCount = 0;
private long m_getEADeviceIDRetryCount = 0;
public interface CompletionCallback {
void callback(Exception exc);
}
public EnvironmentDataContainer getEnvironmentDataContainer() {
return this.m_environmentForSynergyStartUp;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyEnv";
}
public static /* synthetic */ long access$1108(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
long j = synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount;
synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount = 1 + j;
return j;
}
public static /* synthetic */ long access$1308(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
long j = synergyEnvironmentUpdater.m_getAnonUIDRetryCount;
synergyEnvironmentUpdater.m_getAnonUIDRetryCount = 1 + j;
return j;
}
public static /* synthetic */ long access$408(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
long j = synergyEnvironmentUpdater.m_getDirectionRetryCount;
synergyEnvironmentUpdater.m_getDirectionRetryCount = 1 + j;
return j;
}
public static /* synthetic */ long access$808(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
long j = synergyEnvironmentUpdater.m_getEADeviceIDRetryCount;
synergyEnvironmentUpdater.m_getEADeviceIDRetryCount = 1 + j;
return j;
}
public SynergyEnvironmentUpdater(BaseCore baseCore) {
this.m_core = baseCore;
}
public void startSynergyStartupSequence(EnvironmentDataContainer environmentDataContainer, CompletionCallback completionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_completionCallback = completionCallback;
this.m_previousValidEnvironmentData = environmentDataContainer;
if (Network.getComponent().getStatus() != Network.Status.OK) {
onStartUpSequenceFinished(new Error(Error.Code.NETWORK_NO_CONNECTION, "Device is not connected to Wifi or wireless."));
} else {
callSynergyGetDirection();
}
}
public void cancel() {
Log.Helper.LOGPUBLICFUNC(this);
SynergyNetworkConnectionHandle synergyNetworkConnectionHandle = this.m_synergyNetworkConnectionHandle;
if (synergyNetworkConnectionHandle != null) {
Log.Helper.LOGD(this, "Canceling network connection.", new Object[0]);
synergyNetworkConnectionHandle.cancel();
this.m_synergyNetworkConnectionHandle = null;
}
onStartUpSequenceFinished(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Synergy startup sequence canceled."));
}
/* JADX INFO: Access modifiers changed from: private */
public void loadConfig(Map<String, Object> map) {
this.m_environmentForSynergyStartUp.setMostRecentDirectorResponseTimestamp(Long.valueOf(System.currentTimeMillis()));
this.m_environmentForSynergyStartUp.setGetDirectionResponseDictionary(map);
List<Map> list = (List) this.m_environmentForSynergyStartUp.getGetDirectionResponseDictionary().get(f5.r);
this.m_environmentForSynergyStartUp.setServerUrls(new HashMap());
if (list != null) {
for (Map map2 : list) {
this.m_environmentForSynergyStartUp.getServerUrls().put((String) map2.get("key"), (String) map2.get("value"));
}
}
if (this.m_environmentForSynergyStartUp.getServerUrls().size() == 0) {
onStartUpSequenceFinished(new Error(Error.Code.NOT_AVAILABLE, "No Synergy server URLs available."));
return;
}
EnvironmentDataContainer environmentDataContainer = this.m_previousValidEnvironmentData;
if (environmentDataContainer != null && Utility.validString(environmentDataContainer.getEADeviceId())) {
callSynergyValidateEADeviceId(this.m_previousValidEnvironmentData.getEADeviceId());
} else {
callSynergyGetEADeviceId();
}
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyGetDirection() {
Log.Helper.LOGPUBLICFUNC(this);
String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId();
String deviceString = ApplicationEnvironment.getComponent().getDeviceString();
String deviceCodename = ApplicationEnvironment.getComponent().getDeviceCodename();
String deviceManufacturer = ApplicationEnvironment.getComponent().getDeviceManufacturer();
String deviceModel = ApplicationEnvironment.getComponent().getDeviceModel();
String deviceBrand = ApplicationEnvironment.getComponent().getDeviceBrand();
String deviceFingerprint = ApplicationEnvironment.getComponent().getDeviceFingerprint();
if (!Utility.validString(applicationBundleId)) {
Log.Helper.LOGE(this, "GETDIRECTION bundleId is invalid", new Object[0]);
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "bundleId is invalid"));
return;
}
if (!Utility.validString(deviceString)) {
Log.Helper.LOGE(this, "GETDIRECTION deviceString is invalid", new Object[0]);
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "deviceString is invalid"));
return;
}
try {
if (this.m_core.getConfiguration() == NimbleConfiguration.MANUAL) {
try {
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
Resources resources = applicationContext.getResources();
loadConfig(Utility.convertJSONObjectToMap(new JSONObject(Utility.readStringFromStream(resources.openRawResource(resources.getIdentifier("synergy_direction", "raw", applicationContext.getPackageName()))))));
return;
} catch (Exception e) {
Log.Helper.LOGF(this, "Error loading synergy_direction.json: " + e.toString(), new Object[0]);
return;
}
}
HashMap hashMap = new HashMap();
hashMap.put("packageId", applicationBundleId);
hashMap.put("deviceString", deviceString);
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_CODENAME, deviceCodename);
hashMap.put("manufacturer", deviceManufacturer);
hashMap.put("model", deviceModel);
hashMap.put("brand", deviceBrand);
hashMap.put("fingerprint", deviceFingerprint);
hashMap.put("serverEnvironment", getSynergyServerEnvironmentName());
hashMap.put("sdkVersion", Global.NIMBLE_RELEASE_VERSION);
hashMap.put("apiVer", "1.0.0");
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getSynergyDirectorServerUrl(Base.getConfiguration()), "/director/api/android/getDirectionByPackage", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.1
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
Log.Helper.LOGD(this, "GETDIRECTION FINISHED", new Object[0]);
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error == null) {
SynergyEnvironmentUpdater.this.loadConfig(synergyNetworkConnectionHandle.getResponse().getJsonData());
return;
}
if (!(error instanceof SynergyServerError)) {
boolean isTimeoutError = SynergyEnvironmentUpdater.this.isTimeoutError(error);
if (isTimeoutError || SynergyEnvironmentUpdater.this.m_getDirectionRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_getDirectionRetryCount = 0L;
if (isTimeoutError) {
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT, "Synergy /getDirectionByPackage request timed out.", error));
return;
} else {
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(error);
return;
}
}
SynergyEnvironmentUpdater.access$408(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "GetDirection, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getDirectionRetryCount));
SynergyEnvironmentUpdater.this.callSynergyGetDirection();
return;
}
if (((SynergyServerError) error).isError(SynergyEnvironmentUpdater.SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL)) {
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_SERVER_FULL, "Synergy ServerUnavailable signal received.", error));
}
}
});
} catch (Throwable unused) {
}
}
/* renamed from: com.ea.nimble.SynergyEnvironmentUpdater$5, reason: invalid class name */
public static /* synthetic */ class AnonymousClass5 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration;
static {
int[] iArr = new int[NimbleConfiguration.values().length];
$SwitchMap$com$ea$nimble$NimbleConfiguration = iArr;
try {
iArr[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.MANUAL.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
private String getSynergyServerEnvironmentName() {
Log.Helper.LOGFUNC(this);
int i = AnonymousClass5.$SwitchMap$com$ea$nimble$NimbleConfiguration[this.m_core.getConfiguration().ordinal()];
if (i == 1 || i == 2 || i == 3 || i == 4) {
return this.m_core.getConfiguration().toString();
}
if (i == 5) {
return NimbleApplicationConfiguration.getConfigValueAsString("NimbleCustomizedSynergyServerEnvironmentName", "live");
}
Log.Helper.LOGF(this, "Request for Synergy server environment name with unknown NimbleConfiguration %s", this.m_core.getConfiguration().toString());
return "live";
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyGetEADeviceId() {
Log.Helper.LOGFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, ApplicationEnvironment.getComponent().getAndroidId());
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.2
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error != null) {
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount = 0L;
Log.Helper.LOGD(this, "GetEADeviceID Error (%s)", synergyNetworkConnectionHandle.getResponse().getError());
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "GetEADevideId call failed", synergyNetworkConnectionHandle.getResponse().getError()));
return;
} else {
SynergyEnvironmentUpdater.access$808(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "GetEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount));
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
}
Log.Helper.LOGD(this, "GetEADeviceID Success", new Object[0]);
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyValidateEADeviceId(final String str) {
Log.Helper.LOGFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, ApplicationEnvironment.getComponent().getAndroidId());
hashMap.put("eadeviceid", str);
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/validateDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.3
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error == null) {
Log.Helper.LOGD(this, "ValidateEADeviceID Success", new Object[0]);
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
return;
}
Log.Helper.LOGD(this, "ValidateEADeviceID Error (%s)", error);
if (error instanceof SynergyServerError) {
SynergyServerError synergyServerError = (SynergyServerError) error;
if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID)) {
if (SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData != null) {
SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData.setEADeviceId(null);
}
Log.Helper.LOGD(this, "ValidateEADeviceID, Server signal received to delete cached EA Device ID. Making request to get a new EA Device ID.", new Object[0]);
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED)) {
Log.Helper.LOGD(this, "ValidateEADeviceID, EADeviceID validation failed. Making request to get a new EA Device ID.", new Object[0]);
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
}
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount = 0L;
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "ValidateEADeviceId call failed", error));
} else {
SynergyEnvironmentUpdater.access$1108(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "ValidateEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount));
SynergyEnvironmentUpdater.this.callSynergyValidateEADeviceId(str);
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyGetAnonUid() {
Log.Helper.LOGFUNC(this);
String anonymousSynergyId = SynergyIdManager.getComponent().getAnonymousSynergyId();
if (anonymousSynergyId != null) {
Log.Helper.LOGD(this, "Not getting anonymous ID from Synergy since it was loaded from persistence", new Object[0]);
this.m_environmentForSynergyStartUp.setSynergyAnonymousId(anonymousSynergyId);
onStartUpSequenceFinished(null);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("updatePriority", "false");
hashMap.put("hwId", this.m_environmentForSynergyStartUp.getEAHardwareId());
if (Utility.validString(this.m_environmentForSynergyStartUp.getEADeviceId())) {
hashMap.put("eadeviceid", this.m_environmentForSynergyStartUp.getEADeviceId());
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getAnonUid", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.4
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error != null) {
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount = 0L;
Log.Helper.LOGD(this, "GETANON Error, (%s)", synergyNetworkConnectionHandle.getResponse().getError().toString());
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_ANONYMOUS_ID_FAILURE, "Synergy \"get anonymous id\" call failed.", error));
return;
} else {
SynergyEnvironmentUpdater.access$1308(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "GetAnonUid, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount));
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
return;
}
}
Log.Helper.LOGD(this, "GETANON Success", new Object[0]);
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setSynergyAnonymousId(synergyNetworkConnectionHandle.getResponse().getJsonData().get("uid").toString());
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(null);
}
});
} else {
Log.Helper.LOGE(this, "getAnonUid got an invalid EA Device ID.", new Object[0]);
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "EA Device ID is invalid"));
}
}
/* JADX INFO: Access modifiers changed from: private */
public void onStartUpSequenceFinished(Exception exc) {
Log.Helper.LOGFUNC(this);
CompletionCallback completionCallback = this.m_completionCallback;
if (completionCallback != null) {
completionCallback.callback(exc);
} else {
Log.Helper.LOGW(this, "Startup sequence finished, but no completion callback set.", new Object[0]);
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean isTimeoutError(Exception exc) {
Log.Helper.LOGFUNC(this);
return (exc instanceof Error) && ((Error) exc).isError(Error.Code.NETWORK_TIMEOUT);
}
}

View File

@@ -0,0 +1,13 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class SynergyIdManager {
public static final String COMPONENT_ID = "com.ea.nimble.synergyidmanager";
public static final String LOG_TAG = "SynergyID";
public static final String NOTIFICATION_ANONYMOUS_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.anonymous_synergy_id_changed";
public static final String NOTIFICATION_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.synergy_id_changed";
public static ISynergyIdManager getComponent() {
return SynergyIdManagerImpl.getComponent();
}
}

View File

@@ -0,0 +1,34 @@
package com.ea.nimble;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
/* loaded from: classes2.dex */
public class SynergyIdManagerError extends Error {
public static final String ERROR_DOMAIN = "NimbleSynergyIdManager";
private static final long serialVersionUID = 1;
public enum Code {
AUTHENTICATOR_CONFLICT(5000),
UNEXPECTED_LOGIN_STATE(IronSourceConstants.errorCode_biddingDataException),
INVALID_ID(IronSourceConstants.errorCode_isReadyException),
MISSING_AUTHENTICATOR(IronSourceConstants.errorCode_loadInProgress);
private int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public SynergyIdManagerError(Code code, String str, Throwable th) {
super(ERROR_DOMAIN, code.intValue(), str, th);
}
public SynergyIdManagerError(Code code, String str) {
super(ERROR_DOMAIN, code.intValue(), str);
}
}

View File

@@ -0,0 +1,232 @@
package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import com.ea.nimble.SynergyIdManagerError;
import java.util.HashMap;
/* loaded from: classes2.dex */
class SynergyIdManagerImpl extends Component implements ISynergyIdManager, LogSource {
private static final String ANONYMOUS_ID_PERSISTENCE_DATA_ID = "anonymousId";
private static final String AUTHENTICATOR_PERSISTENCE_DATA_ID = "authenticator";
private static final String CURRENT_ID_PERSISTENCE_DATA_ID = "currentId";
private static final String SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID = "com.ea.nimble.synergyidmanager.anonymousId";
private static final String VERSION_PERSISTENCE_DATA_ID = "dataVersion";
private String m_anonymousSynergyId;
private String m_authenticatorIdentifier;
private String m_currentSynergyId;
private BroadcastReceiver m_receiver = new SynergyIdManagerReceiver();
@Override // com.ea.nimble.Component
public String getComponentId() {
return SynergyIdManager.COMPONENT_ID;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyId";
}
public class SynergyIdManagerReceiver extends BroadcastReceiver {
private SynergyIdManagerReceiver() {
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if (ApplicationEnvironment.isMainApplicationActive()) {
SynergyIdManagerImpl.this.onSynergyEnvironmentStartupRequestsFinished();
}
}
}
public static ISynergyIdManager getComponent() {
return (ISynergyIdManager) Base.getComponent(SynergyIdManager.COMPONENT_ID);
}
private void wakeup() {
restoreFromPersistent();
if (!Utility.validString(this.m_anonymousSynergyId)) {
setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId());
}
if (!Utility.validString(this.m_currentSynergyId)) {
setCurrentSynergyId(this.m_anonymousSynergyId);
}
Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, this.m_receiver);
}
private void sleep() {
Utility.unregisterReceiver(this.m_receiver);
saveDataToPersistent();
}
@Override // com.ea.nimble.Component
public void restore() {
wakeup();
}
@Override // com.ea.nimble.Component
public void suspend() {
sleep();
}
@Override // com.ea.nimble.Component
public void resume() {
wakeup();
}
/* JADX INFO: Access modifiers changed from: private */
public void onSynergyEnvironmentStartupRequestsFinished() {
Log.Helper.LOGFUNC(this);
if (SynergyEnvironment.getComponent() != null) {
Log.Helper.LOGD(this, "onSynergyEnvironmentStartupRequestsFinished - Process the notification, everything looks okay", new Object[0]);
setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId());
if (Utility.validString(this.m_currentSynergyId)) {
return;
}
setCurrentSynergyId(this.m_anonymousSynergyId);
return;
}
Log.Helper.LOGI(this, "onSynergyEnvironmentStartupRequestsFinished - Aborted because we were unable to get SynergyEnvironment", new Object[0]);
}
@Override // com.ea.nimble.Component
public void cleanup() {
sleep();
}
private void restoreFromPersistent() {
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyIdManager.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
Log.Helper.LOGD("Loaded persistence data version, %s.", persistenceForNimbleComponent.getStringValue(VERSION_PERSISTENCE_DATA_ID), new Object[0]);
this.m_currentSynergyId = persistenceForNimbleComponent.getStringValue(CURRENT_ID_PERSISTENCE_DATA_ID);
String stringValue = persistenceForNimbleComponent.getStringValue(AUTHENTICATOR_PERSISTENCE_DATA_ID);
this.m_authenticatorIdentifier = stringValue;
Log.Helper.LOGD(this, "Loaded Synergy ID, %s, with authenticator, %s.", this.m_currentSynergyId, stringValue);
} else {
Log.Helper.LOGE(this, "Could not get persistence object to load from.", new Object[0]);
}
Persistence persistenceForNimbleComponent2 = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent2 != null) {
Log.Helper.LOGD(this, "Loaded persistence data version, %s.", Utility.safeString(persistenceForNimbleComponent2.getStringValue(VERSION_PERSISTENCE_DATA_ID)));
String stringValue2 = persistenceForNimbleComponent2.getStringValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID);
this.m_anonymousSynergyId = stringValue2;
Log.Helper.LOGD(this, "Loaded anonymous Synergy ID, %s.", Utility.safeString(stringValue2));
return;
}
Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to load from.", new Object[0]);
}
private void saveDataToPersistent() {
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent != null) {
Log.Helper.LOGD("Saving anonymous Synergy ID, %s, to persistent.", this.m_anonymousSynergyId, new Object[0]);
persistenceForNimbleComponent.setValue(VERSION_PERSISTENCE_DATA_ID, "1.0.0");
persistenceForNimbleComponent.setValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID, this.m_anonymousSynergyId);
persistenceForNimbleComponent.setBackUp(true);
persistenceForNimbleComponent.lambda$new$0();
} else {
Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to save to.", new Object[0]);
}
Persistence persistenceForNimbleComponent2 = PersistenceService.getPersistenceForNimbleComponent(SynergyIdManager.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent2 != null) {
Log.Helper.LOGD(this, "Saving current Synergy ID, %s, and authenticator, %s, to persistent.", this.m_currentSynergyId, this.m_authenticatorIdentifier);
persistenceForNimbleComponent2.setValue(VERSION_PERSISTENCE_DATA_ID, "1.0.0");
persistenceForNimbleComponent2.setValue(CURRENT_ID_PERSISTENCE_DATA_ID, this.m_currentSynergyId);
persistenceForNimbleComponent2.setValue(AUTHENTICATOR_PERSISTENCE_DATA_ID, this.m_authenticatorIdentifier);
persistenceForNimbleComponent2.lambda$new$0();
return;
}
Log.Helper.LOGE(this, "Could not get persistence object to save to.", new Object[0]);
}
private void setAnonymousSynergyId(String str) {
Log.Helper.LOGFUNC(this);
if (Utility.validString(this.m_anonymousSynergyId) && !Utility.validString(str)) {
Log.Helper.LOGE(this, "Attempt to set invalid anonymous Synergy ID over existing ID, %s. Ignoring attempt.", this.m_anonymousSynergyId);
return;
}
String str2 = this.m_anonymousSynergyId;
this.m_anonymousSynergyId = str;
saveDataToPersistent();
if (Utility.validString(str2) && ((Utility.validString(str2) && !str2.equals(this.m_anonymousSynergyId)) || (Utility.validString(this.m_anonymousSynergyId) && !this.m_anonymousSynergyId.equals(str2)))) {
HashMap hashMap = new HashMap();
hashMap.put("previousSynergyId", Utility.safeString(str2));
hashMap.put("currentSynergyId", Utility.safeString(this.m_anonymousSynergyId));
Utility.sendBroadcast(SynergyIdManager.NOTIFICATION_ANONYMOUS_SYNERGY_ID_CHANGED, hashMap);
}
if (this.m_authenticatorIdentifier == null) {
setCurrentSynergyId(this.m_anonymousSynergyId);
}
}
private void setCurrentSynergyId(String str) {
Log.Helper.LOGFUNC(this);
if (Utility.validString(this.m_currentSynergyId) && !Utility.validString(str)) {
Log.Helper.LOGE(this, "Attempt to set invalid current Synergy ID over existing ID, %s. Ignoring attempt.", this.m_currentSynergyId);
return;
}
String str2 = this.m_currentSynergyId;
this.m_currentSynergyId = str;
saveDataToPersistent();
if (Utility.validString(str2)) {
if ((!Utility.validString(str2) || str2.equals(this.m_currentSynergyId)) && (!Utility.validString(this.m_currentSynergyId) || this.m_currentSynergyId.equals(str2))) {
return;
}
HashMap hashMap = new HashMap();
hashMap.put("previousSynergyId", Utility.safeString(str2));
hashMap.put("currentSynergyId", Utility.safeString(this.m_currentSynergyId));
Utility.sendBroadcast(SynergyIdManager.NOTIFICATION_SYNERGY_ID_CHANGED, hashMap);
}
}
@Override // com.ea.nimble.ISynergyIdManager
public String getSynergyId() {
Log.Helper.LOGPUBLICFUNC(this);
return Utility.validString(this.m_currentSynergyId) ? this.m_currentSynergyId : getAnonymousSynergyId();
}
@Override // com.ea.nimble.ISynergyIdManager
public String getAnonymousSynergyId() {
Log.Helper.LOGPUBLICFUNC(this);
return Utility.validString(this.m_anonymousSynergyId) ? this.m_anonymousSynergyId : SynergyEnvironment.getComponent().getSynergyId();
}
@Override // com.ea.nimble.ISynergyIdManager
public SynergyIdManagerError login(String str, String str2) {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_authenticatorIdentifier != null) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE, "Already logged in with authenticator, " + this.m_authenticatorIdentifier);
}
if (!Utility.validString(str) || !Utility.isOnlyDecimalCharacters(str)) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.INVALID_ID, "Synergy ID must be numeric digits.");
}
if (!Utility.validString(str2)) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR, "Authenticator string required for login API.");
}
this.m_authenticatorIdentifier = str2;
setCurrentSynergyId(str);
return null;
}
@Override // com.ea.nimble.ISynergyIdManager
public SynergyIdManagerError logout(String str) {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_authenticatorIdentifier == null) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE, "Already logged out.");
}
if (!Utility.validString(str)) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR, "Authenticator string required for logout API.");
}
if (!this.m_authenticatorIdentifier.equals(str)) {
return new SynergyIdManagerError(SynergyIdManagerError.Code.AUTHENTICATOR_CONFLICT, "Logout must be performed by the same authenticator that logged in, " + this.m_authenticatorIdentifier);
}
setCurrentSynergyId(this.m_anonymousSynergyId);
this.m_authenticatorIdentifier = null;
return null;
}
}

View File

@@ -0,0 +1,10 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class SynergyNetwork {
public static final String COMPONENT_ID = "com.ea.nimble.synergynetwork";
public static ISynergyNetwork getComponent() {
return SynergyNetworkImpl.getComponent();
}
}

View File

@@ -0,0 +1,261 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import java.util.List;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
class SynergyNetworkConnection implements SynergyNetworkConnectionHandle {
private SynergyNetworkConnectionCallback m_completionCallback;
private SynergyRequest m_request;
private NetworkConnectionHandle m_networkHandle = null;
private SynergyResponse m_response = new SynergyResponse();
private SynergyOperationalTelemetryDispatch m_otDispatch = new SynergyOperationalTelemetryDispatch();
private SynergyNetworkConnectionCallback m_headerCallback = null;
private SynergyNetworkConnectionCallback m_progressCallback = null;
public SynergyNetworkConnection(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
this.m_request = synergyRequest;
this.m_completionCallback = synergyNetworkConnectionCallback;
}
public void start() {
this.m_request.prepare(this);
}
public void send() {
Log.Helper.LOGFUNC(this);
try {
this.m_request.build();
NetworkConnectionHandle sendRequest = Network.getComponent().sendRequest(this.m_request.httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.1
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
if (SynergyNetworkConnection.this.m_networkHandle == null) {
SynergyNetworkConnection.this.m_networkHandle = networkConnectionHandle;
}
SynergyNetworkConnection.this.parseDataFromNetworkHandle();
networkConnectionHandle.setHeaderCallback(null);
networkConnectionHandle.setProgressCallback(null);
networkConnectionHandle.setCompletionCallback(null);
if (SynergyNetworkConnection.this.m_completionCallback != null) {
SynergyNetworkConnection.this.m_completionCallback.callback(SynergyNetworkConnection.this);
}
}
}, this.m_otDispatch);
this.m_networkHandle = sendRequest;
this.m_response.httpResponse = sendRequest.getResponse();
updateNetworkHeaderHandler();
updateNetworkProgressHandler();
} catch (Exception e) {
errorPriorToSend(e);
}
}
public void errorPriorToSend(Exception exc) {
Log.Helper.LOGPUBLICFUNC(this);
HttpResponse httpResponse = new HttpResponse();
httpResponse.error = exc;
httpResponse.isCompleted = true;
this.m_response.httpResponse = httpResponse;
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = this.m_completionCallback;
if (synergyNetworkConnectionCallback != null) {
synergyNetworkConnectionCallback.callback(this);
}
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public ISynergyRequest getRequest() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_request;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public ISynergyResponse getResponse() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_response;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public SynergyNetworkConnectionCallback getHeaderCallback() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_headerCallback;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public void setHeaderCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_headerCallback = synergyNetworkConnectionCallback;
if (this.m_networkHandle != null) {
updateNetworkHeaderHandler();
}
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public SynergyNetworkConnectionCallback getProgressCallback() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_progressCallback;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public void setProgressCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_progressCallback = synergyNetworkConnectionCallback;
if (this.m_networkHandle != null) {
updateNetworkProgressHandler();
}
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public SynergyNetworkConnectionCallback getCompletionCallback() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_completionCallback;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public void setCompletionCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_completionCallback = synergyNetworkConnectionCallback;
}
public NetworkConnectionHandle getNetworkConnectionHandle() {
Log.Helper.LOGPUBLICFUNC(this);
return this.m_networkHandle;
}
public void setNetworkConnectionHandle(NetworkConnectionHandle networkConnectionHandle) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_networkHandle = networkConnectionHandle;
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public void waitOn() {
Log.Helper.LOGPUBLICFUNC(this);
NetworkConnectionHandle networkConnectionHandle = this.m_networkHandle;
if (networkConnectionHandle != null) {
networkConnectionHandle.waitOn();
}
}
@Override // com.ea.nimble.SynergyNetworkConnectionHandle
public void cancel() {
Log.Helper.LOGPUBLICFUNC(this);
NetworkConnectionHandle networkConnectionHandle = this.m_networkHandle;
if (networkConnectionHandle != null) {
networkConnectionHandle.cancel();
}
}
private void updateNetworkHeaderHandler() {
Log.Helper.LOGFUNC(this);
if (this.m_headerCallback == null) {
this.m_networkHandle.setHeaderCallback(null);
} else {
this.m_networkHandle.setHeaderCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.2
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
SynergyNetworkConnection.this.m_headerCallback.callback(SynergyNetworkConnection.this);
}
});
}
}
private void updateNetworkProgressHandler() {
Log.Helper.LOGFUNC(this);
if (this.m_progressCallback == null) {
this.m_networkHandle.setProgressCallback(null);
} else {
this.m_networkHandle.setProgressCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.3
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
SynergyNetworkConnection.this.m_progressCallback.callback(SynergyNetworkConnection.this);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void parseDataFromNetworkHandle() {
Log.Helper.LOGFUNC(this);
NetworkConnectionHandle networkConnectionHandle = this.m_networkHandle;
if (networkConnectionHandle != null) {
this.m_response.httpResponse = networkConnectionHandle.getResponse();
this.m_response.parseData();
}
}
public class SynergyOperationalTelemetryDispatch implements IOperationalTelemetryDispatch {
private SynergyOperationalTelemetryDispatch() {
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public void logEvent(String str, String str2) {
Log.Helper.LOGFUNC(this);
if (!BaseCore.getInstance().isActive()) {
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
return;
}
try {
JSONObject jSONObject = new JSONObject(str2);
IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent();
if (component != null) {
SynergyNetworkConnection.this.parseDataFromNetworkHandle();
Map<String, Object> jsonData = SynergyNetworkConnection.this.m_response.getJsonData();
if (jsonData != null && jsonData.containsKey("resultCode")) {
try {
jSONObject.put("SYNERGY_RESULT_CODE", ((Integer) jsonData.get("resultCode")).intValue());
} catch (JSONException unused) {
Log.Helper.LOGE(this, "Failed to add SYNERGY_RESULT_CODE to eventDict.", new Object[0]);
}
}
component.logEvent(str, jSONObject.toString());
}
} catch (Exception unused2) {
Log.Helper.LOGE(this, "SynergyOperationalTelemetryDispatch.logEvent(): Failed to build JSONObject from payload: " + str2, new Object[0]);
}
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public List<OperationalTelemetryEvent> getEvents(String str) {
Log.Helper.LOGFUNC(this);
if (!BaseCore.getInstance().isActive()) {
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
return null;
}
IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent();
if (component == null) {
return null;
}
return component.getEvents(str);
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public void setMaxEventCount(String str, int i) {
Log.Helper.LOGFUNC(this);
if (!BaseCore.getInstance().isActive()) {
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
return;
}
IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent();
if (component == null) {
return;
}
component.setMaxEventCount(str, i);
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public int getMaxEventCount(String str) {
Log.Helper.LOGFUNC(this);
if (!BaseCore.getInstance().isActive()) {
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
return -1;
}
IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent();
if (component == null) {
return -1;
}
return component.getMaxEventCount(str);
}
}
}

View File

@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface SynergyNetworkConnectionCallback {
void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle);
}

View File

@@ -0,0 +1,24 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public interface SynergyNetworkConnectionHandle {
void cancel();
SynergyNetworkConnectionCallback getCompletionCallback();
SynergyNetworkConnectionCallback getHeaderCallback();
SynergyNetworkConnectionCallback getProgressCallback();
ISynergyRequest getRequest();
ISynergyResponse getResponse();
void setCompletionCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
void setHeaderCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
void setProgressCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback);
void waitOn();
}

View File

@@ -0,0 +1,159 @@
package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ea.nimble.ComponentManager;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.ISynergyRequest;
import com.ea.nimble.Log;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
/* loaded from: classes2.dex */
public class SynergyNetworkImpl extends Component implements ISynergyNetwork {
private String m_sessionId;
private ArrayList<SynergyNetworkConnection> m_pendingRequests = null;
private BroadcastReceiver m_synergyEnvironmentNotifyReceiver = null;
private boolean m_sessionIdNeedsRefresh = false;
@Override // com.ea.nimble.Component
public String getComponentId() {
return SynergyNetwork.COMPONENT_ID;
}
@Override // com.ea.nimble.Component
public void suspend() {
this.m_sessionIdNeedsRefresh = true;
}
public String getSessionId() {
if (this.m_sessionId == null || (this.m_sessionIdNeedsRefresh && BaseCore.getInstance().getComponentManager().getStage() == ComponentManager.Stage.READY)) {
this.m_sessionId = generateSessionId();
this.m_sessionIdNeedsRefresh = false;
}
return this.m_sessionId;
}
public static ISynergyNetwork getComponent() {
return (ISynergyNetwork) Base.getComponent(SynergyNetwork.COMPONENT_ID);
}
@Override // com.ea.nimble.Component
public void setup() {
this.m_pendingRequests = new ArrayList<>();
getSessionId();
}
@Override // com.ea.nimble.Component
public void restore() {
if (SynergyEnvironment.getComponent().isDataAvailable()) {
return;
}
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.SynergyNetworkImpl.1
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
String stringExtra = intent.getStringExtra("result");
ArrayList arrayList = new ArrayList(SynergyNetworkImpl.this.m_pendingRequests);
if (stringExtra != null && stringExtra.equals("0")) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((SynergyNetworkConnection) it.next()).errorPriorToSend(new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Failed to retrieve Environment data from Synergy"));
}
} else {
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
((SynergyNetworkConnection) it2.next()).start();
}
}
SynergyNetworkImpl.this.m_pendingRequests.clear();
}
};
this.m_synergyEnvironmentNotifyReceiver = broadcastReceiver;
Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, broadcastReceiver);
}
@Override // com.ea.nimble.Component
public void resume() {
getSessionId();
}
@Override // com.ea.nimble.Component
public void cleanup() {
BroadcastReceiver broadcastReceiver = this.m_synergyEnvironmentNotifyReceiver;
if (broadcastReceiver != null) {
Utility.unregisterReceiver(broadcastReceiver);
this.m_synergyEnvironmentNotifyReceiver = null;
}
this.m_pendingRequests.clear();
}
@Override // com.ea.nimble.ISynergyNetwork
public SynergyNetworkConnectionHandle sendGetRequest(String str, String str2, Map<String, String> map, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.GET, null);
synergyRequest.baseUrl = str;
synergyRequest.urlParameters = map;
return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
}
@Override // com.ea.nimble.ISynergyNetwork
public SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map<String, String> map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.POST, null);
synergyRequest.baseUrl = str;
synergyRequest.urlParameters = map;
synergyRequest.jsonData = iJsonData;
return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
}
@Override // com.ea.nimble.ISynergyNetwork
public SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map<String, String> map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback, Map<String, String> map2) {
Log.Helper.LOGPUBLICFUNC(this);
SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.POST, null);
synergyRequest.baseUrl = str;
synergyRequest.urlParameters = map;
synergyRequest.jsonData = iJsonData;
if (map2 != null) {
synergyRequest.httpRequest.headers.putAll(map2);
}
return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
}
@Override // com.ea.nimble.ISynergyNetwork
public void sendRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGPUBLICFUNC(this);
ISynergyEnvironment component = SynergyEnvironment.getComponent();
if (component.isDataAvailable()) {
sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
return;
}
SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(synergyRequest, synergyNetworkConnectionCallback);
if (component.isUpdateInProgress()) {
this.m_pendingRequests.add(synergyNetworkConnection);
return;
}
Error checkAndInitiateSynergyEnvironmentUpdate = component.checkAndInitiateSynergyEnvironmentUpdate();
if (checkAndInitiateSynergyEnvironmentUpdate == null) {
this.m_pendingRequests.add(synergyNetworkConnection);
} else {
synergyNetworkConnection.errorPriorToSend(checkAndInitiateSynergyEnvironmentUpdate);
}
}
private SynergyNetworkConnectionHandle sendSynergyRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
Log.Helper.LOGFUNC(this);
SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(synergyRequest, synergyNetworkConnectionCallback);
synergyNetworkConnection.start();
return synergyNetworkConnection;
}
private String generateSessionId() {
Log.Helper.LOGFUNC(this);
return UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.US);
}
}

View File

@@ -0,0 +1,144 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.ISynergyRequest;
import com.ea.nimble.Log;
import com.ironsource.nb;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/* loaded from: classes2.dex */
public class SynergyRequest implements ISynergyRequest {
public String api;
public String baseUrl;
public HttpRequest httpRequest;
public ISynergyRequest.IJsonData jsonData;
private SynergyNetworkConnection m_connection = null;
public SynergyRequestPreparingCallback prepareRequestCallback;
public Map<String, String> urlParameters;
public interface SynergyRequestPreparingCallback {
void prepareRequest(SynergyRequest synergyRequest);
}
public SynergyRequest(String str, IHttpRequest.Method method, SynergyRequestPreparingCallback synergyRequestPreparingCallback) {
this.api = str;
HttpRequest httpRequest = new HttpRequest();
this.httpRequest = httpRequest;
this.prepareRequestCallback = synergyRequestPreparingCallback;
this.urlParameters = null;
this.jsonData = null;
httpRequest.method = method;
httpRequest.headers.put("Content-Type", nb.L);
this.httpRequest.headers.put("SDK-VERSION", Global.NIMBLE_RELEASE_VERSION);
this.httpRequest.headers.put("SDK-TYPE", Global.NIMBLE_ID);
String sessionId = ((SynergyNetworkImpl) SynergyNetwork.getComponent()).getSessionId();
if (Utility.validString(sessionId)) {
this.httpRequest.headers.put("EAM-SESSION", sessionId);
} else {
Log.Helper.LOGES("SynergyRequest", "Synergy Network session ID is null", new Object[0]);
}
String synergyId = SynergyIdManager.getComponent().getSynergyId();
if (Utility.validString(synergyId)) {
this.httpRequest.headers.put("EAM-USER-ID", synergyId);
}
String sellId = SynergyEnvironment.getComponent().getSellId();
if (Utility.validString(sellId)) {
this.httpRequest.headers.put("EA-SELL-ID", sellId);
}
}
@Override // com.ea.nimble.ISynergyRequest
public HttpRequest getHttpRequest() {
Log.Helper.LOGPUBLICFUNC(this);
return this.httpRequest;
}
@Override // com.ea.nimble.ISynergyRequest
public String getBaseUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.baseUrl;
}
@Override // com.ea.nimble.ISynergyRequest
public String getApi() {
Log.Helper.LOGPUBLICFUNC(this);
return this.api;
}
public IHttpRequest.Method getMethod() {
Log.Helper.LOGPUBLICFUNC(this);
return this.httpRequest.getMethod();
}
public void setMethod(IHttpRequest.Method method) {
Log.Helper.LOGPUBLICFUNC(this);
this.httpRequest.method = method;
}
@Override // com.ea.nimble.ISynergyRequest
public Map<String, String> getUrlParameters() {
Log.Helper.LOGPUBLICFUNC(this);
return this.urlParameters;
}
@Override // com.ea.nimble.ISynergyRequest
public ISynergyRequest.IJsonData getJsonData() {
Log.Helper.LOGPUBLICFUNC(this);
return this.jsonData;
}
public void send() {
Log.Helper.LOGPUBLICFUNC(this);
this.m_connection.send();
}
public void prepare(SynergyNetworkConnection synergyNetworkConnection) {
Log.Helper.LOGFUNC(this);
this.m_connection = synergyNetworkConnection;
SynergyRequestPreparingCallback synergyRequestPreparingCallback = this.prepareRequestCallback;
if (synergyRequestPreparingCallback != null) {
synergyRequestPreparingCallback.prepareRequest(this);
} else {
send();
}
}
public void build() throws Error {
ISynergyRequest.IJsonData iJsonData;
Log.Helper.LOGFUNC(this);
if (!Utility.validString(this.baseUrl) || !Utility.validString(this.api)) {
throw new Error(Error.Code.INVALID_ARGUMENT, String.format("Invalid synergy request parameter (%s, %s) to build http request url", this.baseUrl, this.api));
}
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
HashMap hashMap = new HashMap();
hashMap.put("appVer", component.getApplicationVersion());
hashMap.put("appLang", component.getShortApplicationLanguageCode());
hashMap.put("localization", component.getApplicationLanguageCode());
hashMap.put("deviceLanguage", Locale.getDefault().getLanguage());
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Locale.getDefault().toString());
String eAHardwareId = SynergyEnvironment.getComponent().getEAHardwareId();
if (Utility.validString(eAHardwareId)) {
hashMap.put("hwId", eAHardwareId);
}
Map<String, String> map = this.urlParameters;
if (map != null) {
hashMap.putAll(map);
}
this.httpRequest.url = Network.generateURL(this.baseUrl + this.api, hashMap);
IHttpRequest.Method method = this.httpRequest.method;
if ((method == IHttpRequest.Method.POST || method == IHttpRequest.Method.PUT) && (iJsonData = this.jsonData) != null && iJsonData.size() > 0) {
String convertObjectToJSONString = Utility.convertObjectToJSONString(this.jsonData.getData());
this.httpRequest.data = new ByteArrayOutputStream();
try {
this.httpRequest.data.write(convertObjectToJSONString.getBytes());
} catch (IOException e) {
throw new Error(Error.Code.INVALID_ARGUMENT, "Error converting jsonData in SynergyRequest to a data stream", e);
}
}
}
}

View File

@@ -0,0 +1,69 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class SynergyResponse implements ISynergyResponse {
public IHttpResponse httpResponse = null;
public Error error = null;
public Map<String, Object> jsonData = null;
public void parseData() {
int intValue;
Log.Helper.LOGPUBLICFUNC(this);
if (this.jsonData != null) {
return;
}
IHttpResponse iHttpResponse = this.httpResponse;
if (iHttpResponse == null || iHttpResponse.getError() != null) {
this.jsonData = null;
this.error = null;
return;
}
String str = "<empty>";
try {
str = Utility.readStringFromStream(this.httpResponse.getDataStream());
Map<String, Object> convertJSONObjectToMap = Utility.convertJSONObjectToMap(new JSONObject(str));
this.jsonData = convertJSONObjectToMap;
if (!convertJSONObjectToMap.containsKey("resultCode") || (intValue = ((Integer) this.jsonData.get("resultCode")).intValue()) >= 0) {
return;
}
this.error = new SynergyServerError(intValue, (String) this.jsonData.get("message"));
} catch (Exception e) {
this.jsonData = null;
this.error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Unparseable synergy json response " + str, e);
}
}
@Override // com.ea.nimble.ISynergyResponse
public IHttpResponse getHttpResponse() {
Log.Helper.LOGPUBLICFUNC(this);
return this.httpResponse;
}
@Override // com.ea.nimble.ISynergyResponse
public boolean isCompleted() {
Log.Helper.LOGPUBLICFUNC(this);
IHttpResponse iHttpResponse = this.httpResponse;
if (iHttpResponse == null) {
return false;
}
return iHttpResponse.isCompleted();
}
@Override // com.ea.nimble.ISynergyResponse
public Exception getError() {
IHttpResponse iHttpResponse;
Error error = this.error;
return (error != null || (iHttpResponse = this.httpResponse) == null) ? error : iHttpResponse.getError();
}
@Override // com.ea.nimble.ISynergyResponse
public Map<String, Object> getJsonData() {
Log.Helper.LOGPUBLICFUNC(this);
return this.jsonData;
}
}

View File

@@ -0,0 +1,40 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public class SynergyServerError extends Error {
public static final String ERROR_DOMAIN = "SynergyServerError";
private static final long serialVersionUID = 1;
public enum Code {
ERROR_NONCE_VERIFICATION(-30013),
ERROR_SIGNATURE_VERIFICATION(-30014),
ERROR_NOT_SUPPORTED_RECEIPT_TYPE(-30015),
AMAZON_SERVER_CONNECTION_ERROR(-30016),
APPLE_SERVER_CONNECTION_ERROR(10001);
private int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public SynergyServerError() {
}
public SynergyServerError(int i, String str, Throwable th) {
super(ERROR_DOMAIN, i, str, th);
}
public SynergyServerError(int i, String str) {
super(ERROR_DOMAIN, i, str, null);
}
public boolean isError(int i) {
return getCode() == i;
}
}

View File

@@ -0,0 +1,127 @@
package com.ea.nimble;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class Timer {
private static Handler s_handler = new Handler(Looper.getMainLooper());
private long m_fireTime;
private long m_pauseTime;
private Runnable m_task;
private Runnable m_taskToRun;
private long m_timeInterval;
private boolean m_running = false;
private boolean m_paused = false;
public boolean isPaused() {
return this.m_paused;
}
public boolean isRunning() {
return this.m_running;
}
public class RepeatingTask implements Runnable {
private RepeatingTask() {
}
@Override // java.lang.Runnable
public void run() {
if (Timer.this.m_paused || !Timer.this.m_running) {
return;
}
Timer.this.m_task.run();
Timer.this.m_fireTime = SystemClock.uptimeMillis() + Timer.this.m_fireTime;
Timer.s_handler.postDelayed(this, Timer.this.m_timeInterval);
}
}
public class SingleRunTask implements Runnable {
private SingleRunTask() {
}
@Override // java.lang.Runnable
public void run() {
if (Timer.this.m_paused || !Timer.this.m_running) {
return;
}
Timer.this.m_running = false;
Timer.this.m_task.run();
}
}
public Timer(Runnable runnable) {
this.m_task = runnable;
}
public void schedule(double d, boolean z) {
cancel();
if (d < 0.1d) {
if (z) {
Log.Helper.LOGES(null, "Timer scheduled to repeat for %.2f seconds, running only once", Double.valueOf(d));
}
if (Looper.myLooper() == Looper.getMainLooper()) {
this.m_task.run();
return;
} else {
s_handler.post(this.m_task);
return;
}
}
this.m_timeInterval = (long) (d * 1000.0d);
this.m_fireTime = SystemClock.uptimeMillis() + this.m_timeInterval;
if (z) {
this.m_taskToRun = new RepeatingTask();
} else {
this.m_taskToRun = new SingleRunTask();
}
s_handler.postDelayed(this.m_taskToRun, this.m_timeInterval);
this.m_running = true;
}
public void fire() {
cancel();
this.m_task.run();
if (this.m_taskToRun instanceof RepeatingTask) {
if (this.m_paused) {
this.m_fireTime = this.m_pauseTime + this.m_timeInterval;
return;
}
long uptimeMillis = SystemClock.uptimeMillis();
long j = this.m_timeInterval;
this.m_fireTime = uptimeMillis + j;
s_handler.postDelayed(this.m_taskToRun, j);
this.m_running = true;
}
}
public void pause() {
if (this.m_paused || !this.m_running) {
return;
}
this.m_pauseTime = SystemClock.uptimeMillis();
s_handler.removeCallbacks(this.m_taskToRun);
this.m_paused = true;
}
public void resume() {
if (this.m_paused && this.m_running) {
long uptimeMillis = this.m_fireTime + (SystemClock.uptimeMillis() - this.m_pauseTime);
this.m_fireTime = uptimeMillis;
s_handler.postAtTime(this.m_taskToRun, uptimeMillis);
this.m_paused = false;
}
}
public void cancel() {
if (this.m_running) {
if (!this.m_paused) {
s_handler.removeCallbacks(this.m_taskToRun);
}
this.m_running = false;
}
}
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class Utility$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class Utility$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class Utility$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package com.ea.nimble;
/* loaded from: classes2.dex */
public abstract /* synthetic */ class Utility$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,463 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.applovin.exoplayer2.common.base.Ascii;
import com.ea.nimble.Log;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
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.TimeZone;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class Utility {
public static boolean getTestResult() {
return true;
}
public static String safeString(String str) {
return str == null ? "" : str;
}
private Utility() {
}
public static void loadLibrary(String str) {
String obj;
if (str == null) {
Log.Helper.LOGDS("Utility", "loadLibrary(): libName is null", new Object[0]);
return;
}
try {
System.loadLibrary(str);
obj = "Success";
} catch (NullPointerException e) {
obj = e.toString();
} catch (SecurityException e2) {
obj = e2.toString();
} catch (Exception e3) {
obj = e3.toString();
} catch (UnsatisfiedLinkError e4) {
obj = e4.toString();
}
Log.Helper.LOGDS("Utility", "loadLibrary(" + str + "): " + obj, new Object[0]);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:36:0x0070 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.util.Map<java.lang.String, java.lang.String> parseXmlFile(int r6) {
/*
r0 = 0
com.ea.nimble.IApplicationEnvironment r1 = com.ea.nimble.ApplicationEnvironment.getComponent() // Catch: java.lang.Throwable -> L48 java.lang.Exception -> L4d
android.content.Context r1 = r1.getApplicationContext() // Catch: java.lang.Throwable -> L48 java.lang.Exception -> L4d
android.content.res.Resources r1 = r1.getResources() // Catch: java.lang.Throwable -> L48 java.lang.Exception -> L4d
android.content.res.XmlResourceParser r6 = r1.getXml(r6) // Catch: java.lang.Throwable -> L48 java.lang.Exception -> L4d
if (r6 == 0) goto L42
java.util.LinkedHashMap r1 = new java.util.LinkedHashMap // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
r1.<init>() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
int r2 = r6.getEventType() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
r3 = r0
L1d:
r4 = 1
if (r2 == r4) goto L3b
r4 = 2
if (r2 != r4) goto L2c
java.lang.String r3 = r6.getName() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
goto L36
L28:
r0 = move-exception
goto L6e
L2a:
r1 = move-exception
goto L4f
L2c:
r4 = 4
if (r2 != r4) goto L36
java.lang.String r2 = r6.getText() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
r1.put(r3, r2) // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
L36:
int r2 = r6.next() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
goto L1d
L3b:
r6.close() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
r6.close()
return r1
L42:
java.lang.Exception r1 = new java.lang.Exception // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
r1.<init>() // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
throw r1 // Catch: java.lang.Throwable -> L28 java.lang.Exception -> L2a
L48:
r6 = move-exception
r5 = r0
r0 = r6
r6 = r5
goto L6e
L4d:
r1 = move-exception
r6 = r0
L4f:
java.lang.String r2 = "Utility"
java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L28
r3.<init>() // Catch: java.lang.Throwable -> L28
java.lang.String r4 = "Error reading xml file: "
r3.append(r4) // Catch: java.lang.Throwable -> L28
r3.append(r1) // Catch: java.lang.Throwable -> L28
java.lang.String r1 = r3.toString() // Catch: java.lang.Throwable -> L28
r3 = 0
java.lang.Object[] r3 = new java.lang.Object[r3] // Catch: java.lang.Throwable -> L28
com.ea.nimble.Log.Helper.LOGES(r2, r1, r3) // Catch: java.lang.Throwable -> L28
if (r6 == 0) goto L6d
r6.close()
L6d:
return r0
L6e:
if (r6 == 0) goto L73
r6.close()
L73:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Utility.parseXmlFile(int):java.util.Map");
}
public static String readStringFromStream(InputStream inputStream) throws IOException {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.defaultCharset());
char[] cArr = new char[4096];
StringWriter stringWriter = new StringWriter();
while (true) {
int read = inputStreamReader.read(cArr, 0, 4096);
if (read > 0) {
stringWriter.write(cArr, 0, read);
} else {
return stringWriter.toString();
}
}
}
public static String getUTCDateStringFormat(Date date) {
if (date == null) {
return "";
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat.format(date);
}
public static boolean validString(String str) {
return str != null && str.length() > 0;
}
public static boolean validStringObject(Object obj) {
return obj != null && (obj instanceof String) && ((String) obj).length() > 0;
}
public static String convertObjectToJSONString(Object obj) {
return new GsonBuilder().disableHtmlEscaping().create().toJson(obj);
}
public static Map<String, Object> convertJSONObjectToMap(JSONObject jSONObject) {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
if (jSONObject.isNull(next)) {
hashMap.put(next, null);
} else {
JSONObject optJSONObject = jSONObject.optJSONObject(next);
if (optJSONObject != null) {
hashMap.put(next, convertJSONObjectToMap(optJSONObject));
} else {
JSONArray optJSONArray = jSONObject.optJSONArray(next);
if (optJSONArray != null) {
hashMap.put(next, convertJSONArrayToList(optJSONArray));
} else {
try {
hashMap.put(next, jSONObject.get(next));
} catch (JSONException e) {
e.printStackTrace();
hashMap.put(next, null);
}
}
}
}
}
return hashMap;
}
public static Map<String, Object> convertJSONObjectStringToMap(String str) {
try {
return convertJSONObjectToMap(new JSONObject(str));
} catch (JSONException e) {
e.printStackTrace();
return new HashMap();
}
}
public static List<Object> convertJSONArrayToList(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
if (jSONArray.isNull(i)) {
arrayList.add(null);
} else {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
arrayList.add(convertJSONObjectToMap(optJSONObject));
} else {
JSONArray optJSONArray = jSONArray.optJSONArray(i);
if (optJSONArray != null) {
arrayList.add(convertJSONArrayToList(optJSONArray));
} else {
try {
arrayList.add(jSONArray.get(i));
} catch (JSONException e) {
e.printStackTrace();
arrayList.add(null);
}
}
}
}
}
return arrayList;
}
public static String readFile(String str) {
try {
InputStream open = ApplicationEnvironment.getCurrentActivity().getAssets().open(str);
byte[] bArr = new byte[open.available()];
open.read(bArr);
open.close();
return new String(bArr, "UTF-8");
} catch (IOException e) {
Log.Helper.LOGVS("Utility", "readFile(): %s", e.toString());
return null;
}
}
public static void sendBroadcast(String str) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str));
}
public static void sendBroadcast(String str, Map<String, String> map) {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
Intent intent = new Intent(str);
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
intent.putExtra(entry.getKey(), entry.getValue());
}
}
localBroadcastManager.sendBroadcast(intent);
}
public static void sendBroadcast(String str, Bundle bundle) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str).replaceExtras(bundle));
}
public static void sendBroadcastSerializable(String str, Map<String, Serializable> map) {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
Intent intent = new Intent(str);
if (map != null) {
for (Map.Entry<String, Serializable> entry : map.entrySet()) {
intent.putExtra(entry.getKey(), entry.getValue());
}
}
localBroadcastManager.sendBroadcast(intent);
}
public static void sendExplicitBroadcast(Intent intent) {
List<ResolveInfo> queryBroadcastReceivers;
PackageManager.ResolveInfoFlags of;
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
PackageManager packageManager = applicationContext.getPackageManager();
if (Build.VERSION.SDK_INT >= 33) {
of = PackageManager.ResolveInfoFlags.of(0L);
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, of);
} else {
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
}
for (ResolveInfo resolveInfo : queryBroadcastReceivers) {
Intent intent2 = new Intent(intent);
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent2.setComponent(new ComponentName(activityInfo.applicationInfo.packageName, activityInfo.name));
applicationContext.sendBroadcast(intent2);
}
}
public static void registerReceiver(String str, BroadcastReceiver broadcastReceiver) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).registerReceiver(broadcastReceiver, new IntentFilter(str));
}
public static void unregisterReceiver(BroadcastReceiver broadcastReceiver) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).unregisterReceiver(broadcastReceiver);
}
public static String SHA256HashString(String str) {
if (str == null) {
return null;
}
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.reset();
byte[] digest = messageDigest.digest(str.getBytes());
StringBuffer stringBuffer = new StringBuffer();
for (byte b : digest) {
stringBuffer.append(Integer.toString((b & 255) + 256, 16).substring(1));
}
return stringBuffer.toString();
} catch (NoSuchAlgorithmException unused) {
Log.Helper.LOGES("Utility", "Can't find SHA-256 algorithm", new Object[0]);
return null;
}
}
public static byte[] SHA256Hash(String str) {
if (str == null) {
return null;
}
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.reset();
return messageDigest.digest(str.getBytes());
} catch (NoSuchAlgorithmException unused) {
Log.Helper.LOGES("Utility", "Can't find SHA-256 algorithm", new Object[0]);
return null;
}
}
public static boolean stringsAreEquivalent(String str, String str2) {
return (str == null || str2 == null) ? str == str2 : str.compareTo(str2) == 0;
}
public static String bytesToHexString(byte[] bArr) {
char[] charArray = "0123456789ABCDEF".toCharArray();
char[] cArr = new char[bArr.length * 2];
for (int i = 0; i < bArr.length; i++) {
byte b = bArr[i];
int i2 = i * 2;
cArr[i2] = charArray[(b & 255) >> 4];
cArr[i2 + 1] = charArray[b & Ascii.SI];
}
return new String(cArr);
}
public static boolean isOnlyDecimalCharacters(String str) {
if (str == null) {
return false;
}
for (int i = 0; i < str.length(); i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
public static String convertLiteralMapToString(Map<String, String> map) {
if (map == null) {
return "NULL";
}
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for (Map.Entry<String, String> entry : map.entrySet()) {
sb.append("\t\"");
sb.append(entry.getKey());
sb.append("\" = \"");
sb.append(entry.getValue());
sb.append("\",\n");
}
sb.deleteCharAt(sb.length() - 2);
sb.append("}");
return sb.toString();
}
public static void runOnWorkerThread(Runnable runnable) {
if (Looper.getMainLooper() == Looper.myLooper()) {
AsyncTask.SERIAL_EXECUTOR.execute(runnable);
} else {
runnable.run();
}
}
public static ApplicationInfo getApplicationInfo(int i) {
PackageManager.ApplicationInfoFlags of;
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
ApplicationInfo applicationInfo = null;
if (currentActivity != null) {
try {
PackageManager packageManager = currentActivity.getPackageManager();
if (packageManager == null) {
Log.Helper.LOGES("Utility", "PackageManager could not be obtained", new Object[0]);
} else if (Build.VERSION.SDK_INT >= 33) {
String packageName = currentActivity.getPackageName();
of = PackageManager.ApplicationInfoFlags.of(i);
applicationInfo = packageManager.getApplicationInfo(packageName, of);
} else {
applicationInfo = packageManager.getApplicationInfo(currentActivity.getPackageName(), i);
}
} catch (PackageManager.NameNotFoundException e) {
Log.Helper.LOGES("Utility", "Package name %s not found. Exception: %s", currentActivity.getPackageName(), e.toString());
}
} else {
Log.Helper.LOGES("Utility", "Application Context is null", new Object[0]);
}
return applicationInfo;
}
public static PackageInfo getPackageInfo(int i) {
PackageManager.PackageInfoFlags of;
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
PackageInfo packageInfo = null;
if (applicationContext != null) {
try {
PackageManager packageManager = applicationContext.getPackageManager();
if (packageManager == null) {
Log.Helper.LOGES("Utility", "PackageManager could not be obtained", new Object[0]);
} else if (Build.VERSION.SDK_INT >= 33) {
String packageName = applicationContext.getPackageName();
of = PackageManager.PackageInfoFlags.of(i);
packageInfo = packageManager.getPackageInfo(packageName, of);
} else {
packageInfo = packageManager.getPackageInfo(applicationContext.getPackageName(), i);
}
} catch (PackageManager.NameNotFoundException e) {
Log.Helper.LOGES("Utility", "Package name %s not found. Exception: %s", applicationContext.getPackageName(), e.toString());
}
} else {
Log.Helper.LOGES("Utility", "Application Context is null", new Object[0]);
}
return packageInfo;
}
}

Some files were not shown because too many files have changed in this diff Show More