Перенос с маленькими правками

This commit is contained in:
2025-03-30 18:08:41 +03:00
parent 0134f6d689
commit 4b7a924752
544 changed files with 45301 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package com.ea.EAIO;
import android.app.Activity;
import android.content.res.AssetManager;
import android.os.Environment;
/* loaded from: classes.dex */
public class EAIO {
public static native void Shutdown();
private static native void StartupNativeImpl(AssetManager assetManager, String str, String str2, String str3);
public static void Startup(Activity activity) {
StartupNativeImpl(activity.getAssets(), Environment.getDataDirectory().getAbsolutePath(), activity.getFilesDir().getAbsolutePath(), Environment.getExternalStorageDirectory().getAbsolutePath());
}
}
@@ -0,0 +1,42 @@
package com.ea.EAMIO;
import android.app.Activity;
import android.os.Environment;
/* loaded from: classes.dex */
public class StorageDirectory {
public static Activity sActivity;
private static native void ShutdownNativeImpl();
private static native void StartupNativeImpl();
public static void Startup(Activity activity) {
sActivity = activity;
StartupNativeImpl();
}
public static void Shutdown() {
ShutdownNativeImpl();
}
public static String GetInternalStorageDirectory() {
return sActivity.getFilesDir().getAbsolutePath();
}
public static String GetPrimaryExternalStorageDirectory() {
return sActivity.getExternalFilesDir(null).getAbsolutePath();
}
public static String GetPrimaryExternalStorageDirectoryRoot() {
return Environment.getExternalStorageDirectory().getAbsolutePath();
}
public static int GetPrimaryExternalStorageState() {
String externalStorageState = Environment.getExternalStorageState();
if ("mounted".equals(externalStorageState)) {
return 2;
}
return "mounted_ro".equals(externalStorageState) ? 1 : 0;
}
}
@@ -0,0 +1,180 @@
package com.ea.InAppWebBrowser;
import android.app.Activity;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import java.util.UUID;
/* loaded from: classes.dex */
public class BrowserAndroid {
public static int gInstanceCount;
public static Activity mActivity;
public static ViewGroup mViewGroup;
public RelativeLayout mLayout;
public WebView mWebView;
public InAppWebBrowserWebViewClient mWebViewClient;
public final int SCROLLBAR_VISIBLE = 0;
public final int SCROLLBAR_INVISIBLE = 1;
public final int JAVASCRIPT_DISABLE = 0;
public final int JAVASCRIPT_ENABLE = 1;
public final int SCROLLBARSTYLE_DEFAULT = 0;
public final int SCROLLBARSTYLE_INSIDE_OVERLAY = 1;
public final int SCROLLBARSTYLE_INSIDE_INSET = 2;
public final int SCROLLBARSTYLE_OUTSIDE_OVERLAY = 3;
public final int SCROLLBARSTYLE_OUTSIDE_INSET = 4;
public int mInstanceID = 0;
private static native void ShutdownNativeImpl();
private static native void StartupNativeImpl();
public void BrowserAndroid() {
}
public static void Startup(Activity activity, ViewGroup viewGroup) {
mActivity = activity;
mViewGroup = viewGroup;
StartupNativeImpl();
}
public static void Shutdown() {
ShutdownNativeImpl();
}
public void init(final int i, final int i2, final int i3, final int i4, final int i5, final int i6, final int i7, final boolean z, final boolean z2) {
int i8 = gInstanceCount;
gInstanceCount = i8 + 1;
this.mInstanceID = i8;
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.1
@Override // java.lang.Runnable
public void run() {
BrowserAndroid.this.mLayout = new RelativeLayout(BrowserAndroid.mActivity);
BrowserAndroid.this.mWebView = new WebView(BrowserAndroid.mActivity);
BrowserAndroid.this.mWebViewClient = new InAppWebBrowserWebViewClient();
BrowserAndroid.this.mWebViewClient.mInstanceID = BrowserAndroid.this.mInstanceID;
BrowserAndroid.this.mWebView.setWebViewClient(BrowserAndroid.this.mWebViewClient);
if (z2) {
BrowserAndroid.this.mWebView.setBackgroundColor(0);
Class<?> cls = BrowserAndroid.this.mWebView.getClass();
try {
cls.getMethod("setLayerType", Integer.TYPE, Paint.class).invoke(BrowserAndroid.this.mWebView, Integer.valueOf(((Integer) cls.getField("LAYER_TYPE_SOFTWARE").get(BrowserAndroid.this.mWebView)).intValue()), null);
} catch (Exception unused) {
}
}
if (!z) {
Class<?> cls2 = BrowserAndroid.this.mWebView.getClass();
try {
cls2.getMethod("setOverScrollMode", Integer.TYPE).invoke(BrowserAndroid.this.mWebView, Integer.valueOf(((Integer) cls2.getField("OVER_SCROLL_NEVER").get(BrowserAndroid.this.mWebView)).intValue()));
} catch (Exception unused2) {
}
}
BrowserAndroid.this.mWebView.requestFocus(130);
BrowserAndroid.this.mWebView.setOnTouchListener(new View.OnTouchListener() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.1.1
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case 0:
case 1:
if (!view.hasFocus()) {
view.requestFocus();
break;
}
break;
}
return false;
}
});
if (i5 == 1) {
BrowserAndroid.this.mWebView.getSettings().setJavaScriptEnabled(true);
}
BrowserAndroid.this.mWebView.setVerticalScrollBarEnabled(i6 == 0);
BrowserAndroid.this.mWebView.setHorizontalScrollBarEnabled(i6 == 0);
BrowserAndroid.this.mWebView.addJavascriptInterface(new JavascriptInterface(BrowserAndroid.this.mWebViewClient), "JavascriptCallback");
switch (i7) {
case 1:
BrowserAndroid.this.mWebView.setScrollBarStyle(0);
break;
case 2:
BrowserAndroid.this.mWebView.setScrollBarStyle(16777216);
break;
case 3:
BrowserAndroid.this.mWebView.setScrollBarStyle(33554432);
break;
case 4:
BrowserAndroid.this.mWebView.setScrollBarStyle(50331648);
break;
}
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4);
layoutParams.leftMargin = i;
layoutParams.topMargin = i2;
BrowserAndroid.this.mLayout.addView(BrowserAndroid.this.mWebView, layoutParams);
BrowserAndroid.mViewGroup.addView(BrowserAndroid.this.mLayout);
}
});
}
public void OpenUrl(final String str) {
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.2
@Override // java.lang.Runnable
public void run() {
BrowserAndroid.this.mWebView.loadUrl(str);
}
});
}
public void LoadHTML(final String str) {
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.3
@Override // java.lang.Runnable
public void run() {
BrowserAndroid.this.mWebView.loadData(str, "text/html", null);
}
});
}
public void SetViewFrame(final int i, final int i2, final int i3, final int i4) {
if (this.mWebView == null) {
return;
}
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.4
@Override // java.lang.Runnable
public void run() {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4);
layoutParams.leftMargin = i;
layoutParams.topMargin = i2;
BrowserAndroid.this.mLayout.updateViewLayout(BrowserAndroid.this.mWebView, layoutParams);
}
});
}
public void EvaluateJavaScript(final String str) {
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.5
@Override // java.lang.Runnable
public void run() {
UUID randomUUID;
do {
randomUUID = UUID.randomUUID();
} while (!BrowserAndroid.this.mWebViewClient.addUUID(randomUUID));
BrowserAndroid.this.mWebView.loadUrl("javascript: JavascriptCallback.ReceiveResult(eval(" + str + "), '" + randomUUID.toString() + "');");
}
});
}
public void destroy() {
mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.6
@Override // java.lang.Runnable
public void run() {
BrowserAndroid.this.mWebView.stopLoading();
BrowserAndroid.this.mWebView.setWebViewClient(null);
BrowserAndroid.this.mWebViewClient = null;
BrowserAndroid.this.mLayout.removeView(BrowserAndroid.this.mWebView);
BrowserAndroid.mViewGroup.removeView(BrowserAndroid.this.mLayout);
BrowserAndroid.this.mWebView = null;
BrowserAndroid.this.mLayout = null;
}
});
}
}
@@ -0,0 +1,74 @@
package com.ea.InAppWebBrowser;
import android.graphics.Bitmap;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
/* loaded from: classes.dex */
public class InAppWebBrowserWebViewClient extends WebViewClient {
public int mInstanceID = 0;
private SortedSet<UUID> mJavascriptIds = Collections.synchronizedSortedSet(new TreeSet());
public native void OnJavascriptResult(String str, int i);
public native void OnLoadError(String str, int i);
public native void OnLoadFinished(String str, int i);
public native void OnLoadStarted(String str, int i);
public native boolean ShouldLoadURL(String str, int i);
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Log.e("InAppWebBrowserWebViewClient", "shouldOverrideUrlLoading: " + str);
return !ShouldLoadURL(str, this.mInstanceID);
}
@Override // android.webkit.WebViewClient
public void onLoadResource(WebView webView, String str) {
Log.e("InAppWebBrowserWebViewClient", "onLoadResource: " + str);
OnLoadStarted(str, this.mInstanceID);
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
Log.e("InAppWebBrowserWebViewClient", "onPageStarted: " + str);
OnLoadStarted(str, this.mInstanceID);
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
Log.e("InAppWebBrowserWebViewClient", "onPageFinished: " + str);
OnLoadFinished(str, this.mInstanceID);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
Log.e("InAppWebBrowserWebViewClient", "onReceivedError");
OnLoadError("Loading Error. URL: " + str2 + " ErrorCode: " + i + " Description: " + str, this.mInstanceID);
}
public void onJavascriptResult(String str, String str2) throws Exception {
UUID fromString = UUID.fromString(str2);
if (fromString != null && this.mJavascriptIds.contains(fromString)) {
this.mJavascriptIds.remove(fromString);
OnJavascriptResult(str, this.mInstanceID);
return;
}
throw new Exception("Unable to verify validity of script result.");
}
public boolean addUUID(UUID uuid) {
if (this.mJavascriptIds.contains(uuid)) {
return false;
}
this.mJavascriptIds.add(uuid);
return true;
}
}
@@ -0,0 +1,14 @@
package com.ea.InAppWebBrowser;
/* loaded from: classes.dex */
public class JavascriptInterface {
private InAppWebBrowserWebViewClient mWebViewClient;
public JavascriptInterface(InAppWebBrowserWebViewClient inAppWebBrowserWebViewClient) {
this.mWebViewClient = inAppWebBrowserWebViewClient;
}
public void ReceiveResult(String str, String str2) throws Exception {
this.mWebViewClient.onJavascriptResult(str, str2);
}
}
@@ -0,0 +1,56 @@
package com.ea.InputMan;
import android.view.MotionEvent;
/* loaded from: classes.dex */
public class InputMan {
private boolean gbMotionEvent_GetSource;
private static int GetEventType(int i) {
switch (i) {
}
return 0;
}
private static native boolean InputMan_OnMotionEvent(int i, int i2, float f, float f2, int i3, float f3);
public InputMan() {
this.gbMotionEvent_GetSource = false;
try {
MotionEvent.class.getMethod("getSource", new Class[0]);
this.gbMotionEvent_GetSource = true;
} catch (Exception unused) {
}
}
private int GetSource(MotionEvent motionEvent) {
if (!this.gbMotionEvent_GetSource) {
return 0;
}
int source = motionEvent.getSource();
if ((source & 2) != 0) {
return (source == 8194 || source != 1048584) ? 0 : 10;
}
return -1;
}
public boolean onTouchEvent(int i, MotionEvent motionEvent) {
int historySize = motionEvent.getHistorySize();
int pointerCount = motionEvent.getPointerCount();
int GetSource = GetSource(motionEvent);
int GetEventType = GetEventType(motionEvent.getAction() & 255);
if (GetSource < 0) {
return false;
}
for (int i2 = 0; i2 < historySize; i2++) {
for (int i3 = 0; i3 < pointerCount; i3++) {
InputMan_OnMotionEvent(i, motionEvent.getPointerId(i3), motionEvent.getHistoricalX(i3, i2), motionEvent.getHistoricalY(i3, i2), GetEventType, motionEvent.getHistoricalPressure(i3, i2));
}
}
boolean z = false;
for (int i4 = 0; i4 < pointerCount; i4++) {
z = InputMan_OnMotionEvent(i, motionEvent.getPointerId(i4), motionEvent.getX(i4), motionEvent.getY(i4), GetEventType, motionEvent.getPressure(i4));
}
return z;
}
}
@@ -0,0 +1,6 @@
package com.ea.eadp.deviceid;
/* loaded from: classes.dex */
public interface DeviceIdService {
String getDeviceId();
}
@@ -0,0 +1,38 @@
package com.ea.eadp.http.models;
import java.net.URL;
/* loaded from: classes.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);
}
@@ -0,0 +1,6 @@
package com.ea.eadp.http.models;
/* loaded from: classes.dex */
public interface HttpRequestListener {
void onComplete(HttpResponse httpResponse);
}
@@ -0,0 +1,26 @@
package com.ea.eadp.http.models;
import java.util.Map;
/* loaded from: classes.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);
}
@@ -0,0 +1,10 @@
package com.ea.eadp.http.services;
import com.ea.eadp.http.models.HttpRequest;
import java.io.IOException;
import java.net.MalformedURLException;
/* loaded from: classes.dex */
public interface HttpService {
HttpRequest getResource(String str) throws MalformedURLException, IOException;
}
@@ -0,0 +1,19 @@
package com.ea.eadp.pushnotification.forwarding;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
/* loaded from: classes.dex */
public class GcmBroadcastReceiver extends BroadcastReceiver {
@Override // android.content.BroadcastReceiver
public final void onReceive(Context context, Intent intent) {
intent.setComponent(new ComponentName(context.getPackageName(), getIntentServiceName()));
GcmIntentService.enqueueWork(context, getIntentServiceName(), intent);
}
protected String getIntentServiceName() {
return GcmIntentService.class.getName();
}
}
@@ -0,0 +1,210 @@
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 android.support.annotation.NonNull;
import android.support.v4.app.JobIntentService;
import android.support.v4.app.NotificationCompat;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
import com.ea.eadp.pushnotification.services.AndroidPushService;
import com.ea.eadp.pushnotification.services.IPushService;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Global;
import com.ea.nimble.Log;
import com.facebook.internal.NativeProtocol;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import java.util.List;
/* loaded from: classes.dex */
public class GcmIntentService extends JobIntentService {
protected static final int JOB_ID = 5566;
private static final String LOG_TAG = "GcmIntentService";
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";
}
protected boolean displayNotification(Bundle bundle) {
return true;
}
protected HttpService getHttpService() {
return null;
}
public static void enqueueWork(Context context, String str, Intent intent) {
try {
enqueueWork(context, Class.forName(str), JOB_ID, intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
@Override // android.support.v4.app.JobIntentService
protected void onHandleWork(@NonNull Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null) {
Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
return;
}
String messageType = GoogleCloudMessaging.getInstance(getApplicationContext()).getMessageType(intent);
if (extras.isEmpty()) {
return;
}
if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
Log.Helper.LOGIS(LOG_TAG, "Error received: " + extras.toString(), new Object[0]);
return;
}
if ("deleted_messages".equals(messageType)) {
Log.Helper.LOGIS(LOG_TAG, "Deleted messages on server: " + extras.toString(), new Object[0]);
return;
}
if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
onHandleMessage(intent);
}
}
protected void onHandleMessage(Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null) {
Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
return;
}
Log.Helper.LOGIS(LOG_TAG, "Message received: " + extras.toString(), new Object[0]);
if (displayNotification(extras)) {
postNotification(getApplicationContext(), extras);
}
int i = 3;
String string = extras.getString(PushIntentExtraKeys.ENS_EVENTS);
if (string != null) {
try {
i = Integer.parseInt(string);
} catch (NumberFormatException unused) {
Log.Helper.LOGWS(LOG_TAG, "ensEvents flag found but not parseable as integer", new Object[0]);
}
}
if (extras.containsKey(PushIntentExtraKeys.PUSH_ID)) {
if (i >= 2 || i < 0) {
if (this.pushManager == null) {
this.pushManager = new AndroidPushService(getApplicationContext(), getHttpService());
}
if (ApplicationEnvironment.isMainApplicationRunning()) {
this.pushManager.sendTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED);
} else {
this.pushManager.persistTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED);
}
}
}
}
@SuppressLint({"InlinedApi"})
private void postNotification(Context context, Bundle bundle) {
Intent intent = new Intent();
if (Build.VERSION.SDK_INT >= 12) {
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;
String str = Global.NOTIFICATION_CHANNEL_DEFAULT_ID;
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
if (applicationInfo.metaData.containsKey(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) {
str = applicationInfo.metaData.getString(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY);
}
} catch (PackageManager.NameNotFoundException e) {
android.util.Log.e(Global.NIMBLE_ID, String.format("%s>GcmIntentService.postNotification():\n%s", LOG_TAG, e.getMessage()));
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, str);
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);
builder.setContentIntent(PendingIntent.getBroadcast(context, hashCode, intent, 134217728));
} else {
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]);
}
protected boolean isInForeground() {
return PushLifecycleCallbacks.inForeground;
}
protected 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.toString(), 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);
}
protected ComponentName getBroadcastForwarderComponent() {
Log.Helper.LOGFUNC(this);
PackageManager packageManager = getApplicationContext().getPackageManager();
Intent intent = new Intent("com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST");
intent.setPackage(getApplicationContext().getPackageName());
List<ResolveInfo> queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
if (queryBroadcastReceivers.isEmpty()) {
return null;
}
ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
return new ComponentName(activityInfo.packageName, activityInfo.name);
}
}
@@ -0,0 +1,139 @@
package com.ea.eadp.pushnotification.forwarding;
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.Bundle;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.eadp.pushnotification.services.IPushService;
import com.ea.nimble.Log;
/* loaded from: classes.dex */
public class PushBroadcastForwarder extends BroadcastReceiver {
private static final String LOG_TAG = "PushBroadcastForwarder";
private IPushService pushManager;
protected HttpService getHttpService() {
return null;
}
/* JADX WARN: Removed duplicated region for block: B:17:0x003a */
/* JADX WARN: Removed duplicated region for block: B:20:0x004f */
/* JADX WARN: Removed duplicated region for block: B:21:0x0063 */
@Override // android.content.BroadcastReceiver
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
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 r1 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L1d
goto L27
L1d:
java.lang.String r1 = "PushBroadcastForwarder"
java.lang.String r3 = "ensEvents flag found but not parseable as integer"
java.lang.Object[] r0 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGWS(r1, r3, r0)
L26:
r1 = 3
L27:
java.lang.String r0 = "pushId"
boolean r0 = r6.containsKey(r0)
if (r0 == 0) goto L76
if (r1 >= r2) goto L36
r0 = 1
if (r1 == r0) goto L36
if (r1 >= 0) goto L76
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 r1 = r5.getApplicationContext()
com.ea.eadp.http.services.HttpService r2 = r4.getHttpService()
r0.<init>(r1, r2)
r4.pushManager = r0
L49:
boolean r0 = com.ea.nimble.ApplicationEnvironment.isMainApplicationRunning()
if (r0 == 0) goto L63
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = "pushId"
java.lang.String r1 = r6.getString(r1)
java.lang.String r2 = "pnType"
java.lang.String r2 = r6.getString(r2)
java.lang.String r3 = "NOTIFICATION_OPENED"
r0.sendTrackingEvent(r1, r2, r3)
goto L76
L63:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = "pushId"
java.lang.String r1 = r6.getString(r1)
java.lang.String r2 = "pnType"
java.lang.String r2 = r6.getString(r2)
java.lang.String r3 = "NOTIFICATION_OPENED"
r0.persistTrackingEvent(r1, r2, r3)
L76:
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");
}
protected void handleNewPushNotification(Context context, Bundle bundle) {
Intent intent;
String string = bundle.getString(GcmIntentService.PushIntentExtraKeys.DEEP_LINK_URL);
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.toString()), new Object[0]);
return;
}
}
intent.putExtras(bundle);
intent.setFlags(603979776);
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1073741824);
if (activity == null) {
Log.Helper.LOGE(LOG_TAG, "Unable to create PendingIntent", new Object[0]);
}
try {
activity.send();
} catch (PendingIntent.CanceledException e2) {
Log.Helper.LOGE(LOG_TAG, String.format("Could not launch PendingIntent for PN %s", e2.toString()), new Object[0]);
}
}
protected 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 "";
}
}
@@ -0,0 +1,47 @@
package com.ea.eadp.pushnotification.lifecycles;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
@TargetApi(14)
/* loaded from: classes.dex */
public class PushLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
public static final int LIFECYCLE_API_VERSION = 14;
public static boolean inForeground;
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
inForeground = true;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
inForeground = false;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
inForeground = false;
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
inForeground = false;
}
}
@@ -0,0 +1,12 @@
package com.ea.eadp.pushnotification.listeners;
/* loaded from: classes.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);
}
@@ -0,0 +1,162 @@
package com.ea.eadp.pushnotification.models;
import android.os.Build;
import java.util.Locale;
import java.util.TimeZone;
/* loaded from: classes.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 getUserAlias() {
return this.userAlias;
}
public void setUserAlias(String str) {
this.userAlias = str;
}
public String getDeviceType() {
return this.deviceType;
}
public void setDeviceType(String str) {
this.deviceType = str;
}
public String getOperatingSystem() {
return this.operatingSystem;
}
public void setOperatingSystem(String str) {
this.operatingSystem = str;
}
public String getManufacturer() {
return this.manufacturer;
}
public void setManufacturer(String str) {
this.manufacturer = str;
}
public String getRegistrationIdentifier() {
return this.registrationIdentifier;
}
public void setRegistrationIdentifier(String str) {
this.registrationIdentifier = str;
}
public String getDeviceIdentifier() {
return this.deviceIdentifier;
}
public void setDeviceIdentifier(String str) {
this.deviceIdentifier = str;
}
public String getModel() {
return this.model;
}
public void setModel(String str) {
this.model = str;
}
public String getAppId() {
return this.appId;
}
public void setAppId(String str) {
this.appId = str;
}
public String getAppVersion() {
return this.appVersion;
}
public void setAppVersion(String str) {
this.appVersion = str;
}
public String getCountry() {
return this.country;
}
public void setCountry(String str) {
this.country = str;
}
public String getLocale() {
return this.locale;
}
public void setLocale(String str) {
this.locale = str;
}
public TimeZone getTimezone() {
return this.timezone;
}
public void setTimezone(TimeZone timeZone) {
this.timezone = timeZone;
}
public Integer getSilentIntervalStart() {
return this.silentIntervalStart;
}
public void setSilentIntervalStart(Integer num) {
this.silentIntervalStart = num;
}
public Integer getSilentIntervalEnd() {
return this.silentIntervalEnd;
}
public void setSilentIntervalEnd(Integer num) {
this.silentIntervalEnd = num;
}
public String getDateOfBirth() {
return this.dateOfBirth;
}
public void setDateOfBirth(String str) {
this.dateOfBirth = str;
}
public String getDisabledReason() {
return this.disabledReason;
}
public void setDisabledReason(String str) {
this.disabledReason = str;
}
public boolean isDisabled() {
return this.disabled;
}
public void setDisabled(boolean z) {
this.disabled = z;
}
}
@@ -0,0 +1,414 @@
package com.ea.eadp.pushnotification.services;
import android.annotation.TargetApi;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.util.Base64;
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.GcmIntentService;
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.GoogleApiAvailability;
import com.google.android.gms.gcm.GoogleCloudMessaging;
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.Charset;
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;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.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 String apiKey;
private String apiSecret;
private String appId;
private Context context;
private DeviceIdService deviceIdService;
private String gameId;
private GoogleCloudMessaging googleCloudMessaging;
private HttpService httpService;
private long inAppNotificationInterval;
private Timer inAppTimer;
private IPushListener pushListener;
private String pushNotificationServerUrl;
private String senderId;
private String startClientToken;
private PushNotificationConfig startConfig;
public AndroidPushService(GoogleCloudMessaging googleCloudMessaging, HttpService httpService, DeviceIdService deviceIdService, Context context, IPushListener iPushListener, String str, String str2, String str3, String str4, String str5, String str6, int i) {
Log.Helper.LOGIS(LOG_TAG, "Instantiating new push mgr", new Object[0]);
this.googleCloudMessaging = googleCloudMessaging;
this.httpService = httpService;
this.deviceIdService = deviceIdService;
this.context = context;
this.pushListener = iPushListener;
this.senderId = str;
this.pushNotificationServerUrl = str2;
this.gameId = str3;
this.appId = str4;
this.apiKey = str5;
this.apiSecret = str6;
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(GAME_ID_KEY);
this.apiKey = loadConfigData(API_KEY_KEY);
this.apiSecret = loadConfigData(API_SECRET_KEY);
}
@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;
}
@Override // com.ea.eadp.pushnotification.services.IPushService
@TargetApi(14)
public void startWithConfig(final PushNotificationConfig pushNotificationConfig, final String str) {
if (pushNotificationConfig == null) {
Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
if (this.pushListener != null) {
this.pushListener.onConnectionError(0, "Config data is null");
return;
}
return;
}
if (this.inAppNotificationInterval > 0) {
this.inAppTimer = new Timer();
this.inAppTimer.schedule(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);
}
}, this.inAppNotificationInterval, this.inAppNotificationInterval);
}
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 GCM", new Object[0]);
try {
String register = AndroidPushService.this.googleCloudMessaging.register(AndroidPushService.this.senderId);
pushNotificationConfig.setRegistrationIdentifier(register);
pushNotificationConfig.setDisabled(false);
pushNotificationConfig.setDisabledReason(null);
Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registered on GCM. Registration id: %s", register), new Object[0]);
try {
if (Build.VERSION.SDK_INT >= 14) {
((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());
}
} catch (Exception e2) {
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to get registration ID from GCM: %s", e2.getLocalizedMessage());
pushNotificationConfig.setDisabled(true);
pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
}
} else {
Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to find appropriate Google Play Service SDK on device. Registering as disabled", 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 registerDevice(final PushNotificationConfig pushNotificationConfig) {
if (pushNotificationConfig == null) {
Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
if (this.pushListener != null) {
this.pushListener.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]);
if (this.pushListener != null) {
this.pushListener.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]);
if (this.pushListener != null) {
this.pushListener.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(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str);
hashMap.put(GcmIntentService.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.commit();
}
@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(GcmIntentService.PushIntentExtraKeys.PUSH_ID), (String) map.get(GcmIntentService.PushIntentExtraKeys.PN_TYPE), (String) map.get("state"));
}
}
}
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.clear();
edit.commit();
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void getInAppNotifications(final String str, final String str2) {
if (str == null) {
if (this.pushListener != null) {
this.pushListener.onConnectionError(0, "UserAlias is null");
return;
}
return;
}
new Thread(new Runnable() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.5
@Override // java.lang.Runnable
public void run() {
int i;
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 httpResponse = resource.get();
i = httpResponse.getCode();
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 e) {
e = e;
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);
}
}
} catch (Exception e2) {
e = e2;
i = 0;
}
}
}, "getInAppNotifications thread").start();
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void onRestart() {
if (this.inAppTimer == null || this.inAppNotificationInterval <= 0) {
return;
}
this.inAppTimer = new Timer();
this.inAppTimer.schedule(new TimerTask() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.6
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
AndroidPushService.this.getInAppNotifications(AndroidPushService.this.startConfig.getUserAlias(), AndroidPushService.this.startClientToken);
}
}, this.inAppNotificationInterval, this.inAppNotificationInterval);
}
@Override // com.ea.eadp.pushnotification.services.IPushService
public void onStop() {
if (this.inAppTimer != null) {
this.inAppTimer.cancel();
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean checkPlayServices() {
return GoogleApiAvailability.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());
}
if (this.pushNotificationServerUrl != null && !this.pushNotificationServerUrl.equals("")) {
edit.putString(PUSH_SERVER_URL_KEY, this.pushNotificationServerUrl);
}
if (this.gameId != null && !this.gameId.equals("")) {
edit.putString(GAME_ID_KEY, this.gameId);
}
if (this.apiKey != null && !this.apiKey.equals("")) {
edit.putString(API_KEY_KEY, this.apiKey);
}
if (this.apiSecret != null && !this.apiSecret.equals("")) {
edit.putString(API_SECRET_KEY, this.apiSecret);
}
edit.commit();
}
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(Charset.forName(HTTP.UTF_8)), 10));
}
private 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());
}
}
}
@@ -0,0 +1,30 @@
package com.ea.eadp.pushnotification.services;
import com.ea.eadp.pushnotification.listeners.IPushListener;
import com.ea.eadp.pushnotification.models.PushNotificationConfig;
/* loaded from: classes.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);
}
@@ -0,0 +1,27 @@
package com.ea.eadp.pushnotification.services;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.google.gson.annotations.Expose;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
class TrackingEvent {
@Expose
private String name;
@Expose
private Map<String, String> parameters = new HashMap();
public TrackingEvent(String str, String str2, String str3, String str4) {
this.name = str3;
this.parameters.put(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str);
this.parameters.put(GcmIntentService.PushIntentExtraKeys.PN_TYPE, str2);
this.parameters.put("deviceType", "android");
this.parameters.put("deviceIdentifier", str4);
this.parameters.put("timestamp", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()));
}
}
@@ -0,0 +1,143 @@
package com.ea.ironmonkey;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
/* loaded from: classes.dex */
public class Accelerometer implements SensorEventListener {
private int bufferReadIndex;
private int bufferSize;
private int[] bufferTimesteps;
private float[] bufferValues;
private int bufferWriteIndex;
private long lastTimestamp = 0;
private int naturalOrientation;
private boolean registered;
private float samplesPerSecond;
private Sensor sensor;
private SensorManager sensorManager;
@Override // android.hardware.SensorEventListener
public void onAccuracyChanged(Sensor sensor, int i) {
}
public Accelerometer(SensorManager sensorManager, Sensor sensor, int i) {
this.sensorManager = sensorManager;
this.sensor = sensor;
this.naturalOrientation = i;
setBufferSize(1);
}
public void setFrequency(float f) {
this.samplesPerSecond = f;
register();
}
public float getFrequency() {
return this.samplesPerSecond;
}
public void setBufferSize(int i) {
this.bufferSize = i;
this.bufferTimesteps = new int[i];
this.bufferValues = new float[i * 3];
this.bufferWriteIndex = 0;
this.bufferReadIndex = 0;
}
public void updateOrientation(int i) {
this.naturalOrientation = i;
}
public int getBufferSize() {
return this.bufferSize;
}
public void pause() {
unregister();
}
public void resume() {
register();
}
private int getSensorDelay() {
return this.samplesPerSecond < 20.0f ? 3 : 1;
}
private void register() {
if (!this.registered && this.samplesPerSecond > 0.0f) {
this.sensorManager.registerListener(this, this.sensor, getSensorDelay());
this.registered = true;
} else if (this.registered && this.samplesPerSecond == 0.0f) {
this.sensorManager.unregisterListener(this);
this.registered = false;
}
}
private void unregister() {
if (this.registered) {
this.sensorManager.unregisterListener(this);
this.registered = false;
}
}
public int getSamples(int i, int[] iArr, float[] fArr) {
int i2;
synchronized (this) {
i2 = 0;
while (this.bufferReadIndex != this.bufferWriteIndex) {
if (this.bufferReadIndex >= this.bufferSize) {
this.bufferReadIndex = 0;
}
if (i2 >= i) {
break;
}
iArr[i2] = this.bufferTimesteps[this.bufferReadIndex];
for (int i3 = 0; i3 < 3; i3++) {
fArr[(i2 * 3) + i3] = this.bufferValues[(this.bufferReadIndex * 3) + i3];
}
i2++;
this.bufferReadIndex++;
}
}
return i2;
}
@Override // android.hardware.SensorEventListener
public void onSensorChanged(SensorEvent sensorEvent) {
int i = (int) ((sensorEvent.timestamp - this.lastTimestamp) / 1000000);
this.lastTimestamp = sensorEvent.timestamp;
synchronized (this) {
this.bufferWriteIndex++;
if (this.bufferWriteIndex >= this.bufferSize) {
this.bufferWriteIndex = 0;
}
if (this.bufferWriteIndex == this.bufferReadIndex) {
this.bufferReadIndex++;
}
this.bufferTimesteps[this.bufferWriteIndex] = i;
switch (this.naturalOrientation) {
case 0:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[0];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[1];
break;
case 1:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[1];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[0];
break;
case 2:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[0];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[1];
break;
case 3:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[1];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[0];
break;
}
this.bufferValues[(this.bufferWriteIndex * 3) + 2] = sensorEvent.values[2];
}
}
}
@@ -0,0 +1,61 @@
package com.ea.ironmonkey;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
/* loaded from: classes.dex */
public class BitmapGraphics {
private Bitmap bitmap;
private Canvas canvas = new Canvas();
public BitmapGraphics(int i, int i2) {
this.bitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
this.canvas.setBitmap(this.bitmap);
}
public Bitmap getBitmap() {
return this.bitmap;
}
public Canvas getCanvas() {
return this.canvas;
}
public void clear() {
this.canvas.drawColor(0, PorterDuff.Mode.CLEAR);
}
private static Paint createPaint(Typeface typeface, float f) {
Paint paint = new Paint();
paint.setTypeface(typeface);
paint.setTextSize(f);
paint.setColor(-1);
paint.setAntiAlias(true);
return paint;
}
public static Paint createPaintFromFamilyName(String str, float f) {
return createPaint(Typeface.create(str, 0), f);
}
public static Paint createPaintFromFile(String str, float f) {
return createPaint(internalCreateFromFile(str), f);
}
private static Typeface internalCreateFromFile(String str) {
if (GameActivityMain.instance.useAssetsFileSystem()) {
if (str.startsWith("/")) {
str = str.substring(1);
}
return Typeface.createFromAsset(GameActivityMain.instance.getAssetManager(), str);
}
return Typeface.createFromFile(str);
}
public void drawString(Paint paint, String str, int i, int i2) {
this.canvas.drawText(str, i, i2, paint);
}
}
@@ -0,0 +1,16 @@
package com.ea.ironmonkey;
/* loaded from: classes.dex */
public class C2DMConstants {
public static final String ACTION_ERROR = "com.ea.ironmonkey.ERROR";
public static final String ACTION_MESSAGE = "com.ea.ironmonkey.MESSAGE";
public static final String ACTION_REGISTER = "com.ea.ironmonkey.REGISTER";
public static final String ACTION_UNREGISTER = "com.ea.ironmonkey.UNREGISTER";
public static final String EXTRA_ERROR_ID = "ERROR_ID";
public static final String EXTRA_REGISTRATION_ID = "REGISTRATION_ID";
public static final String LAUNCH_TYPE_TAG = "app_launch";
public static final String SENDER_EMAIL = "927779459434";
public static final String SYSTEM_MSG_CLASS_RECIPIENT = "com.ea.ironmonkey.GameActivityMain";
public static final String SYSTEM_MSG_PACKAGE_RECIPIENT = "com.ea.games.nfs13_row";
public static final String SYSTEM_MSG_TITLE = "NFS Most Wanted";
}
@@ -0,0 +1,19 @@
package com.ea.ironmonkey;
/* loaded from: classes.dex */
public class DownloaderService extends com.google.android.vending.expansion.downloader.impl.DownloaderService {
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
public String getPublicKey() {
return getPackageName().endsWith("_row") ? SkuConfig.ROW_BASE64_PUBLIC_KEY : SkuConfig.NA_BASE64_PUBLIC_KEY;
}
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
public byte[] getSALT() {
return SkuConfig.SALT;
}
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
public String getAlarmReceiverClassName() {
return DownloaderServiceBroadcastReceiver.class.getName();
}
}
@@ -0,0 +1,19 @@
package com.ea.ironmonkey;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
/* loaded from: classes.dex */
public class DownloaderServiceBroadcastReceiver extends BroadcastReceiver {
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
try {
DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent, (Class<?>) DownloaderService.class);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,8 @@
package com.ea.ironmonkey;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes.dex */
public interface DrawFrameListener {
void onDrawFrame(GL10 gl10);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,223 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.view.MotionEvent;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
/* loaded from: classes.dex */
public class GameGLSurfaceView extends GLSurfaceView {
private static final String TAG = "GameGLSurfaceView";
private boolean enableHistoricalEvents;
private boolean kMotionEvent_GetSource;
private GameActivityMain mActivity;
/* JADX INFO: Access modifiers changed from: private */
public native void nativeTouchPadEvent(int i, int i2, float f, float f2);
/* JADX INFO: Access modifiers changed from: private */
public native void nativeTouchScreenEvent(int i, int i2, float f, float f2);
public GameGLSurfaceView(GameActivityMain gameActivityMain) {
super(gameActivityMain);
this.enableHistoricalEvents = false;
this.kMotionEvent_GetSource = false;
this.mActivity = null;
this.mActivity = gameActivityMain;
try {
MotionEvent.class.getMethod("getSource", new Class[0]);
this.kMotionEvent_GetSource = true;
} catch (Exception unused) {
}
setGLESVersion2();
setFocusable(true);
setFocusableInTouchMode(true);
if (Build.VERSION.SDK_INT >= 11) {
try {
Log.i(TAG, "setPreserveEGLContextOnPause");
getClass().getMethod("setPreserveEGLContextOnPause", Boolean.TYPE).invoke(this, false);
Log.e(TAG, "setPreserveEGLContextOnPause(false) success");
} catch (Exception unused2) {
Log.e(TAG, "setPreserveEGLContextOnPause failed");
}
}
}
public void setEnableHistoricalEvents(boolean z) {
this.enableHistoricalEvents = z;
}
private void setGLESVersion2() {
setEGLContextFactory(new GLSurfaceView.EGLContextFactory() { // from class: com.ea.ironmonkey.GameGLSurfaceView.1
private static final int EGL_CONTEXT_CLIENT_VERSION = 12440;
@Override // android.opengl.GLSurfaceView.EGLContextFactory
public EGLContext createContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig) {
return egl10.eglCreateContext(eGLDisplay, eGLConfig, EGL10.EGL_NO_CONTEXT, new int[]{EGL_CONTEXT_CLIENT_VERSION, 2, 12344});
}
@Override // android.opengl.GLSurfaceView.EGLContextFactory
public void destroyContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLContext eGLContext) {
egl10.eglDestroyContext(eGLDisplay, eGLContext);
}
});
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0));
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
GameActivityMain gameActivityMain = this.mActivity;
int i = GameActivityMain.state;
GameActivityMain gameActivityMain2 = this.mActivity;
if (i != 8) {
return true;
}
motionEvent.getHistorySize();
final int pointerCount = motionEvent.getPointerCount();
final MotionEvent obtain = MotionEvent.obtain(motionEvent);
queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameGLSurfaceView.2
@Override // java.lang.Runnable
public void run() {
int i2 = 0;
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
if (obtain.getSource() == 4098) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex), obtain.getX(actionIndex), obtain.getY(actionIndex));
return;
}
}
if (obtain.getSource() == 1048584) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex2 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(actionIndex2), obtain.getX(actionIndex2), obtain.getY(actionIndex2));
return;
}
}
return;
}
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
} else {
int actionIndex3 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex3), obtain.getX(actionIndex3), obtain.getY(actionIndex3));
}
}
});
return true;
}
private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
private static final int EGL_DEPTH_ENCODING_NV = 12514;
protected int mAlphaSize;
protected int mBlueSize;
protected int mDepthSize;
protected int mGreenSize;
protected int mRedSize;
protected int mStencilSize;
private int[] mValue = new int[1];
public ConfigChooser(int i, int i2, int i3, int i4, int i5, int i6) {
this.mRedSize = i;
this.mGreenSize = i2;
this.mBlueSize = i3;
this.mAlphaSize = i4;
this.mDepthSize = i5;
this.mStencilSize = i6;
}
@Override // android.opengl.GLSurfaceView.EGLConfigChooser
public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay) {
int[] iArr = {12352, 4, 12324, 4, 12323, 4, 12322, 4, 12344};
int[] iArr2 = new int[1];
egl10.eglChooseConfig(eGLDisplay, iArr, null, 0, iArr2);
int i = iArr2[0];
if (i <= 0) {
throw new IllegalArgumentException("No configs match configSpec");
}
EGLConfig[] eGLConfigArr = new EGLConfig[i];
egl10.eglChooseConfig(eGLDisplay, iArr, eGLConfigArr, i, iArr2);
return chooseConfig(egl10, eGLDisplay, eGLConfigArr);
}
public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig[] eGLConfigArr) {
EGLConfig eGLConfig = null;
while (true) {
int i = 0;
if (eGLConfig == null) {
int length = eGLConfigArr.length;
while (true) {
if (i >= length) {
break;
}
EGLConfig eGLConfig2 = eGLConfigArr[i];
int findConfigAttrib = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12325, 0);
int findConfigAttrib2 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12326, 0);
if (findConfigAttrib >= this.mDepthSize && findConfigAttrib2 >= this.mStencilSize) {
int findConfigAttrib3 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12324, 0);
int findConfigAttrib4 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12323, 0);
int findConfigAttrib5 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12322, 0);
int findConfigAttrib6 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12321, 0);
if (findConfigAttrib3 == this.mRedSize && findConfigAttrib4 == this.mGreenSize && findConfigAttrib5 == this.mBlueSize && findConfigAttrib6 == this.mAlphaSize) {
if (findConfigAttrib(egl10, eGLDisplay, eGLConfig2, EGL_DEPTH_ENCODING_NV, 0) == 0) {
eGLConfig = eGLConfig2;
break;
}
eGLConfig = eGLConfig2;
}
}
i++;
}
if (eGLConfig == null) {
if (this.mDepthSize <= 0) {
return null;
}
this.mDepthSize -= 8;
}
} else {
StringBuilder sb = new StringBuilder();
sb.append("depth=");
EGLConfig eGLConfig3 = eGLConfig;
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12325, 0));
sb.append(" stencil=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12326, 0));
sb.append(" red=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12324, 0));
sb.append(" green=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12323, 0));
sb.append(" blue=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12322, 0));
sb.append(" alpha=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12321, 0));
sb.append(" nonLinear=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, EGL_DEPTH_ENCODING_NV, 0) == EGL_DEPTH_ENCODING_NONLINEAR_NV);
Log.i(GameGLSurfaceView.TAG, sb.toString());
return eGLConfig;
}
}
}
private int findConfigAttrib(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig, int i, int i2) {
return egl10.eglGetConfigAttrib(eGLDisplay, eGLConfig, i, this.mValue) ? this.mValue[0] : i2;
}
}
}
@@ -0,0 +1,54 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes.dex */
public class GameRenderer implements GLSurfaceView.Renderer {
static GL10 _gl;
private int _height;
private int _width;
private GameActivityMain activity;
private DrawFrameListener drawFrameListener;
public GameRenderer(GameActivityMain gameActivityMain) {
this.activity = gameActivityMain;
}
public void setDrawFrameListener(DrawFrameListener drawFrameListener) {
this.drawFrameListener = drawFrameListener;
}
public int getWidth() {
return this._width;
}
public int getHeight() {
return this._height;
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onSurfaceCreated(GL10 gl10, EGLConfig eGLConfig) {
this.activity.nativeSurfaceCreated(gl10, eGLConfig);
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onSurfaceChanged(GL10 gl10, int i, int i2) {
if (gl10 != _gl) {
this.activity.nativeSurfaceChanged(gl10, i, i2);
_gl = gl10;
}
this._width = i;
this._height = i2;
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onDrawFrame(GL10 gl10) {
if (this.drawFrameListener != null) {
this.drawFrameListener.onDrawFrame(gl10);
} else {
this.activity.getRunLoop().onRunLoopTick();
}
}
}
@@ -0,0 +1,49 @@
package com.ea.ironmonkey;
import android.provider.Settings;
import com.eamobile.licensing.ILicenseServerActivityCallback;
import com.eamobile.licensing.LicenseServerActivity;
/* loaded from: classes.dex */
class GoogleDrm implements ILicenseServerActivityCallback {
private GameActivityMain _activity;
private String publicKey;
public boolean isEnable() {
return false;
}
public GoogleDrm(GameActivityMain gameActivityMain) {
this._activity = gameActivityMain;
this.publicKey = SkuConfig.NA_BASE64_PUBLIC_KEY;
if (this._activity.getPackageName().endsWith("_row")) {
this.publicKey = SkuConfig.ROW_BASE64_PUBLIC_KEY;
}
}
public void start() {
LicenseServerActivity.getInstance().initLicenseServerActivity(this._activity, this, this._activity, SkuConfig.SALT, this._activity.getPackageName(), this.publicKey, Settings.Secure.getString(this._activity.getContentResolver(), "android_id"));
}
public void destroy() {
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
}
/* JADX WARN: Unreachable blocks removed: 1, instructions: 2 */
@Override // com.eamobile.licensing.ILicenseServerActivityCallback
public void onLicenseResultStart() {
GameActivityMain gameActivityMain = this._activity;
LicenseServerActivity.getInstance().LastCheckPointCheck();
GameActivityMain gameActivityMain2 = this._activity;
gameActivityMain.onResult("GOOGL_DRM", -1);
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
}
@Override // com.eamobile.licensing.ILicenseServerActivityCallback
public void onLicenseResultEnd() {
GameActivityMain gameActivityMain = this._activity;
GameActivityMain gameActivityMain2 = this._activity;
gameActivityMain.onResult("GOOGL_DRM", 0);
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
}
}
@@ -0,0 +1,46 @@
package com.ea.ironmonkey;
/* loaded from: classes.dex */
public class Log {
private static boolean enable;
public static void setEnable(boolean z) {
enable = z;
}
public static void i(String str, String str2) {
if (enable) {
android.util.Log.i(str, str2);
}
}
public static void e(String str, String str2) {
if (enable) {
android.util.Log.e(str, str2);
}
}
public static void w(String str, String str2) {
if (enable) {
android.util.Log.w(str, str2);
}
}
public static void d(String str, String str2) {
if (enable) {
android.util.Log.d(str, str2);
}
}
public static void v(String str, String str2) {
if (enable) {
android.util.Log.v(str, str2);
}
}
public static void e(String str, String str2, Exception exc) {
if (enable) {
android.util.Log.e(str, str2, exc);
}
}
}
@@ -0,0 +1,30 @@
package com.ea.ironmonkey;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.MotionEvent;
import com.bda.controller.StateEvent;
/* loaded from: classes.dex */
public class MogaController implements ControllerListener {
native void nativeOnKeyEvent(KeyEvent keyEvent);
native void nativeOnMotionEvent(MotionEvent motionEvent);
native void nativeOnStateEvent(StateEvent stateEvent);
@Override // com.bda.controller.ControllerListener
public void onKeyEvent(KeyEvent keyEvent) {
nativeOnKeyEvent(keyEvent);
}
@Override // com.bda.controller.ControllerListener
public void onMotionEvent(MotionEvent motionEvent) {
nativeOnMotionEvent(motionEvent);
}
@Override // com.bda.controller.ControllerListener
public void onStateEvent(StateEvent stateEvent) {
nativeOnStateEvent(stateEvent);
}
}
@@ -0,0 +1,489 @@
package com.ea.ironmonkey;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Messenger;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.ea.games.nfs13_row.R;
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller;
import com.google.android.vending.expansion.downloader.Helpers;
import com.google.android.vending.expansion.downloader.IDownloaderClient;
import com.google.android.vending.expansion.downloader.IDownloaderService;
import com.google.android.vending.expansion.downloader.IStub;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/* loaded from: classes.dex */
public class ObbActivity extends Activity implements IDownloaderClient {
static final String LOGTAG = "ObbActivity";
static final int NOTIFICATION_ID = LOGTAG.hashCode();
public static String PACKAGE_NAME;
private View RLayout;
private Button mCancel;
private IStub mDownloaderClientStub;
private TextView mMessageText;
private View mMessageView;
private Button mOK;
private Button mPause;
private TextView mProgressText;
private TextView mProgressTextSmall;
private View mProgressView;
private IDownloaderService mRemoteService;
private boolean mShowingMessage;
private int mState;
Bundle m_savedInstanceState;
NotificationManager myNotificationManager;
private boolean isFirstTime3GCheck = true;
private boolean pausedFor3GCheck = false;
private ProgressBar mProgressBar = null;
private long m_TotalDownloadSize = 0;
private boolean mIsDownloading = false;
public ObbActivity mInstance = null;
private boolean mhasFocus = false;
private boolean ENABLE_LOG = true;
private final Runnable HideSystemKeys = new Runnable() { // from class: com.ea.ironmonkey.ObbActivity.6
@Override // java.lang.Runnable
@TargetApi(18)
public void run() {
if (ObbActivity.this.isAtLeastAPI(19)) {
ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(5894);
} else {
if (!ObbActivity.this.isAtLeastAPI(14) || (ObbActivity.this.getWindow().getDecorView().getSystemUiVisibility() & 1) == 1) {
return;
}
ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(1);
}
}
};
public void setUpNotification() {
}
public void startGameActivity() {
try {
startActivity(new Intent(this, (Class<?>) GameActivityMain.class));
finish();
} catch (Exception e) {
logError(e.toString());
}
}
private void log(String str) {
if (this.ENABLE_LOG) {
android.util.Log.d(LOGTAG, str);
}
}
private void logError(String str) {
if (this.ENABLE_LOG) {
android.util.Log.e(LOGTAG, str);
}
}
@Override // android.app.Activity
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
log("................onCreate of ObbActivity .............");
getWindow().setFlags(1024, 1024);
getWindow().addFlags(128);
this.mInstance = this;
setupUI();
checkAndDownloadFilesIfNeeded();
}
@Override // android.app.Activity
protected void onStart() {
log("obbactivity onStart called ");
super.onStart();
if (this.mDownloaderClientStub != null) {
this.mDownloaderClientStub.connect(this);
}
}
@Override // android.app.Activity
protected void onResume() {
super.onResume();
log("obbactivity onResume called ");
}
@Override // android.app.Activity
protected void onPause() {
super.onPause();
log("obbactivity on Pause called");
}
@Override // android.app.Activity
protected void onStop() {
log("obbactivity onStop called");
if (this.mDownloaderClientStub != null) {
log("..... disconnected the client stub .....");
this.mDownloaderClientStub.disconnect(this);
}
super.onStop();
}
@Override // android.app.Activity
protected void onDestroy() {
super.onDestroy();
log("obbactivity on Destroy called ");
}
private void doTerminate(String str) {
new AlertDialog.Builder(this.mInstance).setMessage(str).setPositiveButton("Ok", new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
ObbActivity.this.mInstance.finish();
System.exit(0);
}
}).show();
}
public void checkAndDownloadFilesIfNeeded() {
log("obbactivity checkAndDownloadFilesIfNeeded called ");
if (expansionFilesDelivered(true)) {
log("................Main.obb present and hence launching Game Activity................");
startGameActivity();
return;
}
log("................ Expansion files were not delivered ................");
this.mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, DownloaderService.class);
startDownload();
if (this.mIsDownloading) {
return;
}
startGameActivity();
}
public void setupUI() {
setContentView(R.layout.downloader);
this.mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
this.mProgressText = (TextView) findViewById(R.id.statusText);
this.mProgressTextSmall = (TextView) findViewById(R.id.progressText);
this.mMessageText = (TextView) findViewById(R.id.messageText);
this.mMessageView = findViewById(R.id.messageView);
this.mProgressView = findViewById(R.id.progressView);
this.mPause = (Button) findViewById(R.id.pauseButton);
this.mOK = (Button) findViewById(R.id.okButton);
this.mCancel = (Button) findViewById(R.id.cancelButton);
this.mOK.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (ObbActivity.this.mState == 9 || ObbActivity.this.mState == 8) {
ObbActivity.this.mRemoteService.setDownloadFlags(1);
}
if (ObbActivity.this.mRemoteService != null) {
ObbActivity.this.mRemoteService.requestContinueDownload();
}
}
});
this.mPause.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (ObbActivity.this.mRemoteService == null) {
return;
}
if (7 == ObbActivity.this.mState) {
ObbActivity.this.mRemoteService.requestContinueDownload();
ObbActivity.this.mPause.setText(R.string.downloader_Pause);
} else {
ObbActivity.this.mRemoteService.requestPauseDownload();
}
}
});
this.mCancel.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.4
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (ObbActivity.this.mRemoteService != null) {
ObbActivity.this.mRemoteService.requestAbortDownload();
}
ObbActivity.this.finish();
}
});
}
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
public void onDownloadProgress(DownloadProgressInfo downloadProgressInfo) {
log("Download Progress ...........!");
if (this.isFirstTime3GCheck) {
try {
if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) {
this.isFirstTime3GCheck = false;
if (this.mRemoteService != null) {
this.pausedFor3GCheck = true;
this.mRemoteService.requestPauseDownload();
showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit);
return;
}
}
} catch (Exception unused) {
logError(".............................error at 3G check.............................");
this.isFirstTime3GCheck = false;
this.pausedFor3GCheck = false;
}
}
if (this.m_TotalDownloadSize == 0) {
this.m_TotalDownloadSize = downloadProgressInfo.mOverallTotal / 1048576;
}
this.mProgressBar.setMax((int) (downloadProgressInfo.mOverallTotal >> 8));
this.mProgressBar.setProgress((int) (downloadProgressInfo.mOverallProgress >> 8));
this.mProgressTextSmall.setText((downloadProgressInfo.mOverallProgress / 1048576) + " MB/ " + this.m_TotalDownloadSize + " MB");
int parseInt = Integer.parseInt(Helpers.getDownloadProgressPercent(downloadProgressInfo.mOverallProgress, downloadProgressInfo.mOverallTotal).replaceAll("[\\D]", ""));
if (parseInt >= 0 && parseInt < 25) {
log("Download Progress 0 .. 25");
this.mProgressText.setText(R.string.text_0_24);
return;
}
if (parseInt >= 25 && parseInt < 50) {
log("Download Progress 25 .. 49");
this.mProgressText.setText(R.string.text_25_49);
return;
}
if (parseInt >= 50 && parseInt < 75) {
log("Download Progress 50 .. 75");
this.mProgressText.setText(R.string.text_50_74);
} else if (parseInt >= 75 && parseInt < 95) {
log("Download Progress 75 .. 95");
this.mProgressText.setText(R.string.text_75_99);
} else {
log("Download Progress 100 !");
this.mProgressText.setText(R.string.text_100);
}
}
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
public void onDownloadStateChanged(int i) {
if (this.mState != i) {
log("onDownloadStateChanged newstate = " + i);
this.mState = i;
this.mProgressText.setText(Helpers.getDownloaderStringResourceIDFromState(i));
boolean z = false;
switch (i) {
case 1:
log(".............................STATE_IDLE.............................");
hideMessage();
z = true;
this.mProgressBar.setIndeterminate(z);
break;
case 2:
case 3:
log(".............................STATE_CONNECTING/STATE_FETCHING_URL.............................");
hideMessage();
z = true;
this.mProgressBar.setIndeterminate(z);
break;
case 4:
log(".............................STATE_DOWNLOADING.............................");
hideMessage();
this.mProgressBar.setIndeterminate(z);
break;
case 5:
log(".............................STATE_COMPLETED.............................");
setUpNotification();
this.mProgressTextSmall.setText(this.m_TotalDownloadSize + "/" + this.m_TotalDownloadSize + " MBs");
this.mProgressText.setText(R.string.text_100);
this.mProgressBar.setMax(1);
this.mProgressBar.setProgress(1);
disablePauseButton();
hideMessage();
this.mIsDownloading = false;
startGameActivity();
break;
case 6:
case 10:
case 11:
case 13:
case 17:
default:
hideMessage();
z = true;
this.mProgressBar.setIndeterminate(z);
break;
case 7:
log(".............................STATE_PAUSED_BY_REQUEST.............................");
this.mPause.setText(R.string.downloader_Resume);
if (!this.pausedFor3GCheck) {
hideMessage();
} else {
this.pausedFor3GCheck = false;
}
this.mProgressBar.setIndeterminate(z);
break;
case 8:
case 9:
log(".............................STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION.............................");
try {
if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) {
this.isFirstTime3GCheck = false;
if (this.mRemoteService != null) {
showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit);
break;
}
} else {
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
}
} catch (Exception unused) {
this.isFirstTime3GCheck = false;
logError(".............................error at 3G check.............................");
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
}
this.mProgressBar.setIndeterminate(z);
break;
case 12:
case 14:
log("............................STATE_PAUSED_ROAMING/STATE_PAUSED_SDCARD_UNAVAILABLE..............................");
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
this.mProgressBar.setIndeterminate(z);
break;
case 15:
log(".............................License check failed.............................");
showMessage(getString(R.string.license_failed), R.string.downloader_Retry, R.string.downloader_Quit);
this.mProgressBar.setIndeterminate(z);
break;
case 16:
case 18:
case 19:
log(".............................STATE_FAILED.............................");
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
this.mProgressBar.setIndeterminate(z);
break;
}
}
}
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
public void onServiceConnected(Messenger messenger) {
this.mRemoteService = DownloaderServiceMarshaller.CreateProxy(messenger);
this.mRemoteService.onClientUpdated(this.mDownloaderClientStub.getMessenger());
log("............................. onServiceConnected! .............................");
}
boolean expansionFilesDelivered(boolean z) {
String expansionAPKFileName = Helpers.getExpansionAPKFileName(this, z, getVersionCode());
log("expansionFilesDelivered ... " + expansionAPKFileName + ".............................");
long j = 0;
try {
InputStream open = getResources().getAssets().open("obb.size");
if (open != null) {
try {
j = Long.parseLong(new BufferedReader(new InputStreamReader(open)).readLine());
} catch (NumberFormatException e) {
logError(e.getMessage());
}
open.close();
}
} catch (IOException e2) {
logError(e2.getMessage());
}
log("checking file " + expansionAPKFileName + " of expected size bytes " + Long.toString(j));
if (!Helpers.doesFileExist(this, expansionAPKFileName, j, false)) {
log("file " + expansionAPKFileName + "of expected size bytes " + j + "was NOT FOUND");
return false;
}
log("EXPANSION FILE DELIVERED!");
return true;
}
private void startDownload() {
try {
Intent intent = new Intent(this, (Class<?>) ObbActivity.class);
intent.setFlags(335544320);
if (DownloaderClientMarshaller.startDownloadServiceIfRequired(this, PendingIntent.getActivity(this, 0, intent, 134217728), (Class<?>) DownloaderService.class) != 0) {
log(".............................Should start downloading!.............................");
this.mIsDownloading = true;
setRequestedOrientation(0);
return;
}
log(".............................No download required!.............................");
} catch (PackageManager.NameNotFoundException e) {
logError(".............................Cannot find package " + e.toString());
}
}
public void showMessage(String str, int i, int i2) {
if (!this.mShowingMessage) {
this.mMessageView.setVisibility(0);
this.mProgressView.setVisibility(8);
log("SHOW MESSAGE " + str + " b1: " + i + " b2: " + i2);
this.mShowingMessage = true;
}
this.mMessageText.setText(str);
this.mOK.setText(i);
this.mCancel.setText(i2);
}
public void hideMessage() {
if (this.mShowingMessage) {
this.mMessageView.setVisibility(8);
this.mProgressView.setVisibility(0);
this.mShowingMessage = false;
}
}
public int getVersionCode() {
try {
return getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (PackageManager.NameNotFoundException unused) {
logError(".............................Cannot read value in manifest. Expected android:versionCode.............................");
return 0;
}
}
public void disablePauseButton() {
this.mPause.setClickable(false);
}
@TargetApi(18)
private void setupSystemUiVisibility() {
if (isAtLeastAPI(19)) {
getWindow().addFlags(33554432);
getWindow().addFlags(134217728);
}
if (isAtLeastAPI(14)) {
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { // from class: com.ea.ironmonkey.ObbActivity.5
@Override // android.view.View.OnSystemUiVisibilityChangeListener
public void onSystemUiVisibilityChange(int i) {
if (ObbActivity.this.mhasFocus) {
ObbActivity.this.onSystemUiVisibilityChanged();
}
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void onSystemUiVisibilityChanged() {
((LinearLayout) findViewById(R.id.OBBLayout)).postDelayed(this.HideSystemKeys, 1000L);
}
public boolean isAtLeastAPI(int i) {
return Build.VERSION.SDK_INT >= i;
}
@Override // android.app.Activity, android.view.Window.Callback
public void onWindowFocusChanged(boolean z) {
log("................onWindowFocusChanged to ............." + z);
super.onWindowFocusChanged(z);
this.mhasFocus = z;
if (this.mhasFocus) {
onSystemUiVisibilityChanged();
}
}
}
@@ -0,0 +1,14 @@
package com.ea.ironmonkey;
import android.content.Context;
import com.google.android.vending.expansion.downloader.Helpers;
/* loaded from: classes.dex */
class ObbHelper {
ObbHelper() {
}
public static String getObbFileName(Context context, int i) {
return Helpers.getExpansionAPKFileName(context, true, i);
}
}
@@ -0,0 +1,132 @@
package com.ea.ironmonkey;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.KeyEvent;
import com.ea.games.nfs13_row.R;
/* loaded from: classes.dex */
public class PermissionsActivity extends Activity {
private static final int PERMISSIONS_REQUEST = 3;
protected void onCreate() {
if (Build.VERSION.SDK_INT >= 23) {
checkPermissions();
} else {
initActivity();
}
}
public void checkPermissions() {
if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
showPermissionDialog(false);
return;
} else {
requestSecurityPermissions();
return;
}
}
initActivity();
return;
}
initActivity();
}
@Override // android.app.Activity
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i != 3) {
return;
}
if (iArr.length == 1 && iArr[0] == 0) {
initActivity();
} else {
showPermissionDialog(true);
}
}
private void showPermissionDialog(final boolean z) {
runOnUiThread(new Runnable() { // from class: com.ea.ironmonkey.PermissionsActivity.1
@Override // java.lang.Runnable
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.STR_PERMISSION_TEXT);
builder.setPositiveButton(R.string.STR_PERMISSION_OK, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
if (!z) {
PermissionsActivity.this.requestSecurityPermissions();
return;
}
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + PermissionsActivity.this.getPackageName()));
intent.addFlags(8388608);
PermissionsActivity.this.startActivityForResult(intent, 3);
}
});
builder.setNegativeButton(R.string.STR_PERMISSION_CANCEL, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.2
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
PermissionsActivity.this.finish();
}
});
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(false);
create.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.3
@Override // android.content.DialogInterface.OnKeyListener
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i != 4) {
return true;
}
PermissionsActivity.this.finish();
dialogInterface.dismiss();
return true;
}
});
create.show();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void requestSecurityPermissions() {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 3);
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
onCreate();
}
@Override // android.app.Activity
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 3) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
initActivity();
return;
} else {
showPermissionDialog(true);
return;
}
}
initActivity();
}
private void initActivity() {
try {
startActivity(new Intent(this, (Class<?>) ObbActivity.class));
finish();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,57 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
/* loaded from: classes.dex */
public class RunLoop {
public static final int STATE_RUNNING = 1;
public static final int STATE_STOPPED = 0;
private GLSurfaceView glSurfaceView;
private int state;
private native void nativeOnRunLoopTick();
public RunLoop(GLSurfaceView gLSurfaceView) {
this.glSurfaceView = gLSurfaceView;
updateRenderMode();
}
public int getState() {
return this.state;
}
public void start() {
setState(1);
}
public void stop() {
setState(0);
}
public void join() {
setState(0);
}
private void setState(int i) {
this.state = i;
updateRenderMode();
}
private void updateRenderMode() {
Log.v("RunLoop", "RunLoop.state = " + this.state);
switch (this.state) {
case 0:
this.glSurfaceView.setRenderMode(0);
break;
case 1:
this.glSurfaceView.setRenderMode(1);
break;
}
}
public void onRunLoopTick() {
if (this.state == 1) {
nativeOnRunLoopTick();
}
}
}
@@ -0,0 +1,8 @@
package com.ea.ironmonkey;
/* loaded from: classes.dex */
public class SkuConfig {
public static final String NA_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsPSqZyfa7iZ9DOslXqDVPiyjsIjCCCDsp1x4pcuH9gFiivyVWhIAHrfMdLlg+6UmlbUoSyKwNRUKJA+H5N/L792/PewpOe2yXSvsqtdROJ12O34q8DPC2D7ezL8M/Io3bp9x18u/D5lf2PEQq4uBNEV1W1iK3PtsdWdpmNKMvnPDQXT3vciWdKa1R0g2xRHCXEK2Ft1Tlkx38ejAAmYvpvoP2e8IqnlwH2fz89G5nxnKdmGop1mz4KTZ8REmBCnmTb07fRkSd4N7S64W2zu8lktMUUbGvCmRbt4zE48AzXEWmyHNW+mqx+IUKyK5wHObnDM9RSwKLWsDe++rrGgROQIDAQAB";
public static final String ROW_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjDe1oWKcLp/Rtm1ezKa9G+fHdqKvWExNR1aYuudU5VGX9gTby6w8UPKLHXeWxuOq2mS2hWxjIXVsOanspXWJbnBaqydpXmNz+0qZ0K6VlEiL7YvVL9KHNpVAck1bz4toLrmrjM6E/RyphBl+3W5+XSGOJ4Z3dabuz/TQdgNlYAr9nd1NlLg8S2Pu1FsFygy79kpwKBDZFUiCTDwzmGgLSetFnOfr0NwC+NnF/bEB6gE3REcdtT0zyFj0SR8ZWIKRvRPu5BYXe9nKguLN0AUvshXm/MjhrxKmRWTjTTKZkax+f3zFut/yq8UDxMwGA15Ex60xkCcELgCcNPBrWdFDtQIDAQAB";
public static final byte[] SALT = {13, -1, 23, -45, 11, -28, 56, -1, -14, 24, -12, 98, -13, 49, 11, 15, -27, 93, 86, -24};
}
@@ -0,0 +1,171 @@
package com.ea.ironmonkey;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes.dex */
public class SplashScreen {
private static final String TAG = "SplashScreen";
private static final int floatSize = 4;
private Activity _activity;
private int _attPosition;
private int _attSampler;
private int _attTexCoord;
private int _fragmentShader;
private int _program;
private int _vertexShader;
private FloatBuffer vBuffer;
private final String vShaderStr = "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n";
private final String fShaderStr = "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n";
private int[] _textureId = new int[1];
public SplashScreen(Activity activity) {
this._activity = activity;
}
public void init(GL10 gl10, int i, int i2) {
Bitmap bitmap;
if (!initRenderer()) {
destroy(gl10);
return;
}
GLES20.glGetError();
GLES20.glGenTextures(1, this._textureId, 0);
GLES20.glBindTexture(3553, this._textureId[0]);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
try {
bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options);
} catch (Exception e) {
Log.e(TAG, "loadBitmap ", e);
bitmap = null;
}
GLUtils.texImage2D(3553, 0, bitmap, 0);
GLES20.glTexParameterf(3553, 10241, 9729.0f);
GLES20.glTexParameterf(3553, 10240, 9729.0f);
GLES20.glTexParameterf(3553, 10242, 33071.0f);
GLES20.glTexParameterf(3553, 10243, 33071.0f);
bitmap.recycle();
int glGetError = GLES20.glGetError();
if (glGetError != 0) {
Log.e(TAG, "Texture Load GLError: " + glGetError);
destroy(gl10);
}
}
private boolean initRenderer() {
this._vertexShader = LoadShader(35633, "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n");
this._fragmentShader = LoadShader(35632, "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n");
this._program = GLES20.glCreateProgram();
if (this._program == 0 || this._vertexShader == 0 || this._fragmentShader == 0) {
Log.e(TAG, "InitRender() - fail\n");
return false;
}
GLES20.glAttachShader(this._program, this._vertexShader);
GLES20.glAttachShader(this._program, this._fragmentShader);
GLES20.glLinkProgram(this._program);
int[] iArr = new int[1];
GLES20.glGetProgramiv(this._program, 35714, iArr, 0);
if (iArr[0] == 0) {
Log.e(TAG, "InitRender() - fail link program");
Log.e(TAG, GLES20.glGetProgramInfoLog(this._program));
GLES20.glDeleteProgram(this._program);
this._program = 0;
return false;
}
this._attPosition = GLES20.glGetAttribLocation(this._program, "a_position");
this._attTexCoord = GLES20.glGetAttribLocation(this._program, "a_texCoord");
this._attSampler = GLES20.glGetAttribLocation(this._program, "s_texture");
return true;
}
private int LoadShader(int i, String str) {
int glCreateShader = GLES20.glCreateShader(i);
if (glCreateShader == 0) {
Log.e(TAG, "LoadShader(" + i + ", " + str + " - create shader fail\n");
return 0;
}
GLES20.glShaderSource(glCreateShader, str);
GLES20.glCompileShader(glCreateShader);
int[] iArr = new int[1];
GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0);
if (iArr[0] != 0) {
return glCreateShader;
}
Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n");
GLES20.glDeleteShader(glCreateShader);
Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader));
return 0;
}
public boolean draw(GL10 gl10, int i, int i2) {
float f;
if (this._textureId[0] == 0) {
return false;
}
float f2 = 0.8f;
if (i > i2) {
f2 = (i2 / i) * 0.8f;
f = 0.8f;
} else {
f = (i / i2) * 0.8f;
}
float f3 = -f2;
float f4 = -f;
float[][] fArr = {new float[]{f3, f4, 0.0f, 1.0f, f2, f4, 1.0f, 1.0f, f3, f, 0.0f, 0.0f, f2, f, 1.0f, 0.0f}, new float[]{f3, f4, 1.0f, 1.0f, f2, f4, 1.0f, 0.0f, f3, f, 0.0f, 1.0f, f2, f, 0.0f, 0.0f}};
this.vBuffer = ByteBuffer.allocateDirect(fArr[0].length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
if (i < i2) {
this.vBuffer.put(fArr[1]);
} else {
this.vBuffer.put(fArr[0]);
}
GLES20.glViewport(0, 0, i, i2);
GLES20.glUseProgram(this._program);
GLES20.glEnable(3553);
GLES20.glActiveTexture(33984);
GLES20.glBindTexture(3553, this._textureId[0]);
GLES20.glUniform1i(this._attSampler, 0);
this.vBuffer.position(0);
GLES20.glVertexAttribPointer(this._attPosition, 2, 5126, false, 16, (Buffer) this.vBuffer);
GLES20.glEnableVertexAttribArray(this._attPosition);
this.vBuffer.position(2);
GLES20.glVertexAttribPointer(this._attTexCoord, 2, 5126, false, 16, (Buffer) this.vBuffer);
GLES20.glEnableVertexAttribArray(this._attTexCoord);
GLES20.glDrawArrays(5, 0, 4);
GLES20.glDisableVertexAttribArray(this._attPosition);
GLES20.glDisableVertexAttribArray(this._attTexCoord);
GLES20.glUseProgram(0);
return true;
}
public void destroy(GL10 gl10) {
if (this._textureId[0] != 0) {
GLES20.glDeleteTextures(1, this._textureId, 0);
this._textureId[0] = 0;
}
if (this._program != 0) {
GLES20.glDeleteProgram(this._program);
this._program = 0;
}
if (this._vertexShader != 0) {
GLES20.glDeleteShader(this._vertexShader);
this._vertexShader = 0;
}
if (this._fragmentShader != 0) {
GLES20.glDeleteShader(this._fragmentShader);
this._fragmentShader = 0;
}
if (this.vBuffer != null) {
this.vBuffer.clear();
this.vBuffer = null;
}
}
}
@@ -0,0 +1,149 @@
package com.ea.ironmonkey;
import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.ea.games.nfs13_row.R;
import java.util.Locale;
/* loaded from: classes.dex */
public class WebActivity extends Activity {
public static String m_Language;
private static volatile Runnable m_RunnableBuildAndShowHTML;
public static String m_URL;
public static boolean m_bWorkingState;
private Bitmap backButton;
private Bitmap backButtonPressed;
private ImageView backImage;
private String m_PageURL = null;
private ProgressBar m_progressBar = null;
final Handler progressHandler = new Handler() { // from class: com.ea.ironmonkey.WebActivity.1
@Override // android.os.Handler
public void handleMessage(Message message) {
WebActivity.this.setProgress(message.arg1);
WebActivity.this.m_progressBar.setProgress(message.arg1);
}
};
private WebView webview;
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
m_bWorkingState = true;
super.onCreate(bundle);
requestWindowFeature(2);
getWindow().setFlags(1024, 1024);
setRequestedOrientation(0);
requestWindowFeature(1);
setProgressBarVisibility(true);
setContentView(R.layout.webview);
this.webview = (WebView) findViewById(R.id.mainWebView);
this.webview.getSettings().setJavaScriptEnabled(true);
this.m_progressBar = (ProgressBar) findViewById(R.id.progressBarWeb);
this.backButton = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back);
this.backButtonPressed = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back_pressed);
this.backImage = (ImageView) findViewById(R.id.backButton);
this.backImage.setOnTouchListener(new View.OnTouchListener() { // from class: com.ea.ironmonkey.WebActivity.2
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == 0) {
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButtonPressed);
return false;
}
if (motionEvent.getAction() != 1) {
return false;
}
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButton);
return false;
}
});
this.backImage.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.WebActivity.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
WebActivity.m_bWorkingState = false;
WebActivity.this.finish();
}
});
Bundle extras = getIntent().getExtras();
String string = extras.getString("URL");
this.m_PageURL = string;
m_URL = string;
String string2 = extras.getString("Language");
m_Language = string2;
if (string2 != null) {
try {
Configuration configuration = new Configuration(getResources().getConfiguration());
configuration.locale = new Locale(string2);
((TextView) findViewById(R.id.appName)).setText(new Resources(getResources().getAssets(), getResources().getDisplayMetrics(), configuration).getString(R.string.app_full_name));
} catch (Throwable unused) {
}
}
this.webview.setWebChromeClient(new WebChromeClient() { // from class: com.ea.ironmonkey.WebActivity.4
@Override // android.webkit.WebChromeClient
public void onProgressChanged(WebView webView, int i) {
Message obtainMessage = WebActivity.this.progressHandler.obtainMessage();
obtainMessage.arg1 = i;
WebActivity.this.progressHandler.sendMessage(obtainMessage);
}
});
this.webview.setWebViewClient(new WebViewClient() { // from class: com.ea.ironmonkey.WebActivity.5
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
WebActivity.this.m_progressBar.setVisibility(8);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
Toast.makeText(WebActivity.this, "Error ! " + str, 0).show();
}
});
m_RunnableBuildAndShowHTML = new Runnable() { // from class: com.ea.ironmonkey.WebActivity.6
@Override // java.lang.Runnable
public void run() {
WebActivity.this.BuildAndShowHTML();
}
};
runOnUiThread(m_RunnableBuildAndShowHTML);
}
/* JADX INFO: Access modifiers changed from: private */
public void BuildAndShowHTML() {
if (this.m_PageURL != null) {
this.webview.loadUrl(this.m_PageURL);
}
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i == 4) {
this.backImage.setImageBitmap(this.backButtonPressed);
return true;
}
return super.onKeyDown(i, keyEvent);
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyUp(int i, KeyEvent keyEvent) {
if (i == 4) {
this.backImage.setImageBitmap(this.backButton);
m_bWorkingState = false;
finish();
return true;
}
return super.onKeyUp(i, keyEvent);
}
}
@@ -0,0 +1,44 @@
package com.ea.nimble;
import android.app.Activity;
/* loaded from: classes.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_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_MODEL = "deviceModel";
public static final String NIMBLE_PARAMETER_FB_ATTR_ID = "fbAttrId";
public static final String NIMBLE_PARAMETER_GAID = "gaid";
public static final String NIMBLE_PARAMETER_IMEI = "imei";
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
@@ -0,0 +1,71 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes.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();
}
}
@@ -0,0 +1,395 @@
package com.ea.nimble;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import com.ea.nimble.IApplicationLifecycle;
import com.ea.nimble.Log;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
class ApplicationLifecycleImpl extends Component implements IApplicationLifecycle, LogSource {
private static final boolean RESTART_ON_CONFIG_CHANGE;
private BaseCore m_core;
private State m_state = State.INIT;
private int m_createdActivityCount = 0;
private int m_runningActivityCount = 0;
private ArrayList<IApplicationLifecycle.ActivityLifecycleCallbacks> m_activityLifecycleCallbacks = new ArrayList<>();
private ArrayList<IApplicationLifecycle.ActivityEventCallbacks> m_activityEventCallbacks = new ArrayList<>();
private ArrayList<IApplicationLifecycle.ApplicationLifecycleCallbacks> m_applicationLifecycleCallbacks = new ArrayList<>();
private 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";
}
static {
RESTART_ON_CONFIG_CHANGE = Build.VERSION.SDK_INT < 11;
}
ApplicationLifecycleImpl(BaseCore baseCore) {
this.m_core = baseCore;
}
@Override // com.ea.nimble.Component
protected 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());
if (this.m_state == State.INIT || this.m_state == State.QUIT) {
Log.Helper.LOGD(this, "Activity created clearly with state %s", this.m_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;
if (this.m_runningActivityCount != 0) {
Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount));
this.m_runningActivityCount = 0;
}
} else if (this.m_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]);
}
if (RESTART_ON_CONFIG_CHANGE) {
this.m_core.onApplicationResume();
}
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it2 = this.m_activityLifecycleCallbacks.iterator();
while (it2.hasNext()) {
it2.next().onActivityCreated(activity, bundle);
}
if (this.m_runningActivityCount != 0) {
Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount));
this.m_runningActivityCount = 0;
}
} else if (this.m_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 (this.m_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++;
if (this.m_runningActivityCount != 0) {
Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount));
this.m_runningActivityCount = 0;
}
} else {
Log.Helper.LOGE(this, "Activity created with %s state, shouldn't happen", this.m_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);
if (this.m_state == State.PAUSE) {
Log.Helper.LOGD(this, "Activity restart from PAUSE, normal activity switch", new Object[0]);
} else if (this.m_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", this.m_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);
if (this.m_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 (this.m_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 (this.m_state == State.CONFIG_CHANGE) {
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> it2 = this.m_activityLifecycleCallbacks.iterator();
while (it2.hasNext()) {
it2.next().onActivityStarted(activity);
}
if (RESTART_ON_CONFIG_CHANGE) {
notifyApplicationResume(activity.getIntent());
}
this.m_state = State.PAUSE;
Log.Helper.LOGD(this, "Activity start with CONFIG_CHANGE state, set to PAUSE", new Object[0]);
} else if (this.m_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);
}
if (this.m_state != State.PAUSE) {
Log.Helper.LOGE(this, "Activity resume on invalid state %s", this.m_state.toString());
Log.Helper.LOGE(this, "<NOTE>Please double check if the game's activity hooks ApplicationLifecycle.onActivityRestart() correctly.", new Object[0]);
}
this.m_state = State.RUN;
Log.Helper.LOGV(this, "State after resume %s (%d, %d)", this.m_state.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());
}
this.m_state = State.PAUSE;
Log.Helper.LOGV(this, "State after pause %s (%d, %d)", this.m_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 (!RESTART_ON_CONFIG_CHANGE && activity.isChangingConfigurations()) {
this.m_state = State.CONFIG_CHANGE;
} else if (this.m_runningActivityCount == 0) {
if (this.m_state != State.PAUSE && this.m_state != State.SUSPEND) {
Log.Helper.LOGW(this, "Interesting case %s, HIGHLIGHT!!", this.m_state);
}
this.m_state = State.SUSPEND;
if (!activity.isFinishing()) {
notifyApplicationSuspend();
this.m_core.onApplicationSuspend();
}
} else if (this.m_state == 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 (this.m_state != State.RUN) {
Log.Helper.LOGE(this, "Activity stop on invalid state %s", this.m_state.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);
}
if (this.m_state != State.CONFIG_CHANGE) {
if (this.m_state != State.SUSPEND && this.m_state != State.RUN) {
Log.Helper.LOGE(this, "Activity destroy on invalid state %s", this.m_state.toString());
}
this.m_createdActivityCount--;
if (this.m_createdActivityCount == 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);
if (RESTART_ON_CONFIG_CHANGE) {
if (this.m_state != State.SUSPEND) {
Log.Helper.LOGW(this, "configuration change should happen between onStop() and onDestroy(), but state is %s", this.m_state.toString());
}
this.m_state = State.CONFIG_CHANGE;
}
}
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();
}
}
}
@@ -0,0 +1,72 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public class BackgroundNetworkConnection extends NetworkConnection {
@Override // com.ea.nimble.NetworkConnection
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);
}
}
+52
View File
@@ -0,0 +1,52 @@
package com.ea.nimble;
import com.ea.nimble.Log;
/* loaded from: classes.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);
}
}
}
@@ -0,0 +1,422 @@
package com.ea.nimble;
import android.content.Intent;
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 java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/* loaded from: classes.dex */
class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
public static final String NIMBLE_COMPONENT_LIST = "setting::components";
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.NimbleTrackingS2SComponent", "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;
private enum State {
INACTIVE,
AUTO_SETUP,
MANUAL_SETUP,
MANUAL_TEARDOWN,
QUITTING,
DESTROY,
FAKE_DESTROY
}
BaseCore() {
}
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);
this.m_log = (LogImpl) Log.getComponent();
this.m_log.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("initialize", 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();
}
}
try {
if (!isAppSigned(ApplicationEnvironment.getComponent().getApplicationContext())) {
android.util.Log.e(Global.NIMBLE_ID, "This application is NOT signed with a valid certificate. MTX may not work correctly with this application");
} else {
android.util.Log.i(Global.NIMBLE_ID, "This application is signed with a valid certificate.");
}
} catch (Exception e2) {
android.util.Log.e(Global.NIMBLE_ID, String.format("Unable to verify application signature. Message: %s", e2.getMessage()));
}
}
public NimbleConfiguration getConfiguration() {
return this.m_configuration;
}
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 ComponentManager getComponentManager() {
return this.m_componentManager;
}
public ILog getLog() {
return this.m_log;
}
public IApplicationEnvironment getApplicationEnvironment() {
return this.m_applicationEnvironment;
}
public IApplicationLifecycle getApplicationLifecycle() {
return this.m_applicationLifecycle;
}
public IPersistenceService getPersistenceService() {
return this.m_persistenceService;
}
public static synchronized BaseCore getInstance() {
BaseCore baseCore;
synchronized (BaseCore.class) {
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.");
}
android.util.Log.d(Global.NIMBLE_ID, String.format("NIMBLE VERSION %s (Build %s)", Global.NIMBLE_RELEASE_VERSION, Global.NIMBLE_SDK_VERSION));
s_core = new BaseCore();
s_core.initialize();
}
baseCore = s_core;
}
return baseCore;
}
public BaseCore activeValidate() {
Log.Helper.LOGPUBLICFUNC(this);
switch (this.m_state) {
case INACTIVE:
Log.Helper.LOGF(this, "Access NimbleBaseCore before setup, call setupNimble() explicitly to activate it.", new Object[0]);
return null;
case MANUAL_TEARDOWN:
Log.Helper.LOGF(this, "Access NimbleBaseCore after clean up, call setupNimble() explicitly again to activate it.", new Object[0]);
return null;
case DESTROY:
Log.Helper.LOGF(this, "Accessing component after destroy, only static components are available right now.", new Object[0]);
return null;
default:
return this;
}
}
public void setup() {
Log.Helper.LOGPUBLICFUNC(this);
switch (this.m_state) {
case INACTIVE:
case MANUAL_TEARDOWN:
this.m_componentManager.setup();
this.m_state = State.MANUAL_SETUP;
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED);
this.m_componentManager.restore();
break;
case DESTROY:
case MANUAL_SETUP:
case QUITTING:
case FAKE_DESTROY:
Log.Helper.LOGF(this, "Multiple setupNimble() calls without teardownNimble().", new Object[0]);
break;
case AUTO_SETUP:
this.m_state = State.MANUAL_SETUP;
break;
}
}
public void teardown() {
Log.Helper.LOGPUBLICFUNC(this);
switch (this.m_state) {
case INACTIVE:
case AUTO_SETUP:
Log.Helper.LOGF(this, "Cannot teardownNimble() before setupNimble().", new Object[0]);
break;
case MANUAL_TEARDOWN:
case DESTROY:
Log.Helper.LOGF(this, "Multiple teardownNimble() calls without setupNibmle().", new Object[0]);
break;
case MANUAL_SETUP:
this.m_componentManager.cleanup();
this.m_state = State.MANUAL_TEARDOWN;
this.m_componentManager.teardown();
break;
case QUITTING:
case FAKE_DESTROY:
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.this.m_configuration = nimbleConfiguration;
BaseCore.this.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) {
if (this.m_state == State.INACTIVE || this.m_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 (this.m_state == State.FAKE_DESTROY) {
this.m_componentManager.resume();
this.m_state = State.AUTO_SETUP;
} else if (this.m_state == State.QUITTING) {
this.m_componentManager.resume();
this.m_state = State.MANUAL_SETUP;
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationSuspend() {
if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) {
this.m_componentManager.suspend();
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationResume() {
if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) {
this.m_componentManager.resume();
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
public void onApplicationQuit() {
switch (this.m_state) {
case INACTIVE:
Log.Helper.LOGF(this, "No app start before app quit, something must be wrong.", new Object[0]);
break;
case DESTROY:
case QUITTING:
Log.Helper.LOGF(this, "Double app quit, something must be wrong.", new Object[0]);
break;
case AUTO_SETUP:
this.m_componentManager.suspend();
this.m_state = State.FAKE_DESTROY;
break;
case MANUAL_SETUP:
this.m_componentManager.suspend();
this.m_state = State.QUITTING;
break;
}
}
protected 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)) {
this.m_configuration = NimbleConfiguration.fromName(configValueAsString);
if (this.m_configuration != NimbleConfiguration.UNKNOWN && this.m_configuration != 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: Removed duplicated region for block: B:18:0x0067 A[ORIG_RETURN, RETURN] */
/* JADX WARN: Removed duplicated region for block: B:19:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private boolean isAppSigned(android.content.Context r9) {
/*
r8 = this;
javax.security.auth.x500.X500Principal r0 = new javax.security.auth.x500.X500Principal
java.lang.String r1 = "CN=Android Debug,O=Android,C=US"
r0.<init>(r1)
r1 = 0
android.content.pm.PackageManager r2 = r9.getPackageManager() // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
if (r2 != 0) goto L16
java.lang.String r9 = "Could not get Package Manager"
java.lang.Object[] r0 = new java.lang.Object[r1] // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
com.ea.nimble.Log.Helper.LOGE(r8, r9, r0) // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
return r1
L16:
java.lang.String r9 = r9.getPackageName() // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
r3 = 64
android.content.pm.PackageInfo r9 = r2.getPackageInfo(r9, r3) // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
android.content.pm.Signature[] r9 = r9.signatures // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
int r2 = r9.length // Catch: java.lang.Exception -> L54 java.security.cert.CertificateException -> L5a android.content.pm.PackageManager.NameNotFoundException -> L60
r3 = 0
r4 = 0
L25:
if (r3 >= r2) goto L65
r5 = r9[r3] // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
java.lang.String r6 = "X.509"
java.security.cert.CertificateFactory r6 = java.security.cert.CertificateFactory.getInstance(r6) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
java.io.ByteArrayInputStream r7 = new java.io.ByteArrayInputStream // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
byte[] r5 = r5.toByteArray() // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
r7.<init>(r5) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
java.security.cert.Certificate r5 = r6.generateCertificate(r7) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
java.security.cert.X509Certificate r5 = (java.security.cert.X509Certificate) r5 // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
javax.security.auth.x500.X500Principal r5 = r5.getSubjectX500Principal() // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
boolean r5 = r5.equals(r0) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52
if (r5 == 0) goto L4a
r4 = r5
goto L65
L4a:
int r3 = r3 + 1
r4 = r5
goto L25
L4e:
r9 = move-exception
goto L56
L50:
r9 = move-exception
goto L5c
L52:
r9 = move-exception
goto L62
L54:
r9 = move-exception
r4 = 0
L56:
r9.printStackTrace()
goto L65
L5a:
r9 = move-exception
r4 = 0
L5c:
r9.printStackTrace()
goto L65
L60:
r9 = move-exception
r4 = 0
L62:
r9.printStackTrace()
L65:
if (r4 != 0) goto L68
r1 = 1
L68:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.BaseCore.isAppSigned(android.content.Context):boolean");
}
public boolean isActive() {
Log.Helper.LOGPUBLICFUNCS("BaseCore");
return this.m_state == State.AUTO_SETUP || this.m_state == State.MANUAL_SETUP;
}
}
@@ -0,0 +1,284 @@
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: classes.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 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 InputStream getInputStream() {
return this.m_input;
}
public OutputStream getOutputStream() {
return this.m_output;
}
public void clear() {
this.m_closed = false;
this.m_availableSegment = 0;
this.m_writePosition = 0;
this.m_readPosition = 0;
}
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;
}
protected class ByteBufferInputStream extends InputStream {
@Override // java.io.InputStream
public boolean markSupported() {
return false;
}
protected ByteBufferInputStream() {
}
@Override // java.io.InputStream
public int available() throws IOException {
if (ByteBufferIOStream.this.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
return ((ByteBufferIOStream.this.m_availableSegment * 4096) + ByteBufferIOStream.this.m_writePosition) - ByteBufferIOStream.this.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 b = ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_readPosition];
ByteBufferIOStream.this.m_readPosition++;
if (ByteBufferIOStream.this.m_readPosition >= 4096) {
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
ByteBufferIOStream.this.m_readPosition = 0;
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
byteBufferIOStream.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;
}
int i3 = 4096 - ByteBufferIOStream.this.m_readPosition;
if (i2 < i3) {
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i2);
ByteBufferIOStream.this.m_readPosition += i2;
} else {
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i3);
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
int i4 = i2 - i3;
int i5 = i + i3;
int i6 = i4 / 4096;
int i7 = i4;
int i8 = i5;
for (int i9 = 0; i9 < i6; i9++) {
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i8, 4096);
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
i7 -= 4096;
i8 += 4096;
}
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i8, i7);
ByteBufferIOStream.this.m_readPosition = i7;
ByteBufferIOStream.this.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;
int i2 = 4096 - ByteBufferIOStream.this.m_readPosition;
if (i < i2) {
ByteBufferIOStream.this.m_readPosition += i;
} else {
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
int i3 = i - i2;
int i4 = i3 / 4096;
for (int i5 = 0; i5 < i4; i5++) {
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
i3 -= 4096;
}
ByteBufferIOStream.this.m_readPosition = i3;
ByteBufferIOStream.this.m_availableSegment -= i4 + 1;
}
return j;
}
}
protected class ByteBufferOutputStream extends OutputStream {
protected 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.");
}
if (ByteBufferIOStream.this.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
int i3 = 4096 - ByteBufferIOStream.this.m_writePosition;
Iterator<byte[]> it = ByteBufferIOStream.this.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.this.m_availableSegment++;
ByteBufferIOStream.this.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 {
if (ByteBufferIOStream.this.m_closed) {
throw new IOException("ByteBufferIOStream is closed");
}
ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_writePosition] = (byte) i;
ByteBufferIOStream.this.m_writePosition++;
if (ByteBufferIOStream.this.m_writePosition == 4096) {
ByteBufferIOStream.this.m_writePosition = 0;
ByteBufferIOStream.this.m_availableSegment++;
}
}
}
protected void closeIOStream() {
this.m_closed = true;
}
}
@@ -0,0 +1,24 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public abstract class Component {
protected void cleanup() {
}
public abstract String getComponentId();
protected void restore() {
}
protected void resume() {
}
protected void setup() {
}
protected void suspend() {
}
protected void teardown() {
}
}
@@ -0,0 +1,134 @@
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: classes.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";
}
ComponentManager() {
}
public Stage getStage() {
return this.m_stage;
}
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);
if (this.m_stage.compareTo(Stage.SETUP) < 0) {
return;
}
if (component2 != null) {
if (this.m_stage.compareTo(Stage.SETUP) >= 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();
}
}
}
Component getComponent(String str) {
return this.m_components.get(str);
}
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()]);
}
void setup() {
this.m_stage = Stage.SETUP;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().setup();
}
}
void restore() {
this.m_stage = Stage.READY;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().restore();
}
}
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();
}
}
void resume() {
this.m_stage = Stage.READY;
Iterator<Component> it = this.m_components.values().iterator();
while (it.hasNext()) {
it.next().resume();
}
}
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();
}
}
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();
}
}
}
@@ -0,0 +1,159 @@
package com.ea.nimble;
import android.content.Context;
import com.ea.nimble.Log;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class EASPDataLoader {
public static class LogEvent {
public int m_EAUID;
public long m_dateTimeInNanoseconds;
public int m_indexInsideSession;
public int m_keyType01;
public int m_keyType02;
public int m_keyType03;
public String m_randomPart;
public long m_timestamp;
public int m_type;
public int m_userLevel;
public String m_value01;
public String m_value02;
public String m_value03;
}
public static class EASPDataBuffer {
public ByteBuffer m_decryptedByteBuffer;
public String m_version;
public EASPDataBuffer(String str, ByteBuffer byteBuffer) {
this.m_version = str;
this.m_decryptedByteBuffer = byteBuffer;
}
}
public static String readString(ByteBuffer byteBuffer) throws IOException {
String str;
int i = byteBuffer.getInt();
if (i <= 0) {
return null;
}
if (i > byteBuffer.remaining()) {
Log.Helper.LOGES("Legacy", "String length greater than buffer remaining bytes.", new Object[0]);
throw new IOException("String length uint32 corrupt, longer than remaining bytes.");
}
byte[] bArr = new byte[i];
byteBuffer.get(bArr, 0, i);
try {
str = new String(bArr, HTTP.UTF_8);
try {
Log.Helper.LOGDS("Legacy", "Read string (%s)", str);
} catch (Exception e) {
e = e;
Log.Helper.LOGES("Legacy", "Read string exception: " + e, new Object[0]);
return str;
}
} catch (Exception e2) {
e = e2;
str = null;
}
return str;
}
public static boolean readBooleanByte(ByteBuffer byteBuffer) {
return byteBuffer.get() != 0;
}
public static LogEvent readLogEvent(ByteBuffer byteBuffer) throws IOException {
LogEvent logEvent = new LogEvent();
try {
if (!readBooleanByte(byteBuffer)) {
return null;
}
logEvent.m_type = byteBuffer.getInt();
logEvent.m_indexInsideSession = byteBuffer.getInt();
logEvent.m_dateTimeInNanoseconds = byteBuffer.getLong();
logEvent.m_EAUID = byteBuffer.getInt();
logEvent.m_randomPart = readString(byteBuffer);
logEvent.m_keyType01 = byteBuffer.getInt();
logEvent.m_value01 = readString(byteBuffer);
logEvent.m_keyType02 = byteBuffer.getInt();
logEvent.m_value02 = readString(byteBuffer);
logEvent.m_timestamp = byteBuffer.getLong();
logEvent.m_keyType03 = byteBuffer.getInt();
logEvent.m_value03 = readString(byteBuffer);
logEvent.m_userLevel = byteBuffer.getInt();
return logEvent;
} catch (IOException e) {
Log.Helper.LOGES("Legacy", "Exception reading LogEvent: " + e, new Object[0]);
throw e;
}
}
public static boolean deleteDatFile(String str) {
File file = new File(str);
if (file.exists()) {
return file.delete();
}
return true;
}
/* JADX WARN: Removed duplicated region for block: B:38:0x00e8 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:44:? A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:45:0x00d7 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static com.ea.nimble.EASPDataLoader.EASPDataBuffer loadDatFile(java.lang.String r12) throws java.lang.Exception {
/*
Method dump skipped, instructions count: 342
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.EASPDataLoader.loadDatFile(java.lang.String):com.ea.nimble.EASPDataLoader$EASPDataBuffer");
}
public static String getTrackingDatFilePath() {
String path;
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
if (applicationContext == null) {
path = System.getProperty("user.dir") + File.separator + "doc";
} else {
File filesDir = applicationContext.getFilesDir();
if (filesDir != null) {
path = filesDir.getPath();
} else {
Log.Helper.LOGES("Legacy", "Could not get Android files directory", new Object[0]);
return null;
}
}
return path + File.separator + "EASP" + File.separator + "Tracking" + File.separator + "tracking.dat";
}
public static String loadEADeviceId() {
File filesDir = ApplicationEnvironment.getComponent().getApplicationContext().getFilesDir();
try {
if (filesDir == null) {
throw new Exception();
}
EASPDataBuffer loadDatFile = loadDatFile(filesDir.getPath() + "/EASP/commoninfo.dat");
if (!loadDatFile.m_version.equals("1.00.02")) {
return null;
}
ByteBuffer byteBuffer = loadDatFile.m_decryptedByteBuffer;
readString(byteBuffer);
readBooleanByte(byteBuffer);
return readString(byteBuffer);
} catch (FileNotFoundException unused) {
return null;
} catch (Exception e) {
Log.Helper.LOGES("Legacy", "Exception when trying to load EASP data: %s", e);
return null;
}
}
}
@@ -0,0 +1,80 @@
package com.ea.nimble;
import android.annotation.SuppressLint;
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.security.Provider;
import java.security.Security;
import java.util.Iterator;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
/* loaded from: classes.dex */
class Encryptor {
private static int ENCRYPTION_KEY_LENGHT = 128;
private static int ENCRYPTION_KEY_ROUND = 997;
private Cipher m_encryptor = null;
private Cipher m_decryptor = null;
@SuppressLint({"NewApi"})
private void initialize() throws GeneralSecurityException {
for (Provider provider : Security.getProviders()) {
Log.Helper.LOGIS(null, "Cryptor Provider: " + provider.getName(), new Object[0]);
Iterator<Provider.Service> it = provider.getServices().iterator();
while (it.hasNext()) {
Log.Helper.LOGIS(null, "Cryptor Algorithm: " + it.next().getAlgorithm(), new Object[0]);
}
}
try {
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 < bArr.length) {
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_LENGHT));
PBEParameterSpec pBEParameterSpec = new PBEParameterSpec(bArr, ENCRYPTION_KEY_ROUND);
this.m_encryptor = Cipher.getInstance("PBEWithMD5AndDES");
this.m_encryptor.init(1, generateSecret, pBEParameterSpec);
this.m_decryptor = Cipher.getInstance("PBEWithMD5AndDES");
this.m_decryptor.init(2, generateSecret, pBEParameterSpec);
} catch (GeneralSecurityException e) {
Log.Helper.LOGFS(null, "Can't initialize Encryptor: " + e.toString(), new Object[0]);
throw e;
}
}
public ObjectInputStream encryptInputStream(InputStream inputStream) throws IOException, GeneralSecurityException {
Log.Helper.LOGFUNC(this);
if (this.m_encryptor == null || this.m_decryptor == null) {
initialize();
}
return new ObjectInputStream(new CipherInputStream(inputStream, this.m_decryptor));
}
public ObjectOutputStream encryptOutputStream(OutputStream outputStream) throws IOException, GeneralSecurityException {
Log.Helper.LOGFUNC(this);
if (this.m_encryptor == null || this.m_decryptor == null) {
initialize();
}
return new ObjectOutputStream(new CipherOutputStream(outputStream, this.m_encryptor));
}
}
@@ -0,0 +1,294 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
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: classes.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";
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyEnv";
}
@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);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.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);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("productId");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getEAHardwareId() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("hwId");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientId() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("clientId");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getNexusClientSecret() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) {
return null;
}
return (String) this.m_getDirectionResponseDictionary.get("clientSecret");
}
@Override // com.ea.nimble.ISynergyEnvironment
public String getGosMdmAppKey() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.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);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.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;
}
switch (parseInt) {
case 0:
default:
return 0;
case 1:
return 1;
case 2:
return 2;
}
}
@Override // com.ea.nimble.ISynergyEnvironment
public int getTrackingPostInterval() {
Integer num;
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty() || (num = (Integer) this.m_getDirectionResponseDictionary.get("telemetryFreq")) == null) {
return -1;
}
return num.intValue();
}
Map<String, Object> getGetDirectionResponseDictionary() {
return this.m_getDirectionResponseDictionary;
}
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("productId", ((Integer) map.get("productId")).toString());
map.put("hwId", ((Integer) map.get("hwId")).toString());
this.m_getDirectionResponseDictionary = map;
return;
}
this.m_getDirectionResponseDictionary = new HashMap();
}
Map<String, String> getServerUrls() {
return this.m_serverUrls;
}
void setServerUrls(Map<String, String> map) {
Log.Helper.LOGFUNC(this);
this.m_serverUrls = map;
}
void setEADeviceId(String str) {
Log.Helper.LOGFUNC(this);
this.m_eaDeviceId = str;
}
String getSynergyAnonymousId() {
Log.Helper.LOGFUNC(this);
return this.m_synergyAnonymousId;
}
void setSynergyAnonymousId(String str) {
Log.Helper.LOGFUNC(this);
this.m_synergyAnonymousId = str;
}
Long getMostRecentDirectorResponseTimestamp() {
Log.Helper.LOGFUNC(this);
return this.m_lastDirectorResponseTimestamp;
}
void setMostRecentDirectorResponseTimestamp(Long l) {
Log.Helper.LOGFUNC(this);
this.m_lastDirectorResponseTimestamp = l;
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
this.m_getDirectionResponseDictionary = (Map) objectInput.readObject();
if (this.m_getDirectionResponseDictionary.isEmpty()) {
this.m_getDirectionResponseDictionary = null;
}
this.m_serverUrls = (Map) objectInput.readObject();
if (this.m_serverUrls.isEmpty()) {
this.m_serverUrls = null;
}
this.m_eaDeviceId = (String) objectInput.readObject();
if (this.m_eaDeviceId.length() == 0) {
this.m_eaDeviceId = null;
}
this.m_synergyAnonymousId = (String) objectInput.readObject();
if (this.m_synergyAnonymousId.length() == 0) {
this.m_synergyAnonymousId = null;
}
this.m_lastDirectorResponseTimestamp = Long.valueOf(objectInput.readLong());
if (this.m_lastDirectorResponseTimestamp.longValue() == 0) {
this.m_lastDirectorResponseTimestamp = null;
}
this.m_applicationLanguageCode = (String) objectInput.readObject();
if (this.m_applicationLanguageCode.length() == 0) {
this.m_applicationLanguageCode = null;
}
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
objectOutput.writeObject(this.m_getDirectionResponseDictionary == null ? new HashMap() : this.m_getDirectionResponseDictionary);
objectOutput.writeObject(this.m_serverUrls == null ? new HashMap() : this.m_serverUrls);
objectOutput.writeObject(this.m_eaDeviceId == null ? "" : this.m_eaDeviceId);
objectOutput.writeObject(this.m_synergyAnonymousId == null ? "" : this.m_synergyAnonymousId);
objectOutput.writeLong(this.m_lastDirectorResponseTimestamp == null ? 0L : this.m_lastDirectorResponseTimestamp.longValue());
objectOutput.writeObject(this.m_applicationLanguageCode == null ? "" : this.m_applicationLanguageCode);
}
/* JADX WARN: Removed duplicated region for block: B:78:0x0273 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:80:0x0274 A[RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public java.util.Set<java.lang.String> getKeysOfDifferences(com.ea.nimble.ISynergyEnvironment r4) {
/*
Method dump skipped, instructions count: 630
To view this dump change 'Code comments level' option to 'DEBUG'
*/
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);
if (this.m_getDirectionResponseDictionary == null || (list = (List) this.m_getDirectionResponseDictionary.get("disabledFeatures")) == null) {
return false;
}
return list.contains(str);
}
}
+180
View File
@@ -0,0 +1,180 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* android.os.Parcel
* android.os.Parcelable
* android.os.Parcelable$Creator
*/
package com.ea.nimble;
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.Serializable;
import java.io.StringWriter;
public class Error
extends Exception
implements Parcelable,
Externalizable {
public static final Parcelable.Creator<Error> CREATOR = new Parcelable.Creator<Error>(){
public Error createFromParcel(Parcel parcel) {
return new Error(parcel);
}
public Error[] newArray(int n2) {
return new Error[n2];
}
};
public static final String ERROR_DOMAIN = "NimbleError";
private static final long serialVersionUID = 1L;
private int m_code;
private String m_domain;
public Error() {
}
public Error(Parcel parcel) {
this.readFromParcel(parcel);
}
public Error(Code code, String string2) {
this(code, string2, null);
}
public Error(Code code, String string2, Throwable throwable) {
this(ERROR_DOMAIN, code.intValue(), string2, throwable);
}
public Error(String string2, int n2, String string3) {
this(string2, n2, string3, null);
}
public Error(String string2, int n2, String string3, Throwable throwable) {
super(string3, throwable);
this.m_domain = string2;
this.m_code = n2;
}
public int describeContents() {
return 0;
}
public int getCode() {
return this.m_code;
}
public String getDomain() {
return this.m_domain;
}
public boolean isError(Code code) {
if (this.m_code != code.intValue()) return false;
return true;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
this.m_domain = objectInput.readUTF();
this.m_code = objectInput.readInt();
this.initCause((Throwable)objectInput.readObject());
}
public void readFromParcel(Parcel parcel) {
this.m_domain = parcel.readString();
this.m_code = parcel.readInt();
this.initCause((Throwable)parcel.readSerializable());
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
if (this.m_domain != null && this.m_domain.length() > 0) {
stringBuilder.append(this.m_domain).append("(");
} else {
stringBuilder.append("Error").append("(");
}
stringBuilder.append(this.m_code).append(")");
Object object = this.getLocalizedMessage();
if (object != null && ((String)object).length() > 0) {
stringBuilder.append(": ").append((String)object);
}
if ((object = this.getCause()) == null) return stringBuilder.toString();
stringBuilder.append("\nCaused by: ");
StringWriter stringWriter = new StringWriter();
((Throwable)object).printStackTrace(new PrintWriter(stringWriter));
stringBuilder.append(stringWriter.toString());
return stringBuilder.toString();
}
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
if (this.m_domain != null && this.m_domain.length() > 0) {
objectOutput.writeUTF(this.m_domain);
} else {
objectOutput.writeUTF("");
}
objectOutput.writeInt(this.m_code);
objectOutput.writeObject(this.getCause());
}
public void writeToParcel(Parcel parcel, int n2) {
if (this.m_domain != null && this.m_domain.length() > 0) {
parcel.writeString(this.m_domain);
} else {
parcel.writeString("");
}
parcel.writeInt(this.m_code);
Throwable throwable = this.getCause();
if (throwable != null) {
parcel.writeSerializable((Serializable)throwable);
return;
}
parcel.writeSerializable((Serializable)((Object)""));
}
public static enum Code {
UNKNOWN(0),
SYSTEM_UNEXPECTED(100),
NOT_READY(101),
UNSUPPORTED(102),
NOT_AVAILABLE(103),
NOT_IMPLEMENTED(104),
INVALID_ARGUMENT(301),
MISSING_CALLBACK(300),
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 int m_value;
private Code(int n3) {
this.m_value = n3;
}
public int intValue() {
return this.m_value;
}
}
}
@@ -0,0 +1,14 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public class Facebook {
public static final String COMPONENT_ID = "com.ea.nimble.facebook";
private static void initialize() {
Base.registerComponent(new FacebookImpl(), "com.ea.nimble.facebook");
}
public static IFacebook getComponent() {
return (IFacebook) Base.getComponent("com.ea.nimble.facebook");
}
}
@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public interface FacebookCallback {
void callback(IFacebook iFacebook, boolean z, Exception exc);
}
@@ -0,0 +1,386 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import com.ea.nimble.Error;
import com.ea.nimble.IApplicationLifecycle;
import com.ea.nimble.IFacebook;
import com.ea.nimble.Log;
import com.ea.nimble.NimbleFacebookError;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.HttpMethod;
import com.facebook.Profile;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.share.internal.ShareConstants;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.client.methods.HttpGet;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
class FacebookImpl extends Component implements IFacebook, LogSource, IApplicationLifecycle.ActivityLifecycleCallbacks, IApplicationLifecycle.ActivityEventCallbacks {
private CallbackManager m_callbackManager = null;
private IFacebook.RequestCallback m_loginCallback = null;
@Override // com.ea.nimble.Component
public String getComponentId() {
return "com.ea.nimble.facebook";
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "FB-Android";
}
@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) {
}
@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) {
}
FacebookImpl() {
}
@Override // com.ea.nimble.Component
protected void setup() {
Log.Helper.LOGV(this, "Using Facebook SDK version " + FacebookSdk.getSdkVersion() + ".", new Object[0]);
}
@Override // com.ea.nimble.Component
public void restore() {
ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this);
ApplicationLifecycle.getComponent().registerActivityLifecycleCallbacks(this);
}
@Override // com.ea.nimble.Component
protected void cleanup() {
ApplicationLifecycle.getComponent().unregisterActivityLifecycleCallbacks(this);
ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this);
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
if (this.m_callbackManager != null) {
this.m_callbackManager.onActivityResult(i, i2, intent);
}
}
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
this.m_callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(this.m_callbackManager, new com.facebook.FacebookCallback<LoginResult>() { // from class: com.ea.nimble.FacebookImpl.1
@Override // com.facebook.FacebookCallback
public void onSuccess(LoginResult loginResult) {
Log.Helper.LOGV(this, "Login success", new Object[0]);
synchronized (this) {
HashMap hashMap = new HashMap();
hashMap.put("status", "loggedIn");
Utility.sendBroadcast(IFacebook.NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED, hashMap);
if (FacebookImpl.this.m_loginCallback != null) {
FacebookImpl.this.m_loginCallback.callback(null, null);
FacebookImpl.this.m_loginCallback = null;
}
}
}
@Override // com.facebook.FacebookCallback
public void onCancel() {
synchronized (this) {
Log.Helper.LOGV(this, "Login canceled", new Object[0]);
if (FacebookImpl.this.m_loginCallback != null) {
FacebookImpl.this.m_loginCallback.callback(null, new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "User canceled", (Throwable) null));
FacebookImpl.this.m_loginCallback = null;
}
}
}
@Override // com.facebook.FacebookCallback
public void onError(FacebookException facebookException) {
Log.Helper.LOGE(this, "Login failed\nError: %s", facebookException.toString());
synchronized (this) {
if (FacebookImpl.this.m_loginCallback != null) {
FacebookImpl.this.m_loginCallback.callback(null, new Error(Error.Code.UNKNOWN, "Login failed", facebookException));
FacebookImpl.this.m_loginCallback = null;
}
}
}
});
}
@Override // com.ea.nimble.IFacebook
public void login(List<String> list, IFacebook.RequestCallback requestCallback) {
Log.Helper.LOGPUBLICFUNC(this);
this.m_loginCallback = requestCallback;
while (!FacebookSdk.isInitialized()) {
try {
Thread.sleep(10L);
} catch (InterruptedException unused) {
}
}
synchronized (this) {
LoginManager.getInstance().logInWithReadPermissions(ApplicationEnvironment.getCurrentActivity(), list);
}
}
@Override // com.ea.nimble.IFacebook
public void logout() {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (this) {
LoginManager.getInstance().logOut();
AccessToken.setCurrentAccessToken(null);
Profile.setCurrentProfile(null);
HashMap hashMap = new HashMap();
hashMap.put("status", "loggedOut");
Utility.sendBroadcast(IFacebook.NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED, hashMap);
}
}
private void sendGraphRequest(final String str, final HashMap<String, String> hashMap, String str2, final IFacebook.RequestCallback requestCallback) {
Log.Helper.LOGFUNC(this);
if (!hasOpenSession()) {
Log.Helper.LOGD(this, "Unable to send FB Graph request to " + str + " as there is no currently active session.", new Object[0]);
if (requestCallback != null) {
requestCallback.callback(null, new Error(Error.Code.UNKNOWN, "Request failed as there is no active session."));
return;
}
return;
}
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.ea.nimble.FacebookImpl.2
@Override // java.lang.Runnable
public void run() {
Bundle bundle = new Bundle();
if (hashMap != null) {
for (Map.Entry entry : hashMap.entrySet()) {
bundle.putString((String) entry.getKey(), (String) entry.getValue());
}
}
new GraphRequest(AccessToken.getCurrentAccessToken(), str, bundle, HttpMethod.GET, new GraphRequest.Callback() { // from class: com.ea.nimble.FacebookImpl.2.1
/* JADX WARN: Removed duplicated region for block: B:10:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:7:0x0072 */
@Override // com.facebook.GraphRequest.Callback
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void onCompleted(com.facebook.GraphResponse r6) {
/*
r5 = this;
if (r6 == 0) goto L6b
com.facebook.FacebookRequestError r0 = r6.getError()
r1 = 0
if (r0 == 0) goto L43
com.ea.nimble.Error r0 = new com.ea.nimble.Error
com.ea.nimble.Error$Code r2 = com.ea.nimble.Error.Code.UNKNOWN
java.lang.String r3 = "Request failed."
com.facebook.FacebookRequestError r4 = r6.getError()
com.facebook.FacebookException r4 = r4.getException()
r0.<init>(r2, r3, r4)
java.lang.String r2 = "Facebook"
java.lang.StringBuilder r3 = new java.lang.StringBuilder
r3.<init>()
java.lang.String r4 = "Response of FB Graph request to "
r3.append(r4)
com.ea.nimble.FacebookImpl$2 r4 = com.ea.nimble.FacebookImpl.AnonymousClass2.this
java.lang.String r4 = r3
r3.append(r4)
java.lang.String r4 = " failed due to error: "
r3.append(r4)
java.lang.String r4 = r0.getMessage()
r3.append(r4)
java.lang.String r3 = r3.toString()
java.lang.Object[] r1 = new java.lang.Object[r1]
com.ea.nimble.Log.Helper.LOGDS(r2, r3, r1)
goto L6c
L43:
java.lang.String r0 = "Facebook"
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
java.lang.String r3 = "Response of FB Graph request "
r2.append(r3)
com.ea.nimble.FacebookImpl$2 r3 = com.ea.nimble.FacebookImpl.AnonymousClass2.this
java.lang.String r3 = r3
r2.append(r3)
java.lang.String r3 = " returned with data: "
r2.append(r3)
org.json.JSONObject r3 = r6.getJSONObject()
r2.append(r3)
java.lang.String r2 = r2.toString()
java.lang.Object[] r1 = new java.lang.Object[r1]
com.ea.nimble.Log.Helper.LOGDS(r0, r2, r1)
L6b:
r0 = 0
L6c:
com.ea.nimble.FacebookImpl$2 r1 = com.ea.nimble.FacebookImpl.AnonymousClass2.this
com.ea.nimble.IFacebook$RequestCallback r1 = r4
if (r1 == 0) goto L7d
com.ea.nimble.FacebookImpl$2 r1 = com.ea.nimble.FacebookImpl.AnonymousClass2.this
com.ea.nimble.IFacebook$RequestCallback r1 = r4
java.lang.String r6 = r6.getRawResponse()
r1.callback(r6, r0)
L7d:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.FacebookImpl.AnonymousClass2.AnonymousClass1.onCompleted(com.facebook.GraphResponse):void");
}
}).executeAsync();
}
});
}
@Override // com.ea.nimble.IFacebook
public void requestUserInfo(HashMap<String, String> hashMap, IFacebook.RequestCallback requestCallback) {
Log.Helper.LOGPUBLICFUNC(this);
if (hashMap == null || !hashMap.containsKey(GraphRequest.FIELDS_PARAM)) {
hashMap = new HashMap<>();
hashMap.put(GraphRequest.FIELDS_PARAM, "id, email, name, first_name, last_name, gender, link, locale, timezone, updated_time, verified");
}
sendGraphRequest("/me", hashMap, HttpGet.METHOD_NAME, requestCallback);
}
@Override // com.ea.nimble.IFacebook
public void requestFriends(HashMap<String, String> hashMap, IFacebook.RequestCallback requestCallback) {
Log.Helper.LOGPUBLICFUNC(this);
sendGraphRequest("/me/friends", hashMap, HttpGet.METHOD_NAME, requestCallback);
}
@Override // com.ea.nimble.IFacebook
public boolean hasOpenSession() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
return (currentAccessToken == null || currentAccessToken.isExpired()) ? false : true;
}
@Override // com.ea.nimble.IFacebook
public String getAccessToken() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return currentAccessToken.getToken();
}
return null;
}
@Override // com.ea.nimble.IFacebook
public List<String> getPermissions() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return new ArrayList(currentAccessToken.getPermissions());
}
return null;
}
@Override // com.ea.nimble.IFacebook
public Date getTokenExpirationDate() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return currentAccessToken.getExpires();
}
return null;
}
@Override // com.ea.nimble.IFacebook
public String getApplicationId() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return currentAccessToken.getApplicationId();
}
return null;
}
@Override // com.ea.nimble.IFacebook
public void refreshToken() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken.refreshCurrentAccessTokenAsync();
}
@Override // com.ea.nimble.IFacebook
public Map<String, Object> getGraphUser() {
Log.Helper.LOGPUBLICFUNC(this);
Profile currentProfile = Profile.getCurrentProfile();
if (currentProfile == null) {
return null;
}
HashMap hashMap = new HashMap();
hashMap.put("first_name", currentProfile.getFirstName());
hashMap.put("last_name", currentProfile.getLastName());
hashMap.put("link", currentProfile.getLinkUri());
hashMap.put("avatar", "https://graph.facebook.com/" + currentProfile.getId() + "/picture");
hashMap.put("id", currentProfile.getId());
return hashMap;
}
@Override // com.ea.nimble.IFacebook
public void retrieveFriends(int i, int i2, final IFacebook.FacebookFriendsCallback facebookFriendsCallback) {
Log.Helper.LOGPUBLICFUNC(this);
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("offset", "" + i);
hashMap.put("limit", "" + i2);
hashMap.put(GraphRequest.FIELDS_PARAM, "name, id, picture.type(normal)");
sendGraphRequest("/me/friends", hashMap, HttpGet.METHOD_NAME, new IFacebook.RequestCallback() { // from class: com.ea.nimble.FacebookImpl.3
@Override // com.ea.nimble.IFacebook.RequestCallback
public void callback(String str, Error error) {
NimbleFacebookError nimbleFacebookError;
JSONArray jSONArray = null;
if (error != null) {
nimbleFacebookError = new NimbleFacebookError(NimbleFacebookError.Code.FBSERVER_ERROR, error.toString());
} else {
try {
jSONArray = new JSONObject(str).getJSONArray(ShareConstants.WEB_DIALOG_PARAM_DATA);
nimbleFacebookError = null;
} catch (JSONException e) {
Log.Helper.LOGE(this, "JSON Exception encountered when parsing the facebook FQL query", new Object[0]);
nimbleFacebookError = new NimbleFacebookError(NimbleFacebookError.Code.RESPONSE_PARSE_ERROR, e.toString());
}
}
facebookFriendsCallback.callback(Facebook.getComponent(), jSONArray, nimbleFacebookError);
}
});
}
}
@@ -0,0 +1,37 @@
package com.ea.nimble;
/* loaded from: classes.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_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.40.0.39";
public static final String NIMBLE_SDK_VERSION = "1.40.0.39.0921";
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";
}
@@ -0,0 +1,15 @@
package com.ea.nimble;
/* loaded from: classes.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);
}
}
@@ -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: classes.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;
}
}
@@ -0,0 +1,81 @@
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: classes.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);
if (this.lastModified == 0) {
return new Date();
}
if (this.lastModified > 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;
}
}
@@ -0,0 +1,89 @@
package com.ea.nimble;
import android.content.Context;
import java.util.Map;
/* loaded from: classes.dex */
public interface IApplicationEnvironment {
public static final String UNAVAILABLE_ADVERTISING_ID = "";
public interface AdvertisingIdCalback {
void onCallback(String str, boolean z);
}
public interface SafetyNetAttestationCallback {
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();
String getGoogleEmail();
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 requestSafetyNetAttestation(byte[] bArr, SafetyNetAttestationCallback safetyNetAttestationCallback);
void retrieveAdvertisingId(AdvertisingIdCalback advertisingIdCalback);
void setApplicationLanguageCode(String str);
void setGameSpecifiedPlayerId(String str);
void setPlayerId(String str, String str2);
}
@@ -0,0 +1,134 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes.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);
}
@@ -0,0 +1,44 @@
package com.ea.nimble;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
/* loaded from: classes.dex */
public interface IFacebook {
public static final String NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED = "nimble.notification.facebook.statuschanged";
public interface FacebookFriendsCallback {
void callback(IFacebook iFacebook, JSONArray jSONArray, Error error);
}
public interface RequestCallback {
void callback(String str, Error error);
}
String getAccessToken();
String getApplicationId();
Map<String, Object> getGraphUser();
List<String> getPermissions();
Date getTokenExpirationDate();
boolean hasOpenSession();
void login(List<String> list, RequestCallback requestCallback);
void logout();
void refreshToken();
void requestFriends(HashMap<String, String> hashMap, RequestCallback requestCallback);
void requestUserInfo(HashMap<String, String> hashMap, RequestCallback requestCallback);
void retrieveFriends(int i, int i2, FacebookFriendsCallback facebookFriendsCallback);
}
@@ -0,0 +1,60 @@
/*
* Decompiled with CFR 0.152.
*/
package com.ea.nimble;
import java.net.URL;
import java.util.EnumSet;
import java.util.Map;
public interface IHttpRequest {
byte[] getData();
Map<String, String> getHeaders();
Method getMethod();
EnumSet<OverwritePolicy> getOverwritePolicy();
boolean getRunInBackground();
String getTargetFilePath();
double getTimeout();
URL getUrl();
static enum Method {
GET("GET"),
HEAD("HEAD"),
POST("POST"),
PUT("PUT"),
DELETE("DELETE"),
UNRECOGNIZED("UNRECOGNIZED");
private String title;
Method(String title) {
this.title = title;
}
public String toString() {
return title;
}
}
enum OverwritePolicy {
RESUME_DOWNLOAD,
DATE_CHECK,
LENGTH_CHECK;
static final EnumSet<OverwritePolicy> OVERWRITE;
static final EnumSet<OverwritePolicy> SMART;
static {
OVERWRITE = EnumSet.noneOf(OverwritePolicy.class);
SMART = EnumSet.allOf(OverwritePolicy.class);
}
}
}
@@ -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: classes.dex */
public interface IHttpResponse {
InputStream getDataStream();
long getDownloadedContentLength();
Exception getError();
long getExpectedContentLength();
Map<String, String> getHeaders();
Date getLastModified();
int getStatusCode();
URL getUrl();
boolean isCompleted();
}
+21
View File
@@ -0,0 +1,21 @@
package com.ea.nimble;
/* loaded from: classes.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);
}
@@ -0,0 +1,24 @@
package com.ea.nimble;
import com.ea.nimble.Network;
import java.net.URL;
import java.util.HashMap;
/* loaded from: classes.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);
}
@@ -0,0 +1,8 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public interface INimbleBadgeProvider {
int getBadgeCount();
Error setBadgeCount(int i, String str, String str2);
}
@@ -0,0 +1,22 @@
package com.ea.nimble;
import java.util.Date;
/* loaded from: classes.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 setBadgeCount(int i, String str, String str2);
void setBadgeProvider(INimbleBadgeProvider iNimbleBadgeProvider);
void setEnabled(boolean z);
}
@@ -0,0 +1,20 @@
package com.ea.nimble;
import java.util.List;
import org.json.JSONObject;
/* loaded from: classes.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, JSONObject jSONObject);
void setMaxEventCount(String str, int i);
}
@@ -0,0 +1,17 @@
package com.ea.nimble;
import com.ea.nimble.Persistence;
import com.ea.nimble.PersistenceService;
/* loaded from: classes.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();
}
@@ -0,0 +1,46 @@
package com.ea.nimble;
/* loaded from: classes.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);
}
@@ -0,0 +1,12 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public interface ISynergyIdManager {
String getAnonymousSynergyId();
String getSynergyId();
SynergyIdManagerError login(String str, String str2);
SynergyIdManagerError logout(String str);
}
@@ -0,0 +1,15 @@
package com.ea.nimble;
import com.ea.nimble.ISynergyRequest;
import java.util.Map;
/* loaded from: classes.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);
}
@@ -0,0 +1,23 @@
package com.ea.nimble;
import java.util.Map;
/* loaded from: classes.dex */
public interface ISynergyRequest {
public interface IJsonData {
Object getData();
int size();
}
String getApi();
String getBaseUrl();
IHttpRequest getHttpRequest();
IJsonData getJsonData();
Map<String, String> getUrlParameters();
}
@@ -0,0 +1,14 @@
package com.ea.nimble;
import java.util.Map;
/* loaded from: classes.dex */
public interface ISynergyResponse {
Exception getError();
IHttpResponse getHttpResponse();
Map<String, Object> getJsonData();
boolean isCompleted();
}
+113
View File
@@ -0,0 +1,113 @@
package com.ea.nimble;
/* loaded from: classes.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(Log.LEVEL_FATAL, 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(Log.LEVEL_FATAL, 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) {
if (s_instance == null) {
s_instance = new LogImpl();
}
iLog = s_instance;
}
return iLog;
}
}
@@ -0,0 +1,461 @@
package com.ea.nimble;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.v4.media.session.PlaybackStateCompat;
import com.ea.nimble.ILog;
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;
import org.apache.http.HttpHeaders;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.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;
@Override // com.ea.nimble.Component
public String getComponentId() {
return Log.COMPONENT_ID;
}
private 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();
}
}
private static class LogRecord {
public int level;
public String message;
private LogRecord() {
}
}
LogImpl() {
}
@Override // com.ea.nimble.Component
public void setup() {
configure();
}
@Override // com.ea.nimble.Component
public void suspend() {
if (this.m_guardTimer != null) {
this.m_guardTimer.pause();
}
}
@Override // com.ea.nimble.Component
public void resume() {
if (this.m_guardTimer != null) {
this.m_guardTimer.fire();
this.m_guardTimer.resume();
}
}
@Override // com.ea.nimble.Component
public void teardown() {
if (this.m_guardTimer != null) {
this.m_guardTimer.cancel();
this.m_guardTimer = null;
}
if (this.m_logFileStream != null) {
try {
this.m_logFileStream.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 int getThresholdLevel() {
return this.m_level;
}
@Override // com.ea.nimble.ILog
public void setThresholdLevel(int i) {
this.m_level = i;
}
@Override // com.ea.nimble.ILog
public String getLogFilePath() {
if (this.m_filePath != null) {
return this.m_filePath.toString();
}
return null;
}
@Override // com.ea.nimble.ILog
public void setLogCallback(ILog.LogCallback logCallback) {
this.m_callback = logCallback;
}
@Override // com.ea.nimble.ILog
public void writeWithSource(int i, Object obj, String str, Object... objArr) {
String str2 = "";
if (obj instanceof LogSource) {
str2 = ((LogSource) obj).getLogSourceTitle();
} else if (obj != null) {
str2 = obj.getClass().getName();
}
writeWithTitle(i, str2, 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);
if (this.m_callback != null) {
this.m_callback.callback(i, str, str2);
}
}
protected void connectToCore(BaseCore baseCore) {
this.m_core = baseCore;
configure();
flushCache();
}
protected void disconnectFromCore() {
this.m_core = null;
}
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;
android.util.Log.i(Global.NIMBLE_ID, String.format("LOG: Default Log level(%d) without log configuration file", Integer.valueOf(this.m_level)));
return;
}
return;
}
int parseLevel2 = parseLevel(settings.get("Level"));
if (parseLevel2 != this.m_level) {
this.m_level = parseLevel2;
android.util.Log.i(Global.NIMBLE_ID, String.format("LOG: Log level(%d)", Integer.valueOf(this.m_level)));
}
if (this.m_level <= 100) {
this.m_messageLengthLimit = 0;
} else {
String str = settings.get("MessageLengthLimit");
if (str == null) {
this.m_messageLengthLimit = 1000;
} else {
try {
this.m_messageLengthLimit = Integer.parseInt(str);
if (this.m_messageLengthLimit < 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;
android.util.Log.i(Global.NIMBLE_ID, "LOG: Disable log to file since no filename provided");
return;
}
return;
}
String str3 = settings.get(HttpHeaders.LOCATION);
String str4 = ApplicationEnvironment.getComponent().getCachePath() + File.separator + str2;
if (Utility.validString(str3) && str3.equalsIgnoreCase("external") && Environment.getExternalStorageState().equals("mounted")) {
String name = ApplicationEnvironment.getCurrentActivity().getClass().getPackage().getName();
try {
PackageManager packageManager = ApplicationEnvironment.getCurrentActivity().getPackageManager();
if (packageManager != null) {
name = packageManager.getPackageInfo(ApplicationEnvironment.getCurrentActivity().getPackageName(), 0).packageName;
}
} catch (Exception unused2) {
}
File file = new File(Environment.getExternalStorageDirectory(), name);
boolean exists = file.exists();
if (!exists) {
exists = file.mkdir();
}
if (exists) {
str4 = file + File.separator + str2;
}
}
File file2 = new File(str4);
if (file2 != this.m_filePath) {
this.m_filePath = file2;
try {
this.m_logFileStream = new FileOutputStream(this.m_filePath, true);
android.util.Log.d(Global.NIMBLE_ID, "LOG: File path: " + this.m_filePath.toString());
} catch (FileNotFoundException unused3) {
android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't create log file at " + str4);
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 {
this.m_interval = Integer.parseInt(settings.get("FileCheckInterval"));
if (this.m_interval <= 0) {
this.m_interval = DEFAULT_CHECK_INTERVAL;
}
} catch (NumberFormatException unused4) {
this.m_interval = DEFAULT_CHECK_INTERVAL;
}
try {
this.m_sizeLimit = Integer.parseInt(settings.get("MaxFileSize"));
if (this.m_sizeLimit <= 0) {
this.m_sizeLimit = 1024;
}
} catch (NumberFormatException unused5) {
this.m_sizeLimit = 1024;
}
GuardTask guardTask = new GuardTask();
guardTask.run();
this.m_guardTimer = new Timer(guardTask);
this.m_guardTimer.schedule(this.m_interval, true);
}
private void flushCache() {
Iterator<LogRecord> it = this.m_cache.iterator();
while (it.hasNext()) {
LogRecord next = it.next();
writeLine(next.level, 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 Log.LEVEL_FATAL;
}
if (str.equalsIgnoreCase("silent")) {
return Log.LEVEL_SILENT;
}
}
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) {
String str2 = formatLine[i2];
android.util.Log.v(Global.NIMBLE_ID, str2);
outputMessageToFile(str2);
i2++;
}
} else if (i == 100) {
String[] formatLine2 = formatLine("NIM_VERBOSE", str);
int length2 = formatLine2.length;
while (i2 < length2) {
String str3 = formatLine2[i2];
android.util.Log.v(Global.NIMBLE_ID, str3);
outputMessageToFile(str3);
i2++;
}
} else if (i == 200) {
String[] formatLine3 = formatLine("NIM_DEBUG", str);
int length3 = formatLine3.length;
while (i2 < length3) {
String str4 = formatLine3[i2];
android.util.Log.d(Global.NIMBLE_ID, str4);
outputMessageToFile(str4);
i2++;
}
} else if (i == 300) {
String[] formatLine4 = formatLine("NIM_INFO", str);
int length4 = formatLine4.length;
while (i2 < length4) {
String str5 = formatLine4[i2];
android.util.Log.i(Global.NIMBLE_ID, str5);
outputMessageToFile(str5);
i2++;
}
} else if (i == 400) {
String[] formatLine5 = formatLine("NIM_WARN", str);
int length5 = formatLine5.length;
while (i2 < length5) {
String str6 = formatLine5[i2];
android.util.Log.w(Global.NIMBLE_ID, str6);
outputMessageToFile(str6);
i2++;
}
} else if (i == 500) {
String[] formatLine6 = formatLine("NIM_ERROR", str);
int length6 = formatLine6.length;
while (i2 < length6) {
String str7 = formatLine6[i2];
android.util.Log.e(Global.NIMBLE_ID, str7);
outputMessageToFile(str7);
i2++;
}
} else if (i == 600) {
String[] formatLine7 = formatLine("NIM_FATAL", str);
String str8 = formatLine7[0];
while (i2 < formatLine7.length - 1) {
android.util.Log.e(Global.NIMBLE_ID, str8);
outputMessageToFile(str8);
i2++;
str8 = formatLine7[i2];
}
android.util.Log.wtf(Global.NIMBLE_ID, str8);
outputMessageToFile(str8);
} else {
String[] formatLine8 = formatLine(String.format("NIM(%d)", Integer.valueOf(i)), str);
String str9 = formatLine8[0];
while (i2 < formatLine8.length - 1) {
android.util.Log.e(Global.NIMBLE_ID, str9);
outputMessageToFile(str9);
i2++;
str9 = formatLine8[i2];
}
android.util.Log.wtf(Global.NIMBLE_ID, str9);
outputMessageToFile(str9);
}
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 = 0;
if (length > this.m_messageLengthLimit && this.m_messageLengthLimit != 0) {
str3 = str3.substring(0, this.m_messageLengthLimit) + String.format("... and %d chars more", Integer.valueOf(length - this.m_messageLengthLimit));
length = str3.length();
}
double d = length;
Double.isNaN(d);
String[] strArr = new String[(int) Math.ceil(d / 4000.0d)];
while (i < length) {
int i2 = i + DEFAULT_CONSOLE_OUTPUT_LIMIT;
if (i2 < length) {
strArr[i / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i, i2);
} else {
strArr[i / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i);
}
i = i2;
}
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(HTTP.UTF_8)));
this.m_logFileStream.flush();
} catch (IOException e) {
android.util.Log.e(Global.NIMBLE_ID, "Error writing to log file: " + e.toString());
}
}
}
}
@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public interface LogSource {
String getLogSourceTitle();
}
@@ -0,0 +1,112 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class Network {
public static final String COMPONENT_ID = "com.ea.nimble.network";
public enum Status {
UNKNOWN,
NONE,
DEAD,
OK;
@Override // java.lang.Enum
public String toString() {
switch (this) {
case NONE:
return "NET NONE";
case DEAD:
return "NET DEAD";
case OK:
return "NET OK";
default:
return "NET UNKNOWN";
}
}
}
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("Network", "URL parameters map contains invalid key", new Object[0]);
} else {
try {
String encode = URLEncoder.encode(key, HTTP.UTF_8);
if ("".equals(value)) {
Log.Helper.LOGWS("Network", "URL parameters map contains invalid value", new Object[0]);
} else {
try {
str = (((str + encode) + "=") + URLEncoder.encode(value, HTTP.UTF_8)) + "&";
} catch (UnsupportedEncodingException unused) {
Log.Helper.LOGWS("Network", "URL parameters map contains invalid value", new Object[0]);
}
}
} catch (UnsupportedEncodingException unused2) {
Log.Helper.LOGWS("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("Network", "Base url is blank, return null", new Object[0]);
return null;
}
String generateParameterString = generateParameterString(map);
if (generateParameterString == null) {
Log.Helper.LOGWS("Network", "Generated URL with only base url = %s", str);
} else {
str = str + "?" + generateParameterString;
Log.Helper.LOGVS("Network", "Generated URL = %s", str);
}
try {
return new URL(str);
} catch (MalformedURLException unused) {
Log.Helper.LOGES("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 + ":" + property2;
} catch (Exception e) {
Log.Helper.LOGES("Network", "Unable to get system proxy settings. %s", e.toString());
return null;
}
}
}
@@ -0,0 +1,591 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
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.UnknownHostException;
import java.util.Date;
import java.util.Map;
import org.apache.http.message.TokenParser;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
/* loaded from: classes.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 String m_loggingId;
private NetworkImpl m_manager;
private IOperationalTelemetryDispatch m_otDispatch;
private NetworkConnectionCallback m_progressCallback;
private HttpRequest m_request;
private String m_requestDataForLog;
private HttpResponse m_response;
private StringBuilder m_responseDataForLog;
private Thread m_thread;
public String getLogSourceTitle() {
return "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) {
if (this.m_thread != null) {
this.m_thread.interrupt();
} else {
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Network connection " + toString() + " is cancelled"));
}
}
}
void cancelForAppSuspend() {
cancel();
}
public void run() {
Log.Helper.LOGPUBLICFUNCS("NetworkConnection");
try {
try {
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) 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("Connection", "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 (SocketTimeoutException e) {
finishWithError(new Error(Error.Code.NETWORK_TIMEOUT, "Connection " + toString() + " timed out", e));
synchronized (this) {
this.m_thread = null;
}
} catch (Exception e2) {
finishWithError(new Error(Error.Code.SYSTEM_UNEXPECTED, "Unexpected error.", e2));
synchronized (this) {
this.m_thread = null;
}
}
} catch (IOException e3) {
finishWithError(new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Connection " + toString() + " failed with I/O exception", e3));
synchronized (this) {
this.m_thread = null;
}
} catch (ClassCastException e4) {
finishWithError(new Error(Error.Code.NETWORK_UNSUPPORTED_CONNECTION_TYPE, "Request " + toString() + " failed for unsupported connection type" + this.m_request.getUrl().getProtocol(), e4));
synchronized (this) {
this.m_thread = null;
}
}
} catch (UnknownHostException e5) {
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(), e5));
} else {
finishWithError(new Error(Error.Code.NETWORK_UNREACHABLE, "Request " + toString() + " failed for unreachable host", e5));
}
synchronized (this) {
this.m_thread = null;
}
}
} catch (InterruptedIOException e6) {
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Connection " + toString() + " is cancelled", e6));
synchronized (this) {
this.m_thread = null;
}
}
} catch (Error e7) {
finishWithError(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();
if (this.m_request.headers != null) {
for (String str : this.m_request.headers.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 outputStream2 = httpURLConnection.getOutputStream();
try {
outputStream2.write(byteArray);
if (outputStream2 != null) {
outputStream2.close();
}
} catch (Exception e) {
e = e;
outputStream = outputStream2;
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) {
outputStream.close();
}
} catch (Throwable th) {
th = th;
outputStream = outputStream2;
if (outputStream != null) {
outputStream.close();
}
throw th;
}
} catch (Exception e2) {
e = e2;
}
} catch (Throwable th2) {
th = th2;
}
}
/* JADX WARN: Removed duplicated region for block: B:30:0x00a8 */
/* JADX WARN: Removed duplicated region for block: B:35:0x00b5 A[Catch: all -> 0x01b5, TryCatch #2 {all -> 0x01b5, blocks: (B:6:0x0012, B:7:0x003f, B:9:0x0045, B:11:0x0063, B:14:0x0071, B:17:0x0086, B:19:0x008e, B:32:0x00ab, B:33:0x00b4, B:35:0x00b5, B:36:0x00d2, B:37:0x00d3, B:39:0x00dd, B:49:0x00ea, B:50:0x00ef, B:52:0x00f7, B:54:0x00fd, B:56:0x0115, B:57:0x011a, B:58:0x0137, B:59:0x010c, B:62:0x0145, B:63:0x0172, B:65:0x0175, B:66:0x0194, B:67:0x0195, B:68:0x01b4), top: B:5:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:39:0x00dd A[Catch: all -> 0x01b5, TryCatch #2 {all -> 0x01b5, blocks: (B:6:0x0012, B:7:0x003f, B:9:0x0045, B:11:0x0063, B:14:0x0071, B:17:0x0086, B:19:0x008e, B:32:0x00ab, B:33:0x00b4, B:35:0x00b5, B:36:0x00d2, B:37:0x00d3, B:39:0x00dd, B:49:0x00ea, B:50:0x00ef, B:52:0x00f7, B:54:0x00fd, B:56:0x0115, B:57:0x011a, B:58:0x0137, B:59:0x010c, B:62:0x0145, B:63:0x0172, B:65:0x0175, B:66:0x0194, B:67:0x0195, B:68:0x01b4), top: B:5:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:42:0x00e5 */
/* JADX WARN: Removed duplicated region for block: B:44:0x013e A[DONT_GENERATE] */
/* JADX WARN: Removed duplicated region for block: B:47:0x00e6 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void httpRecv(java.net.HttpURLConnection r10) throws java.io.IOException, com.ea.nimble.Error {
/*
Method dump skipped, instructions count: 458
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.httpRecv(java.net.HttpURLConnection):void");
}
/* JADX WARN: Removed duplicated region for block: B:75:0x01ab */
/* JADX WARN: Removed duplicated region for block: B:77:0x01b0 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void downloadToFile(java.io.InputStream r14) throws java.io.IOException {
/*
Method dump skipped, instructions count: 483
To view this dump change 'Code comments level' option to 'DEBUG'
*/
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();
int i = 0;
while (true) {
if (i < 0) {
break;
}
try {
byte[] prepareSegment = this.m_response.data.prepareSegment();
if (prepareSegment == null) {
Log.Helper.LOGE(this, "Error preparing segment", new Object[0]);
break;
}
int i2 = 0;
do {
read = inputStream.read(prepareSegment, i2, prepareSegment.length - i2);
if (!Thread.interrupted()) {
if (read < 0) {
break;
}
if (read == 0) {
Thread.yield();
} else {
prepareResponseLog(prepareSegment, i2, read);
i2 += read;
this.m_response.downloadedContentLength += read;
}
} else {
throw new InterruptedIOException();
}
} while (i2 < prepareSegment.length);
this.m_response.data.appendSegmentToBuffer(prepareSegment, i2);
if (this.m_progressCallback != null) {
this.m_progressCallback.callback(this);
}
i = read;
} finally {
inputStream.close();
}
}
}
private void finish() {
Log.Helper.LOGFUNCS("NetworkConnection");
this.m_response.isCompleted = true;
logOperationalTelemetryResponse();
if (this.m_completionCallback != null) {
this.m_completionCallback.callback(this);
}
synchronized (this) {
notifyAll();
}
this.m_manager.removeConnection(this);
}
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");
int i = 2048;
if (this.m_request.data != null && this.m_request.data.size() > 0) {
i = 2048 + this.m_request.data.size();
try {
str = this.m_request.data.toString(HTTP.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(TokenParser.SP);
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;
}
this.m_responseDataForLog = new StringBuilder(this.m_response.expectedContentLength > 0 ? (int) this.m_response.expectedContentLength : 4096);
}
private void prepareResponseLog(byte[] bArr, int i, int i2) {
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100 || this.m_responseDataForLog == null) {
return;
}
try {
this.m_responseDataForLog.append(new String(bArr, i, i2, HTTP.UTF_8));
} catch (UnsupportedEncodingException unused) {
this.m_responseDataForLog = null;
}
}
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) {
Log.Helper.LOGFUNCS("NetworkConnection");
if (str == null) {
return str;
}
String str2 = null;
try {
Object nextValue = new JSONTokener(str).nextValue();
if (nextValue instanceof JSONObject) {
str2 = ((JSONObject) nextValue).toString(4);
} else if (nextValue instanceof JSONArray) {
str2 = ((JSONArray) nextValue).toString(4);
}
return str2 != null ? str2 : str;
} catch (JSONException unused) {
return str;
}
}
private void logRequest() {
Log.Helper.LOGFUNCS("NetworkConnection");
if (Log.getComponent().getThresholdLevel() > 100) {
return;
}
this.m_requestDataForLog = prepareRequestLog();
Log.Helper.LOGD(this, "\n>>>> CONNECTION ID %s BEGIN >>>>>>>>>>>>>>>>>>\n%s<<<< CONNECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<<\n", this.m_loggingId, this.m_requestDataForLog);
}
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 = this.m_requestDataForLog.length() + 4096;
boolean z = this.m_request.targetFilePath != null;
if (this.m_responseDataForLog == null || this.m_responseDataForLog.length() <= 0) {
str = z ? "<-- FILE -->" : "<-- EMPTY -->";
} else {
try {
str = this.m_responseDataForLog.toString();
} catch (Exception unused) {
str = "<-- UNREADABLE -->";
}
}
StringBuilder sb = new StringBuilder(length + str.length());
sb.append(String.format("%n>>>> CONNECTION ID %s FINISH >>>> REQUEST >>>>%n", this.m_loggingId));
sb.append(this.m_requestDataForLog);
sb.append("<<<< REQUEST <<<<<<<< -- >>>>>>>> RESPONSE >>>>\n");
sb.append("RESP URL: ");
sb.append(this.m_response.url.toString());
sb.append('\n');
sb.append("RESP STATUS: ");
sb.append(this.m_response.statusCode);
sb.append('\n');
if (this.m_response.getError() != null) {
sb.append("RESP ERROR: ");
if (this.m_response.getError().getMessage() != null) {
sb.append(this.m_response.getError().getMessage());
sb.append("\n");
} else {
sb.append("<-- UNKNOWN -->\n");
}
}
if (z) {
sb.append("RESP FILE: ");
sb.append(this.m_request.targetFilePath);
sb.append("\n");
}
generateHttpHeaderAndBodyLogString(sb, true, this.m_response.headers, str);
sb.append("<<<< RESPONSE <<<< CONNECTION FINISH <<<<<<<<<<");
Log.Helper.LOGD(this, sb.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();
if (value == null) {
value = "(null)";
}
sb.append(" VALUE: ");
sb.append(value);
sb.append('\n');
if (key.equals("Content-Type") && (value.contains("application/json") || value.contains("text/json"))) {
z3 = true;
}
} else {
String str3 = map.get(key);
if (str3 == null) {
str3 = "(null)";
}
Log.Helper.LOGW("Network request contains a null key with value %s", str3, 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(24:14|(2:16|(2:18|19))|20|(1:22)|23|(2:25|(8:27|28|29|30|32|33|34|(18:38|39|40|41|42|44|45|46|47|48|49|50|51|52|53|54|55|56))(2:69|70))|73|39|40|41|42|44|45|46|47|48|49|50|51|52|53|54|55|56) */
/* JADX WARN: Code restructure failed: missing block: B:59:0x013a, code lost:
r10 = r2;
*/
/* JADX WARN: Code restructure failed: missing block: B:60:0x013f, code lost:
com.ea.nimble.Log.Helper.LOGE(r14, "Failed to add " + r10 + " to eventDict.", new java.lang.Object[0]);
*/
/* JADX WARN: Code restructure failed: missing block: B:62:0x013c, code lost:
r10 = "URL_PROTOCOL";
*/
/* JADX WARN: Code restructure failed: missing block: B:64:0x013e, code lost:
r10 = "CONNECTIONID";
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
void logOperationalTelemetryResponse() {
/*
Method dump skipped, instructions count: 362
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.logOperationalTelemetryResponse():void");
}
}
@@ -0,0 +1,6 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public interface NetworkConnectionCallback {
void callback(NetworkConnectionHandle networkConnectionHandle);
}
@@ -0,0 +1,24 @@
package com.ea.nimble;
/* loaded from: classes.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();
}
@@ -0,0 +1,442 @@
package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
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: classes.dex */
public 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 DetectionState m_networkDetectionState;
private int m_pingIndex;
private List<NetworkConnection> m_queue;
private Network.Status m_status;
private Timer m_timer;
private LinkedList<NetworkConnection> m_waitingToExecuteQueue;
private 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 "Network";
}
private class ConnectivityReceiver extends BroadcastReceiver {
private ConnectivityReceiver() {
}
@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);
}
}
}
public NetworkImpl() {
Log.Helper.LOGFUNC(this);
this.m_connectivityReceiver = 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) {
Iterator it = new ArrayList(this.m_queue).iterator();
while (it.hasNext()) {
((NetworkConnection) it.next()).cancelForAppSuspend();
}
}
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, "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);
if (this.m_connectivityReceiver == null) {
Log.Helper.LOGD(this, "Register network reachability listener.", new Object[0]);
this.m_connectivityReceiver = new ConnectivityReceiver();
ApplicationEnvironment.getComponent().getApplicationContext().registerReceiver(this.m_connectivityReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
}
private void unregisterNetworkListener() {
Log.Helper.LOGFUNC(this);
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;
}
}
@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);
if (httpRequest.url == null || !Utility.validString(httpRequest.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);
}
if (this.m_asyncTaskManager == null || this.m_asyncTaskManager.isShutdown()) {
if (this.m_asyncTaskManager != null) {
Log.Helper.LOGW(this, "AsyncTaskManager shutdown. Queueing networkconnection until AsyncTaskManager is started.", new Object[0]);
} else {
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection 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;
}
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);
if (this.m_detectionConnection != null) {
if (!z) {
return;
}
NetworkConnection networkConnection = this.m_detectionConnection;
this.m_detectionConnection = null;
networkConnection.cancel();
}
stopPing();
if (reachabilityCheck()) {
if (this.m_status != Network.Status.DEAD) {
setStatus(Network.Status.OK);
}
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_MAIN;
} else {
if (this.m_status == Network.Status.UNKNOWN) {
setStatus(Network.Status.NONE);
}
this.m_networkDetectionState = DetectionState.VERIFY_UNREACHABLE_MAIN;
}
verifyReachability(MAIN_NETWORK_REACHABILITY_CHECK_URL, 5.0d);
}
private boolean reachabilityCheck() {
ConnectivityManager connectivityManager;
NetworkInfo activeNetworkInfo;
Log.Helper.LOGFUNC(this);
this.m_isWifi = false;
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
if (applicationContext == null || (connectivityManager = (ConnectivityManager) applicationContext.getSystemService("connectivity")) == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnectedOrConnecting()) {
return false;
}
if (activeNetworkInfo.getType() == 1 || activeNetworkInfo.getType() == 9) {
this.m_isWifi = true;
}
if (BaseCore.getInstance().isActive()) {
return true;
}
Log.Helper.LOGD(this, "BaseCore not active yet. Postpone reachability check.", new Object[0]);
return false;
}
private void startPing() {
Log.Helper.LOGFUNC(this);
if (this.m_pingIndex >= PING_INTERVAL.length) {
this.m_pingIndex = PING_INTERVAL.length - 1;
}
this.m_timer = new Timer(new TimerTask());
this.m_timer.schedule(PING_INTERVAL[this.m_pingIndex], false);
}
private void stopPing() {
Log.Helper.LOGFUNC(this);
if (this.m_timer != null) {
this.m_timer.cancel();
this.m_timer = null;
}
}
private class TimerTask implements Runnable {
private TimerTask() {
}
@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.GET;
this.m_detectionConnection = new NetworkConnection(this, httpRequest);
this.m_detectionConnection.setCompletionCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.NetworkImpl.1
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
NetworkImpl.this.onReachabilityVerification(networkConnectionHandle);
}
});
if (this.m_asyncTaskManager == null || this.m_asyncTaskManager.isShutdown()) {
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection 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 */
public synchronized void onReachabilityVerification(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);
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]);
}
}
switch (this.m_networkDetectionState) {
case VERIFY_REACHABLE_MAIN:
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_BACKUP;
verifyReachability(BACKUP_NETWORK_REACHABILITY_CHECK_URL, 30.0d);
break;
case VERIFY_UNREACHABLE_MAIN:
setStatus(Network.Status.NONE);
break;
case VERIFY_REACHABLE_BACKUP:
this.m_networkDetectionState = DetectionState.PING;
if (this.m_status == Network.Status.DEAD) {
startPing();
break;
} else {
setStatus(Network.Status.DEAD);
this.m_pingIndex = 0;
startPing();
break;
}
case PING:
this.m_pingIndex++;
startPing();
break;
}
}
private void setStatus(Network.Status status) {
Log.Helper.LOGI(this, "Status change %s -> %s", this.m_status, status);
if (status != this.m_status) {
this.m_status = status;
Utility.sendBroadcast(Global.NOTIFICATION_NETWORK_STATUS_CHANGE);
}
}
private synchronized void startWork() {
Log.Helper.LOGFUNC(this);
if (this.m_asyncTaskManager != null) {
return;
}
detect(true);
registerNetworkListener();
this.m_asyncTaskManager = Executors.newFixedThreadPool(4);
if (this.m_waitingToExecuteQueue != null && !this.m_waitingToExecuteQueue.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]);
}
}
}
}
private void stopWork() {
Log.Helper.LOGFUNC(this);
synchronized (this) {
this.m_detectionConnection = null;
stopPing();
unregisterNetworkListener();
}
if (this.m_asyncTaskManager == null) {
return;
}
try {
Iterator<Runnable> it = this.m_asyncTaskManager.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;
}
}
@@ -0,0 +1,95 @@
package com.ea.nimble;
import android.app.Activity;
import android.content.pm.PackageManager;
import com.ea.nimble.Log;
/* loaded from: classes.dex */
public class NimbleApplicationConfiguration {
private static final String LOG_TITLE = "AppConfig";
public static boolean configValueExists(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
try {
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.containsKey(str);
}
} catch (PackageManager.NameNotFoundException unused) {
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
}
return false;
}
public static String getConfigValueAsString(String str) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
return getConfigValueAsString(str, "");
}
public static String getConfigValueAsString(String str, String str2) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
try {
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getString(str);
}
} catch (PackageManager.NameNotFoundException unused) {
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) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
try {
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getInt(str);
}
} catch (PackageManager.NameNotFoundException unused) {
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) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
try {
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getDouble(str);
}
} catch (PackageManager.NameNotFoundException unused) {
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) {
Log.Helper.LOGPUBLICFUNCS(LOG_TITLE);
try {
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getBoolean(str);
}
} catch (PackageManager.NameNotFoundException unused) {
Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str);
}
return z;
}
}
@@ -0,0 +1,51 @@
package com.ea.nimble;
import com.ea.nimble.Log;
/* loaded from: classes.dex */
public enum NimbleConfiguration {
UNKNOWN,
INTEGRATION,
STAGE,
LIVE,
CUSTOMIZED,
MANUAL;
public static NimbleConfiguration fromName(String str) {
Log.Helper.LOGPUBLICFUNCS("AppConfig");
if (str.equals("int")) {
return INTEGRATION;
}
if (str.equals("stage")) {
return STAGE;
}
if (str.equals("live")) {
return LIVE;
}
if (str.equals(com.ea.games.nfs13.BuildConfig.FLAVOR)) {
return CUSTOMIZED;
}
if (str.equals("manual")) {
return MANUAL;
}
return UNKNOWN;
}
@Override // java.lang.Enum
public String toString() {
switch (this) {
case INTEGRATION:
return "int";
case STAGE:
return "stage";
case LIVE:
return "live";
case CUSTOMIZED:
return com.ea.games.nfs13.BuildConfig.FLAVOR;
case MANUAL:
return "manual";
default:
return "unknown";
}
}
}
@@ -0,0 +1,34 @@
package com.ea.nimble;
/* loaded from: classes.dex */
public class NimbleFacebookError extends Error {
public static final String NIMBLE_FACEBOOK_ERROR_DOMAIN = "NimbleFacebookError";
private static final long serialVersionUID = 1;
public enum Code {
FBSERVER_ERROR(90000),
RESPONSE_PARSE_ERROR(90001);
private int m_value;
Code(int i) {
this.m_value = i;
}
public int intValue() {
return this.m_value;
}
}
public NimbleFacebookError(Code code, String str, Throwable th) {
super(NIMBLE_FACEBOOK_ERROR_DOMAIN, code.intValue(), str, th);
}
public NimbleFacebookError(Code code, String str) {
super(NIMBLE_FACEBOOK_ERROR_DOMAIN, code.intValue(), str);
}
public boolean isError(int i) {
return getCode() == i;
}
}
@@ -0,0 +1,67 @@
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.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.nimble.Log;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import java.util.HashMap;
/* loaded from: classes.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());
}
protected void handleNewLocalNotification(Context context, Bundle bundle) {
String string = bundle.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID, "");
String pushTargetActivity = getPushTargetActivity(context);
Log.Helper.LOGD(this, "[handleNewLocalNotification]: Local notification received with target activity: " + pushTargetActivity, new Object[0]);
try {
Intent intent = new Intent(context, Class.forName(pushTargetActivity));
intent.putExtras(bundle);
intent.putExtra("PushNotification", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
intent.setFlags(603979776);
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1073741824);
if (ApplicationEnvironment.isMainApplicationActive()) {
HashMap hashMap = new HashMap();
hashMap.put("en", ShareConstants.WEB_DIALOG_PARAM_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);
return;
}
Notification notification = (Notification) bundle.getParcelable("notification");
notification.contentIntent = activity;
((NotificationManager) context.getSystemService("notification")).notify(string.hashCode(), notification);
} catch (ClassNotFoundException e) {
Log.Helper.LOGD(this, String.format("[handleNewLocalNotification]: Could not launch target activity: %s, exception: %s", pushTargetActivity, e.toString()), new Object[0]);
}
}
protected String getPushTargetActivity(Context context) {
Context applicationContext = context.getApplicationContext();
return applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName()).resolveActivity(applicationContext.getPackageManager()).getClassName();
}
}
@@ -0,0 +1,20 @@
package com.ea.nimble;
import com.ea.nimble.Log;
/* loaded from: classes.dex */
public class NimbleLocalNotifications {
public static final String COMPONENT_ID = "com.ea.nimble.base.localNotifications";
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);
}
}
@@ -0,0 +1,295 @@
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.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.drive.DriveFile;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
/* loaded from: classes.dex */
public class NimbleLocalNotificationsImpl extends Component implements INimbleLocalNotifications {
private static 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 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.Component
public void restore() {
Log.Helper.LOGPUBLICFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
if (persistenceForNimbleComponent.hasKey(PERSISTENCE_ENABLED_KEY)) {
this.m_enabled = persistenceForNimbleComponent.getBoolValue(PERSISTENCE_ENABLED_KEY);
} else {
this.m_enabled = true;
}
if (persistenceForNimbleComponent.hasKey(PERSISTENCE_NOTIFICATION_MAP_KEY)) {
this.m_notificationMap = (HashMap) persistenceForNimbleComponent.getValue(PERSISTENCE_NOTIFICATION_MAP_KEY);
Iterator<String> it = this.m_notificationMap.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.toString() + ") is in the past!", new Object[0]);
it.remove();
}
}
saveNotificationMap();
} else {
this.m_notificationMap = new HashMap<>();
}
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY)) {
return;
}
String str = Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_VALUE;
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY)) {
str = applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY));
}
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) {
Notification build;
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", str, str2, str3, date.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");
}
if (!Utility.validString(str3)) {
str3 = "auto_" + date2.getTime();
}
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
Resources resources = ApplicationEnvironment.getComponent().getApplicationContext().getResources();
String packageName = ApplicationEnvironment.getComponent().getApplicationContext().getPackageName();
if (Build.VERSION.SDK_INT >= 26) {
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).setAutoCancel(true);
try {
autoCancel.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
build = autoCancel.build();
} catch (Exception e) {
Log.Helper.LOGE(this, "scheduleNotification(): Not scheduled. Unable to set application icon due to exception: " + e.toString(), new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon");
}
} else {
NotificationCompat.Builder autoCancel2 = new NotificationCompat.Builder(applicationContext).setContentTitle(str).setContentText(str2).setAutoCancel(true);
try {
autoCancel2.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
build = autoCancel2.build();
} catch (Exception e2) {
Log.Helper.LOGE(this, "scheduleNotification(): Not scheduled. Unable to set application icon due to exception: " + e2.toString(), new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon");
}
}
this.m_notificationMap.put(str3, date);
saveNotificationMap();
Intent intent = new Intent(applicationContext, (Class<?>) NimbleLocalNotificationReceiver.class);
intent.putExtra("notification", build);
intent.putExtra(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str3);
intent.putExtra(GcmIntentService.PushIntentExtraKeys.PN_TYPE, "local");
((AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(0, System.currentTimeMillis() + (date.getTime() - date2.getTime()), PendingIntent.getBroadcast(applicationContext, str3 != null ? str3.hashCode() : 0, intent, 134217728));
HashMap hashMap = new HashMap();
hashMap.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE);
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap);
bundle.putString("msg_id", str3);
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;
}
@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), DriveFile.MODE_WRITE_ONLY);
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", ShareConstants.WEB_DIALOG_PARAM_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(PERSISTENCE_ENABLED_KEY, Boolean.valueOf(this.m_enabled));
persistenceForNimbleComponent.synchronize();
cancelAllNotifications();
}
}
@Override // com.ea.nimble.INimbleLocalNotifications
public boolean isEnabled() {
return this.m_enabled;
}
@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) {
if (m_badgeProvider != null) {
return m_badgeProvider.setBadgeCount(i, str, str2);
}
if (Build.VERSION.SDK_INT >= 26) {
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(BADGE_ID.hashCode());
return null;
}
if (i < 0 || i > 999999) {
String str3 = "setBadgeCount(): Badge count " + String.valueOf(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(GcmIntentService.PushIntentExtraKeys.PUSH_ID, BADGE_ID);
intent.putExtra(GcmIntentService.PushIntentExtraKeys.PN_TYPE, "local");
intent.setFlags(603979776);
build.contentIntent = PendingIntent.getActivity(applicationContext, 0, intent, 1073741824);
notificationManager.notify(BADGE_ID.hashCode(), build);
return null;
} catch (ClassNotFoundException e) {
String format = String.format("setBadgeCount(): Could not launch target activity: %s, exception: %s", className, e.toString());
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.toString(), new Object[0]);
return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon");
}
}
Log.Helper.LOGE(this, "setBadgeCount(): Unsupported Android version, unable to set badge count", new Object[0]);
return new Error(Error.Code.UNSUPPORTED, "setBadgeCount(): Unsupported Android version, unable to set badge count");
}
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");
}
@Override // com.ea.nimble.INimbleLocalNotifications
public int getBadgeCount() {
Log.Helper.LOGPUBLICFUNC(this);
if (m_badgeProvider != null) {
return m_badgeProvider.getBadgeCount();
}
if (Build.VERSION.SDK_INT >= 26) {
for (StatusBarNotification statusBarNotification : ((NotificationManager) ApplicationEnvironment.getComponent().getApplicationContext().getSystemService("notification")).getActiveNotifications()) {
if (statusBarNotification.getId() == BADGE_ID.hashCode()) {
return statusBarNotification.getNotification().number;
}
}
} else {
Log.Helper.LOGE(this, "getBadgeCount(): Unsupported Android version, unable to get badge count", new Object[0]);
}
return 0;
}
private void saveNotificationMap() {
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
persistenceForNimbleComponent.setValue(PERSISTENCE_NOTIFICATION_MAP_KEY, this.m_notificationMap);
persistenceForNimbleComponent.synchronize();
}
}
@@ -0,0 +1,11 @@
package com.ea.nimble;
/* loaded from: classes.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);
}
}
@@ -0,0 +1,227 @@
package com.ea.nimble;
import com.ea.nimble.Log;
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: classes.dex */
class OperationalTelemetryDispatchImpl extends Component implements IOperationalTelemetryDispatch, LogSource {
private List<OperationalTelemetryEvent> m_networkMetricsArray = new ArrayList();
private List<OperationalTelemetryEvent> m_networkPayloadsArray = new ArrayList();
private Map<String, Integer> m_maxEventQueueSizeDict = new HashMap();
@Override // com.ea.nimble.Component
protected 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
protected void restore() {
}
@Override // com.ea.nimble.Component
protected void resume() {
}
@Override // com.ea.nimble.Component
protected void suspend() {
}
public OperationalTelemetryDispatchImpl() {
this.m_maxEventQueueSizeDict.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, JSONObject jSONObject) {
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;
}
if (jSONObject == null || 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) {
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;
}
}
if (!z) {
Log.Helper.LOGE(this, "logEvent, unsupported OT eventType, " + str + ".", new Object[0]);
}
updateEventThresholdListeners();
}
@Override // com.ea.nimble.IOperationalTelemetryDispatch
public List<OperationalTelemetryEvent> getEvents(String str) {
Log.Helper.LOGPUBLICFUNC(this);
List<OperationalTelemetryEvent> list = null;
if (!Utility.validString(str)) {
Log.Helper.LOGE(this, "getEvents called with null or empty eventType.", new Object[0]);
return null;
}
synchronized (this) {
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();
}
}
if (list == null) {
Log.Helper.LOGE(this, "getEvents, unsupported OT eventType, " + str + ".", new Object[0]);
}
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)) {
list = this.m_networkPayloadsArray;
} else {
Log.Helper.LOGE(this, "canLogEvent, unsupported OT eventType, " + str + ".", new Object[0]);
return false;
}
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) {
double d = maxEventCount;
Double.isNaN(d);
if (this.m_networkMetricsArray.size() >= ((int) (d * 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) {
double d2 = maxEventCount2;
Double.isNaN(d2);
if (this.m_networkPayloadsArray.size() >= ((int) (d2 * 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 + ".", 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) {
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);
}
}
}
}
@@ -0,0 +1,15 @@
package com.ea.nimble;
import java.util.Date;
import org.json.JSONObject;
/* loaded from: classes.dex */
public interface OperationalTelemetryEvent {
JSONObject getEventDictionary();
String getEventDictionaryString();
String getEventType();
Date getLoggedTime();
}
@@ -0,0 +1,41 @@
package com.ea.nimble;
import java.util.Date;
import org.json.JSONObject;
/* loaded from: classes.dex */
class OperationalTelemetryEventImpl implements OperationalTelemetryEvent {
private JSONObject m_eventDictionary;
private String m_eventType;
private Date 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 getEventType() {
return this.m_eventType;
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public JSONObject getEventDictionary() {
return this.m_eventDictionary;
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public String getEventDictionaryString() {
return this.m_eventDictionary.toString();
}
@Override // com.ea.nimble.OperationalTelemetryEvent
public Date getLoggedTime() {
return this.m_loggedTime;
}
public String toString() {
return String.format("OperationalTelemetryEvent(%s)-(%s) > %s", getEventType(), getLoggedTime(), getEventDictionary());
}
}
@@ -0,0 +1,556 @@
package com.ea.nimble;
import android.app.backup.BackupManager;
import android.content.Context;
import com.ea.nimble.Log;
import com.ea.nimble.PersistenceService;
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: classes.dex */
public class Persistence implements LogSource {
private static 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 Encryptor m_encryptor;
private String m_identifier;
private Storage m_storage;
private Timer m_synchronizeTimer;
public enum Storage {
DOCUMENT,
CACHE,
TEMP
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "Persistence";
}
Persistence(String str, Storage storage, Encryptor encryptor) {
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1
@Override // java.lang.Runnable
public void run() {
Persistence.this.synchronize();
}
});
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;
}
Persistence(Persistence persistence, String str) {
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1
@Override // java.lang.Runnable
public void run() {
Persistence.this.synchronize();
}
});
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) {
Log.Helper.LOGF(this, "Error: Backup flag not supported for storage: " + this.m_storage, new Object[0]);
return;
}
this.m_backUp = z;
}
void merge(Persistence persistence, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
Log.Helper.LOGFUNC(this);
switch (persistenceMergePolicy) {
case OVERWRITE:
this.m_content = new HashMap(persistence.m_content);
break;
case SOURCE_FIRST:
this.m_content.putAll(persistence.m_content);
break;
case TARGET_FIRST:
for (String str : persistence.m_content.keySet()) {
if (this.m_content.get(str) == null) {
this.m_content.put(str, persistence.m_content.get(str));
}
}
break;
}
}
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) {
if (!Utility.validString(str)) {
Log.Helper.LOGD(this, "Key " + str + " is an invalid string", new Object[0]);
Log.Helper.LOGF(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.toString() + " was unable to be archived", new Object[0]);
Log.Helper.LOGF(this, "NimblePersistence cannot archive value", new Object[0]);
}
}
}
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 + ":" + 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);
try {
if (value != null) {
return ((Boolean) value).booleanValue();
}
throw new ClassCastException();
} 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) {
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]);
}
}
}
}
public void clean() {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
this.m_content.clear();
clearSynchronizeTimer();
String persistencePath = getPersistencePath(this.m_identifier, this.m_storage);
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());
}
}
}
public void synchronize() {
Log.Helper.LOGPUBLICFUNC(this);
synchronized (s_dataLock) {
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();
}
}
}
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();
}
private void loadPersistenceData(boolean z, Context context) {
String persistencePath;
FileInputStream fileInputStream;
ObjectInputStream objectInputStream;
ObjectInputStream objectInputStream2;
Log.Helper.LOGFUNC(this);
if (context == null) {
persistencePath = getPersistencePath(this.m_identifier, this.m_storage);
} else {
persistencePath = getPersistencePath(this.m_identifier, this.m_storage, 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;
try {
try {
try {
fileInputStream = new FileInputStream(file);
try {
objectInputStream = new ObjectInputStream(fileInputStream);
} catch (Exception e) {
e = e;
fileInputStream2 = fileInputStream;
Log.Helper.LOGE(this, "Can't read persistence (%s) file, %s: %s", this.m_identifier, persistencePath, e.toString());
e.printStackTrace();
if (fileInputStream2 != null) {
fileInputStream2.close();
}
return;
} catch (Throwable th) {
th = th;
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException unused) {
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
fileInputStream = fileInputStream2;
}
} catch (Exception e2) {
e = e2;
}
if (objectInputStream.readInt() != PERSISTENCE_VERSION) {
throw new InvalidClassException("com.ea.nimble.Persistence", "Persistence version doesn't match");
}
this.m_encryption = objectInputStream.readBoolean();
this.m_backUp = objectInputStream.readBoolean();
if (!z) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
if (this.m_encryption) {
objectInputStream2 = this.m_encryptor.encryptInputStream(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();
}
objectInputStream.close();
fileInputStream.close();
} catch (IOException unused2) {
}
}
/* JADX WARN: Code restructure failed: missing block: B:24:0x00b7, code lost:
if (r6 == null) goto L30;
*/
/* JADX WARN: Removed duplicated region for block: B:32:0x00cf A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void savePersistenceData() {
/*
Method dump skipped, instructions count: 211
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.savePersistenceData():void");
}
static File getPersistenceDirectory(Storage storage) {
String documentPath;
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
switch (storage) {
case DOCUMENT:
documentPath = component.getDocumentPath();
break;
case CACHE:
documentPath = component.getCachePath();
break;
case TEMP:
documentPath = component.getTempPath();
break;
default:
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;
}
/* JADX WARN: Removed duplicated region for block: B:11:0x002f */
/* JADX WARN: Removed duplicated region for block: B:13:0x003b */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
static java.io.File getPersistenceDirectory(com.ea.nimble.Persistence.Storage r6, android.content.Context r7) {
/*
int[] r0 = com.ea.nimble.Persistence.AnonymousClass2.$SwitchMap$com$ea$nimble$Persistence$Storage
int r1 = r6.ordinal()
r0 = r0[r1]
r1 = 0
switch(r0) {
case 1: goto L1f;
case 2: goto L14;
case 3: goto L14;
default: goto Lc;
}
Lc:
java.lang.String r6 = "Nimble"
java.lang.String r7 = "Persistence : Unknown storage type"
android.util.Log.e(r6, r7)
return r1
L14:
java.io.File r7 = r7.getCacheDir()
if (r7 == 0) goto L2a
java.lang.String r7 = r7.getPath()
goto L2b
L1f:
java.io.File r7 = r7.getFilesDir()
if (r7 == 0) goto L2a
java.lang.String r7 = r7.getPath()
goto L2b
L2a:
r7 = r1
L2b:
r0 = 0
r2 = 1
if (r7 != 0) goto L3b
java.lang.String r7 = "Nimble"
java.lang.String r3 = "Persistence : Could not build base path for storage(%s)"
java.lang.Object[] r2 = new java.lang.Object[r2]
r2[r0] = r6
com.ea.nimble.Log.Helper.LOGE(r7, r3, r2)
return r1
L3b:
java.lang.String r3 = "com.ea.nimble.configuration"
java.lang.String r3 = com.ea.nimble.NimbleApplicationConfiguration.getConfigValueAsString(r3)
java.lang.StringBuilder r4 = new java.lang.StringBuilder
r4.<init>()
r4.append(r7)
java.lang.String r7 = java.io.File.separator
r4.append(r7)
java.lang.String r7 = "Nimble"
r4.append(r7)
java.lang.String r7 = java.io.File.separator
r4.append(r7)
r4.append(r3)
java.lang.String r7 = java.io.File.separator
r4.append(r7)
java.lang.String r7 = "persistence"
r4.append(r7)
java.lang.String r7 = r4.toString()
com.ea.nimble.Persistence$Storage r3 = com.ea.nimble.Persistence.Storage.TEMP
if (r6 != r3) goto L83
java.lang.StringBuilder r3 = new java.lang.StringBuilder
r3.<init>()
r3.append(r7)
java.lang.String r7 = java.io.File.separator
r3.append(r7)
java.lang.String r7 = "temp"
r3.append(r7)
java.lang.String r7 = r3.toString()
L83:
java.io.File r3 = new java.io.File
r3.<init>(r7)
boolean r4 = r3.isDirectory()
if (r4 != 0) goto La7
boolean r4 = r3.mkdirs()
if (r4 != 0) goto La7
java.lang.String r3 = "Nimble"
java.lang.String r4 = "Persistence : Cannot create persistence folder in storage(%s) %s"
r5 = 2
java.lang.Object[] r5 = new java.lang.Object[r5]
r5[r0] = r6
r5[r2] = r7
java.lang.String r6 = java.lang.String.format(r4, r5)
android.util.Log.e(r3, r6)
return r1
La7:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.getPersistenceDirectory(com.ea.nimble.Persistence$Storage, android.content.Context):java.io.File");
}
static String getPersistencePath(String str, Storage storage) {
File persistenceDirectory = getPersistenceDirectory(storage);
if (persistenceDirectory == null) {
return null;
}
return persistenceDirectory + File.separator + str + ".dat";
}
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";
}
}
@@ -0,0 +1,123 @@
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: classes.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:0x003e */
/* JADX WARN: Removed duplicated region for block: B:9:0x0048 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
static void writeBackup(android.os.ParcelFileDescriptor r18, android.app.backup.BackupDataOutput r19, android.os.ParcelFileDescriptor r20, android.content.Context r21) throws java.io.IOException {
/*
Method dump skipped, instructions count: 268
To view this dump change 'Code comments level' option to 'DEBUG'
*/
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");
}
static void readBackup(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor, Context context) throws IOException {
FileOutputStream fileOutputStream;
while (true) {
FileOutputStream fileOutputStream2 = 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 = new FileOutputStream(Persistence.getPersistencePath(key, Persistence.Storage.DOCUMENT, context));
} catch (Throwable th) {
th = th;
}
try {
fileOutputStream.write(bArr);
fileOutputStream.close();
} catch (Throwable th2) {
th = th2;
fileOutputStream2 = fileOutputStream;
if (fileOutputStream2 != null) {
fileOutputStream2.close();
}
throw th;
}
}
if (ApplicationEnvironment.isMainApplicationRunning()) {
for (Persistence persistence : ((PersistenceServiceImpl) getComponent()).m_persistences.values()) {
if (persistence.getBackUp()) {
persistence.restore(false, null);
}
}
}
}
}
@@ -0,0 +1,190 @@
package com.ea.nimble;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import com.ea.nimble.PersistenceService;
import com.google.android.vending.expansion.downloader.Constants;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* loaded from: classes.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) {
Persistence loadPersistenceById = loadPersistenceById(str, storage);
if (loadPersistenceById != null) {
return loadPersistenceById;
}
Persistence persistence = new Persistence(str, storage, this.m_encryptor);
this.m_persistences.put(str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString(), persistence);
return persistence;
}
}
@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 + Constants.FILENAME_SEQUENCE_SEPARATOR + 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) {
String str3 = str2 + Constants.FILENAME_SEQUENCE_SEPARATOR + 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.synchronize();
} else {
loadPersistenceById2.merge(loadPersistenceById, persistenceMergePolicy);
}
}
}
private void synchronize() {
Log.Helper.LOGFUNC(this);
Iterator<Persistence> it = this.m_persistences.values().iterator();
while (it.hasNext()) {
it.next().synchronize();
}
}
private Persistence loadPersistenceById(String str, Persistence.Storage storage) {
Log.Helper.LOGFUNC(this);
synchronized (Persistence.s_dataLock) {
String str2 = str + Constants.FILENAME_SEQUENCE_SEPARATOR + 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;
}
}
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();
}
}
+10
View File
@@ -0,0 +1,10 @@
package com.ea.nimble;
import com.ea.nimble.Persistence;
/* loaded from: classes.dex */
public class QA {
static String getPersistencePath(String str, Persistence.Storage storage) {
return Persistence.getPersistencePath(str, storage);
}
}
@@ -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: classes.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]);
}
}
@@ -0,0 +1,40 @@
package com.ea.nimble;
/* loaded from: classes.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_AKAMAI = "akamai.url";
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_DYNAMIC_MORE_GAMES = "dmg.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_MAYHEM = "mayhem.url";
public static final String SERVER_URL_KEY_ORIGIN_AVATAR = "avatars.url";
public static final String SERVER_URL_KEY_ORIGIN_CASUAL_APP = "origincasualapp.url";
public static final String SERVER_URL_KEY_ORIGIN_CASUAL_SERVER = "origincasualserver.url";
public static final String SERVER_URL_KEY_ORIGIN_FRIENDS = "friends.url";
public static final String SERVER_URL_KEY_SYNERGY_CENTRAL_IP_GEOLOCATION = "geoip.url";
public static final String SERVER_URL_KEY_SYNERGY_DIRECTOR = "synergy.director";
public static final String SERVER_URL_KEY_SYNERGY_DRM = "synergy.drm";
public static final String SERVER_URL_KEY_SYNERGY_MESSAGE_TO_USER = "synergy.m2u";
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);
}
}

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