Рабочий первый рабочий коммит

This commit is contained in:
2025-03-31 21:19:55 +03:00
parent 4b7a924752
commit 3b16cf38db
162 changed files with 660 additions and 14087 deletions
+7 -2
View File
@@ -11,11 +11,15 @@ android {
applicationId = "com.ea.games.nfs13_mod"
minSdk = 27
targetSdk = 35
versionCode = 1
versionName = "1.0"
versionCode = 1003128
versionName = "1.3.128"
ndk.abiFilters.add("armeabi-v7a")
ndk.abiFilters.add("x86")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
ndkVersion = "21.0.6113669"
buildTypes {
release {
@@ -46,5 +50,6 @@ dependencies {
implementation("com.parse.bolts:bolts-tasks:1.4.0")
implementation("org.apache.httpcomponents:httpclient-android:4.3.5.1")
implementation("com.google.code.gson:gson:2.7")
//implementation("com.android.support:support-v4:28.0.0")
}
+11 -16
View File
@@ -25,9 +25,8 @@
<uses-configuration android:reqTouchScreen="finger"/>
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
<application
android:theme="@style/AppTheme"
android:theme="@style/Theme.AppCompat.Light"
android:label="@string/app_name"
android:icon="@mipmap/adaptive_icon"
android:screenOrientation="userLandscape"
@@ -37,35 +36,31 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/adaptive_icon_round">
<activity
android:theme="@style/AppTheme"
android:name="com.ea.ironmonkey.GameActivityMain"
android:launchMode="singleTask"
android:screenOrientation="userLandscape"
android:configChanges="smallestScreenSize|screenSize|orientation|keyboardHidden|locale"
android:alwaysRetainTaskState="true"
android:resizeableActivity="false">
<meta-data
android:name="foo"
android:value="bar"/>
</activity>
<activity
android:theme="@style/AppTheme"
android:name="com.ea.ironmonkey.WebActivity"
android:configChanges="keyboardHidden|locale"
android:resizeableActivity="false"/>
<activity
android:theme="@style/AppTheme"
android:exported="true"
android:name="com.ea.ironmonkey.PermissionsActivity"
android:launchMode="singleTask"
android:configChanges="layoutDirection|screenSize|orientation|keyboardHidden|locale"
android:resizeableActivity="false"/>
android:resizeableActivity="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="@style/AppTheme"
android:name="com.ea.ironmonkey.ObbActivity"
android:launchMode="singleTask"
android:configChanges="layoutDirection|screenSize|orientation|keyboardHidden|locale"
android:resizeableActivity="false"/>
<meta-data
android:name="com.ea.nimble.configuration"
android:value="@string/nimble_configuration"/>
@@ -1,19 +0,0 @@
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();
}
}
@@ -1,210 +0,0 @@
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);
}
}
@@ -1,139 +0,0 @@
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 "";
}
}
@@ -1,47 +0,0 @@
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;
}
}
@@ -1,162 +0,0 @@
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;
}
}
@@ -1,414 +0,0 @@
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());
}
}
}
@@ -1,30 +0,0 @@
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);
}
@@ -1,27 +0,0 @@
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()));
}
}
@@ -1,16 +0,0 @@
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";
}
@@ -1,19 +0,0 @@
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();
}
}
@@ -1,19 +0,0 @@
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();
}
}
}
@@ -1,11 +1,14 @@
package com.ea.ironmonkey;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Configuration;
@@ -17,11 +20,11 @@ import android.net.Uri;
import android.opengl.GLES20;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.PowerManager;
import android.os.Process;
import android.provider.Settings;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.DisplayCutout;
@@ -29,24 +32,29 @@ import android.view.KeyEvent;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewParent;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ComponentActivity;
import com.ea.EAIO.EAIO;
import com.ea.EAMIO.StorageDirectory;
import com.ea.nimble.ApplicationLifecycle;
import com.ea.nimble.Global;
import com.facebook.FacebookSdk;
import com.google.android.vending.expansion.downloader.Constants;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
@@ -61,7 +69,7 @@ import javax.microedition.khronos.opengles.GL10;
import org.fmod.FMODAudioDevice;
/* loaded from: classes.dex */
public class GameActivityMain extends Activity implements DrawFrameListener {
public class GameActivityMain extends AppCompatActivity implements DrawFrameListener {
private static final String DOWNLOAD_PROPERTIES = "downloadcontent/config.properties";
public static final int LIFECYCLE_CREATED = 1;
public static final int LIFECYCLE_DESTROYED = 5;
@@ -90,7 +98,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
private Accelerometer accelerometer;
private GameGLSurfaceView gameGLSurfaceView;
private GameRenderer gameRenderer;
private GoogleDrm googleDrm;
private Handler handler;
private int laststate;
private int lifecycle;
@@ -98,7 +105,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
private FMODAudioDevice mFMODAudioDevice;
private FrameLayout mFrameLayout;
private OrientationEventListener mOrientationListener;
private Map<String, Map<String, FSNode>> mResources;
private Map mResources;
private PowerManager.WakeLock mWakeLock;
public int naturalOrientation;
private RunLoop runLoop;
@@ -112,6 +119,14 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
private AssetLocationType mAssetLocationType = AssetLocationType.EXTERNAL;
private String[] lifecycleNames = {"LIFECYCLE_NONE", "LIFECYCLE_CREATED", "LIFECYCLE_STARTED", "LIFECYCLE_RUNNING", "LIFECYCLE_STOPPED", "LIFECYCLE_DESTROYED"};
public File getSave() {
return save;
}
public void setSave(File save) {
this.save = save;
}
enum AssetLocationType {
EXTERNAL,
ASSETS,
@@ -176,6 +191,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
restoreSave();
Log.setEnable(true);
Log.i(TAG, "onCreate");
super.onCreate(bundle);
@@ -200,11 +216,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
Log.d(TAG, "It's Amazon dev");
isAmazonDev = true;
}
if (!isAtLeastAPI(18) && getRequestedOrientation() != 6) {
setRequestedOrientation(6);
if (!isAtLeastAPI(18) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
if (isAtLeastAPI(28)) {
getWindow().getAttributes().layoutInDisplayCutoutMode = 1;
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().addFlags(67108864);
}
getWindow().setFlags(1024, 1024);
@@ -229,7 +245,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
if (this.mOrientationListener.canDetectOrientation()) {
this.mOrientationListener.enable();
}
mAudioManager = (AudioManager) getSystemService("audio");
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
sIsOtherMusicPlaying = mAudioManager.isMusicActive();
Log.i(TAG, "onCreate() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying));
this.mFMODAudioDevice = new FMODAudioDevice();
@@ -237,7 +253,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
try {
Log.d(TAG, "onCreate open resources.json");
InputStream open = getAssetManager().open("resources.json");
this.mResources = (Map) new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
this.mResources = new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
}.getType());
Log.d(TAG, "onCreate resources.json contains " + Integer.toString(this.mResources.size()) + " items");
open.close();
@@ -259,7 +275,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
Log.e(TAG, e2.getMessage());
}
}
SensorManager sensorManager = (SensorManager) getSystemService("sensor");
SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor defaultSensor = sensorManager.getDefaultSensor(1);
int rotation = getWindow().getWindowManager().getDefaultDisplay().getRotation();
switch (rotation) {
@@ -289,13 +305,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
this.mFrameLayout = new FrameLayout(this);
this.mFrameLayout.addView(this.gameGLSurfaceView);
setContentView(this.mFrameLayout);
this.googleDrm = new GoogleDrm(this);
System.loadLibrary("fmodex");
System.loadLibrary("fmodevent");
System.loadLibrary("c++_shared");
System.loadLibrary(Global.NIMBLE_ID);
System.loadLibrary("app");
FacebookSdk.sdkInitialize(this);
Log.d(TAG, "Init EAIO/EAMIO");
EAIO.Startup(this);
StorageDirectory.Startup(this);
@@ -304,14 +318,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
nativeOnCreate();
}
public String[] forEach(String str) {
Log.d(TAG, "forEach path = " + str);
if (this.mResources.containsKey(str)) {
Log.d(TAG, "forEach mResources contains " + str);
return (String[]) this.mResources.get(str).keySet().toArray(new String[0]);
}
Log.d(TAG, "forEach mResources not contains " + str);
return new String[0];
public String[] forEach(String input) {
return new String[] { input };
}
public int getAssetSize(String str) {
@@ -328,7 +336,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
Log.d(TAG, "getAssetSize path = " + parent);
if (this.mResources.containsKey(parent)) {
Log.d(TAG, "getAssetSize mResources contains " + parent);
Map<String, FSNode> map = this.mResources.get(parent);
Map<String, FSNode> map = (Map<String, FSNode>) this.mResources.get(parent);
String name = file.getName();
Log.d(TAG, "getAssetSize name = " + name);
if (map.containsKey(name)) {
@@ -368,6 +376,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
}
public String getObbFullPath() {
Log.i(this.getClass().getName(), getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode()));
return getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode());
}
@@ -409,13 +418,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
}
}
private void getC2DMRegistrationId() {
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
intent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
intent.putExtra("sender", C2DMConstants.SENDER_EMAIL);
startService(intent);
}
@Override // android.app.Activity
public void onStart() {
CallGC();
@@ -447,6 +449,62 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
ApplicationLifecycle.onActivityStart(this);
}
// Методы для воостановления сейва и его сохранения чтобы всегда использовать внешний сейв
private String saveFileName = "nfstr_save.sb";
private File save = null;
private File externalSave = new File(Environment.getStorageDirectory(),"games/nfsmw/nfstr_save.sb");
// Сохранить
private void storeSave() {
try {
save = new File(getFilesDir(), "var/nfstr_save.sb");
// Создаем директории, если они не существуют
externalSave.getParentFile().mkdirs();
// Копируем файл из внутреннего хранилища во внешнее
try (InputStream in = new FileInputStream(save);
OutputStream out = new FileOutputStream(externalSave)) {
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
} catch (IOException e) {
e.printStackTrace();
// Обработка ошибки сохранения
}
}
// Восстановить
private void restoreSave() {
try {
save = new File(getFilesDir(), "var/nfstr_save.sb");
// Проверяем, существует ли внешний файл
if (!externalSave.exists()) {
return; // ничего не делаем, если файла нет
}
// Создаем директории для внутреннего файла, если нужно
save.getParentFile().mkdirs();
// Копируем файл из внешнего хранилища во внутреннее
try (InputStream in = new FileInputStream(externalSave);
OutputStream out = new FileOutputStream(save)) {
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
} catch (IOException e) {
e.printStackTrace();
// Обработка ошибки восстановления
}
}
@Override // android.app.Activity
public void onRestart() {
Log.i(TAG, "onRestart");
@@ -477,7 +535,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
private void ForceHideVirtualKeyboard() {
View currentFocus = getCurrentFocus();
if (currentFocus != null) {
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
}
getWindow().setSoftInputMode(3);
}
@@ -529,9 +587,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
return;
}
setLifecycle(5);
if (this.googleDrm.isEnable()) {
this.googleDrm.destroy();
}
storeSave();
if (state == 8) {
ApplicationLifecycle.onActivityDestroy(this);
nativeOnDestroy();
@@ -541,12 +597,13 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
System.exit(0);
}
@SuppressLint("InvalidWakeLockTag")
public void wakeLockAcquire() {
if (this.isSleepModeEnabled) {
return;
}
if (this.mWakeLock == null) {
this.mWakeLock = ((PowerManager) getSystemService("power")).newWakeLock(10, TAG);
this.mWakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(10, TAG);
}
if (this.mWakeLock.isHeld()) {
return;
@@ -621,6 +678,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
@Override // android.app.Activity
public void onBackPressed() {
//super.onBackPressed();
if (state == 1 || state == 0 || state == 7) {
finish();
}
@@ -763,18 +821,9 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onLowMemory() {
ActivityManager activityManager = (ActivityManager) getSystemService("activity");
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
Log.i(TAG, "Available memory: " + ((memoryInfo.availMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
Log.i(TAG, "Threshold: " + ((memoryInfo.threshold / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
new TreeMap();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
if (runningAppProcessInfo.processName.indexOf("nfs13") != -1) {
Log.i(TAG, "Total memory: " + (activityManager.getProcessMemoryInfo(new int[]{runningAppProcessInfo.pid})[0].getTotalPss() / 1024) + "MB\n");
}
}
super.onLowMemory();
}
@@ -866,18 +915,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
case 0:
this.splash = new SplashScreen(this);
this.splash.init(gl10, this.gameRenderer.getWidth(), this.gameRenderer.getHeight());
if (this.googleDrm.isEnable()) {
Log.i(TAG, "Begin DRM Check...");
this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.7
@Override // java.lang.Runnable
public void run() {
GameActivityMain.this.googleDrm.start();
}
}, 20L);
state = 2;
} else {
state = 1;
}
state = 1;
this.splashCounter = 3;
break;
case 1:
@@ -961,16 +999,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
public void onResult(String str, int i) {
Log.w(TAG, "onResult(" + str + "," + i + ")");
if (str.equals("GOOGL_DRM")) {
if (i == -1) {
state = 1;
return;
}
Log.e(TAG, "No Google account!!!!");
finish();
Process.killProcess(Process.myPid());
return;
}
if (i == -1) {
File file = new File(new File(str).getParent() + "/.nomedia");
if (!file.exists()) {
@@ -998,116 +1026,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
Process.killProcess(Process.myPid());
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x004a, code lost:
r3 = r3[1].trim().split(" ");
com.ea.ironmonkey.Log.d("mem", r3[0]);
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x005d, code lost:
r3 = java.lang.Integer.parseInt(r3[0].trim()) / 1024;
*/
/* JADX WARN: Code restructure failed: missing block: B:22:0x006a, code lost:
r3 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:23:0x006b, code lost:
com.ea.ironmonkey.Log.d("mem", r3.toString());
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public int getTotalMemory() {
/*
r9 = this;
java.io.File r0 = new java.io.File
java.lang.String r1 = "/proc/meminfo"
r0.<init>(r1)
boolean r1 = r0.exists()
r2 = 0
if (r1 == 0) goto L9c
r1 = 1
java.io.FileReader r3 = new java.io.FileReader // Catch: java.lang.Exception -> L7f
r3.<init>(r0) // Catch: java.lang.Exception -> L7f
java.io.BufferedReader r4 = new java.io.BufferedReader // Catch: java.lang.Exception -> L7f
r4.<init>(r3) // Catch: java.lang.Exception -> L7f
L19:
java.lang.String r3 = r4.readLine() // Catch: java.lang.Exception -> L7f
if (r3 == 0) goto L74
java.lang.String r5 = "mem"
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
java.lang.String r5 = ":"
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
java.lang.String r5 = "mem"
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
java.lang.String r5 = "mem"
r6 = r3[r1] // Catch: java.lang.Exception -> L7f
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
r5 = r3[r2] // Catch: java.lang.Exception -> L7f
java.lang.String r5 = r5.trim() // Catch: java.lang.Exception -> L7f
java.lang.String r5 = r5.toLowerCase() // Catch: java.lang.Exception -> L7f
java.lang.String r6 = "memtotal"
boolean r5 = r5.equals(r6) // Catch: java.lang.Exception -> L7f
if (r5 == 0) goto L19
r3 = r3[r1] // Catch: java.lang.Exception -> L7f
java.lang.String r3 = r3.trim() // Catch: java.lang.Exception -> L7f
java.lang.String r5 = " "
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
java.lang.String r5 = "mem"
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
r3 = r3[r2] // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
java.lang.String r3 = r3.trim() // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
int r3 = java.lang.Integer.parseInt(r3) // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
int r3 = r3 / 1024
goto L75
L6a:
r3 = move-exception
java.lang.String r5 = "mem"
java.lang.String r3 = r3.toString() // Catch: java.lang.Exception -> L7f
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
L74:
r3 = 0
L75:
r4.close() // Catch: java.lang.Exception -> L7a
r2 = r3
goto L9c
L7a:
r4 = move-exception
r8 = r4
r4 = r3
r3 = r8
goto L81
L7f:
r3 = move-exception
r4 = 0
L81:
java.lang.String r5 = "GameActivityMain"
java.lang.String r6 = "Error reading system file: %s (%s)"
r7 = 2
java.lang.Object[] r7 = new java.lang.Object[r7]
java.lang.String r0 = r0.getAbsolutePath()
r7[r2] = r0
java.lang.String r0 = r3.getMessage()
r7[r1] = r0
java.lang.String r0 = java.lang.String.format(r6, r7)
com.ea.ironmonkey.Log.e(r5, r0)
r2 = r4
L9c:
java.lang.String r0 = "mem"
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
java.lang.String r3 = "totalmemory="
r1.append(r3)
r1.append(r2)
java.lang.String r1 = r1.toString()
com.ea.ironmonkey.Log.d(r0, r1)
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.getTotalMemory():int");
return 40000;
}
public void openURL(String str) {
@@ -1125,87 +1045,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
}
public float getPerformanceScore() {
String readCpuFile = readCpuFile("present");
int i = 0;
float f = 0.0f;
if (readCpuFile.length() > 0) {
List<Integer> parseCpuList = parseCpuList(readCpuFile);
Iterator<Integer> it = parseCpuList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (readCpuFile(String.format("cpu%d/cpufreq/cpuinfo_max_freq", Integer.valueOf(it.next().intValue()))).length() > 0) {
try {
f = Integer.parseInt(r4) * 0.001f;
break;
} catch (NumberFormatException unused) {
continue;
}
}
}
i = parseCpuList.size();
}
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return calcPerformanceScore(f, i, displayMetrics.widthPixels, displayMetrics.heightPixels);
}
public List<Integer> parseCpuList(String str) {
ArrayList arrayList = new ArrayList();
for (String str2 : str.split(",")) {
if (str2.contains(Constants.FILENAME_SEQUENCE_SEPARATOR)) {
String[] split = str2.split(Constants.FILENAME_SEQUENCE_SEPARATOR);
if (split.length >= 2) {
try {
int parseInt = Integer.parseInt(split[1]);
for (int parseInt2 = Integer.parseInt(split[0]); parseInt2 <= parseInt; parseInt2++) {
arrayList.add(Integer.valueOf(parseInt2));
}
} catch (NumberFormatException unused) {
}
}
} else {
arrayList.add(Integer.valueOf(Integer.parseInt(str2)));
}
}
return arrayList;
}
public String readCpuFile(String str) {
File file = new File("/sys/devices/system/cpu", str);
if (!file.exists()) {
return "";
}
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
String readLine = bufferedReader.readLine();
bufferedReader.close();
return readLine;
} catch (Exception e) {
Log.e(TAG, String.format("Error reading system file: %s (%s)", file.getAbsolutePath(), e.getMessage()));
return "";
}
}
public float calcPerformanceScore(float f, int i, int i2, int i3) {
Log.i(TAG, "calcPerformanceScore(" + f + ", " + i + ", " + i2 + ", " + i3 + ")");
float f2 = f * 0.001f;
float f3 = (3.0f * f2) + 0.0f;
if (i > 1) {
f3 += f2 * (Math.min(i, 4) - 1) * 0.5f;
}
double d = 0.0f;
double sqrt = Math.sqrt(i2 * i3) * 0.0010000000474974513d * 0.5d;
Double.isNaN(d);
float f4 = (float) (d + sqrt);
try {
Log.i(TAG, new BufferedReader(new FileReader(new File("/proc/cpuinfo"))).readLine());
} catch (IOException e) {
e.printStackTrace();
}
Log.i(TAG, Build.MODEL);
return ((f3 + 1.0f) / (f4 + 1.0f)) * 0.33333334f;
return 6.6f;
}
public boolean needInstallWallpaper() {
@@ -1213,145 +1053,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
return false;
}
/* JADX WARN: Code restructure failed: missing block: B:15:0x0068, code lost:
if (r3 != null) goto L13;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x006a, code lost:
r3.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x0099, code lost:
if (r3 != null) goto L13;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void installWallpaper() {
/*
r12 = this;
android.content.Intent r0 = new android.content.Intent
java.lang.String r1 = "android.intent.action.VIEW"
r0.<init>(r1)
java.lang.String r1 = new java.lang.String
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
java.io.File r3 = android.os.Environment.getExternalStorageDirectory()
java.lang.String r3 = r3.getAbsolutePath()
r2.append(r3)
java.lang.String r3 = "/published/wallpaper/"
r2.append(r3)
java.lang.String r2 = r2.toString()
r1.<init>(r2)
r2 = 0
java.io.File r3 = new java.io.File // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
r3.<init>(r1) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
r3.mkdirs() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
android.content.res.Resources r3 = r12.getResources() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
r4 = 2131427328(0x7f0b0000, float:1.847627E38)
android.content.res.AssetFileDescriptor r3 = r3.openRawResourceFd(r4) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
java.io.File r4 = new java.io.File // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
java.lang.String r5 = "wallpaper.apk"
r4.<init>(r1, r5) // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
r4.createNewFile() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
java.io.FileInputStream r5 = r3.createInputStream() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
java.nio.channels.FileChannel r5 = r5.getChannel() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
java.io.FileOutputStream r6 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
r6.<init>(r4) // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
java.nio.channels.FileChannel r4 = r6.getChannel() // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
r8 = 0
long r10 = r3.getLength() // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
r6 = r4
r7 = r5
r6.transferFrom(r7, r8, r10) // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
if (r4 == 0) goto L63
r4.close() // Catch: java.io.IOException -> L9c
L63:
if (r5 == 0) goto L68
r5.close() // Catch: java.io.IOException -> L9c
L68:
if (r3 == 0) goto L9c
L6a:
r3.close() // Catch: java.io.IOException -> L9c
goto L9c
L6e:
r0 = move-exception
r2 = r4
goto L7d
L71:
r2 = r4
goto L8f
L73:
r0 = move-exception
goto L7d
L75:
r0 = move-exception
r5 = r2
goto L7d
L78:
r5 = r2
goto L8f
L7a:
r0 = move-exception
r3 = r2
r5 = r3
L7d:
if (r2 == 0) goto L82
r2.close() // Catch: java.io.IOException -> L8c
L82:
if (r5 == 0) goto L87
r5.close() // Catch: java.io.IOException -> L8c
L87:
if (r3 == 0) goto L8c
r3.close() // Catch: java.io.IOException -> L8c
L8c:
throw r0
L8d:
r3 = r2
r5 = r3
L8f:
if (r2 == 0) goto L94
r2.close() // Catch: java.io.IOException -> L9c
L94:
if (r5 == 0) goto L99
r5.close() // Catch: java.io.IOException -> L9c
L99:
if (r3 == 0) goto L9c
goto L6a
L9c:
java.io.File r2 = new java.io.File
java.lang.StringBuilder r3 = new java.lang.StringBuilder
r3.<init>()
r3.append(r1)
java.lang.String r1 = "wallpaper.apk"
r3.append(r1)
java.lang.String r1 = r3.toString()
r2.<init>(r1)
android.net.Uri r1 = android.net.Uri.fromFile(r2)
java.lang.String r2 = "application/vnd.android.package-archive"
r0.setDataAndType(r1, r2)
r12.startActivity(r0)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.installWallpaper():void");
}
public void onDownloadEvent(int i) {
String str = getApplicationInfo().dataDir + "/files/var1/adcEvents";
long currentTimeMillis = System.currentTimeMillis();
Log.i(TAG, "GetADCTelemetry: eventId= " + i + " eventTime=" + currentTimeMillis + " fileName=" + str);
byte[] bArr = {(byte) ((i >> 24) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 8) & 255), (byte) (i & 255), (byte) ((int) ((currentTimeMillis >> 56) & 255)), (byte) ((int) ((currentTimeMillis >> 48) & 255)), (byte) ((int) ((currentTimeMillis >> 40) & 255)), (byte) ((int) ((currentTimeMillis >> 32) & 255)), (byte) ((int) ((currentTimeMillis >> 24) & 255)), (byte) ((int) ((currentTimeMillis >> 16) & 255)), (byte) ((int) ((currentTimeMillis >> 8) & 255)), (byte) ((int) (currentTimeMillis & 255))};
Log.i(TAG, "Write adcEvents file");
try {
FileOutputStream fileOutputStream = new FileOutputStream(new File(str), true);
fileOutputStream.write(bArr, 0, 12);
fileOutputStream.close();
} catch (Exception unused) {
Log.i(TAG, "Can't save adcEvents file");
}
}
public void installWallpaper() {}
public long getUtcTime() {
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
@@ -1,49 +0,0 @@
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();
}
}
@@ -1,489 +0,0 @@
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();
}
}
}
@@ -1,7 +1,6 @@
package com.ea.ironmonkey;
import android.content.Context;
import com.google.android.vending.expansion.downloader.Helpers;
/* loaded from: classes.dex */
class ObbHelper {
@@ -9,6 +8,6 @@ class ObbHelper {
}
public static String getObbFileName(Context context, int i) {
return Helpers.getExpansionAPKFileName(context, true, i);
return "main." + i + "." + context.getPackageName() + ".obb";
}
}
@@ -1,44 +1,39 @@
package com.ea.ironmonkey;
import static android.os.Build.VERSION_CODES.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
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;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
/* 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();
}
checkPermissions();
}
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;
}
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
showPermissionDialog(false);
} else {
requestSecurityPermissions();
}
initActivity();
return;
}
initActivity();
return;
}
@Override // android.app.Activity
@@ -54,50 +49,41 @@ public class PermissionsActivity extends Activity {
}
private void showPermissionDialog(final boolean z) {
Context context = this;
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.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("DIALOG");
builder.setPositiveButton("OK", (dialogInterface, i) -> {
if (!z) {
PermissionsActivity.this.requestSecurityPermissions();
return;
}
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + PermissionsActivity.this.getPackageName()));
PermissionsActivity.this.startActivityForResult(intent, 3);
});
builder.setNegativeButton("DIALOG", (dialogInterface, 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();
create.setOnKeyListener((dialogInterface, i, 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);
ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 3);
}
@Override // android.app.Activity
@@ -110,7 +96,9 @@ public class PermissionsActivity extends 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) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0
&& ContextCompat.checkSelfPermission(this, "android.permission.READ_EXTERNAL_STORAGE") == 0
) {
initActivity();
return;
} else {
@@ -123,7 +111,7 @@ public class PermissionsActivity extends Activity {
private void initActivity() {
try {
startActivity(new Intent(this, (Class<?>) ObbActivity.class));
startActivity(new Intent(this, GameActivityMain.class));
finish();
} catch (Exception e) {
e.printStackTrace();
@@ -1,8 +0,0 @@
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};
}
@@ -5,6 +5,9 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import java.io.IOException;
import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -14,7 +17,6 @@ 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;
@@ -23,149 +25,231 @@ public class SplashScreen {
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 final String vShaderStr =
"attribute vec4 a_position; \n" +
"attribute vec2 a_texCoord; \n" +
"varying vec2 v_texCoord; \n" +
"void main() { \n" +
" gl_Position = a_position; \n" +
" v_texCoord = a_texCoord; \n" +
"} \n";
// Фрагментный шейдер
private final String fShaderStr =
"precision mediump float; \n" +
"varying vec2 v_texCoord; \n" +
"uniform sampler2D s_texture; \n" +
"void main() { \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;
public void init(GL10 gl10, int width, int height) {
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;
// Загрузка текстуры
GLES20.glGenTextures(1, _textureId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, _textureId[0]);
// Установка параметров текстуры
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
// Загрузка изображения
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options);
} catch (Exception e) {
Log.e(TAG, "loadBitmap ", e);
bitmap = null;
InputStream is = _activity.getAssets().open("splash.png");
bitmap = BitmapFactory.decodeStream(is);
} catch (IOException e) {
Log.e(TAG, "Could not load bitmap", e);
}
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);
if (bitmap != null) {
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
} else {
Log.e(TAG, "Failed to load bitmap");
destroy(gl10);
return;
}
// Проверка ошибок
int error = GLES20.glGetError();
if (error != GLES20.GL_NO_ERROR) {
Log.e(TAG, "Texture Load GLError: " + error);
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");
// Загрузка шейдеров
_vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vShaderStr);
_fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fShaderStr);
// Создание программы
_program = GLES20.glCreateProgram();
if (_program == 0) {
Log.e(TAG, "Failed to create program");
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;
// Прикрепление шейдеров
GLES20.glAttachShader(_program, _vertexShader);
GLES20.glAttachShader(_program, _fragmentShader);
// Линковка программы
GLES20.glLinkProgram(_program);
// Проверка статуса линковки
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(_program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: " + GLES20.glGetProgramInfoLog(_program));
GLES20.glDeleteProgram(_program);
_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");
// Получение атрибутов
_attPosition = GLES20.glGetAttribLocation(_program, "a_position");
_attTexCoord = GLES20.glGetAttribLocation(_program, "a_texCoord");
_attSampler = GLES20.glGetUniformLocation(_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");
private int loadShader(int type, String shaderCode) {
int shader = GLES20.glCreateShader(type);
if (shader == 0) {
Log.e(TAG, "Failed to create shader");
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;
GLES20.glShaderSource(shader, shaderCode);
GLES20.glCompileShader(shader);
// Проверка статуса компиляции
int[] compiled = new int[1];
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
if (compiled[0] == 0) {
Log.e(TAG, "Could not compile shader: " + GLES20.glGetShaderInfoLog(shader));
GLES20.glDeleteShader(shader);
return 0;
}
Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n");
GLES20.glDeleteShader(glCreateShader);
Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader));
return 0;
return shader;
}
public boolean draw(GL10 gl10, int i, int i2) {
float f;
if (this._textureId[0] == 0) {
public boolean draw(GL10 gl10, int width, int height) {
if (_textureId[0] == 0 || _program == 0) {
return false;
}
float f2 = 0.8f;
if (i > i2) {
f2 = (i2 / i) * 0.8f;
f = 0.8f;
// Расчет координат с уменьшением на 20%
float ratio = (float) width / height;
float imageRatio = 1.0f; // Предполагаем квадратное изображение
float scaleX, scaleY;
if (ratio > imageRatio) {
// Шире, чем изображение
scaleY = 0.8f; // Уменьшаем на 20%
scaleX = imageRatio / ratio * 0.8f;
} else {
f = (i / i2) * 0.8f;
// Уже, чем изображение
scaleX = 0.8f; // Уменьшаем на 20%
scaleY = ratio / imageRatio * 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);
// Координаты вершин и текстур
float[] vertices = {
-scaleX, -scaleY, 0.0f, // нижний левый
scaleX, -scaleY, 0.0f, // нижний правый
-scaleX, scaleY, 0.0f, // верхний левый
scaleX, scaleY, 0.0f // верхний правый
};
float[] texCoords = {
0.0f, 1.0f, // нижний левый
1.0f, 1.0f, // нижний правый
0.0f, 0.0f, // верхний левый
1.0f, 0.0f // верхний правый
};
// Создание буферов
ByteBuffer bb = ByteBuffer.allocateDirect(vertices.length * 4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer vertexBuffer = bb.asFloatBuffer();
vertexBuffer.put(vertices);
vertexBuffer.position(0);
bb = ByteBuffer.allocateDirect(texCoords.length * 4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer texBuffer = bb.asFloatBuffer();
texBuffer.put(texCoords);
texBuffer.position(0);
// Отрисовка с белым фоном
GLES20.glViewport(0, 0, width, height);
GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // Белый цвет
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glUseProgram(_program);
// Передача вершин
GLES20.glVertexAttribPointer(_attPosition, 3, GLES20.GL_FLOAT, false, 0, vertexBuffer);
GLES20.glEnableVertexAttribArray(_attPosition);
// Передача текстурных координат
GLES20.glVertexAttribPointer(_attTexCoord, 2, GLES20.GL_FLOAT, false, 0, texBuffer);
GLES20.glEnableVertexAttribArray(_attTexCoord);
// Активация текстуры
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, _textureId[0]);
GLES20.glUniform1i(_attSampler, 0);
// Отрисовка
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
// Отключение атрибутов
GLES20.glDisableVertexAttribArray(_attPosition);
GLES20.glDisableVertexAttribArray(_attTexCoord);
return true;
}
public void destroy(GL10 gl10) {
if (this._textureId[0] != 0) {
GLES20.glDeleteTextures(1, this._textureId, 0);
this._textureId[0] = 0;
if (_textureId[0] != 0) {
GLES20.glDeleteTextures(1, _textureId, 0);
_textureId[0] = 0;
}
if (this._program != 0) {
GLES20.glDeleteProgram(this._program);
this._program = 0;
if (_program != 0) {
GLES20.glDeleteProgram(_program);
_program = 0;
}
if (this._vertexShader != 0) {
GLES20.glDeleteShader(this._vertexShader);
this._vertexShader = 0;
if (_vertexShader != 0) {
GLES20.glDeleteShader(_vertexShader);
_vertexShader = 0;
}
if (this._fragmentShader != 0) {
GLES20.glDeleteShader(this._fragmentShader);
this._fragmentShader = 0;
if (_fragmentShader != 0) {
GLES20.glDeleteShader(_fragmentShader);
_fragmentShader = 0;
}
if (this.vBuffer != null) {
this.vBuffer.clear();
this.vBuffer = null;
if (vBuffer != null) {
vBuffer.clear();
vBuffer = null;
}
}
}
@@ -1,149 +0,0 @@
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);
}
}
@@ -53,7 +53,6 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
private String m_packageId;
private Map<String, String> m_parameters;
private Map<String, String> m_playerIdMap;
private InstallReferrerClient m_referrerClient;
private String m_version;
private String m_advertisingId = null;
private boolean m_limitAdTrackingEnabled = true;
@@ -108,14 +107,7 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Utility.safeString(Locale.getDefault().toString()));
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_COUNTRY_CODE, Utility.safeString(Locale.getDefault().getCountry()));
PackageManager packageManager = this.m_context.getPackageManager();
if (packageManager != null && packageManager.checkPermission("android.permission.READ_PHONE_STATE", this.m_context.getPackageName()) == 0) {
TelephonyManager telephonyManager = (TelephonyManager) this.m_context.getSystemService(PlaceFields.PHONE);
if (telephonyManager != null) {
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_IMEI, Utility.safeString(telephonyManager.getDeviceId()));
} else {
Log.Helper.LOGE(this, "Could not retrieve telephony service", new Object[0]);
}
}
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_IMEI, "");
try {
Cursor query = this.m_context.getContentResolver().query(Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider"), null, null, null, null);
if (query != null) {
@@ -341,16 +333,6 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
@Override // com.ea.nimble.IApplicationEnvironment
public String getCarrier() {
Log.Helper.LOGPUBLICFUNC(this);
Context applicationContext = getApplicationContext();
if (applicationContext == null) {
return null;
}
TelephonyManager telephonyManager = (TelephonyManager) applicationContext.getSystemService(PlaceFields.PHONE);
if (telephonyManager != null) {
return telephonyManager.getNetworkOperator();
}
Log.Helper.LOGE(this, "Could not retrieve telephony service", new Object[0]);
return null;
}
@@ -419,23 +401,7 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
@Override // com.ea.nimble.IApplicationEnvironment
public String getGoogleEmail() {
Log.Helper.LOGPUBLICFUNC(this);
AccountManager accountManager = AccountManager.get(getApplicationContext());
if (accountManager == null) {
Log.Helper.LOGE(this, "Could not get Account Manager", new Object[0]);
return null;
}
Account[] accountsByType = accountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
if (accountsByType.length > 0) {
return accountsByType[0].name;
}
Pattern pattern = Patterns.EMAIL_ADDRESS;
for (Account account : accountManager.getAccounts()) {
if (pattern.matcher(account.name).matches()) {
return account.name;
}
}
return null;
return "hehe@gmial.com";
}
@Override // com.ea.nimble.IApplicationEnvironment
@@ -517,32 +483,7 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.3
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
HashMap hashMap = new HashMap();
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
Map<String, Object> jsonData = synergyNetworkConnectionHandle.getResponse().getJsonData();
Integer num = (Integer) jsonData.get("code");
if (num != null && num.intValue() > 0) {
String str = (String) jsonData.get(ShareConstants.WEB_DIALOG_PARAM_MESSAGE);
Log.Helper.LOGD(this, "LOG_CALLBACK_ERROR : %s", str);
hashMap.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "0");
hashMap.put("error", new Exception(str));
} else {
int intValue = ((Integer) ((Map) jsonData.get("agerequirements")).get("minLegalRegAge")).intValue();
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
persistenceForNimbleComponent.setValue(ApplicationEnvironmentImpl.PERSISTENCE_TIME_RETRIEVED, Long.valueOf(new Date().getTime()));
persistenceForNimbleComponent.setValue(ApplicationEnvironmentImpl.PERSISTENCE_AGE_REQUIREMENTS, Integer.valueOf(intValue));
} else {
Log.Helper.LOGE(this, "Could not get persistence object", new Object[0]);
}
hashMap.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "1");
}
} else {
Log.Helper.LOGD(this, "LOG_CALLBACK_ERROR : %s", synergyNetworkConnectionHandle.getResponse().getError().getMessage());
hashMap.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "0");
hashMap.put("error", synergyNetworkConnectionHandle.getResponse().getError());
}
Utility.sendBroadcastSerializable(ApplicationEnvironment.NOTIFICATION_AGE_COMPLIANCE_REFRESHED, hashMap);
}
};
SynergyNetwork.getComponent().sendRequest(new SynergyRequest(SYNERGY_API_GET_AGE_REQUIREMENTS, IHttpRequest.Method.GET, synergyRequestPreparingCallback), synergyNetworkConnectionCallback);
@@ -618,222 +559,6 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
private void retrieveAdvertisingIdImpl(IApplicationEnvironment.AdvertisingIdCalback advertisingIdCalback) {
Log.Helper.LOGFUNC(this);
try {
Class.forName("com.google.android.gms.common.GooglePlayServicesNotAvailableException");
synchronized (this) {
if (this.m_advertisingIdCallbacks != null) {
if (advertisingIdCalback != null) {
this.m_advertisingIdCallbacks.add(advertisingIdCalback);
}
return;
}
this.m_advertisingIdCallbacks = new ArrayList();
if (advertisingIdCalback != null) {
this.m_advertisingIdCallbacks.add(advertisingIdCalback);
}
try {
new Thread(new Runnable() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.4
@Override // java.lang.Runnable
public void run() {
List list;
List list2;
List list3;
List list4;
List list5;
List list6;
List list7;
ApplicationEnvironmentImpl applicationEnvironmentImpl = ApplicationEnvironmentImpl.this;
Log.Helper.LOGV(applicationEnvironmentImpl, "Running thread to get Google Advertising ID", new Object[0]);
String str = ApplicationEnvironmentImpl.this.m_advertisingId;
boolean z = ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled;
try {
try {
if (ApplicationEnvironment.getCurrentActivity() != null) {
AdvertisingIdClient.Info advertisingIdInfo = (!ApplicationEnvironment.isMainApplicationRunning() || ApplicationEnvironment.getCurrentActivity() == null) ? null : AdvertisingIdClient.getAdvertisingIdInfo(ApplicationEnvironment.getCurrentActivity());
if (advertisingIdInfo != null) {
Log.Helper.LOGD(applicationEnvironmentImpl, "Setting values for Google Advertising ID and isLimitAdTrackingEnabled flag", new Object[0]);
String id = advertisingIdInfo.getId();
try {
z = advertisingIdInfo.isLimitAdTrackingEnabled();
str = id;
} catch (GooglePlayServicesNotAvailableException unused) {
str = id;
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Google Play Services not available on this device", new Object[0]);
synchronized (applicationEnvironmentImpl) {
list6 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list6 != null) {
Iterator it = list6.iterator();
while (it.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it.next()).onCallback(str, z);
}
return;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (GooglePlayServicesRepairableException unused2) {
str = id;
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Recoverable error connecting to Google Play Services", new Object[0]);
synchronized (applicationEnvironmentImpl) {
list5 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list5 != null) {
Iterator it2 = list5.iterator();
while (it2.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it2.next()).onCallback(str, z);
}
return;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (IOException unused3) {
str = id;
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Unrecoverable error connecting to Google Play Services", new Object[0]);
synchronized (applicationEnvironmentImpl) {
list4 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list4 != null) {
Iterator it3 = list4.iterator();
while (it3.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it3.next()).onCallback(str, z);
}
return;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (IllegalStateException e) {
e = e;
str = id;
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - Illegal State Exception " + e.getMessage(), new Object[0]);
synchronized (applicationEnvironmentImpl) {
list3 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list3 != null) {
Iterator it4 = list3.iterator();
while (it4.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it4.next()).onCallback(str, z);
}
return;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (Exception e2) {
e = e2;
str = id;
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - General Exception " + e.getMessage(), new Object[0]);
synchronized (applicationEnvironmentImpl) {
list2 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list2 != null) {
Iterator it5 = list2.iterator();
while (it5.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it5.next()).onCallback(str, z);
}
return;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (Throwable th) {
th = th;
str = id;
synchronized (applicationEnvironmentImpl) {
list = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list != null) {
Iterator it6 = list.iterator();
while (it6.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it6.next()).onCallback(str, z);
}
} else {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
}
throw th;
}
} else {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID - AdvertisingIdInfo is null", new Object[0]);
}
} else {
Log.Helper.LOGW(applicationEnvironmentImpl, "Cannot get Google Advertising ID because there is no current activity", new Object[0]);
}
synchronized (applicationEnvironmentImpl) {
list7 = ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks;
ApplicationEnvironmentImpl.this.m_advertisingId = str;
ApplicationEnvironmentImpl.this.m_limitAdTrackingEnabled = z;
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_GAID, Utility.safeString(str));
ApplicationEnvironmentImpl.this.m_parameters.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
ApplicationEnvironmentImpl.this.m_advertisingIdCallbacks = null;
}
if (list7 != null) {
Iterator it7 = list7.iterator();
while (it7.hasNext()) {
((IApplicationEnvironment.AdvertisingIdCalback) it7.next()).onCallback(str, z);
}
return;
}
} catch (GooglePlayServicesNotAvailableException unused4) {
} catch (GooglePlayServicesRepairableException unused5) {
} catch (IOException unused6) {
} catch (IllegalStateException e3) {
e = e3;
} catch (Exception e4) {
e = e4;
}
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after refreshing advertising ID, something is wrong", new Object[0]);
} catch (Throwable th2) {
th = th2;
}
}
}).start();
} catch (Throwable unused) {
Log.Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported", new Object[0]);
synchronized (this) {
this.m_advertisingId = "";
boolean z = this.m_limitAdTrackingEnabled;
List<IApplicationEnvironment.AdvertisingIdCalback> list = this.m_advertisingIdCallbacks;
this.m_advertisingIdCallbacks = null;
if (list == null) {
Log.Helper.LOGW(this, "m_advertisingIdCallbacks was null after trying to refresh advertising ID, something is wrong", new Object[0]);
return;
}
Iterator<IApplicationEnvironment.AdvertisingIdCalback> it = list.iterator();
while (it.hasNext()) {
it.next().onCallback("", z);
}
}
}
}
} catch (ClassNotFoundException unused2) {
Log.Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not using google play services", new Object[0]);
this.m_advertisingId = "";
if (advertisingIdCalback != null) {
advertisingIdCalback.onCallback(this.m_advertisingId, this.m_limitAdTrackingEnabled);
}
}
}
@Override // com.ea.nimble.IApplicationEnvironment
@@ -904,32 +629,7 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
@Override // com.ea.nimble.IApplicationEnvironment
public void requestSafetyNetAttestation(byte[] bArr, final IApplicationEnvironment.SafetyNetAttestationCallback safetyNetAttestationCallback) {
Log.Helper.LOGPUBLICFUNC(this);
try {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getCurrentActivity()) != 0) {
Log.Helper.LOGW(this, "Skipping SafetyNet Attestation as Google Play Services is not available", new Object[0]);
safetyNetAttestationCallback.onCallback(null, new Error(Error.Code.NOT_AVAILABLE, "Google Play Services is not available"));
return;
}
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString("com.ea.nimble.safetynet_api_key", null);
if (configValueAsString == null) {
Log.Helper.LOGW(this, "Skipping SafetyNet Attestation since 'com.ea.nimble.safetynet_api_key' was not found in manifest", new Object[0]);
safetyNetAttestationCallback.onCallback(null, new Error(Error.Code.NOT_AVAILABLE, "Safety Net API key not found"));
} else {
SafetyNet.getClient(getCurrentActivity()).attest(bArr, configValueAsString).addOnSuccessListener(getCurrentActivity(), new OnSuccessListener<SafetyNetApi.AttestationResponse>() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.6
public void onSuccess(SafetyNetApi.AttestationResponse attestationResponse) {
safetyNetAttestationCallback.onCallback(attestationResponse.getJwsResult(), null);
}
}).addOnFailureListener(getCurrentActivity(), new OnFailureListener() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.5
public void onFailure(@NonNull Exception exc) {
safetyNetAttestationCallback.onCallback(null, new Error(Error.Code.UNKNOWN, String.format("SafetyNet Attest Request failed\nCause:%s", exc.getMessage()), exc));
}
});
}
} catch (Exception e) {
Log.Helper.LOGW(this, "Skipping SafetyNet Attestation due to exception\nCause:%s", e.getMessage());
safetyNetAttestationCallback.onCallback(null, new Error(Error.Code.NOT_AVAILABLE, String.format("Skipping SafetyNet Attestation due to exception\nCause:%s", e.getMessage()), e));
}
}
/* JADX INFO: Access modifiers changed from: private */
@@ -954,128 +654,6 @@ public class ApplicationEnvironmentImpl extends Component implements IApplicatio
}
};
Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_attributionDataNetworkListener);
} else {
try {
this.m_referrerClient = InstallReferrerClient.newBuilder(this.m_context).build();
this.m_referrerClient.startConnection(new InstallReferrerStateListener() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.8
/* JADX WARN: Unreachable blocks removed: 2, instructions: 3 */
/* JADX WARN: Unreachable blocks removed: 2, instructions: 4 */
@Override // com.android.installreferrer.api.InstallReferrerStateListener
public void onInstallReferrerSetupFinished(int i) {
long j;
String str;
String str2;
String str3;
long j2;
String str4;
long referrerClickTimestampSeconds;
String str5;
long j3;
String str6;
switch (i) {
case 0:
try {
ReferrerDetails installReferrer = ApplicationEnvironmentImpl.this.m_referrerClient.getInstallReferrer();
String installReferrer2 = installReferrer.getInstallReferrer();
try {
j = installReferrer.getInstallBeginTimestampSeconds();
try {
str4 = installReferrer2;
referrerClickTimestampSeconds = installReferrer.getReferrerClickTimestampSeconds();
str5 = "ok";
j3 = j;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str5, str4, j3, referrerClickTimestampSeconds);
} catch (Exception e) {
e = e;
j2 = j;
str3 = installReferrer2;
try {
Log.Helper.LOGW(this, "requestAttributionData(): Failed with exception.\n" + e.toString(), new Object[0]);
String exc = e.toString();
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(exc, str3, j2, 0L);
return;
} catch (Throwable th) {
th = th;
str = "ok";
str2 = str3;
j = j2;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str, str2, j, 0L);
throw th;
}
} catch (Throwable th2) {
th = th2;
str = "ok";
str2 = installReferrer2;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str, str2, j, 0L);
throw th;
}
} catch (Exception e2) {
e = e2;
str3 = installReferrer2;
j2 = 0;
Log.Helper.LOGW(this, "requestAttributionData(): Failed with exception.\n" + e.toString(), new Object[0]);
String exc2 = e.toString();
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(exc2, str3, j2, 0L);
return;
} catch (Throwable th3) {
th = th3;
j = 0;
}
} catch (Exception e3) {
e = e3;
str3 = "";
} catch (Throwable th4) {
th = th4;
j = 0;
str = "ok";
str2 = "";
}
case 1:
str6 = "SERVICE_UNAVAILABLE";
break;
case 2:
str6 = "FEATURE_NOT_SUPPORTED";
break;
case 3:
str6 = "DEVELOPER_ERROR";
break;
default:
str4 = "";
j3 = 0;
referrerClickTimestampSeconds = 0;
str5 = "";
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str5, str4, j3, referrerClickTimestampSeconds);
}
str4 = "";
j3 = 0;
referrerClickTimestampSeconds = 0;
str5 = str6;
ApplicationEnvironmentImpl.this.m_referrerClient.endConnection();
ApplicationEnvironmentImpl.this.m_referrerClient = null;
ApplicationEnvironmentImpl.this.setAttributionData(str5, str4, j3, referrerClickTimestampSeconds);
}
@Override // com.android.installreferrer.api.InstallReferrerStateListener
public void onInstallReferrerServiceDisconnected() {
Log.Helper.LOGV(this, "requestAttributionData(): Google Play Install Referrer client disconnected.", new Object[0]);
}
});
} catch (Exception e) {
Log.Helper.LOGW(this, "requestAttributionData(): Failed to start Install Referrer connection.\n", e.toString());
setAttributionData(e.getMessage(), "", 0L, 0L);
}
}
}
+5 -100
View File
@@ -9,6 +9,7 @@ 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.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
@@ -108,7 +109,7 @@ class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
if (identifier == 0) {
return null;
}
return Utility.parseXmlFile(identifier);
return new HashMap<>();
}
public ComponentManager getComponentManager() {
@@ -220,31 +221,7 @@ class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
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;
}
}
});
new Handler(Looper.getMainLooper()).post(() -> {});
}
}
@@ -341,82 +318,10 @@ class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
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");
return true;
}
public boolean isActive() {
Log.Helper.LOGPUBLICFUNCS("BaseCore");
return this.m_state == State.AUTO_SETUP || this.m_state == State.MANUAL_SETUP;
return false;
}
}
@@ -1,12 +1,11 @@
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 {
@@ -50,7 +49,7 @@ public class EASPDataLoader {
byte[] bArr = new byte[i];
byteBuffer.get(bArr, 0, i);
try {
str = new String(bArr, HTTP.UTF_8);
str = new String(bArr);
try {
Log.Helper.LOGDS("Legacy", "Read string (%s)", str);
} catch (Exception e) {
@@ -59,7 +58,6 @@ public class EASPDataLoader {
return str;
}
} catch (Exception e2) {
e = e2;
str = null;
}
return str;
+90 -337
View File
@@ -3,384 +3,137 @@ 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.Collections;
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
@Override
public String getComponentId() {
return "com.ea.nimble.facebook";
return "";
}
@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
@Override
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
@Override
public boolean onBackPressed() {
return false;
}
@Override
public void onNewIntent(Activity activity, Intent intent) {
}
@Override
public void onWindowFocusChanged(boolean z) {
}
@Override
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
public void onActivityDestroyed(Activity activity) {
}
@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);
}
@Override
public void onActivityPaused(Activity activity) {
}
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
public void onActivityResumed(Activity activity) {
}
@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
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@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
public void onActivityStarted(Activity activity) {
}
@Override // com.ea.nimble.IFacebook
public boolean hasOpenSession() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
return (currentAccessToken == null || currentAccessToken.isExpired()) ? false : true;
@Override
public void onActivityStopped(Activity activity) {
}
@Override // com.ea.nimble.IFacebook
@Override
public String getAccessToken() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return currentAccessToken.getToken();
}
return null;
return "";
}
@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
@Override
public String getApplicationId() {
Log.Helper.LOGPUBLICFUNC(this);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
return currentAccessToken.getApplicationId();
}
return "";
}
@Override
public Map<String, Object> getGraphUser() {
return Collections.emptyMap();
}
@Override
public List<String> getPermissions() {
return Collections.emptyList();
}
@Override
public Date getTokenExpirationDate() {
return null;
}
@Override // com.ea.nimble.IFacebook
@Override
public boolean hasOpenSession() {
return false;
}
@Override
public void login(List<String> list, RequestCallback requestCallback) {
}
@Override
public void logout() {
}
@Override
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
public void requestFriends(HashMap<String, String> hashMap, RequestCallback requestCallback) {
}
@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);
}
});
@Override
public void requestUserInfo(HashMap<String, String> hashMap, RequestCallback requestCallback) {
}
@Override
public void retrieveFriends(int i, int i2, FacebookFriendsCallback facebookFriendsCallback) {
}
@Override
public String getLogSourceTitle() {
return "";
}
}
@@ -4,6 +4,7 @@ import com.ea.nimble.IHttpRequest;
import com.ea.nimble.Log;
import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.util.EnumSet;
import java.util.HashMap;
/* loaded from: classes.dex */
@@ -43,6 +44,11 @@ public class HttpRequest implements IHttpRequest {
return this.method;
}
@Override
public EnumSet<OverwritePolicy> getOverwritePolicy() {
return null;
}
@Override // com.ea.nimble.IHttpRequest
public byte[] getData() {
Log.Helper.LOGPUBLICFUNC(this);
+5 -6
View File
@@ -2,8 +2,6 @@ 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;
@@ -17,7 +15,8 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import org.apache.http.HttpHeaders;
import org.apache.http.protocol.HTTP;
import kotlin.text.Charsets;
/* loaded from: classes.dex */
public class LogImpl extends Component implements ILog {
@@ -48,7 +47,7 @@ public class LogImpl extends Component implements ILog {
@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) {
if (LogImpl.this.m_filePath == null || LogImpl.this.m_filePath.length() <= LogImpl.this.m_sizeLimit) {
return;
}
LogImpl.this.clearLog();
@@ -451,10 +450,10 @@ public class LogImpl extends Component implements ILog {
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.write((this.m_format.format(new Date()) + " " + str + property).getBytes());
this.m_logFileStream.flush();
} catch (IOException e) {
android.util.Log.e(Global.NIMBLE_ID, "Error writing to log file: " + e.toString());
android.util.Log.e(Global.NIMBLE_ID, "Error writing to log file: " + e);
}
}
}
+2 -32
View File
@@ -6,7 +6,6 @@ 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 {
@@ -38,37 +37,8 @@ public class 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);
return null;
}
public static URL generateURL(String str, Map<String, String> map) {
@@ -16,8 +16,6 @@ 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;
@@ -145,219 +143,6 @@ class NetworkConnection implements NetworkConnectionHandle, Runnable, LogSource
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() {
@@ -390,18 +175,13 @@ class NetworkConnection implements NetworkConnectionHandle, Runnable, LogSource
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 -->";
}
str = this.m_request.data.toString();
} 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);
@@ -421,11 +201,7 @@ class NetworkConnection implements NetworkConnectionHandle, Runnable, LogSource
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;
}
this.m_responseDataForLog.append(new String(bArr, i, i2));
}
private String multiplyStringNTimes(String str, int i) {
@@ -65,9 +65,6 @@ public class NetworkImpl extends Component implements INetwork, LogSource {
@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);
}
}
}
@@ -2,6 +2,8 @@ package com.ea.nimble;
import com.ea.nimble.Log;
import org.apache.http.BuildConfig;
/* loaded from: classes.dex */
public enum NimbleConfiguration {
UNKNOWN,
@@ -22,7 +24,7 @@ public enum NimbleConfiguration {
if (str.equals("live")) {
return LIVE;
}
if (str.equals(com.ea.games.nfs13.BuildConfig.FLAVOR)) {
if (str.equals(BuildConfig.FLAVOR)) {
return CUSTOMIZED;
}
if (str.equals("manual")) {
@@ -41,7 +43,7 @@ public enum NimbleConfiguration {
case LIVE:
return "live";
case CUSTOMIZED:
return com.ea.games.nfs13.BuildConfig.FLAVOR;
return BuildConfig.FLAVOR;
case MANUAL:
return "manual";
default:
@@ -1,19 +1,9 @@
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 {
@@ -22,42 +12,7 @@ public class NimbleLocalNotificationReceiver extends BroadcastReceiver {
@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) {
@@ -1,24 +1,9 @@
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;
@@ -65,7 +50,7 @@ public class NimbleLocalNotificationsImpl extends Component implements INimbleLo
}
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY)) {
return;
}
@@ -73,7 +58,7 @@ public class NimbleLocalNotificationsImpl extends Component implements INimbleLo
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);
NotificationChannel notificationChannel = new NotificationChannel(Global.NOTIFICATION_CHANNEL_DEFAULT_ID, str, NotificationManager.IMPORTANCE_DEFAULT);
if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY)) {
notificationChannel.setDescription(applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY)));
}
@@ -83,71 +68,7 @@ public class NimbleLocalNotificationsImpl extends Component implements INimbleLo
@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;
}
@@ -161,30 +82,7 @@ public class NimbleLocalNotificationsImpl extends Component implements INimbleLo
@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
@@ -211,79 +109,11 @@ public class NimbleLocalNotificationsImpl extends Component implements INimbleLo
@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");
return new Error(Error.Code.NOT_AVAILABLE, "setBadgeCount() hehe");
}
@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;
}
@@ -14,6 +14,7 @@ import java.io.InvalidClassException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -289,7 +290,7 @@ public class Persistence implements LogSource {
return;
}
clearSynchronizeTimer();
savePersistenceData();
//savePersistenceData();
if (this.m_backUp) {
new BackupManager(ApplicationEnvironment.getComponent().getApplicationContext()).dataChanged();
}
@@ -328,8 +329,8 @@ public class Persistence implements LogSource {
private void loadPersistenceData(boolean z, Context context) {
String persistencePath;
FileInputStream fileInputStream;
ObjectInputStream objectInputStream;
FileInputStream fileInputStream = null;
ObjectInputStream objectInputStream = null;
ObjectInputStream objectInputStream2;
Log.Helper.LOGFUNC(this);
if (context == null) {
@@ -373,11 +374,9 @@ public class Persistence implements LogSource {
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");
@@ -397,7 +396,9 @@ public class Persistence implements LogSource {
}
objectInputStream.close();
fileInputStream.close();
} catch (IOException unused2) {
} catch (IOException ignored) {
} catch (ClassNotFoundException | GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
@@ -449,7 +450,7 @@ public class Persistence implements LogSource {
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) {
static File getPersistenceDirectory(Storage r6, Context r7) {
/*
int[] r0 = com.ea.nimble.Persistence.AnonymousClass2.$SwitchMap$com$ea$nimble$Persistence$Storage
int r1 = r6.ordinal()
@@ -100,17 +100,7 @@ public class PersistenceService {
} 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()) {
@@ -1,9 +1,5 @@
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;
@@ -57,7 +53,7 @@ public class PersistenceServiceImpl extends Component implements IPersistenceSer
return loadPersistenceById;
}
Persistence persistence = new Persistence(str, storage, this.m_encryptor);
this.m_persistences.put(str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString(), persistence);
this.m_persistences.put(str + "-" + storage.toString(), persistence);
return persistence;
}
}
@@ -80,7 +76,7 @@ public class PersistenceServiceImpl extends Component implements IPersistenceSer
return;
}
synchronized (Persistence.s_dataLock) {
this.m_persistences.remove(str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString());
this.m_persistences.remove(str + "-" + storage.toString());
}
}
@@ -126,7 +122,7 @@ public class PersistenceServiceImpl extends Component implements IPersistenceSer
return;
}
synchronized (Persistence.s_dataLock) {
String str3 = str2 + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString();
String str3 = str2 + "-" + storage.toString();
Persistence loadPersistenceById = loadPersistenceById(str, storage);
if (loadPersistenceById == null) {
if (persistenceMergePolicy == PersistenceService.PersistenceMergePolicy.OVERWRITE) {
@@ -161,7 +157,7 @@ public class PersistenceServiceImpl extends Component implements IPersistenceSer
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();
String str2 = str + "-" + storage.toString();
Persistence persistence = this.m_persistences.get(str2);
if (persistence != null) {
return persistence;
@@ -6,10 +6,6 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.facebook.places.model.PlaceFields;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -106,7 +102,7 @@ class SynergyEnvironmentUpdater implements LogSource {
this.m_environmentForSynergyStartUp.setServerUrls(new HashMap());
if (list != null) {
for (Map map2 : list) {
this.m_environmentForSynergyStartUp.getServerUrls().put(map2.get("key"), map2.get("value"));
this.m_environmentForSynergyStartUp.getServerUrls().put((String) map2.get("key"), (String) map2.get("value"));
}
}
if (this.m_environmentForSynergyStartUp.getServerUrls().size() == 0) {
@@ -114,15 +110,8 @@ class SynergyEnvironmentUpdater implements LogSource {
return;
}
if (this.m_previousValidEnvironmentData != null && Utility.validString(this.m_previousValidEnvironmentData.getEADeviceId())) {
callSynergyValidateEADeviceId(this.m_previousValidEnvironmentData.getEADeviceId());
return;
}
String loadEADeviceId = EASPDataLoader.loadEADeviceId();
if (loadEADeviceId != null) {
callSynergyValidateEADeviceId(loadEADeviceId);
} else {
callSynergyGetEADeviceId();
}
}
/* JADX INFO: Access modifiers changed from: private */
@@ -220,128 +209,6 @@ class SynergyEnvironmentUpdater implements LogSource {
}
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyGetEADeviceId() {
int phoneType;
String string;
Log.Helper.LOGFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
Context applicationContext = component != null ? component.getApplicationContext() : null;
if (applicationContext != null && (string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id")) != null) {
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, string);
}
if (applicationContext != null) {
TelephonyManager telephonyManager = (TelephonyManager) applicationContext.getSystemService(PlaceFields.PHONE);
PackageManager packageManager = applicationContext.getPackageManager();
if (telephonyManager != null && packageManager != null && packageManager.checkPermission("android.permission.READ_PHONE_STATE", applicationContext.getPackageName()) == 0 && (phoneType = telephonyManager.getPhoneType()) != 0) {
String deviceId = telephonyManager.getDeviceId();
if (Utility.validString(deviceId)) {
String str = ApplicationEnvironment.NIMBLE_PARAMETER_IMEI;
if (phoneType == 2) {
str = "meid";
}
hashMap.put(str, deviceId);
}
}
}
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.2
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error != null) {
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount = 0L;
Log.Helper.LOGD(this, "GetEADeviceID Error (%s)", synergyNetworkConnectionHandle.getResponse().getError());
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "GetEADevideId call failed", synergyNetworkConnectionHandle.getResponse().getError()));
return;
} else {
SynergyEnvironmentUpdater.access$808(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "GetEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount));
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
}
Log.Helper.LOGD(this, "GetEADeviceID Success", new Object[0]);
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyValidateEADeviceId(final String str) {
int phoneType;
String string;
Log.Helper.LOGFUNC(this);
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
hashMap.put("eadeviceid", str);
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
Context applicationContext = component != null ? component.getApplicationContext() : null;
if (applicationContext != null && (string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id")) != null) {
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, string);
}
if (applicationContext != null) {
TelephonyManager telephonyManager = (TelephonyManager) applicationContext.getSystemService(PlaceFields.PHONE);
PackageManager packageManager = applicationContext.getPackageManager();
if (telephonyManager != null && packageManager != null && packageManager.checkPermission("android.permission.READ_PHONE_STATE", applicationContext.getPackageName()) == 0 && (phoneType = telephonyManager.getPhoneType()) != 0) {
String deviceId = telephonyManager.getDeviceId();
if (Utility.validString(deviceId)) {
String str2 = ApplicationEnvironment.NIMBLE_PARAMETER_IMEI;
if (phoneType == 2) {
str2 = "meid";
}
hashMap.put(str2, deviceId);
}
}
}
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/validateDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.3
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
if (error == null) {
Log.Helper.LOGD(this, "ValidateEADeviceID Success", new Object[0]);
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
return;
}
Log.Helper.LOGD(this, "ValidateEADeviceID Error (%s)", error);
if (error instanceof SynergyServerError) {
SynergyServerError synergyServerError = (SynergyServerError) error;
if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID)) {
if (SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData != null) {
SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData.setEADeviceId(null);
}
Log.Helper.LOGD(this, "ValidateEADeviceID, Server signal received to delete cached EA Device ID. Making request to get a new EA Device ID.", new Object[0]);
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED)) {
Log.Helper.LOGD(this, "ValidateEADeviceID, EADeviceID validation failed. Making request to get a new EA Device ID.", new Object[0]);
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
return;
}
}
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount >= 3) {
SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount = 0L;
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "ValidateEADeviceId call failed", error));
} else {
SynergyEnvironmentUpdater.access$1108(SynergyEnvironmentUpdater.this);
Log.Helper.LOGD(this, "ValidateEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount));
SynergyEnvironmentUpdater.this.callSynergyValidateEADeviceId(str);
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void callSynergyGetAnonUid() {
Log.Helper.LOGFUNC(this);
@@ -1,6 +1,5 @@
package com.ea.nimble;
import com.eamobile.DownloadActivityInternal;
/* loaded from: classes.dex */
public class SynergyIdManagerError extends Error {
@@ -9,8 +8,8 @@ public class SynergyIdManagerError extends Error {
public enum Code {
AUTHENTICATOR_CONFLICT(5000),
UNEXPECTED_LOGIN_STATE(DownloadActivityInternal.ERROR_UNSUPPORTED_DEVICE),
INVALID_ID(DownloadActivityInternal.ERROR_ASSETS_NOT_FOUND),
UNEXPECTED_LOGIN_STATE(3),
INVALID_ID(3),
MISSING_AUTHENTICATOR(5003);
private int m_value;
@@ -3,12 +3,6 @@ package com.ea.nimble;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ea.nimble.ComponentManager;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.ISynergyRequest;
import com.ea.nimble.Log;
import com.google.android.vending.expansion.downloader.Constants;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
@@ -155,6 +149,6 @@ public class SynergyNetworkImpl extends Component implements ISynergyNetwork {
private String generateSessionId() {
Log.Helper.LOGFUNC(this);
return UUID.randomUUID().toString().replace(Constants.FILENAME_SEQUENCE_SEPARATOR, "").toLowerCase(Locale.US);
return UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.US);
}
}
@@ -1,8 +1,5 @@
package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.facebook.share.internal.ShareConstants;
import java.util.Map;
import org.json.JSONObject;
@@ -28,7 +25,7 @@ public class SynergyResponse implements ISynergyResponse {
if (!this.jsonData.containsKey("resultCode") || (intValue = ((Integer) this.jsonData.get("resultCode")).intValue()) >= 0) {
return;
}
this.error = new SynergyServerError(intValue, (String) this.jsonData.get(ShareConstants.WEB_DIALOG_PARAM_MESSAGE));
this.error = new SynergyServerError(intValue, (String) this.jsonData.get(""));
} catch (Exception e2) {
e = e2;
this.jsonData = null;
@@ -1,7 +1,5 @@
package com.ea.nimble;
import com.google.android.gms.games.GamesActivityResultCodes;
/* loaded from: classes.dex */
public class SynergyServerError extends Error {
public static final String ERROR_DOMAIN = "SynergyServerError";
@@ -12,7 +10,7 @@ public class SynergyServerError extends Error {
ERROR_SIGNATURE_VERIFICATION(-30014),
ERROR_NOT_SUPPORTED_RECEIPT_TYPE(-30015),
AMAZON_SERVER_CONNECTION_ERROR(-30016),
APPLE_SERVER_CONNECTION_ERROR(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED);
APPLE_SERVER_CONNECTION_ERROR(1111110);
private int m_value;
+6 -23
View File
@@ -9,7 +9,9 @@ import android.content.pm.ResolveInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.ea.nimble.Log;
import com.google.gson.GsonBuilder;
import java.io.IOException;
@@ -29,7 +31,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -258,7 +259,7 @@ public final class Utility {
byte[] bArr = new byte[open.available()];
open.read(bArr);
open.close();
return new String(bArr, HTTP.UTF_8);
return new String(bArr);
} catch (IOException e) {
Log.Helper.LOGV("Utility", "readFile(): %s", e.toString());
return null;
@@ -266,33 +267,15 @@ public final class Utility {
}
public static void sendBroadcast(String str) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str));
}
public static void sendBroadcast(String str, Map<String, String> map) {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
Intent intent = new Intent(str);
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
intent.putExtra(entry.getKey(), entry.getValue());
}
}
localBroadcastManager.sendBroadcast(intent);
}
public static void sendBroadcast(String str, Bundle bundle) {
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str).replaceExtras(bundle));
}
public static void sendBroadcast(String str, Bundle bundle) {}
public static void sendBroadcastSerializable(String str, Map<String, Serializable> map) {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
Intent intent = new Intent(str);
if (map != null) {
for (Map.Entry<String, Serializable> entry : map.entrySet()) {
intent.putExtra(entry.getKey(), entry.getValue());
}
}
localBroadcastManager.sendBroadcast(intent);
}
public static void sendExplicitBroadcast(Intent intent) {
@@ -47,9 +47,6 @@ public class WebView extends Activity {
final String string = getIntent().getExtras().getString("Redirect_URL");
if (extras.containsKey("Oauth_URL")) {
webView.loadUrl(getIntent().getExtras().getString("Oauth_URL"));
if (string == null || string.isEmpty()) {
string = "";
}
webView.setWebViewClient(new WebViewClient() { // from class: com.ea.nimble.WebView.1
@Override // android.webkit.WebViewClient
public void onPageStarted(android.webkit.WebView webView2, String str, Bitmap bitmap) {
@@ -1,22 +0,0 @@
package com.ea.nimble.bridge;
import com.ea.nimble.Error;
import com.ea.nimble.INimbleAndroidGoogleService;
import java.util.Map;
/* loaded from: classes.dex */
public class GoogleServiceRequestCallback implements INimbleAndroidGoogleService.RequestCallback {
private int m_id;
public GoogleServiceRequestCallback(int i) {
this.m_id = i;
}
public void callback(Map<String, Object> map, Error error) {
BaseNativeCallback.sendNativeCallback(this.m_id, map, error);
}
public void finalize() {
BaseNativeCallback.nativeFinalize(this.m_id);
}
}
@@ -3,7 +3,6 @@ package com.ea.nimble.bridge;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.ApplicationLifecycle;
import com.ea.nimble.Base;
@@ -143,18 +142,6 @@ public class NimbleCppApplicationLifeCycle extends Component implements IApplica
}
private void parsePushNotificationDetails(Map<String, String> map, Bundle bundle) {
map.put("mode", "pn");
if (bundle == null || bundle.isEmpty()) {
return;
}
if (bundle.containsKey(GcmIntentService.PushIntentExtraKeys.PUSH_ID)) {
map.put(GcmIntentService.PushIntentExtraKeys.PUSH_ID, bundle.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID));
}
if (bundle.containsKey(GcmIntentService.PushIntentExtraKeys.PN_TYPE)) {
map.put(GcmIntentService.PushIntentExtraKeys.PN_TYPE, bundle.getString(GcmIntentService.PushIntentExtraKeys.PN_TYPE));
}
if (map.containsKey(GcmIntentService.PushIntentExtraKeys.PUSH_ID) || map.containsKey(GcmIntentService.PushIntentExtraKeys.PN_TYPE)) {
map.put("deviceId", SynergyEnvironment.getComponent().getEADeviceId());
}
}
}
@@ -1,8 +1,6 @@
package com.ea.nimble.friends;
import com.ea.nimble.Global;
import com.ea.nimble.friends.NimbleUser;
import com.facebook.share.internal.ShareConstants;
import java.util.Date;
import org.json.JSONObject;
@@ -12,7 +10,7 @@ class NimbleFacebookUser extends NimbleUser {
this.authenticatorId = Global.NIMBLE_AUTHENTICATOR_FACEBOOK;
this.userId = jSONObject.optString("id");
this.displayName = jSONObject.optString("name");
this.imageUrl = jSONObject.optJSONObject("picture").optJSONObject(ShareConstants.WEB_DIALOG_PARAM_DATA).optString("url");
this.imageUrl = "";
this.refreshTimestamp = new Date();
setPlayedCurrentGame(NimbleUser.PlayedCurrentGameFlag.PLAYED);
}
@@ -1,8 +1,6 @@
package com.ea.nimble.friends;
import android.support.v4.internal.view.SupportMenu;
import com.ea.nimble.Error;
import com.google.android.gms.games.GamesActivityResultCodes;
/* loaded from: classes.dex */
public class NimbleFriendsError extends Error {
@@ -24,12 +22,12 @@ public class NimbleFriendsError extends Error {
NIMBLE_FRIENDS_SERVER_HTTP_ERROR(80002),
NIMBLE_FRIENDS_SERVER_CODE_ERROR(80003),
NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR(80004),
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED),
NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(GamesActivityResultCodes.RESULT_SIGN_IN_FAILED),
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(GamesActivityResultCodes.RESULT_LICENSE_FAILED),
NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(GamesActivityResultCodes.RESULT_APP_MISCONFIGURED),
NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(GamesActivityResultCodes.RESULT_LEFT_ROOM),
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR(GamesActivityResultCodes.RESULT_NETWORK_FAILURE),
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(1111110),
NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(1111111),
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(1111112),
NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(1111113),
NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(1111114),
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR(234234234),
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE(10007),
NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY(10008),
NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_NOT_UPDATED(10009),
@@ -40,7 +38,7 @@ public class NimbleFriendsError extends Error {
NIMBLE_FRIENDS_REFRESH_SCOPE_SERVER_RESPONSE_ERROR(10015),
NIMBLE_FRIENDS_REFRESH_SCOPE_FRIENDS_LIST_TYPE_UNSUPPORTED(10016),
NIMBLE_FRIENDS_REFRESH_TYPE_UNSUPPORTED(10017),
NIMBLE_FRIENDS_UNKNOWN_ERROR(SupportMenu.USER_MASK),
NIMBLE_FRIENDS_UNKNOWN_ERROR(23423423),
NIMBLE_FRIENDS_SERVER_RETURNED_ERROR(90009),
NIMBLE_FRIENDS_ORIGIN_SERVICES_SERVER_RESPONSE_ERROR(10018),
NIMBLE_FRIENDS_REFRESH_SCOPE_FAILED_TO_CREATE_GOS_REQUEST(10012);
@@ -12,12 +12,9 @@ import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
import com.ea.nimble.SynergyEnvironment;
import com.ea.nimble.Utility;
import com.ea.nimble.friends.NimbleFriendsError;
import com.ea.nimble.friends.NimbleFriendsList;
import com.ea.nimble.identity.INimbleIdentity;
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
import com.ea.nimble.identity.NimbleIdentityPidInfo;
import com.facebook.internal.ServerProtocol;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -27,7 +24,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import org.apache.http.HttpStatus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -76,63 +72,12 @@ public class NimbleFriendsListOrigin extends NimbleFriendsListImpl {
iNimbleIdentity.getAuthenticatorById(this.m_authenticatorId).requestAccessToken(new INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListOrigin.1
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str2, String str3, Error error) {
if (error == null) {
NimbleFriendsListOrigin.this.sendGosRefreshFriendsRequest(i, i2, str2, str3, pid, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo);
} else {
NimbleFriendsListOrigin.this.invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, error, friendsListType);
}
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendGosRefreshFriendsRequest(int i, int i2, String str, String str2, String str3, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, final NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeGetFriendsRequest = makeGetFriendsRequest(i, i2, true, str, str2, str3);
if (makeGetFriendsRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for GOS getFriendsList", new Object[0]);
invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for GOS getFriendsList", friendsListType);
return;
}
try {
Network.getComponent().sendRequest(makeGetFriendsRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListOrigin.2
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
ArrayList<NimbleUser> parseBodyJSONData = NimbleFriendsListOrigin.this.parseBodyJSONData(networkConnectionHandle);
if (parseBodyJSONData != null && parseBodyJSONData.size() > 0) {
Log.Helper.LOGD(this, "Successful in retrieving friends list from GOS", new Object[0]);
NimbleFriendsListOrigin.this.updateFriendsListBasicInfo(parseBodyJSONData, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo);
return;
}
if (NimbleFriendsListOrigin.this.lastError != null) {
Log.Helper.LOGE(this, NimbleFriendsListOrigin.this.lastError.getMessage(), new Object[0]);
NimbleFriendsListOrigin.this.invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsListOrigin.this.lastError, friendsListType);
} else if (NimbleFriendsListOrigin.this.lastError == null && parseBodyJSONData != null && parseBodyJSONData.size() <= 0) {
Log.Helper.LOGD(this, "GOS FriendsList request is successful, but there are no friends", new Object[0]);
NimbleFriendsListOrigin.this.updateFriendsListBasicInfo(parseBodyJSONData, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo);
} else {
Log.Helper.LOGE(this, "Error in response for GOS getFriendsList request", new Object[0]);
NimbleFriendsListOrigin.this.invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_EMPTY_HTTP_RESPONSE, "Error in response for GOS getFriendsList request", friendsListType);
}
} catch (Error e) {
String str4 = "Error parsing response from GOS" + e.getMessage();
Log.Helper.LOGE(this, str4, new Object[0]);
NimbleFriendsListOrigin.this.invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_ERROR_PARSING_HTTP_RESPONSE, str4, friendsListType);
}
}
});
} catch (Exception unused) {
String format = String.format("Authenticator (%s) does not support Identity Refresh for Friends List", this.m_authenticatorId);
Log.Helper.LOGE(this, format, new Object[0]);
invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_SUPPORTED, format, friendsListType);
}
} catch (Exception unused2) {
}
}
@Override // com.ea.nimble.friends.NimbleFriendsListImpl
protected void refreshFriendsListIdentityInfo(ArrayList<String> arrayList, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback) {
Log.Helper.LOGFUNC(this);
@@ -155,300 +100,19 @@ public class NimbleFriendsListOrigin extends NimbleFriendsListImpl {
iNimbleIdentity.getAuthenticatorById(this.m_authenticatorId).requestAccessToken(new INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListOrigin.3
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str, String str2, Error error) {
if (error == null) {
NimbleFriendsListOrigin.this.sendGosRefreshAvatarsRequest(str, str2, list, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshScope);
} else {
if (error != null) {
NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, error, friendsListType);
}
//NimbleFriendsListOrigin.this.sendGosRefreshAvatarsRequest(str, str2, list, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshScope);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendGosRefreshAvatarsRequest(String str, String str2, List<String> list, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, final NimbleFriendsRefreshScope nimbleFriendsRefreshScope) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeGetFriendsAvatarInfoRequest = makeGetFriendsAvatarInfoRequest(str, str2, list);
if (makeGetFriendsAvatarInfoRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for GOS getAvatarInfo", new Object[0]);
invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for GOS getAvatarInfo", friendsListType);
} else {
Network.getComponent().sendRequest(makeGetFriendsAvatarInfoRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListOrigin.4
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
ArrayList<NimbleUser> parseAvatarInfoXml = NimbleFriendsListOrigin.this.parseAvatarInfoXml(networkConnectionHandle);
if (parseAvatarInfoXml != null && parseAvatarInfoXml.size() > 0) {
NimbleFriendsListOrigin.this.updateFriendsListAvatarInfo(parseAvatarInfoXml, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshScope);
}
if (NimbleFriendsListOrigin.this.lastError != null) {
NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsListOrigin.this.lastError, friendsListType);
} else {
Log.Helper.LOGE(NimbleFriendsListOrigin.this, "Error in response for GOS getAvatarInfo request", new Object[0]);
NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_EMPTY_HTTP_RESPONSE, "Error in response for GOS getAvatarInfo request", friendsListType);
}
} catch (Exception e) {
if (NimbleFriendsListOrigin.this.lastError != null) {
NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsListOrigin.this.lastError, friendsListType);
return;
}
Log.Helper.LOGE(this, String.format("GoS Avatar Info XML parsIng raised an exception. Details: %s", e.getMessage()), new Object[0]);
e.printStackTrace();
NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_ERROR_PARSING_HTTP_RESPONSE, "Failed to parse response XML for Avatar Info"), friendsListType);
}
}
});
}
} catch (Exception e) {
Log.Helper.LOGE(this, String.format("Exception raised when creating GoS Avatar URL refresh request. Exception: %s", e.getMessage()), new Object[0]);
invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_ERROR_PARSING_HTTP_RESPONSE, "Failed to process request for Avatar Info"), friendsListType);
}
}
private HttpRequest makeGetFriendsRequest(int i, int i2, boolean z, String str, String str2, String str3) {
String format;
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String originFriendsUrlFromSynergy = getOriginFriendsUrlFromSynergy();
String mdmAppKey = getMdmAppKey();
if (str == null || str.length() <= 0) {
Log.Helper.LOGE(this, "Failed to create GOS friends request because access token for Origin is null or invalid", new Object[0]);
return null;
}
if (originFriendsUrlFromSynergy == null || originFriendsUrlFromSynergy.length() <= 0) {
Log.Helper.LOGE(this, "Failed to create GOS friends request because GOS request URL is null or invalid", new Object[0]);
return null;
}
if (mdmAppKey == null || mdmAppKey.length() <= 0) {
Log.Helper.LOGE(this, "Failed to create GOS friends request because MDM App Key is null or invalid", new Object[0]);
return null;
}
if (str3 == null || str3.length() <= 0) {
Log.Helper.LOGE(this, "Failed to create GOS friends request because Origin user's PID is null or invalid", new Object[0]);
return null;
}
String str4 = str2 + " " + str;
if (z) {
format = String.format(GET_FRIENDS_URI_PARAMS, str3, Integer.valueOf(i), Integer.valueOf(i2), ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
} else {
format = String.format(GET_FRIENDS_URI_PARAMS, str3, Integer.valueOf(i), Integer.valueOf(i2), "false");
}
try {
httpRequest = new HttpRequest(new URL(originFriendsUrlFromSynergy + format));
} catch (MalformedURLException e) {
e = e;
httpRequest = null;
}
try {
httpRequest.method = IHttpRequest.Method.GET;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("Authorization", str4);
hashMap.put("X-Application-Key", mdmAppKey);
hashMap.put("X-Api-Version", "2");
httpRequest.headers = hashMap;
} catch (MalformedURLException e2) {
e = e2;
Log.Helper.LOGW(this, "Exception when creating GOS getFreindList request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
return httpRequest;
}
private HttpRequest makeGetFriendsAvatarInfoRequest(String str, String str2, List<String> list) {
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String originAvatarsUrlFromSynergy = getOriginAvatarsUrlFromSynergy();
if (str == null || str.length() <= 0 || list == null || list.size() <= 0 || list.size() > 20 || originAvatarsUrlFromSynergy == null || originAvatarsUrlFromSynergy.length() <= 0) {
return null;
}
StringBuilder sb = new StringBuilder();
Iterator<String> it = list.iterator();
while (it.hasNext()) {
sb.append(it.next());
sb.append(";");
}
sb.deleteCharAt(sb.length() - 1);
try {
httpRequest = new HttpRequest(new URL(originAvatarsUrlFromSynergy + String.format(GET_FRIENDS_AVATAR_URI, sb.toString())));
try {
httpRequest.method = IHttpRequest.Method.GET;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("AuthToken", str);
httpRequest.headers = hashMap;
} catch (MalformedURLException e) {
e = e;
Log.Helper.LOGE(this, "Exception when creating GOS getAvatarInfo request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
} catch (MalformedURLException e2) {
e = e2;
httpRequest = null;
}
return httpRequest;
}
private String getOriginFriendsUrlFromSynergy() {
Log.Helper.LOGFUNC(this);
String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_EADP_FRIENDS_HOST);
if (serverUrlWithKey == null || serverUrlWithKey.length() <= 0) {
return null;
}
return serverUrlWithKey.charAt(serverUrlWithKey.length() + (-1)) == '/' ? serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1) : serverUrlWithKey;
}
private String getOriginAvatarsUrlFromSynergy() {
Log.Helper.LOGFUNC(this);
String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_ORIGIN_AVATAR);
if (serverUrlWithKey == null || serverUrlWithKey.length() <= 0) {
return null;
}
return serverUrlWithKey.charAt(serverUrlWithKey.length() + (-1)) == '/' ? serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1) : serverUrlWithKey;
}
private String getMdmAppKey() {
Log.Helper.LOGFUNC(this);
return SynergyEnvironment.getComponent().getGosMdmAppKey();
}
/* JADX INFO: Access modifiers changed from: private */
public ArrayList<NimbleUser> parseAvatarInfoXml(NetworkConnectionHandle networkConnectionHandle) throws Error {
Log.Helper.LOGFUNC(this);
this.lastError = null;
int statusCode = networkConnectionHandle.getResponse().getStatusCode();
if (statusCode != 200) {
switch (statusCode) {
case 400:
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_SERVER_RESPONSE_ERROR, String.format("Avatar Info HTTP Resonse Error. Description: %s", "The indicated parameter is empty or invalid."));
break;
case HttpStatus.SC_UNAUTHORIZED /* 401 */:
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_SERVER_RESPONSE_ERROR, String.format("Avatar Info HTTP Resonse Error. Description: %s", "The specified AuthToken is empty or invalid."));
break;
default:
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_SERVER_RESPONSE_ERROR, "Avatar Info HTTP Resonse Error");
break;
}
throw this.lastError;
}
InputStream dataStream = networkConnectionHandle.getResponse().getDataStream();
if (dataStream == null || dataStream.toString().length() == 0) {
throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_HTTP_ERROR, "Empty response from server for refreshing avatar", new HttpError(networkConnectionHandle.getResponse().getStatusCode(), networkConnectionHandle.getResponse().getError().getMessage()));
}
try {
XmlPullParser newPullParser = XmlPullParserFactory.newInstance().newPullParser();
newPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces", false);
newPullParser.setInput(dataStream, null);
ArrayList<NimbleUser> arrayList = null;
NimbleUser nimbleUser = null;
for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
if (eventType == 0) {
arrayList = new ArrayList<>();
} else {
switch (eventType) {
case 2:
String name = newPullParser.getName();
if (name.equalsIgnoreCase("user")) {
NimbleUser nimbleUser2 = new NimbleUser();
nimbleUser2.setAuthenticatorId(Global.NIMBLE_AUTHENTICATOR_ORIGIN);
nimbleUser = nimbleUser2;
break;
} else if (nimbleUser == null) {
break;
} else if (name.equalsIgnoreCase("userId")) {
String nextText = newPullParser.nextText();
nimbleUser.setUserId(nextText);
nimbleUser.setPid(nextText);
break;
} else if (name.equalsIgnoreCase("link")) {
nimbleUser.setImageUrl(newPullParser.nextText());
break;
} else {
break;
}
case 3:
if (newPullParser.getName().equalsIgnoreCase("user") && nimbleUser != null) {
arrayList.add(nimbleUser);
nimbleUser = null;
break;
}
break;
}
}
}
return arrayList;
} catch (Exception e) {
Log.Helper.LOGE(this, String.format("Parsing of GOS Avatar Info XML raised an exception. Details: %s", e.getMessage()), new Object[0]);
e.printStackTrace();
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_ERROR_PARSING_HTTP_RESPONSE, "Failed to parse the response XML from GOS Avatar service");
throw this.lastError;
}
}
/* JADX INFO: Access modifiers changed from: private */
public ArrayList<NimbleUser> parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error {
Log.Helper.LOGFUNC(this);
InputStream dataStream = networkConnectionHandle.getResponse().getDataStream();
this.lastError = null;
if (dataStream == null || dataStream.toString().length() == 0) {
throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_HTTP_ERROR, "Empty response body for refresh friends request", new HttpError(networkConnectionHandle.getResponse().getStatusCode(), networkConnectionHandle.getResponse().getError().getMessage()));
}
Scanner scanner = new Scanner(dataStream);
Scanner useDelimiter = scanner.useDelimiter("\\A");
String next = useDelimiter.hasNext() ? useDelimiter.next() : "";
useDelimiter.close();
scanner.close();
ArrayList<NimbleUser> arrayList = new ArrayList<>();
if (next != null && next.length() > 0) {
try {
JSONObject jSONObject = new JSONObject(next);
if (jSONObject.optJSONObject("error") != null) {
JSONObject optJSONObject = jSONObject.optJSONObject("error");
String optString = optJSONObject.optString("type");
int optInt = optJSONObject.optInt("code", -1);
if (optString != null && optString.length() > 0) {
Log.Helper.LOGE(this, String.format("Server error for refresh friends request. Code = %d, Message = %s", Integer.valueOf(optInt), optString), new Object[0]);
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for refresh friends request", new NimbleFriendsServerCodeError(optInt, optString));
}
return null;
}
JSONArray optJSONArray = jSONObject.optJSONArray("entries");
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
if (jSONObject2 != null) {
NimbleUser createNimbleUser = createNimbleUser(jSONObject2);
if (createNimbleUser.getUserId() != null && createNimbleUser.getUserId().length() > 0) {
arrayList.add(createNimbleUser);
}
}
}
} else {
if (optJSONArray != null && optJSONArray.length() == 0) {
Log.Helper.LOGD(this, "GOS response indicates there are no friends for this Origin user", new Object[0]);
this.lastError = null;
return arrayList;
}
JSONObject jSONObject3 = jSONObject.getJSONObject("error");
if (jSONObject3 != null) {
int optInt2 = jSONObject3.optInt("code", -1);
String optString2 = jSONObject3.optString("type", "");
Log.Helper.LOGE(this, String.format("Server error for refresh friends request. Code = %d, Message = %s", Integer.valueOf(optInt2), optString2), new Object[0]);
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for refresh friends request", new NimbleFriendsServerCodeError(optInt2, optString2));
} else {
Log.Helper.LOGE(this, "Unknown server error for refresh friends request.", new Object[0]);
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Unknown server error for refresh friends request.");
}
}
} catch (JSONException e) {
Log.Helper.LOGE(this, String.format("%s Error: %s", "Exception when parsing JSON response for refresh friends request.", e.getMessage()), new Object[0]);
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Exception when parsing JSON response for refresh friends request.", e);
return arrayList;
}
} else {
Log.Helper.LOGE(this, "Empty response data for user search by display name .", new Object[0]);
this.lastError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Empty response data for user search by display name .");
}
return arrayList;
return new ArrayList<>();
}
@Override // com.ea.nimble.friends.NimbleFriendsListImpl
@@ -16,12 +16,9 @@ import com.ea.nimble.Network;
import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
import com.ea.nimble.SynergyEnvironment;
import com.ea.nimble.friends.INimbleOriginFriendsService;
import com.ea.nimble.friends.NimbleFriendsError;
import com.ea.nimble.identity.INimbleIdentity;
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
import com.ea.nimble.identity.NimbleIdentityPidInfo;
import com.facebook.internal.ServerProtocol;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -31,7 +28,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Scanner;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -103,7 +99,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process searchUserByEmail request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, String.format("searchUserByEmail API called with email = %s", str), new Object[0]);
processSearchUserRequest(str, UserSearchCriteria.EMAIL, nimbleUserSearchCallback);
//processSearchUserRequest(str, UserSearchCriteria.EMAIL, nimbleUserSearchCallback);
}
}
@@ -114,7 +110,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process searchUserByDisplayName request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, String.format("searchUserByDisplayName API called with namePrefix = %s", str), new Object[0]);
processSearchUserRequest(str, UserSearchCriteria.DISPLAY_NAME, nimbleUserSearchCallback);
//processSearchUserRequest(str, UserSearchCriteria.DISPLAY_NAME, nimbleUserSearchCallback);
}
}
@@ -125,7 +121,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process listFriendInvitationSent request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, "Request: listFriendInvitationSent", new Object[0]);
processInivtationListRequest(GET_SENT_INVITATION_LIST_URI, nimbleUserSearchCallback);
//processInivtationListRequest(GET_SENT_INVITATION_LIST_URI, nimbleUserSearchCallback);
}
}
@@ -136,7 +132,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process listFriendInvitationReceived request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, "Request: listFriendInvitationReceived", new Object[0]);
processInivtationListRequest(GET_RECEIVED_INVITATION_LIST_URI, nimbleUserSearchCallback);
//processInivtationListRequest(GET_RECEIVED_INVITATION_LIST_URI, nimbleUserSearchCallback);
}
}
@@ -147,7 +143,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process sendFriendInvitation request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, "Request: sendFriendInvitation", new Object[0]);
processSendFriendInvitationRequest(str, str2, nimbleFriendInvitationCallback);
//processSendFriendInvitationRequest(str, str2, nimbleFriendInvitationCallback);
}
}
@@ -158,7 +154,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
Log.Helper.LOGE(this, "Cannot process acceptFriendInvitation request because callback is null", new Object[0]);
} else {
Log.Helper.LOGD(this, "Request: acceptFriendInvitation", new Object[0]);
processRespondToFriendInvitationRequest(true, str, nimbleFriendInvitationCallback);
//processRespondToFriendInvitationRequest(true, str, nimbleFriendInvitationCallback);
}
}
@@ -265,7 +261,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str3, String str4, Error error) {
if (error == null) {
NimbleOriginFriendsServiceImpl.this.sendFriendInvitationRequest(pid, str3, str, str2, nimbleFriendInvitationCallback);
//NimbleOriginFriendsServiceImpl.this.sendFriendInvitationRequest(pid, str3, str, str2, nimbleFriendInvitationCallback);
} else {
Log.Helper.LOGE(this, "Failed to refresh AccessToken - cannot send friend invitation request.", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, error);
@@ -292,7 +288,7 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str2, String str3, Error error) {
if (error == null) {
NimbleOriginFriendsServiceImpl.this.sendRespondToFriendInvitationRequest(z, pid, str, str2, nimbleFriendInvitationCallback);
// NimbleOriginFriendsServiceImpl.this.sendRespondToFriendInvitationRequest(z, pid, str, str2, nimbleFriendInvitationCallback);
} else {
Log.Helper.LOGE(this, "Failed to refresh AccessToken - cannot process request for responding to friend invitation.", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, error);
@@ -302,210 +298,8 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
}
}
private void processInivtationListRequest(final String str, final INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) {
Log.Helper.LOGFUNC(this);
if (!isNimbleComponentAvailable("com.ea.nimble.identity")) {
Log.Helper.LOGE(this, "Unable to process request because NimbleIdentity is not available", new Object[0]);
invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to process request because NimbleIdentity is not available");
return;
}
INimbleIdentity iNimbleIdentity = (INimbleIdentity) Base.getComponent("com.ea.nimble.identity");
NimbleIdentityPidInfo pidInfo = iNimbleIdentity.getAuthenticatorById(Global.NIMBLE_AUTHENTICATOR_ORIGIN).getPidInfo();
final String pid = pidInfo != null ? pidInfo.getPid() : null;
if (pid == null || pid.length() <= 0) {
invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_LOGGED_IN, "Origin PID for the current user is not available.");
} else {
iNimbleIdentity.getAuthenticatorById(Global.NIMBLE_AUTHENTICATOR_ORIGIN).requestAccessToken(new INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.3
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str2, String str3, Error error) {
if (error == null) {
NimbleOriginFriendsServiceImpl.this.sendGetFriendInvitationListRequest(pid, str2, str, nimbleUserSearchCallback);
} else {
Log.Helper.LOGE(this, "Failed to refresh AccessToken - cannot process request.", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, error);
}
}
});
}
}
private void processSearchUserRequest(final String str, final UserSearchCriteria userSearchCriteria, final INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) {
Log.Helper.LOGFUNC(this);
if (!isNimbleComponentAvailable("com.ea.nimble.identity")) {
Log.Helper.LOGE(this, "Unable to process request because NimbleIdentity is not available", new Object[0]);
invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to process request because NimbleIdentity is not available");
} else {
((INimbleIdentity) Base.getComponent("com.ea.nimble.identity")).getAuthenticatorById(Global.NIMBLE_AUTHENTICATOR_ORIGIN).requestAccessToken(new INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.4
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback
public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str2, String str3, Error error) {
if (error == null) {
NimbleOriginFriendsServiceImpl.this.sendSearchUserRequest(str2, str3, str, userSearchCriteria, nimbleUserSearchCallback);
} else {
Log.Helper.LOGE(this, "Failed to refresh AccessToken - cannot process request.", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, error);
}
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendFriendInvitationRequest(String str, String str2, String str3, String str4, final INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeFriendInvitationRequest = makeFriendInvitationRequest(str, str2, str3, str4, nimbleFriendInvitationCallback);
if (makeFriendInvitationRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for sending friend invitation", new Object[0]);
invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for sending friend invitation");
} else {
Network.getComponent().sendRequest(makeFriendInvitationRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.5
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
if (networkConnectionHandle.getResponse().getStatusCode() == 204) {
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithSuccess(nimbleFriendInvitationCallback);
} else {
Log.Helper.LOGD(this, "Server responded with an error (%d) for sending friend invitation request", Integer.valueOf(networkConnectionHandle.getResponse().getStatusCode()));
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_HTTP_ERROR, "Server responded with an error (%d) for sending friend invitation request", new HttpError(networkConnectionHandle.getResponse().getStatusCode(), networkConnectionHandle.getResponse().getError().getMessage())));
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending friend invitation request failed with unexpected excpetion at receiving: " + e.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation request failed with unexpected excpetion at receiving", e));
}
}
});
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending friend invitation request failed with unexpected excpetion at posting: " + e.getMessage(), new Object[0]);
invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation request failed with unexpected excpetion at posting", e));
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendRespondToFriendInvitationRequest(boolean z, String str, String str2, String str3, final INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeRespondToFriendInvitationRequest = makeRespondToFriendInvitationRequest(z, str, str2, str3);
if (makeRespondToFriendInvitationRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for respoding to friend invitation", new Object[0]);
invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for respoding to friend invitation");
} else {
Network.getComponent().sendRequest(makeRespondToFriendInvitationRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.6
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
if (networkConnectionHandle.getResponse().getStatusCode() == 204) {
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithSuccess(nimbleFriendInvitationCallback);
} else {
Log.Helper.LOGD(this, "Server responded with an error (%d) for sending friend invitation response", Integer.valueOf(networkConnectionHandle.getResponse().getStatusCode()));
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_HTTP_ERROR, "Server responded with an error (%d) for sending friend invitation response", new HttpError(networkConnectionHandle.getResponse().getStatusCode(), networkConnectionHandle.getResponse().getError().getMessage())));
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending friend invitation response failed with unexpected excpetion at receiving: " + e.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation response failed with unexpected excpetion at receiving", e));
}
}
});
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending friend invitation response failed with unexpected excpetion at posting: " + e.getMessage(), new Object[0]);
invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation response failed with unexpected excpetion at posting", e));
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendGetFriendInvitationListRequest(String str, String str2, String str3, final INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeGetFriendInvitationListRequest = makeGetFriendInvitationListRequest(str, str2, str3);
if (makeGetFriendInvitationListRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for retrieving outbound friend invitation list", new Object[0]);
invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for retrieving outbound friend invitation list");
} else {
Network.getComponent().sendRequest(makeGetFriendInvitationListRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.7
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
ArrayList parseBodyJSONData = NimbleOriginFriendsServiceImpl.this.parseBodyJSONData(networkConnectionHandle);
if (parseBodyJSONData == null) {
Log.Helper.LOGE(this, "Error in response from GOS server. Unable to get list of invitations", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Error in response from GOS server. Unable to get list of invitations");
} else if (parseBodyJSONData.size() <= 0) {
Log.Helper.LOGD(this, "Server request was successful, but we did not find any pending invitations", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithSuccess(nimbleUserSearchCallback, parseBodyJSONData);
} else {
Log.Helper.LOGD(this, "Successful in retrieving invitation list from GOS", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithSuccess(nimbleUserSearchCallback, parseBodyJSONData);
}
} catch (Error e) {
Log.Helper.LOGE(this, "Error parsing response from GOS" + e.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, e);
} catch (Exception e2) {
Log.Helper.LOGE(this, "Sending friend invitation list request failed with unexpected excpetion at receiving: " + e2.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation list request failed with unexpected excpetion at receiving", e2));
}
}
});
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending friend invitation list request failed with unexpected excpetion at posting: " + e.getMessage(), new Object[0]);
invokeUserSearchCallbackWithError(nimbleUserSearchCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending friend invitation list request failed with unexpected excpetion at posting", e));
}
}
/* JADX INFO: Access modifiers changed from: private */
public void sendSearchUserRequest(String str, String str2, String str3, final UserSearchCriteria userSearchCriteria, final INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) {
Log.Helper.LOGFUNC(this);
try {
HttpRequest makeSearchUserRequest = makeSearchUserRequest(str, str2, str3, userSearchCriteria);
if (makeSearchUserRequest == null) {
Log.Helper.LOGE(this, "Failed to create HTTP Request for user search", new Object[0]);
invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST, "Failed to create HTTP Request for user search");
} else {
Network.getComponent().sendRequest(makeSearchUserRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.friends.NimbleOriginFriendsServiceImpl.8
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
try {
ArrayList parseUserSearchByEmailResponse = userSearchCriteria == UserSearchCriteria.EMAIL ? NimbleOriginFriendsServiceImpl.this.parseUserSearchByEmailResponse(networkConnectionHandle) : NimbleOriginFriendsServiceImpl.this.parseUserSearchByDisplayNameResponse(networkConnectionHandle);
if (parseUserSearchByEmailResponse == null) {
Log.Helper.LOGE(this, "There was an error processing your user search request", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithCode(nimbleUserSearchCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "There was an error processing your user search request");
} else if (parseUserSearchByEmailResponse.size() <= 0) {
Log.Helper.LOGD(this, "No users found for your search criteria. Please try again with a different criteria.", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithSuccess(nimbleUserSearchCallback, parseUserSearchByEmailResponse);
} else {
Log.Helper.LOGD(this, "Found users with matching email or display name prefix", new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithSuccess(nimbleUserSearchCallback, parseUserSearchByEmailResponse);
}
} catch (Error e) {
Log.Helper.LOGE(this, "Error parsing response for user search by email or displayName request" + e.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, e);
} catch (Exception e2) {
Log.Helper.LOGE(this, "Sending search user request failed with unexpected excpetion at receiving: " + e2.getMessage(), new Object[0]);
NimbleOriginFriendsServiceImpl.this.invokeUserSearchCallbackWithError(nimbleUserSearchCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending search user request failed with unexpected excpetion at receiving", e2));
}
}
});
}
} catch (Exception e) {
Log.Helper.LOGE(this, "Sending search user request failed with unexpected excpetion at posting: " + e.getMessage(), new Object[0]);
invokeUserSearchCallbackWithError(nimbleUserSearchCallback, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR, "Sending search user request failed with unexpected excpetion at posting", e));
}
}
private String getOriginFriendsUrlFromSynergy() {
Log.Helper.LOGFUNC(this);
String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_EADP_FRIENDS_HOST);
if (serverUrlWithKey == null || serverUrlWithKey.length() <= 0) {
return null;
}
return serverUrlWithKey.charAt(serverUrlWithKey.length() + (-1)) == '/' ? serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1) : serverUrlWithKey;
}
private String getMdmAppKey() {
Log.Helper.LOGFUNC(this);
return SynergyEnvironment.getComponent().getGosMdmAppKey();
}
protected static String getIdentityProxyUrlFromSynergy() {
Log.Helper.LOGFUNCS("OriginFriendsService");
@@ -516,235 +310,6 @@ public class NimbleOriginFriendsServiceImpl extends Component implements INimble
return serverUrlWithKey.charAt(serverUrlWithKey.length() + (-1)) == '/' ? serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1) : serverUrlWithKey;
}
private HttpRequest makeFriendInvitationRequest(String str, String str2, String str3, String str4, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) {
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String originFriendsUrlFromSynergy = getOriginFriendsUrlFromSynergy();
String mdmAppKey = getMdmAppKey();
if (originFriendsUrlFromSynergy == null || originFriendsUrlFromSynergy.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for sending friend invitation because friends endpoint URI is empty or null", new Object[0]);
return null;
}
if (mdmAppKey == null || mdmAppKey.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for sending friend invitation because MDM app key is empty or null", new Object[0]);
return null;
}
if (str2 == null || str2.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for sending friend invitation because access token is null or empty", new Object[0]);
return null;
}
if (str == null || str.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for sending friend invitation because user's nucleus ID is null or empty", new Object[0]);
return null;
}
if (str3 == null || str3.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for sending friend invitation because target user's nucleus ID is null or empty", new Object[0]);
return null;
}
String str5 = originFriendsUrlFromSynergy + String.format(POST_SEND_FRIEND_INVITATION_URI, str, str3);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("source=mobile");
if (str4 != null && str4.length() > 0) {
stringBuffer.append("&comment=");
stringBuffer.append(str4);
}
try {
httpRequest = new HttpRequest(new URL(str5));
} catch (MalformedURLException e) {
e = e;
httpRequest = null;
} catch (Exception e2) {
e = e2;
httpRequest = null;
}
try {
httpRequest.method = IHttpRequest.Method.POST;
byte[] bytes = stringBuffer.toString().getBytes(HTTP.UTF_8);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
byteArrayOutputStream.write(bytes);
httpRequest.data = byteArrayOutputStream;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("X-AuthToken", str2);
hashMap.put("X-Application-Key", mdmAppKey);
hashMap.put("X-Api-Version", "2");
httpRequest.headers = hashMap;
} catch (MalformedURLException e3) {
e = e3;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL for send friend invitation. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
} catch (Exception e4) {
e = e4;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL for send friend invitation. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
return httpRequest;
}
private HttpRequest makeRespondToFriendInvitationRequest(boolean z, String str, String str2, String str3) {
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String originFriendsUrlFromSynergy = getOriginFriendsUrlFromSynergy();
String mdmAppKey = getMdmAppKey();
if (originFriendsUrlFromSynergy == null || originFriendsUrlFromSynergy.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for responding to an invitation because end point URI is null or empty", new Object[0]);
return null;
}
if (mdmAppKey == null || mdmAppKey.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for responding to an invitation because MDM App Keyis null or empty", new Object[0]);
return null;
}
if (str == null || str.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for responding to an invitation because nucleus ID is null or empty", new Object[0]);
return null;
}
if (str2 == null || str2.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for responding to an invitation because friend ID is null or empty", new Object[0]);
return null;
}
if (str3 == null || str3.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request for responding to an invitation because access token is null or empty", new Object[0]);
return null;
}
try {
httpRequest = new HttpRequest(new URL(originFriendsUrlFromSynergy + String.format(RESPOND_TO_FRIEND_INVITATION_URI, str, str2)));
try {
if (z) {
httpRequest.method = IHttpRequest.Method.POST;
} else {
httpRequest.method = IHttpRequest.Method.DELETE;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("X-AuthToken", str3);
hashMap.put("X-Application-Key", mdmAppKey);
hashMap.put("X-Api-Version", "2");
httpRequest.headers = hashMap;
} catch (MalformedURLException e) {
e = e;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL for responding to Friends request. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
} catch (Exception e2) {
e = e2;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL for responding to Friends request. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
} catch (MalformedURLException e3) {
e = e3;
httpRequest = null;
} catch (Exception e4) {
e = e4;
httpRequest = null;
}
return httpRequest;
}
private HttpRequest makeGetFriendInvitationListRequest(String str, String str2, String str3) {
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String originFriendsUrlFromSynergy = getOriginFriendsUrlFromSynergy();
String mdmAppKey = getMdmAppKey();
if (originFriendsUrlFromSynergy == null || originFriendsUrlFromSynergy.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request because friends endpoint URI is empty or null", new Object[0]);
return null;
}
if (mdmAppKey == null || mdmAppKey.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request because MDM app key is empty or null", new Object[0]);
return null;
}
if (str3 == null || str3.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request friends API URI is empty or null", new Object[0]);
return null;
}
if (str2 == null || str2.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request because access token is null or empty", new Object[0]);
return null;
}
if (str == null || str.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make HTTP request because user's nucleus ID is null or empty", new Object[0]);
return null;
}
try {
httpRequest = new HttpRequest(new URL(originFriendsUrlFromSynergy + String.format(str3, str)));
} catch (MalformedURLException e) {
e = e;
httpRequest = null;
} catch (Exception e2) {
e = e2;
httpRequest = null;
}
try {
httpRequest.method = IHttpRequest.Method.GET;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("X-AuthToken", str2);
hashMap.put("X-Application-Key", mdmAppKey);
hashMap.put("X-Api-Version", "2");
httpRequest.headers = hashMap;
} catch (MalformedURLException e3) {
e = e3;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
} catch (Exception e4) {
e = e4;
Log.Helper.LOGE(this, "Exception when creating HTTP request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
return httpRequest;
}
private HttpRequest makeSearchUserRequest(String str, String str2, String str3, UserSearchCriteria userSearchCriteria) {
String format;
HttpRequest httpRequest;
Log.Helper.LOGFUNC(this);
String identityProxyUrlFromSynergy = getIdentityProxyUrlFromSynergy();
if (identityProxyUrlFromSynergy == null || identityProxyUrlFromSynergy.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make user search HTTP request because endpoint URI is empty or null", new Object[0]);
return null;
}
if (str == null || str.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make user search HTTP request because AccessToken is empty or null", new Object[0]);
return null;
}
if (str2 == null || str2.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make user search HTTP request TokenType is empty or null", new Object[0]);
return null;
}
if (str3 == null || str3.length() <= 0) {
Log.Helper.LOGW(this, "Cannot make user searchHTTP request because searchCriteria is null or empty", new Object[0]);
return null;
}
if (userSearchCriteria == UserSearchCriteria.EMAIL) {
format = String.format(SEARCH_USER_BY_EMAIL_URI, str3);
} else {
format = String.format(SEARCH_USER_BY_DISPLAY_NAME_URI, str3);
}
String str4 = str2 + " " + str;
try {
httpRequest = new HttpRequest(new URL(identityProxyUrlFromSynergy + format));
try {
httpRequest.method = IHttpRequest.Method.GET;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("Authorization", str4);
hashMap.put("X-Include-Underage", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
hashMap.put("X-Expand-Results", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
httpRequest.headers = hashMap;
} catch (MalformedURLException e) {
e = e;
Log.Helper.LOGE(this, "Exception when creating search user HTTP request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
} catch (Exception e2) {
e = e2;
Log.Helper.LOGE(this, "Exception when creating search user HTTP request URL. Exception: " + e.getMessage(), new Object[0]);
return httpRequest;
}
} catch (MalformedURLException e3) {
e = e3;
httpRequest = null;
} catch (Exception e4) {
e = e4;
httpRequest = null;
}
return httpRequest;
}
private boolean isNimbleComponentAvailable(String str) {
Log.Helper.LOGFUNC(this);
return Base.getComponent(str) != null;
@@ -33,7 +33,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public abstract class AuthenticatorBase extends Component implements INimbleIdentityAuthenticator, LogSource {
@@ -62,12 +61,12 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
private NimbleIdentityPidInfo m_pidInfo;
private NetworkConnectionHandle m_pidInfoRequest;
private NimbleIdentityToken m_token;
protected INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE;
protected NimbleIdentityAuthenticationState m_state = NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE;
protected NimbleIdentityUserInfo m_userInfo = new NimbleIdentityUserInfo();
protected ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> m_authenticateCallbacks = new ArrayList<>();
private ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> m_userInfoCallbacks = new ArrayList<>();
private ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> m_pidInfoCallbacks = new ArrayList<>();
private ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> m_personaCallbacks = new ArrayList<>();
protected ArrayList<NimbleIdentityAuthenticatorCallback> m_authenticateCallbacks = new ArrayList<>();
private ArrayList<NimbleIdentityAuthenticatorCallback> m_userInfoCallbacks = new ArrayList<>();
private ArrayList<NimbleIdentityAuthenticatorCallback> m_pidInfoCallbacks = new ArrayList<>();
private ArrayList<NimbleIdentityAuthenticatorCallback> m_personaCallbacks = new ArrayList<>();
private Timer m_tokenRefreshTimer = new Timer(new Runnable() { // from class: com.ea.nimble.identity.AuthenticatorBase.1
@Override // java.lang.Runnable
public void run() {
@@ -113,11 +112,11 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
abstract void autoLogin();
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState getState() {
public NimbleIdentityAuthenticationState getState() {
return this.m_state;
}
void setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState nimbleIdentityAuthenticationState) {
void setState(NimbleIdentityAuthenticationState nimbleIdentityAuthenticationState) {
if (nimbleIdentityAuthenticationState != this.m_state) {
this.m_state = nimbleIdentityAuthenticationState;
saveState();
@@ -145,11 +144,11 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
return INimbleIdentityAuthenticator.AUTHENTICATOR_COMPONENT_PREFIX + getAuthenticatorId();
}
public void restoreAuthenticator(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
public void restoreAuthenticator(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_UNAVAILABLE) {
if (this.m_state != NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_UNAVAILABLE) {
loadState();
if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
if (this.m_state != NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
loadToken();
loadPidInfo();
}
@@ -169,9 +168,9 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
resume(null);
}
private synchronized void resume(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
private synchronized void resume(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGFUNC(this);
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
Log.Helper.LOGIS(this.TAG, "Skipping autoLogin for state NONE", new Object[0]);
return;
}
@@ -182,13 +181,13 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
Log.Helper.LOGIS(this.TAG, "Authenticator %s resume failing - environment not ready.", getAuthenticatorId());
return;
}
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
Log.Helper.LOGIS(this.TAG, "Skipping autoLogin for state GOING", new Object[0]);
return;
}
if (this.m_token != null) {
if (this.m_token.getAccessTokenExpiryTime().after(new Date())) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS);
verifyAccessToken();
return;
} else if (this.m_token.getRefreshTokenExpiryTime().after(new Date())) {
@@ -237,9 +236,9 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void refreshUserInfo(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
public void refreshUserInfo(final NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
refreshPidInfo(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.7
refreshPidInfo(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.7
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
if (nimbleIdentityAuthenticatorCallback == null) {
@@ -254,7 +253,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void refreshUserProfile(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
public synchronized void refreshUserProfile(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGFUNC(this);
Error environmentCheck = environmentCheck();
if (environmentCheck != null) {
@@ -277,10 +276,10 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
public NimbleIdentityPidInfo getPidInfo() {
Log.Helper.LOGPUBLICFUNC(this);
NimbleIdentityPidInfo nimbleIdentityPidInfo = this.m_pidInfo;
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_pidInfo == null || this.m_pidInfo.getExpiryTime().before(new Date()))) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_pidInfo == null || this.m_pidInfo.getExpiryTime().before(new Date()))) {
synchronized (this) {
nimbleIdentityPidInfo = this.m_pidInfo;
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_pidInfo == null || this.m_pidInfo.getExpiryTime().before(new Date()))) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_pidInfo == null || this.m_pidInfo.getExpiryTime().before(new Date()))) {
refreshPidInfo(null);
}
}
@@ -290,9 +289,9 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void refreshPidInfo(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
public void refreshPidInfo(final NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
prepare(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.8
prepare(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.8
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
if (error == null) {
@@ -309,7 +308,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
return;
}
synchronized (AuthenticatorBase.this) {
if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
AuthenticatorBase.this.m_pidInfoRefreshTimer.schedule(60.0d, false);
}
if (nimbleIdentityAuthenticatorCallback != null) {
@@ -327,7 +326,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
Log.Helper.LOGPUBLICFUNC(this);
synchronized (this) {
arrayList = this.m_personas;
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_personas == null || (this.m_personas.size() > 0 && this.m_personas.get(0).getExpiryTime().before(new Date())))) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS && (this.m_personas == null || (this.m_personas.size() > 0 && this.m_personas.get(0).getExpiryTime().before(new Date())))) {
updatePersonas();
}
}
@@ -335,9 +334,9 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void refreshPersonas(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
public void refreshPersonas(final NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
prepare(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.9
prepare(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.9
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
if (error == null) {
@@ -354,7 +353,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
return;
}
synchronized (AuthenticatorBase.this) {
if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
AuthenticatorBase.this.m_personaRefreshTimer.schedule(60.0d, false);
}
if (nimbleIdentityAuthenticatorCallback != null) {
@@ -400,13 +399,13 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void requestAuthCode(final String str, final String str2, final INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback nimbleIdentityServerAuthCodeCallback) {
public void requestAuthCode(final String str, final String str2, final NimbleIdentityServerAuthCodeCallback nimbleIdentityServerAuthCodeCallback) {
Log.Helper.LOGPUBLICFUNC(this);
if (nimbleIdentityServerAuthCodeCallback == null) {
Log.Helper.LOGWS(this.TAG, "Request server authentication oAuth code without callback, no way to get result", new Object[0]);
} else {
Log.Helper.LOGDS(this.TAG, "Request server authentication oauth code for serverId %s and scope %s", str, str2);
prepare(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.10
prepare(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.10
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
URL url;
@@ -450,13 +449,13 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
}
public void requestIdentityForFriends(ArrayList<String> arrayList, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) throws Exception {
public void requestIdentityForFriends(ArrayList<String> arrayList, NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) throws Exception {
Log.Helper.LOGPUBLICFUNC(this);
throw new Exception("Authenticator " + getAuthenticatorId() + " doesn't support identity information for friends");
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void requestAccessToken(final INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback nimbleAuthenticatorAccessTokenCallback) {
public void requestAccessToken(final NimbleAuthenticatorAccessTokenCallback nimbleAuthenticatorAccessTokenCallback) {
Log.Helper.LOGPUBLICFUNC(this);
if (nimbleAuthenticatorAccessTokenCallback == null) {
Log.Helper.LOGW(this, "requestAccessToken API called without a callback. Aborting token refresh", new Object[0]);
@@ -471,7 +470,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
nimbleAuthenticatorAccessTokenCallback.AccessTokenCallback(this, this.m_token.getAccessToken(), this.m_token.getType(), null);
return;
} else {
prepare(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.11
prepare(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.11
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
if (error == null) {
@@ -495,8 +494,8 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
private synchronized Error environmentCheck() {
Log.Helper.LOGFUNC(this);
if (Network.getComponent().getStatus() != Network.Status.OK) {
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
}
return new Error(Error.Code.NETWORK_NO_CONNECTION, "Idenitity cannot work without network.");
}
@@ -518,7 +517,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private synchronized void prepare(com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback r3) {
private synchronized void prepare(NimbleIdentityAuthenticatorCallback r3) {
/*
r2 = this;
monitor-enter(r2)
@@ -591,7 +590,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
protected void exchangeDataForToken(String str) {
URL url;
URL url = null;
Log.Helper.LOGFUNC(this);
URL url2 = null;
try {
@@ -599,7 +598,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
} catch (IOException unused) {
}
try {
byte[] bytes = str.getBytes(HTTP.UTF_8);
byte[] bytes = str.getBytes();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
byteArrayOutputStream.write(bytes);
HashMap<String, String> hashMap = new HashMap<>();
@@ -628,14 +627,14 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
if (this.m_tokenRefreshTimer.isRunning()) {
this.m_tokenRefreshTimer.cancel();
}
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
NimbleIdentityConfig configuration = getConfiguration();
URL url = null;
String format = String.format(DATA_TEMPLATE_LOGIN_WITH_REFRESH_TOKEN, this.m_token.getRefreshToken(), configuration.getClientId(), configuration.getClientSecret());
try {
URL url2 = new URL(String.format(URL_TEMPLATE_LOGIN, configuration.getConnectServerUrl()));
try {
byte[] bytes = format.getBytes(HTTP.UTF_8);
byte[] bytes = format.getBytes();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
byteArrayOutputStream.write(bytes);
HashMap<String, String> hashMap = new HashMap<>();
@@ -674,17 +673,17 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
this.m_personaRequest.cancel();
this.m_personaRequest = null;
}
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
if (this.m_authenticateRequest != null) {
this.m_authenticateRequest.cancel();
this.m_authenticateRequest = null;
}
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
}
}
protected void closeAuthentication(Error error) {
ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> arrayList;
ArrayList<NimbleIdentityAuthenticatorCallback> arrayList;
Log.Helper.LOGFUNC(this);
synchronized (this) {
this.m_authenticateRequest = null;
@@ -713,7 +712,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET, Utility.convertObjectToJSONString(hashMap3));
iTracking.logEvent(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_LOGIN, hashMap);
}
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS);
if (getConfiguration().getAutoRefresh()) {
double time = this.m_token.getAccessTokenExpiryTime().getTime() - System.currentTimeMillis();
Double.isNaN(time);
@@ -730,20 +729,20 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
} else {
Log.Helper.LOGES(this.TAG, "Authentication closed with error %s.", error);
setState(isPlatformLoggedIn() ? INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE : INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
setState(isPlatformLoggedIn() ? NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE : NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
}
arrayList = this.m_authenticateCallbacks;
this.m_authenticateCallbacks = new ArrayList<>();
}
this.m_autoLoginAttempt = false;
Iterator<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
Iterator<NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
while (it.hasNext()) {
it.next().onCallback(this, error);
}
}
protected void closeUserInfoUpdate(Error error, boolean z) {
ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> arrayList;
ArrayList<NimbleIdentityAuthenticatorCallback> arrayList;
Log.Helper.LOGFUNC(this);
if (error == null) {
Log.Helper.LOGVS(this.TAG, "Updating user profile succeed!", new Object[0]);
@@ -753,7 +752,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
synchronized (this) {
if (z) {
try {
if (getConfiguration().getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (getConfiguration().getAutoRefresh() && this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (error == null && this.m_userInfo.getExpiryTime() != null) {
double time = this.m_userInfo.getExpiryTime().getTime() - System.currentTimeMillis();
Double.isNaN(time);
@@ -769,7 +768,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
arrayList = this.m_userInfoCallbacks;
this.m_userInfoCallbacks = new ArrayList<>();
}
Iterator<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
Iterator<NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
while (it.hasNext()) {
it.next().onCallback(this, error);
}
@@ -777,7 +776,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
/* JADX INFO: Access modifiers changed from: private */
public void closePidInfoUpdate(Error error) {
ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> arrayList;
ArrayList<NimbleIdentityAuthenticatorCallback> arrayList;
Log.Helper.LOGFUNC(this);
if (error == null) {
Log.Helper.LOGVS(this.TAG, "Updating pid information succeed!", new Object[0]);
@@ -786,7 +785,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
synchronized (this) {
this.m_pidInfoRequest = null;
if (getConfiguration().getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (getConfiguration().getAutoRefresh() && this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (error == null) {
double time = this.m_pidInfo.getExpiryTime().getTime() - System.currentTimeMillis();
Double.isNaN(time);
@@ -798,13 +797,13 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
arrayList = this.m_pidInfoCallbacks;
this.m_pidInfoCallbacks = new ArrayList<>();
}
Iterator<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
Iterator<NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
while (it.hasNext()) {
it.next().onCallback(this, error);
}
}
protected void requestIdentityForFriends(String str, ArrayList<String> arrayList, final INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) {
protected void requestIdentityForFriends(String str, ArrayList<String> arrayList, final NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) {
Log.Helper.LOGFUNC(this);
if (nimbleIdentityFriendsIdentityInfoCallback == null) {
Log.Helper.LOGES(this.TAG, "requestIdentityForFriends called with no way to notify caller", new Object[0]);
@@ -821,7 +820,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
try {
URL url2 = new URL(String.format("%s%s", getConfiguration().getProxyServerUrl(), URL_TEMPALTE_GET_IDENTITY_INFO_FOR_FRIENDS));
try {
byte[] bytes = convertObjectToJSONString.getBytes(HTTP.UTF_8);
byte[] bytes = convertObjectToJSONString.getBytes();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
byteArrayOutputStream.write(bytes);
String format = String.format("%s %s", this.m_token.getType(), this.m_token.getAccessToken());
@@ -932,7 +931,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
/* JADX INFO: Access modifiers changed from: private */
public void closePersonaUpdate(Error error) {
ArrayList<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> arrayList;
ArrayList<NimbleIdentityAuthenticatorCallback> arrayList;
double expiryInterval;
Log.Helper.LOGFUNC(this);
if (error == null) {
@@ -943,7 +942,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
synchronized (this) {
this.m_personaRequest = null;
NimbleIdentityConfig configuration = getConfiguration();
if (configuration.getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (configuration.getAutoRefresh() && this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (this.m_personas != null && this.m_personas.size() > 0) {
double time = this.m_personas.get(0).getExpiryTime().getTime() - System.currentTimeMillis();
Double.isNaN(time);
@@ -959,7 +958,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
arrayList = this.m_personaCallbacks;
this.m_personaCallbacks = new ArrayList<>();
}
Iterator<INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
Iterator<NimbleIdentityAuthenticatorCallback> it = arrayList.iterator();
while (it.hasNext()) {
it.next().onCallback(this, error);
}
@@ -1024,7 +1023,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
synchronized void enableAutoRefresh(boolean z) {
Log.Helper.LOGFUNC(this);
if (z) {
if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (this.m_state != NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
return;
}
if (!this.m_tokenRefreshTimer.isRunning() && this.m_authenticateRequest == null && this.m_token != null) {
@@ -1060,10 +1059,10 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
}
}
protected synchronized void cleanAtLogout(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
protected synchronized void cleanAtLogout(final NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGFUNC(this);
boolean z = true;
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) {
try {
NimbleIdentityConfig configuration = getConfiguration();
HttpRequest httpRequest = new HttpRequest(new URL(String.format(URL_TEMPLATE_LOGOUT, configuration.getConnectServerUrl(), configuration.getClientId(), this.m_token.getAccessToken())));
@@ -1095,7 +1094,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
z = false;
}
this.m_personas = null;
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
Log.Helper.LOGDS(this.TAG, "Logout of authenticator " + getAuthenticatorId(), new Object[0]);
if (z2) {
HashMap hashMap = new HashMap();
@@ -1123,8 +1122,8 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
} catch (MalformedURLException unused) {
Log.Helper.LOGFS("Network", "Malformed URL from %s", null);
}
} else if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
} else if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
Log.Helper.LOGWS(this.TAG, "Logout of authenticator %s while state was going. Premature interruption. Check for failure.", getAuthenticatorId());
if (nimbleIdentityAuthenticatorCallback != null) {
nimbleIdentityAuthenticatorCallback.onCallback(this, null);
@@ -1134,7 +1133,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
authenticationConductor2.handleLogout(this);
}
} else {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE);
}
}
@@ -1147,11 +1146,11 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
resume();
return;
}
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
if (this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) {
cancelAuthentication();
}
if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
if (this.m_state != NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) {
setState(NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE);
}
}
@@ -1172,7 +1171,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
return;
}
synchronized (this) {
this.m_pidInfoCallbacks.add(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.18
this.m_pidInfoCallbacks.add(new NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.18
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
AuthenticatorBase.this.closeAuthentication(error);
@@ -1268,7 +1267,7 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent != null) {
boolean z = this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING || this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE || this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS;
boolean z = this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING || this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE || this.m_state == NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS;
persistenceForNimbleComponent.setValue("loggedIn", Boolean.valueOf(z));
persistenceForNimbleComponent.synchronize();
Log.Helper.LOGDS(this.TAG, "Saved loggedIn value to persistence as %s for state %s", Boolean.valueOf(z), this.m_state);
@@ -1280,10 +1279,10 @@ public abstract class AuthenticatorBase extends Component implements INimbleIden
Log.Helper.LOGFUNC(this);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT);
if (persistenceForNimbleComponent != null && (bool = (Boolean) persistenceForNimbleComponent.getValue("loggedIn")) != null && bool.booleanValue()) {
this.m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE;
this.m_state = NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE;
Log.Helper.LOGVS(this.TAG, "Loaded state: OFFLINE", new Object[0]);
} else {
this.m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE;
this.m_state = NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE;
Log.Helper.LOGVS(this.TAG, "Loaded state: NONE", new Object[0]);
}
}
@@ -1,293 +1,24 @@
package com.ea.nimble.identity;
import android.support.v4.app.NotificationCompat;
import com.ea.nimble.Base;
import com.ea.nimble.Error;
import com.ea.nimble.Global;
import com.ea.nimble.IFacebook;
import com.ea.nimble.INetwork;
import com.ea.nimble.Log;
import com.ea.nimble.Network;
import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
import com.ea.nimble.Utility;
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
import com.ea.nimble.identity.NimbleIdentityError;
import com.ea.nimble.identity.NimbleIdentityLoginParams;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
class AuthenticatorFacebook extends AuthenticatorBase {
private static final String PID_TYPE = "mobile_facebook";
private static final String URL_TEMPLATE_FACEBOOK_IMAGE_URL = "https://graph.facebook.com/%s/picture?type=normal";
private static final String URL_TEMPLATE_FACEBOOK_LOGIN = "%s/connect/auth?mobile_login_type=mobile_game_facebook&client_id=%s&response_type=code&fb_token=%s&redirect_uri=nucleus:rest";
private String m_overrideBirthday;
private static void initialize() {
Log.Helper.LOGFUNCS("AuthenticatorFacebook");
AuthenticatorFacebook authenticatorFacebook = new AuthenticatorFacebook();
Base.registerComponent(authenticatorFacebook, authenticatorFacebook.getComponentId());
}
private AuthenticatorFacebook() {
this.TAG = "AuthenticatorFacebook";
}
@Override // com.ea.nimble.Component
protected void setup() {
Log.Helper.LOGFUNC(this);
this.m_overrideBirthday = null;
}
@Override // com.ea.nimble.identity.AuthenticatorBase
public void restoreAuthenticator(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
if (Base.getComponent("com.ea.nimble.facebook") == null) {
Log.Helper.LOGIS(this.TAG, "FacebookAuthenticator is disabled since there is no NimbleFacebook component", new Object[0]);
Log.Helper.LOGIS(this.TAG, "To enable FacebookAuthenticator, please ensure the NimbleFacebook jar is correctly linked", new Object[0]);
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_UNAVAILABLE);
}
super.restoreAuthenticator(nimbleIdentityAuthenticatorCallback);
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public String getAuthenticatorId() {
Log.Helper.LOGPUBLICFUNC(this);
return Global.NIMBLE_AUTHENTICATOR_FACEBOOK;
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void login(NimbleIdentityLoginParams nimbleIdentityLoginParams, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
Log.Helper.LOGIS(this.TAG, "Facebook Authenticator Login", new Object[0]);
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
Log.Helper.LOGIS(this.TAG, "Cannot login with FacebookAuthenticator since it is disabled for no NimbleFacebook component", new Object[0]);
if (nimbleIdentityAuthenticatorCallback != null) {
nimbleIdentityAuthenticatorCallback.onCallback(this, new Error(Error.Code.NOT_AVAILABLE, "Cannot login with FacebookAuthenticator since it is disabled for no NimbleFacebook component"));
return;
}
return;
}
IFacebook iFacebook = (IFacebook) component;
if (nimbleIdentityLoginParams != null) {
if (nimbleIdentityLoginParams instanceof NimbleIdentityLoginParams.FacebookClientLoginParams) {
loginFacebook(iFacebook, ((NimbleIdentityLoginParams.FacebookClientLoginParams) nimbleIdentityLoginParams).getFacebookPermissions(), nimbleIdentityAuthenticatorCallback);
return;
}
if (!(nimbleIdentityLoginParams instanceof NimbleIdentityLoginParams.FacebookAccessTokenLoginParams)) {
if (nimbleIdentityAuthenticatorCallback != null) {
nimbleIdentityAuthenticatorCallback.onCallback(this, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_INVALID_LOGINPARAMS, "Unrecognized login parameters"));
return;
}
return;
}
NimbleIdentityLoginParams.FacebookAccessTokenLoginParams facebookAccessTokenLoginParams = (NimbleIdentityLoginParams.FacebookAccessTokenLoginParams) nimbleIdentityLoginParams;
if (!Utility.validString(facebookAccessTokenLoginParams.getFacebookAccessToken())) {
if (nimbleIdentityAuthenticatorCallback != null) {
nimbleIdentityAuthenticatorCallback.onCallback(this, new Error(Error.Code.INVALID_ARGUMENT, "Invalid Facebook access token for Facebook token"));
return;
}
return;
} else {
synchronized (this) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
if (nimbleIdentityAuthenticatorCallback != null) {
this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback);
}
iFacebook.refreshToken();
exchangeFacebookAccessTokenForAuthCode(facebookAccessTokenLoginParams.getFacebookAccessToken());
}
return;
}
}
loginFacebook(iFacebook, null, nimbleIdentityAuthenticatorCallback);
}
private void loginFacebook(IFacebook iFacebook, List<String> list, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGFUNC(this);
synchronized (this) {
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
if (nimbleIdentityAuthenticatorCallback != null) {
this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback);
}
}
iFacebook.login(list, new IFacebook.RequestCallback() { // from class: com.ea.nimble.identity.AuthenticatorFacebook.1
@Override // com.ea.nimble.IFacebook.RequestCallback
public void callback(String str, Error error) {
Log.Helper.LOGPUBLICFUNC(this);
IFacebook iFacebook2 = (IFacebook) Base.getComponent("com.ea.nimble.facebook");
if (iFacebook2 != null) {
if (error == null) {
if (!Utility.validString(iFacebook2.getAccessToken())) {
AuthenticatorFacebook.this.closeAuthentication(new Error(Error.Code.SYSTEM_UNEXPECTED, "Facebook SDK gives login success without a valid Facebook token"));
return;
} else {
synchronized (this) {
AuthenticatorFacebook.this.exchangeFacebookAccessTokenForAuthCode(iFacebook2.getAccessToken());
}
return;
}
}
AuthenticatorFacebook.this.closeAuthentication(error.getCode() == Error.Code.NETWORK_OPERATION_CANCELLED.intValue() ? new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_USER_CANCELLED, "Facebook login is cancelled by user", error) : error);
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void exchangeFacebookAccessTokenForAuthCode(String str) {
Log.Helper.LOGFUNC(this);
try {
NimbleIdentityConfig configuration = getConfiguration();
URL url = new URL(String.format(URL_TEMPLATE_FACEBOOK_LOGIN, configuration.getConnectServerUrl(), configuration.getClientId(), str));
INetwork component = Network.getComponent();
if (component != null) {
this.m_authenticateRequest = component.sendGetRequest(url, new HashMap<>(), new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorFacebook.2
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
Log.Helper.LOGPUBLICFUNC(this);
try {
Map<String, Object> parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle);
String str2 = (String) parseBodyJSONData.get("code");
if (!Utility.validString(str2)) {
AuthenticatorFacebook.this.closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Cannot read login OAuth code data from server response data " + parseBodyJSONData));
return;
}
AuthenticatorFacebook.this.exchangeAuthCodeToToken(str2);
} catch (Error e) {
AuthenticatorFacebook.this.closeAuthentication(e);
}
}
});
} else {
Log.Helper.LOGES("Network", "Network Component was null!", new Object[0]);
}
} catch (MalformedURLException unused) {
Log.Helper.LOGFS("Network", "Malformed URL from %s", null);
}
}
@Override // com.ea.nimble.identity.INimbleIdentityAuthenticator
public void logout(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
Log.Helper.LOGPUBLICFUNC(this);
Log.Helper.LOGIS(this.TAG, "Facebook Authenticator is logging out", new Object[0]);
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
Log.Helper.LOGIS(this.TAG, "Cannot logout with FacebookAuthenticator since it is disabled for no NimbleFacebook component", new Object[0]);
NimbleIdentityError nimbleIdentityError = new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_INVALID_REQUEST, "Cannot logout with FacebookAuthenticator since it is disabled for no NimbleFacebook component");
if (nimbleIdentityAuthenticatorCallback != null) {
nimbleIdentityAuthenticatorCallback.onCallback(this, nimbleIdentityError);
return;
}
return;
}
cancelAuthentication();
((IFacebook) component).logout();
cleanAtLogout(nimbleIdentityAuthenticatorCallback);
}
@Override // com.ea.nimble.identity.AuthenticatorBase
@Override
void autoLogin() {
Log.Helper.LOGIS(this.TAG, "Facebook Authenticator AutoLogin", new Object[0]);
this.m_autoLoginAttempt = true;
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
closeAuthentication(new Error(Error.Code.SYSTEM_UNEXPECTED, "Cannot auto login with FacebookAuthenticator since it is disabled for no NimbleFacebook component"));
return;
}
IFacebook iFacebook = (IFacebook) component;
if (Utility.validString(iFacebook.getAccessToken())) {
synchronized (this) {
this.m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING;
exchangeFacebookAccessTokenForAuthCode(iFacebook.getAccessToken());
}
return;
}
closeAuthentication(new Error(Error.Code.SYSTEM_UNEXPECTED, "Cannot auto login with FacebookAuthenticator since Facebook SDK doesn't have any session existing"));
}
@Override // com.ea.nimble.identity.AuthenticatorBase, com.ea.nimble.identity.INimbleIdentityAuthenticator
public void requestIdentityForFriends(ArrayList<String> arrayList, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) throws Exception {
Log.Helper.LOGPUBLICFUNC(this);
requestIdentityForFriends(PID_TYPE, arrayList, nimbleIdentityFriendsIdentityInfoCallback);
@Override
public String getAuthenticatorId() {
return "";
}
@Override // com.ea.nimble.identity.AuthenticatorBase
protected boolean isPlatformLoggedIn() {
Log.Helper.LOGFUNC(this);
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
return false;
}
return Utility.validString(((IFacebook) component).getAccessToken());
@Override
public void login(NimbleIdentityLoginParams nimbleIdentityLoginParams, NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
}
@Override // com.ea.nimble.identity.AuthenticatorBase
protected void updateUserProfile() {
NimbleIdentityUserInfo m4clone;
Log.Helper.LOGFUNC(this);
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
closeUserInfoUpdate(new Error(Error.Code.NOT_AVAILABLE, "Cannot auto login with FacebookAuthenticator since it is disabled for no NimbleFacebook component"), true);
return;
}
Map<String, Object> graphUser = ((IFacebook) component).getGraphUser();
if (this.m_userInfo == null) {
m4clone = new NimbleIdentityUserInfo();
} else {
m4clone = this.m_userInfo.m4clone();
}
if (graphUser != null) {
m4clone.setUserId((String) graphUser.get("id"));
m4clone.setDisplayName((String) graphUser.get("name"));
m4clone.setUserName((String) graphUser.get("username"));
m4clone.setAvatarUri(String.format(URL_TEMPLATE_FACEBOOK_IMAGE_URL, m4clone.getUserId()));
String str = (String) graphUser.get("birthday");
if (Utility.validString(str) && (!Utility.validString(m4clone.getDateOfBirth()) || m4clone.getDateOfBirth().equals(this.m_overrideBirthday))) {
this.m_overrideBirthday = str;
m4clone.setDateOfBirth(str);
}
m4clone.setEmail((String) graphUser.get(NotificationCompat.CATEGORY_EMAIL));
m4clone.setExpiryTime(new Date(System.currentTimeMillis() + ((long) (getConfiguration().getExpiryInterval() * 1000.0d))));
synchronized (this) {
this.m_userInfo = m4clone;
}
closeUserInfoUpdate(null, true);
HashMap hashMap = new HashMap();
hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, getAuthenticatorId());
Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_IDENTITY_USER_INFO_UPDATE, hashMap);
}
}
@Override
public void logout(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
@Override // com.ea.nimble.identity.AuthenticatorBase
protected void cancelAuthentication() {
Log.Helper.LOGFUNC(this);
if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING && this.m_authenticateRequest == null) {
super.cancelAuthentication();
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
} else {
super.cancelAuthentication();
}
}
@Override // com.ea.nimble.identity.AuthenticatorBase, com.ea.nimble.identity.INimbleIdentityAuthenticator
public void verifyAccessToken() {
Log.Helper.LOGPUBLICFUNC(this);
Object component = Base.getComponent("com.ea.nimble.facebook");
if (component == null) {
return;
}
if (((IFacebook) component).hasOpenSession()) {
onVerifiedAccessToken();
} else {
closeAuthentication(new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_SESSION_EXPIRED, "Facebook Access token no longer has permissions"));
}
}
}
@@ -1,10 +1,6 @@
package com.ea.nimble.identity;
import android.support.v4.view.PointerIconCompat;
import android.support.v7.widget.ActivityChooserView;
import com.ea.nimble.Error;
import com.facebook.internal.NativeProtocol;
import com.google.android.gms.appstate.AppStateClient;
import java.util.Map;
/* loaded from: classes.dex */
@@ -17,20 +13,20 @@ public class NimbleIdentityError extends Error {
NIMBLE_IDENTITY_ERROR_UNSUPPORTED_ACTION(101),
NIMBLE_IDENTITY_ERROR_UNAUTHENTICATED(1001),
NIMBLE_IDENTITY_ERROR_SESSION_EXPIRED(1002),
NIMBLE_IDENTITY_ERROR_INVALID_LOGINPARAMS(PointerIconCompat.TYPE_HELP),
NIMBLE_IDENTITY_ERROR_INVALID_LOGINPARAMS(444444),
NIMBLE_IDENTITY_ERROR_REFRESH_USER_INFO_FROM_FIRST_PARTY(1101),
NIMBLE_IDENTITY_ERROR_REFRESH_USER_INFO_FROM_PID_INFO(1102),
NIMBLE_IDENTITY_ERROR_BAD_CLIENT_ID(1500),
NIMBLE_IDENTITY_ERROR_BAD_CLIENT_SECRET(1501),
NIMBLE_IDENTITY_ERROR_INVALID_REQUEST(AppStateClient.STATUS_WRITE_SIZE_EXCEEDED),
NIMBLE_IDENTITY_ERROR_INVALID_OAUTH_INFO(AppStateClient.STATUS_STATE_KEY_NOT_FOUND),
NIMBLE_IDENTITY_ERROR_INVALID_REQUEST(654),
NIMBLE_IDENTITY_ERROR_INVALID_OAUTH_INFO(7654),
NIMBLE_IDENTITY_ERROR_MIGRATION_SOURCE_INVALID(9101),
NIMBLE_IDENTITY_ERROR_MIGRATION_TARGET_INVALID(9102),
NIMBLE_IDENTITY_ERROR_MIGRATION_NOT_AUTHENTICATED(9103),
NIMBLE_IDENTITY_ERROR_MIGRATION_NO_ACCESS_TOKENS(9104),
NIMBLE_IDENTITY_ERROR_MIGRATION_NO_URL(9105),
NIMBLE_IDENTITY_ERROR_MIGRATION_FAILED(9106),
NIMBLE_IDENTITY_ERROR_UNKNOWN(ActivityChooserView.ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
NIMBLE_IDENTITY_ERROR_UNKNOWN(9876);
private int m_value;
@@ -54,10 +50,7 @@ public class NimbleIdentityError extends Error {
public static NimbleIdentityError createWithData(Map<String, Object> map) {
String str = (String) map.get("error");
NimbleIdentityErrorCode parseErrorCode = parseErrorCode(str);
String str2 = (String) map.get(NativeProtocol.BRIDGE_ARG_ERROR_DESCRIPTION);
if (str2 == null) {
str2 = str;
}
String str2 = str;
return new NimbleIdentityError(parseErrorCode, str2);
}
@@ -37,7 +37,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class NimbleIdentityImpl extends Component implements INimbleIdentity, LogSource {
@@ -102,7 +101,7 @@ public class NimbleIdentityImpl extends Component implements INimbleIdentity, Lo
Component[] componentList = Base.getComponentList(INimbleIdentityAuthenticator.AUTHENTICATOR_COMPONENT_PREFIX);
Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE, this.m_authenticationUpdateReceiver);
Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE, this.m_pidInfoUpdateReceiver);
for (ApplicationEnvironmentImpl applicationEnvironmentImpl : componentList) {
for (Component applicationEnvironmentImpl : componentList) {
if (!(applicationEnvironmentImpl instanceof INimbleIdentityAuthenticator)) {
Log.Helper.LOGW(this, "Invalid authenticator %s", applicationEnvironmentImpl.getComponentId());
} else {
@@ -530,15 +529,11 @@ public class NimbleIdentityImpl extends Component implements INimbleIdentity, Lo
serverUrlWithKey = serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1);
}
url = new URL(String.format(URL_TEMPLATE_MIGRATE, serverUrlWithKey) + format);
byte[] bytes = format.getBytes();
byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
try {
byte[] bytes = format.getBytes(HTTP.UTF_8);
byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
try {
byteArrayOutputStream.write(bytes);
} catch (IOException unused) {
}
} catch (IOException unused2) {
byteArrayOutputStream = null;
byteArrayOutputStream.write(bytes);
} catch (IOException ignored) {
}
} catch (IOException unused3) {
byteArrayOutputStream = null;
@@ -1,6 +1,5 @@
package com.ea.nimble.identity;
import android.support.v4.app.NotificationCompat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -8,9 +7,6 @@ import java.util.List;
/* loaded from: classes.dex */
public abstract class NimbleIdentityLoginParams {
public static class AnonymousLoginParams extends NimbleIdentityLoginParams {
}
protected NimbleIdentityLoginParams() {
}
@@ -79,24 +75,4 @@ public abstract class NimbleIdentityLoginParams {
}
}
public static class FacebookClientLoginParams extends NimbleIdentityLoginParams {
private List<String> facebookPermissions;
public FacebookClientLoginParams(List<String> list) {
if (list != null && list.size() > 0) {
this.facebookPermissions = list;
if (list.contains(NotificationCompat.CATEGORY_EMAIL)) {
return;
}
this.facebookPermissions.add(NotificationCompat.CATEGORY_EMAIL);
return;
}
this.facebookPermissions = new ArrayList();
this.facebookPermissions.add(NotificationCompat.CATEGORY_EMAIL);
}
List<String> getFacebookPermissions() {
return this.facebookPermissions;
}
}
}
@@ -1,8 +1,6 @@
package com.ea.nimble.identity;
import com.ea.nimble.Log;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import java.util.Date;
import java.util.Map;
@@ -75,18 +73,6 @@ public class NimbleIdentityPersona {
this.showPersona = toEnumPersonaPrivacyLevel((String) map.get("showPersona"));
this.dateCreated = (String) map.get("dateCreated");
this.lastAuthenticated = (String) map.get("lastAuthenticated");
Object obj = map.get("isVisible");
if (obj != null) {
if (obj instanceof Boolean) {
if (((Boolean) obj).booleanValue()) {
this.isVisible = ServerProtocol.DIALOG_RETURN_SCOPES_TRUE;
} else {
this.isVisible = "false";
}
} else if (obj instanceof String) {
this.isVisible = (String) obj;
}
}
this.expiryTime = new Date(date.getTime());
}
@@ -298,8 +284,6 @@ public class NimbleIdentityPersona {
return "NO_ONE";
case PERSONA_PRIVACY_LEVEL_EVERYONE:
return "EVERYONE";
case PERSONA_PRIVACY_LEVEL_FRIENDS:
return ShareConstants.PEOPLE_IDS;
case PERSONA_PRIVACY_LEVEL_FRIENDS_OF_FRIENDS:
return "FRIENDS_OF_FRIENDS";
default:
@@ -400,9 +384,6 @@ public class NimbleIdentityPersona {
if (str.equalsIgnoreCase("EVERYONE")) {
return PersonaPrivacyLevel.PERSONA_PRIVACY_LEVEL_EVERYONE;
}
if (str.equalsIgnoreCase(ShareConstants.PEOPLE_IDS)) {
return PersonaPrivacyLevel.PERSONA_PRIVACY_LEVEL_FRIENDS;
}
return str.equalsIgnoreCase("FRIENDS_OF_FRIENDS") ? PersonaPrivacyLevel.PERSONA_PRIVACY_LEVEL_FRIENDS_OF_FRIENDS : personaPrivacyLevel;
}
}
@@ -15,7 +15,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import org.apache.http.protocol.HTTP;
import org.json.JSONException;
import org.json.JSONObject;
@@ -59,7 +58,7 @@ class NimbleIdentityUtility {
}
try {
byte[] bytes = new GsonBuilder().serializeNulls().create().toJson(hashMap, new TypeToken<HashMap<String, Object>>() { // from class: com.ea.nimble.identity.NimbleIdentityUtility.1
}.getType()).getBytes(HTTP.UTF_8);
}.getType()).getBytes();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
byteArrayOutputStream.write(bytes);
return byteArrayOutputStream;
@@ -22,7 +22,6 @@ import com.ea.nimble.SynergyRequest;
import com.ea.nimble.Utility;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.NimbleMTXError;
import com.facebook.internal.ServerProtocol;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -128,7 +127,6 @@ public class SynergyCatalog implements LogSource {
hashMap.put("uid", Utility.validString(SynergyIdManager.getComponent().getSynergyId()) ? SynergyIdManager.getComponent().getSynergyId() : "0");
hashMap.put("sdkVer", Global.NIMBLE_RELEASE_VERSION);
hashMap.put("langCode", component.getShortApplicationLanguageCode());
hashMap.put("includeOfferType", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
@@ -9,8 +9,10 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.content.LocalBroadcastManager;
import android.telephony.TelephonyManager;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.ApplicationLifecycle;
import com.ea.nimble.Base;
@@ -54,10 +56,6 @@ import com.ea.nimble.mtx.googleplay.util.Purchase;
import com.ea.nimble.mtx.googleplay.util.SkuDetails;
import com.ea.nimble.tracking.ITracking;
import com.ea.nimble.tracking.Tracking;
import com.facebook.FacebookSdk;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.places.model.PlaceFields;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -239,23 +237,6 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
private void createIabHelper() {
this.mGooglePlayIabHelper = new IabHelper(ApplicationEnvironment.getComponent().getApplicationContext(), getAppPublicKey(), GOOGLEPLAY_ACTIVITY_RESULT_REQUEST_CODE);
this.mGooglePlayIabHelper.enableDebugLogging(true);
this.mGooglePlayIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.1
@Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabSetupFinishedListener
public void onIabSetupFinished(IabResult iabResult) {
Log.Helper.LOGD(this, "InAppBilling helper setup finished.", new Object[0]);
if (iabResult.isSuccess()) {
GooglePlay.this.m_itemRestorer.restoreItems();
return;
}
Log.Helper.LOGD(this, "Error setting up InAppBilling helper: " + iabResult, new Object[0]);
}
}, new IabHelper.OnIabBroadcastListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.2
@Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabBroadcastListener
public void receivedBroadcast() {
Log.Helper.LOGD(this, "Received PURCHASES_UPDATED broadcast - resolving transactions", new Object[0]);
GooglePlay.this.restorePurchasedTransactions();
}
}, this);
}
public static GooglePlay getComponent() {
@@ -268,33 +249,7 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
@Override // com.ea.nimble.Component
public void setup() {
Log.Helper.LOGD(this, "Component setup", new Object[0]);
if (this.mGooglePlayIabHelper == null) {
createIabHelper();
}
this.m_verificationEnabled = true;
this.m_reportingEnabled = true;
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString("com.ea.nimble.mtx.enableVerification");
if ("false".equalsIgnoreCase(configValueAsString)) {
Log.Helper.LOGD(this, "Receipt verification has been disabled.", new Object[0]);
this.m_verificationEnabled = false;
String configValueAsString2 = NimbleApplicationConfiguration.getConfigValueAsString("com.ea.nimble.mtx.reportingEnabled");
if ("false".equalsIgnoreCase(configValueAsString2)) {
Log.Helper.LOGD(this, "Transaction reporting has been disabled.", new Object[0]);
this.m_reportingEnabled = false;
return;
} else {
if (ServerProtocol.DIALOG_RETURN_SCOPES_TRUE.equalsIgnoreCase(configValueAsString2)) {
return;
}
Log.Helper.LOGD(this, "Value com.ea.nimble.mtx.reportingEnabled corrupted or non existed in manifest file.", new Object[0]);
return;
}
}
if (ServerProtocol.DIALOG_RETURN_SCOPES_TRUE.equalsIgnoreCase(configValueAsString)) {
return;
}
Log.Helper.LOGD(this, "Value com.ea.nimble.mtx.enableVerification corrupted or non existed in manifest file.", new Object[0]);
}
@Override // com.ea.nimble.Component
@@ -434,7 +389,6 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
hashMap2.put("en", "mtx");
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap2);
bundle.putString(NativeProtocol.WEB_DIALOG_ACTION, "begin");
if (sellIdFromSku != null) {
bundle.putString("itemSellId", sellIdFromSku);
} else {
@@ -584,7 +538,6 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
hashMap2.put("en", "mtx");
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap2);
bundle.putString(NativeProtocol.WEB_DIALOG_ACTION, "purchased");
if (sellIdFromSku != null) {
bundle.putString("itemSellId", sellIdFromSku);
} else {
@@ -1147,7 +1100,7 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
if (googlePlayCatalogItem != null && googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.SUBSCRIPTION) {
str = IabHelper.ITEM_TYPE_SUBS;
}
this.mGooglePlayIabHelper.launchPurchaseFlow(ApplicationEnvironment.getCurrentActivity(), googlePlayTransaction.getItemSku(), str, googlePlayTransaction.mDeveloperPayload);
// this.mGooglePlayIabHelper.launchPurchaseFlow(ApplicationEnvironment.getCurrentActivity(), googlePlayTransaction.getItemSku(), str, googlePlayTransaction.mDeveloperPayload);
}
@Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabPurchaseFinishedListener
@@ -1421,10 +1374,6 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
hashMap3.put("appVersion", Utility.safeString(component.getApplicationVersion()));
hashMap3.put("appLanguage", Utility.safeString(ApplicationEnvironment.getComponent().getShortApplicationLanguageCode()));
hashMap3.put(ApplicationEnvironment.NIMBLE_PARAMETER_COUNTRY_CODE, Utility.safeString(Locale.getDefault().getCountry()));
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(FacebookSdk.APPLICATION_ID_PROPERTY);
if (Utility.validString(configValueAsString)) {
hashMap3.put("fbAppId", configValueAsString);
}
try {
Cursor query = ApplicationEnvironment.getComponent().getApplicationContext().getContentResolver().query(Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider"), null, null, null, null);
if (query != null) {
@@ -1441,9 +1390,9 @@ public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIab
hashMap4.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_NAME, "Android");
hashMap4.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, bool);
PackageManager packageManager = component.getApplicationContext().getPackageManager();
TelephonyManager telephonyManager = (TelephonyManager) component.getApplicationContext().getSystemService(PlaceFields.PHONE);
if (packageManager.checkPermission("android.permission.READ_PHONE_STATE", component.getApplicationContext().getPackageName()) == 0) {
hashMap4.put(ApplicationEnvironment.NIMBLE_PARAMETER_IMEI, Utility.safeString(telephonyManager.getDeviceId()));
TelephonyManager telephonyManager = (TelephonyManager) component.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
if (packageManager.checkPermission("android.permission.READ_PHONE_STATE", component.getApplicationContext().getPackageName()) == PackageManager.PERMISSION_GRANTED) {
//hashMap4.put(ApplicationEnvironment.NIMBLE_PARAMETER_IMEI, Utility.safeString(telephonyManager.getDeviceId()));
}
hashMap.put("deviceInfo", Utility.convertObjectToJSONString(hashMap4));
hashMap.put("schemaVer", "2");
@@ -2,7 +2,6 @@ package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Error;
import com.ea.nimble.mtx.googleplay.util.IabHelper;
import com.google.android.gms.games.GamesActivityResultCodes;
/* loaded from: classes.dex */
class GooglePlayError extends Error {
@@ -29,7 +28,7 @@ class GooglePlayError extends Error {
IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE(IabHelper.IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE),
IABHELPER_INVALID_CONSUMPTION(IabHelper.IABHELPER_INVALID_CONSUMPTION),
IABHELPER_SUBSCRIPTION_UPDATE_NOT_AVAILABLE(IabHelper.IABHELPER_SUBSCRIPTION_UPDATE_NOT_AVAILABLE),
UNKNOWN(GamesActivityResultCodes.RESULT_LICENSE_FAILED);
UNKNOWN(1111112);
private int m_value;
@@ -1,7 +1,5 @@
package com.ea.nimble.mtx.googleplay.util;
import android.support.v7.widget.ActivityChooserView;
/* loaded from: classes.dex */
public class Base64 {
static final /* synthetic */ boolean $assertionsDisabled = false;
@@ -53,7 +51,7 @@ public class Base64 {
}
public static String encode(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
byte[] encode = encode(bArr, i, i2, bArr2, ActivityChooserView.ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
byte[] encode = encode(bArr, i, i2, bArr2, 7);
int length = encode.length;
while (!z && length > 0 && encode[length - 1] == 61) {
length--;
@@ -16,11 +16,9 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import com.android.vending.billing.IInAppBillingService;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Log;
import com.ea.nimble.LogSource;
import com.google.android.gms.common.GooglePlayServicesUtil;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
@@ -68,7 +66,6 @@ public class IabHelper implements LogSource {
OnIabPurchaseFinishedListener mPurchaseListener;
String mPurchasingItemType;
int mRequestCode;
IInAppBillingService mService;
ServiceConnection mServiceConn;
String mSignatureBase64;
boolean mDebugLog = false;
@@ -172,88 +169,6 @@ public class IabHelper implements LogSource {
}
}
public void startSetup(final OnIabSetupFinishedListener onIabSetupFinishedListener, final OnIabBroadcastListener onIabBroadcastListener, OnIabPurchaseFinishedListener onIabPurchaseFinishedListener) {
if (this.mSetupDone) {
throw new IllegalStateException("IAB helper is already set up.");
}
logDebug("Starting in-app billing setup.");
this.mPurchaseListener = onIabPurchaseFinishedListener;
this.mServiceConn = new ServiceConnection() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.1
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
IabHelper.this.logDebug("Billing service disconnected.");
if (IabHelper.this.mPurchaseUpdateReceiver != null) {
ApplicationEnvironment.getComponent().getApplicationContext().unregisterReceiver(IabHelper.this.mPurchaseUpdateReceiver);
IabHelper.this.mPurchaseUpdateReceiver = null;
}
IabHelper.this.mService = null;
IabHelper.this.mSetupDone = false;
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
int isBillingSupported;
IabHelper.this.logDebug("Billing service connected.");
IabHelper.this.mService = IInAppBillingService.Stub.asInterface(iBinder);
String packageName = IabHelper.this.mContext.getPackageName();
try {
IabHelper.this.logDebug("Checking for in-app billing 3 support.");
isBillingSupported = IabHelper.this.mService.isBillingSupported(3, packageName, IabHelper.ITEM_TYPE_INAPP);
} catch (RemoteException e) {
if (onIabSetupFinishedListener != null) {
onIabSetupFinishedListener.onIabSetupFinished(new IabResult(IabHelper.IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing."));
}
e.printStackTrace();
}
if (isBillingSupported != 0) {
if (onIabSetupFinishedListener != null) {
onIabSetupFinishedListener.onIabSetupFinished(new IabResult(isBillingSupported, "Error checking for billing v3 support."));
}
IabHelper.this.mSubscriptionsSupported = false;
return;
}
int isBillingSupported2 = IabHelper.this.mService.isBillingSupported(3, packageName, IabHelper.ITEM_TYPE_SUBS);
if (isBillingSupported2 == 0) {
IabHelper.this.logDebug("Subscriptions AVAILABLE.");
IabHelper.this.mSubscriptionsSupported = true;
} else {
IabHelper.this.logDebug("Subscriptions NOT AVAILABLE. Response: " + isBillingSupported2);
IabHelper.this.mSubscriptionsSupported = false;
}
IabHelper.this.logDebug("In-app billing version 3 supported for " + packageName);
if (IabHelper.this.mPurchaseUpdateReceiver == null) {
IabHelper.this.mPurchaseUpdateReceiver = IabHelper.this.new IabPurchaseUpdateReceiver(onIabBroadcastListener);
ApplicationEnvironment.getComponent().getApplicationContext().registerReceiver(IabHelper.this.mPurchaseUpdateReceiver, new IntentFilter("com.android.vending.billing.PURCHASES_UPDATED"));
}
IabHelper.this.mSetupDone = true;
if (onIabSetupFinishedListener != null) {
onIabSetupFinishedListener.onIabSetupFinished(new IabResult(0, "Setup successful."));
}
}
};
logDebug("...Starting in-app billing setup.");
logDebug("Binding service...");
PackageManager packageManager = this.mContext.getPackageManager();
Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
intent.setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE);
ResolveInfo resolveService = packageManager.resolveService(intent, 0);
if (resolveService != null) {
logDebug("PackageName = " + resolveService.serviceInfo.packageName);
logDebug("ClassName = " + resolveService.serviceInfo.name);
intent.setComponent(new ComponentName(resolveService.serviceInfo.packageName, resolveService.serviceInfo.name));
if (this.mContext.bindService(intent, this.mServiceConn, 1)) {
logDebug("Success - Bind to InAppBillingService");
return;
} else {
logError("Failed to Bind to InAppBillingService");
this.mServiceConn = null;
return;
}
}
logError("Unable to get ResolveInfo for InAppBillingService intent. Cannot bind to InAppBillinbService");
this.mServiceConn = null;
}
public void dispose() {
logDebug("Disposing.");
this.mSetupDone = false;
@@ -263,72 +178,9 @@ public class IabHelper implements LogSource {
this.mContext.unbindService(this.mServiceConn);
}
this.mServiceConn = null;
this.mService = null;
this.mPurchaseListener = null;
}
}
public void launchPurchaseFlow(Activity activity, String str, String str2) {
launchPurchaseFlow(activity, str, str2, "");
}
public synchronized void launchPurchaseFlow(final Activity activity, final String str, final String str2, final String str3) {
startOrQueueRunnable(new AsyncOperation("launchPurchaseFlow", false, new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.2
@Override // java.lang.Runnable
public void run() {
try {
IabHelper.this.logDebug("Constructing buy intent for " + str);
Bundle buyIntent = IabHelper.this.mService.getBuyIntent(3, IabHelper.this.mContext.getPackageName(), str, str2, str3);
int responseCodeFromBundle = IabHelper.this.getResponseCodeFromBundle(buyIntent);
if (responseCodeFromBundle != 0) {
IabHelper.this.logDebug("BuyIntent Bundle: " + buyIntent);
IabHelper.this.logError("Unable to buy item, Error response: " + IabHelper.getResponseDesc(responseCodeFromBundle));
IabHelper.this.flagEndAsync();
IabResult iabResult = new IabResult(responseCodeFromBundle, "Unable to buy item");
if (IabHelper.this.mPurchaseListener != null) {
try {
IabHelper.this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
return;
} catch (Exception e) {
IabHelper.this.logError("Uncaught exception in listener's onIabPurchaseFinished: " + e);
return;
}
}
return;
}
PendingIntent pendingIntent = (PendingIntent) buyIntent.getParcelable(IabHelper.RESPONSE_BUY_INTENT);
IabHelper.this.logDebug("Launching buy intent for " + str + ". Request code: " + IabHelper.this.mRequestCode);
Activity activity2 = activity;
IntentSender intentSender = pendingIntent.getIntentSender();
int i = IabHelper.this.mRequestCode;
Intent intent = new Intent();
Integer num = 0;
int intValue = num.intValue();
Integer num2 = 0;
Integer num3 = 0;
activity2.startIntentSenderForResult(intentSender, i, intent, intValue, num2.intValue(), num3.intValue());
IabHelper.this.mPurchasingItemType = str2;
} catch (IntentSender.SendIntentException e2) {
IabHelper.this.logError("SendIntentException while launching purchase flow for sku " + str);
e2.printStackTrace();
IabResult iabResult2 = new IabResult(IabHelper.IABHELPER_SEND_INTENT_FAILED, "Failed to send intent.");
if (IabHelper.this.mPurchaseListener != null) {
IabHelper.this.mPurchaseListener.onIabPurchaseFinished(iabResult2, null);
}
IabHelper.this.flagEndAsync();
} catch (RemoteException e3) {
IabHelper.this.logError("RemoteException while launching purchase flow for sku " + str);
e3.printStackTrace();
IabResult iabResult3 = new IabResult(IabHelper.IABHELPER_REMOTE_EXCEPTION, "Remote exception while starting purchase flow");
if (IabHelper.this.mPurchaseListener != null) {
IabHelper.this.mPurchaseListener.onIabPurchaseFinished(iabResult3, null);
}
IabHelper.this.flagEndAsync();
}
}
}));
}
public boolean handleActivityResult(int i, int i2, Intent intent) {
logDebug("handleActivityResult...");
if (i != this.mRequestCode) {
@@ -512,14 +364,11 @@ public class IabHelper implements LogSource {
try {
inventory = IabHelper.this.queryInventory(z, z2, list);
} catch (IabException e) {
iabResult = e.getResult();
inventory = null;
}
IabHelper.this.flagEndAsync();
handler.post(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.3.1
@Override // java.lang.Runnable
public void run() {
queryInventoryFinishedListener.onQueryInventoryFinished(iabResult, inventory);
}
});
}
@@ -536,24 +385,13 @@ public class IabHelper implements LogSource {
void consume(Purchase purchase) throws IabException {
checkSetupDone("consume");
try {
String token = purchase.getToken();
String sku = purchase.getSku();
if (token == null || token.equals("")) {
logError("Can't consume " + sku + ". No token.");
throw new IabException(IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: " + sku + " " + purchase);
}
logDebug("Consuming sku: " + sku + ", token: " + token);
int consumePurchase = this.mService.consumePurchase(3, this.mContext.getPackageName(), token);
if (consumePurchase == 0) {
logDebug("Successfully consumed sku: " + sku);
return;
}
logDebug("Error consuming consuming sku " + sku + ". " + getResponseDesc(consumePurchase));
throw new IabException(consumePurchase, "Error consuming sku " + sku);
} catch (RemoteException e) {
throw new IabException(IABHELPER_REMOTE_EXCEPTION, "Remote exception while consuming. PurchaseInfo: " + purchase, e);
String token = purchase.getToken();
String sku = purchase.getSku();
if (token == null || token.equals("")) {
logError("Can't consume " + sku + ". No token.");
throw new IabException(IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: " + sku + " " + purchase);
}
logDebug("Consuming sku: " + sku + ", token: " + token);
}
public void consumeAsync(Purchase purchase, OnConsumeFinishedListener onConsumeFinishedListener) {
@@ -683,55 +521,6 @@ public class IabHelper implements LogSource {
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.mtx.googleplay.util.IabHelper.queryPurchases(com.ea.nimble.mtx.googleplay.util.Inventory, java.lang.String):int");
}
int querySkuDetails(Inventory inventory, List<String> list, String str) throws RemoteException, JSONException, IllegalStateException {
logDebug("Querying SKU details.");
IInAppBillingService iInAppBillingService = this.mService;
if (iInAppBillingService == null) {
throw new IllegalStateException("Billing service is not connected.");
}
if (this.mContext == null) {
throw new IllegalStateException("InAppBilling application context is unset.");
}
ArrayList arrayList = new ArrayList();
arrayList.addAll(inventory.getAllOwnedSkus());
if (list != null) {
arrayList.addAll(list);
}
if (arrayList.size() == 0) {
logDebug("queryPrices: nothing to do because there are no SKUs.");
return 0;
}
int i = 0;
while (i != arrayList.size()) {
int size = arrayList.size() - i > 20 ? i + 20 : arrayList.size();
ArrayList<String> arrayList2 = new ArrayList<>(arrayList.subList(i, size));
Bundle bundle = new Bundle();
bundle.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, arrayList2);
Bundle skuDetails = iInAppBillingService.getSkuDetails(3, this.mContext.getPackageName(), str, bundle);
if (skuDetails == null) {
throw new IllegalStateException("Billing service is not connected.");
}
if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
int responseCodeFromBundle = getResponseCodeFromBundle(skuDetails);
if (responseCodeFromBundle != 0) {
logDebug("getSkuDetails() failed: " + getResponseDesc(responseCodeFromBundle));
return responseCodeFromBundle;
}
logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
return IABHELPER_BAD_RESPONSE;
}
Iterator<String> it = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST).iterator();
while (it.hasNext()) {
SkuDetails skuDetails2 = new SkuDetails(it.next());
logDebug("Got sku details: " + skuDetails2);
inventory.addSkuDetails(skuDetails2);
}
i = size;
}
return 0;
}
void consumeAsyncInternal(final List<Purchase> list, final OnConsumeFinishedListener onConsumeFinishedListener, final OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) {
Looper myLooper = Looper.myLooper();
if (myLooper == null) {
@@ -784,6 +573,6 @@ public class IabHelper implements LogSource {
}
public boolean isServiceAvailable() {
return this.mSetupDone && this.mService != null;
return false;
}
}
@@ -1,11 +0,0 @@
package com.ea.nimble.pushtng;
/* loaded from: classes.dex */
public final class BuildConfig {
public static final String APPLICATION_ID = "com.ea.nimble.pushtng";
public static final String BUILD_TYPE = "release";
public static final boolean DEBUG = false;
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
@@ -0,0 +1,5 @@
package com.ea.nimble.pushtng;
public interface IPushListener {
void onConnectionError(int i, String s);
}
@@ -1,6 +1,5 @@
package com.ea.nimble.pushtng;
import com.ea.eadp.pushnotification.listeners.IPushListener;
import java.util.Date;
/* loaded from: classes.dex */
@@ -0,0 +1,4 @@
package com.ea.nimble.pushtng;
public class IPushService {
}
@@ -13,8 +13,6 @@ import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.HashMap;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class NimbleAndroidHttpRequest implements HttpRequest {
@@ -64,7 +62,7 @@ public class NimbleAndroidHttpRequest implements HttpRequest {
public HttpRequest setBody(String str) {
Log.Helper.LOGPUBLICFUNC(this);
this.body = str;
setHeader("Content-Type", URLEncodedUtils.CONTENT_TYPE);
setHeader("Content-Type", "");
return this;
}
@@ -114,7 +112,7 @@ public class NimbleAndroidHttpRequest implements HttpRequest {
@Override // com.ea.eadp.http.models.HttpRequest
public void postAsync(final HttpRequestListener httpRequestListener) {
Log.Helper.LOGPUBLICFUNC(this);
this.nimbleNetwork.sendPostRequest(this.resource, this.headers, this.body.getBytes(Charset.forName(HTTP.UTF_8)), new NetworkConnectionCallback() { // from class: com.ea.nimble.pushtng.NimbleAndroidHttpRequest.2
this.nimbleNetwork.sendPostRequest(this.resource, this.headers, this.body.getBytes(), new NetworkConnectionCallback() { // from class: com.ea.nimble.pushtng.NimbleAndroidHttpRequest.2
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
NimbleAndroidHttpRequest.this.sendResponseCallback(networkConnectionHandle, httpRequestListener);
@@ -1,86 +0,0 @@
package com.ea.nimble.pushtng;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Log;
import com.ea.nimble.NimbleApplicationConfiguration;
import com.ea.nimble.tracking.Tracking;
import com.google.android.vending.expansion.downloader.Constants;
import java.io.File;
import java.util.HashMap;
/* loaded from: classes.dex */
public class NimblePushTNGBroadcastForwarder extends PushBroadcastForwarder {
@Override // com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder
protected void handleNewPushNotification(Context context, Bundle bundle) {
Log.Helper.LOGFUNC(this);
String string = bundle.getString(GcmIntentService.PushIntentExtraKeys.COLLAPSE_KEY);
if (string != null) {
String replace = string.replace(File.pathSeparator, Constants.FILENAME_SEQUENCE_SEPARATOR).replace(File.separator, "_");
context.getApplicationContext().getSharedPreferences("PushTNGStacking_" + replace, 0).edit().clear().commit();
}
if (bundle.getBoolean(NimblePushTNGIntentService.EXTRA_IS_DELETE_INTENT)) {
return;
}
String string2 = bundle.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID);
String string3 = bundle.getString(GcmIntentService.PushIntentExtraKeys.PN_TYPE);
if (string2 != null && string3 != null) {
HashMap hashMap = new HashMap();
hashMap.put(PushNotification.KEY_TRACKING_TYPE, Tracking.EVENT_PN_SHOWN_TO_USER);
hashMap.put("NIMBLESTANDARD::KEY_PN_MESSAGE_ID", string2);
hashMap.put(Tracking.KEY_PN_MESSAGE_TYPE, string3);
PushNotificationImpl.persistTrackingData(context, hashMap, string2 + "_" + Tracking.EVENT_PN_SHOWN_TO_USER);
}
if (ApplicationEnvironment.isMainApplicationActive()) {
try {
showMessage(bundle);
IPushNotification component = PushNotification.getComponent();
if (component != null) {
component.sendPendingTrackingRequests();
} else {
Log.Helper.LOGE(this, "Couldn't find Push Notification component with Base, unable to send pending tracking requests", new Object[0]);
}
return;
} catch (AssertionError unused) {
return;
}
}
super.handleNewPushNotification(context, bundle);
}
protected void showMessage(Bundle bundle) {
Log.Helper.LOGFUNC(this);
}
@Override // com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder
protected String getPushTargetActivity(Context context) {
Intent launchIntentForPackage;
ComponentName resolveActivity;
Log.Helper.LOGFUNC(this);
int configValueAsInt = NimbleApplicationConfiguration.getConfigValueAsInt("com.ea.nimble.pushtng.notification.activity.name");
if (configValueAsInt != 0) {
return context.getResources().getString(configValueAsInt);
}
Log.Helper.LOGIS("PushTNG", "Could not locate target activity. PN delivered to launch activity", new Object[0]);
Context applicationContext = context.getApplicationContext();
PackageManager packageManager = applicationContext.getPackageManager();
if (packageManager != null && (launchIntentForPackage = packageManager.getLaunchIntentForPackage(applicationContext.getPackageName())) != null && (resolveActivity = launchIntentForPackage.resolveActivity(packageManager)) != null) {
return resolveActivity.getClassName();
}
Log.Helper.LOGE(this, "Null Pointer found in pushActivityName generation, unable to get class name for push activity", new Object[0]);
return "";
}
@Override // com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder
protected HttpService getHttpService() {
Log.Helper.LOGFUNC(this);
return new NimbleAndroidHttpService();
}
}
@@ -1,13 +0,0 @@
package com.ea.nimble.pushtng;
import com.ea.eadp.pushnotification.forwarding.GcmBroadcastReceiver;
import com.ea.nimble.Log;
/* loaded from: classes.dex */
public class NimblePushTNGBroadcastReceiver extends GcmBroadcastReceiver {
@Override // com.ea.eadp.pushnotification.forwarding.GcmBroadcastReceiver
protected String getIntentServiceName() {
Log.Helper.LOGFUNC(this);
return NimblePushTNGIntentService.class.getName();
}
}
@@ -1,117 +0,0 @@
package com.ea.nimble.pushtng;
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Log;
import com.ea.nimble.tracking.Tracking;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.google.android.gms.drive.DriveFile;
import com.google.android.vending.expansion.downloader.Constants;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
/* loaded from: classes.dex */
public class NimblePushTNGIntentService extends GcmIntentService {
private static final String DO_NOT_COLLAPSE = "do_not_collapse";
public static final String EXTRA_IS_DELETE_INTENT = "IsDeleteIntent";
private static final String KEY_PUSH_COUNT = "push_count";
private static final String KEY_PUSH_TEXT_LIST = "push_text_list";
@Override // com.ea.eadp.pushnotification.forwarding.GcmIntentService
protected void onHandleMessage(Intent intent) {
Log.Helper.LOGFUNC(this);
Bundle extras = intent.getExtras();
if (extras == null) {
Log.Helper.LOGE(this, "NimblePushTNGIntentService onHandleMessage failed! Extras from intent were null, unable to process message.", new Object[0]);
return;
}
String string = extras.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID);
String string2 = extras.getString(GcmIntentService.PushIntentExtraKeys.PN_TYPE);
if (string != null && string2 != null) {
HashMap hashMap = new HashMap();
hashMap.put(PushNotification.KEY_TRACKING_TYPE, Tracking.EVENT_PN_RECEIVED);
hashMap.put("NIMBLESTANDARD::KEY_PN_MESSAGE_ID", string);
hashMap.put(Tracking.KEY_PN_MESSAGE_TYPE, string2);
PushNotificationImpl.persistTrackingData(getApplicationContext(), hashMap, string + "_" + Tracking.EVENT_PN_RECEIVED);
}
intent.putExtra("PushNotification", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
super.onHandleMessage(intent);
}
@Override // com.ea.eadp.pushnotification.forwarding.GcmIntentService
@TargetApi(11)
protected void customizeNotification(NotificationCompat.Builder builder, Bundle bundle) {
String string;
Log.Helper.LOGFUNC(this);
super.customizeNotification(builder, bundle);
if (Build.VERSION.SDK_INT < 11 || (string = bundle.getString(GcmIntentService.PushIntentExtraKeys.COLLAPSE_KEY)) == null || string.equalsIgnoreCase(DO_NOT_COLLAPSE)) {
return;
}
String replace = string.replace(File.pathSeparator, Constants.FILENAME_SEQUENCE_SEPARATOR).replace(File.separator, "_");
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("PushTNGStacking_" + replace, 0);
int i = sharedPreferences.getInt(KEY_PUSH_COUNT, 0);
Vector vector = new Vector();
for (int i2 = 0; i2 < i; i2++) {
String string2 = sharedPreferences.getString(KEY_PUSH_TEXT_LIST + i2, null);
if (string2 != null) {
vector.add(string2);
}
}
int i3 = i + 1;
vector.add(bundle.getString(GcmIntentService.PushIntentExtraKeys.ALERT));
if (i3 > 1) {
Resources resources = getApplicationContext().getResources();
String packageName = getApplicationContext().getPackageName();
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
Iterator it = vector.iterator();
while (it.hasNext()) {
inboxStyle.addLine((CharSequence) it.next());
}
CharSequence charSequence = getApplicationContext().getResources().getString(resources.getIdentifier(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, "string", packageName)) + "(" + i3 + ")";
inboxStyle.setBigContentTitle(charSequence);
builder.setContentTitle(charSequence);
builder.setStyle(inboxStyle);
}
ComponentName broadcastForwarderComponent = getBroadcastForwarderComponent();
if (broadcastForwarderComponent != null) {
Intent intent = new Intent();
intent.setComponent(broadcastForwarderComponent);
intent.putExtra(EXTRA_IS_DELETE_INTENT, true);
intent.putExtra(GcmIntentService.PushIntentExtraKeys.COLLAPSE_KEY, replace);
builder.setDeleteIntent(PendingIntent.getBroadcast(getApplicationContext(), 0, intent, DriveFile.MODE_READ_ONLY));
} else {
Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Skipping setting DeleteIntent in Notification.", new Object[0]);
}
SharedPreferences.Editor edit = sharedPreferences.edit();
for (int i4 = 0; i4 < vector.size(); i4++) {
edit.putString(KEY_PUSH_TEXT_LIST + i4, (String) vector.elementAt(i4));
}
edit.putInt(KEY_PUSH_COUNT, i3);
edit.commit();
}
@Override // com.ea.eadp.pushnotification.forwarding.GcmIntentService
protected boolean isInForeground() {
Log.Helper.LOGFUNC(this);
return ApplicationEnvironment.isMainApplicationActive();
}
@Override // com.ea.eadp.pushnotification.forwarding.GcmIntentService
protected HttpService getHttpService() {
Log.Helper.LOGFUNC(this);
return new NimbleAndroidHttpService();
}
}
@@ -0,0 +1,4 @@
package com.ea.nimble.pushtng;
public class PushNotificationConfig {
}
@@ -10,12 +10,10 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import com.ea.eadp.pushnotification.listeners.IPushListener;
import com.ea.eadp.pushnotification.models.PushNotificationConfig;
import com.ea.eadp.pushnotification.services.AndroidPushService;
import com.ea.eadp.pushnotification.services.IPushService;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.ApplicationLifecycle;
import com.ea.nimble.Base;
@@ -32,9 +30,6 @@ import com.ea.nimble.SynergyEnvironment;
import com.ea.nimble.Utility;
import com.ea.nimble.tracking.ITracking;
import com.ea.nimble.tracking.Tracking;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.google.gson.Gson;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -91,21 +86,6 @@ public class PushNotificationImpl extends Component implements IPushNotification
@Override // com.ea.nimble.Component
public void setup() {
if (this.m_ageListener == null) {
this.m_ageListener = new BroadcastReceiver() { // from class: com.ea.nimble.pushtng.PushNotificationImpl.1
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if (intent != null) {
Bundle extras = intent.getExtras();
PushNotificationImpl.this.dobFromAgeCompliance = extras.getLong("dob", -2147483648L);
if (PushNotificationImpl.this.dobFromAgeCompliance != -2147483648L) {
Log.Helper.LOGV(this, "PushTNG received AgeCompliance birthday update", new Object[0]);
}
}
}
};
Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_AGE_COMPLIANCE_DOB_UPDATE, this.m_ageListener);
}
}
@Override // com.ea.nimble.Component
@@ -167,28 +147,19 @@ public class PushNotificationImpl extends Component implements IPushNotification
NimbleAndroidHttpService nimbleAndroidHttpService = new NimbleAndroidHttpService();
NimbleDeviceIdService nimbleDeviceIdService = new NimbleDeviceIdService();
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (!NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) {
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);
NotificationChannel notificationChannel = new NotificationChannel(Global.NOTIFICATION_CHANNEL_DEFAULT_ID, str, NotificationManager.IMPORTANCE_DEFAULT);
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);
}
}
int configValueAsInt = NimbleApplicationConfiguration.getConfigValueAsInt("com.ea.nimble.pushtng.gcm.sender.id");
int configValueAsInt2 = NimbleApplicationConfiguration.getConfigValueAsInt("com.ea.nimble.pushtng.auth.api.key");
int configValueAsInt3 = NimbleApplicationConfiguration.getConfigValueAsInt("com.ea.nimble.pushtng.auth.api.secret");
if (configValueAsInt != 0 && configValueAsInt2 != 0 && configValueAsInt3 != 0) {
this.pushService = new AndroidPushService(GoogleCloudMessaging.getInstance(applicationContext), nimbleAndroidHttpService, nimbleDeviceIdService, applicationContext, null, applicationContext.getResources().getString(configValueAsInt), serverUrlWithKey, productId, sellId, applicationContext.getResources().getString(configValueAsInt2), applicationContext.getResources().getString(configValueAsInt3), 0);
Utility.sendBroadcast(PushNotification.NOTIFICATION_PUSHTNG_COMPONENT_SETUP_COMPLETE);
this.pushService.sendPendingTrackingRequests();
return;
}
Log.Helper.LOGW(this, "Configuration data not loaded. Push component not initialized.", new Object[0]);
}
@@ -203,10 +174,6 @@ public class PushNotificationImpl extends Component implements IPushNotification
}
return;
}
PushNotificationConfig pushNotificationConfig = new PushNotificationConfig();
pushNotificationConfig.setUserAlias(str);
pushNotificationConfig.setDateOfBirth(new SimpleDateFormat("yyyy-MM").format(getValidDOB(date)));
startWithConfig(pushNotificationConfig, iPushListener);
}
@Override // com.ea.nimble.pushtng.IPushNotification
@@ -218,82 +185,6 @@ public class PushNotificationImpl extends Component implements IPushNotification
}
} else {
PushNotificationConfig pushNotificationConfig = new PushNotificationConfig();
pushNotificationConfig.setUserAlias(str);
pushNotificationConfig.setDateOfBirth(new SimpleDateFormat("yyyy-MM").format(getValidDOB(date)));
pushNotificationConfig.setDisabled(true);
pushNotificationConfig.setDisabledReason(str2);
startWithConfig(pushNotificationConfig, iPushListener);
}
}
private void startWithConfig(final PushNotificationConfig pushNotificationConfig, final IPushListener iPushListener) {
Log.Helper.LOGFUNC(this);
final Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
this.pushService.setPushListener(new IPushListener() { // from class: com.ea.nimble.pushtng.PushNotificationImpl.3
@Override // com.ea.eadp.pushnotification.listeners.IPushListener
public void onTrackingSuccess(int i, String str) {
if (iPushListener != null) {
iPushListener.onTrackingSuccess(i, str);
}
}
@Override // com.ea.eadp.pushnotification.listeners.IPushListener
public void onRegistrationSuccess(int i, String str) {
boolean z = false;
Log.Helper.LOGD(this, "onRegistrationSuccess: " + str, new Object[0]);
HashMap hashMap = new HashMap();
hashMap.put(Tracking.KEY_PN_DATE_OF_BIRTH, pushNotificationConfig.getDateOfBirth());
hashMap.put(Tracking.KEY_PN_DISABLED_FLAG, pushNotificationConfig.isDisabled() ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
hashMap.put(PushNotification.KEY_TRACKING_TYPE, Tracking.EVENT_PN_DEVICE_REGISTERED);
PushNotificationImpl.this.disableCheck = pushNotificationConfig.isDisabled() ? pushNotificationConfig.getDisabledReason() : null;
PushNotificationImpl pushNotificationImpl = PushNotificationImpl.this;
if (i >= 200 && i < 300) {
z = true;
}
pushNotificationImpl.statusCheck = z;
PushNotificationImpl.persistTrackingData(applicationContext, hashMap, str);
if (ApplicationEnvironment.isMainApplicationRunning()) {
PushNotificationImpl.this.sendPendingTrackingRequests();
}
if (iPushListener != null) {
iPushListener.onRegistrationSuccess(i, str);
}
}
@Override // com.ea.eadp.pushnotification.listeners.IPushListener
public void onGetInAppSuccess(int i, String str) {
if (iPushListener != null) {
iPushListener.onGetInAppSuccess(i, str);
}
}
@Override // com.ea.eadp.pushnotification.listeners.IPushListener
public void onConnectionError(int i, String str) {
Log.Helper.LOGW(this, "onConnectionError: " + str, new Object[0]);
if (iPushListener != null) {
iPushListener.onConnectionError(i, str);
}
PushNotificationImpl.this.statusCheck = false;
}
});
this.pushService.startWithConfig(pushNotificationConfig, null);
boolean isDisabled = pushNotificationConfig.isDisabled();
if ((!isDisabled || pushNotificationConfig.getDisabledReason().equals(PushNotification.DISABLED_REASON_OPT_OUT)) && !Boolean.valueOf(isDisabled).equals(this.disabled)) {
this.disabled = Boolean.valueOf(isDisabled);
HashMap hashMap = new HashMap();
hashMap.put("en", "settings");
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap);
bundle.putString("type", "opt_in_pn");
bundle.putString("status", isDisabled ? "declined" : "accepted");
Intent intent = new Intent();
intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT);
intent.putExtras(bundle);
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent);
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE);
if (persistenceForNimbleComponent != null) {
persistenceForNimbleComponent.setValue(PERSISTENCE_DISABLED_KEY, this.disabled);
}
}
}
@@ -329,7 +220,7 @@ public class PushNotificationImpl extends Component implements IPushNotification
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
HashMap hashMap = new HashMap((Map) it2.next());
String remove = hashMap.remove(PushNotification.KEY_TRACKING_TYPE);
String remove = (String) hashMap.remove(PushNotification.KEY_TRACKING_TYPE);
hashMap.put(Tracking.KEY_PN_DEVICE_ID, SynergyEnvironment.getComponent().getEADeviceId());
iTracking.logEvent(remove, hashMap);
}
@@ -339,7 +230,7 @@ public class PushNotificationImpl extends Component implements IPushNotification
if (str.equals(Tracking.EVENT_PN_RECEIVED) || str.equals(Tracking.EVENT_PN_SHOWN_TO_USER)) {
String str2 = str.equals(Tracking.EVENT_PN_RECEIVED) ? "received" : "impression";
HashMap hashMap2 = new HashMap();
hashMap2.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE);
//hashMap2.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE);
Bundle bundle = new Bundle();
bundle.putSerializable("core", hashMap2);
bundle.putString("type", "pn");
@@ -238,33 +238,8 @@ abstract class NimbleTrackingImplBase extends Component implements ITracking, Lo
this.m_threadManager = NimbleTrackingThreadManager.acquireInstance();
}
/* JADX WARN: Removed duplicated region for block: B:100:0x02f4 */
/* JADX WARN: Removed duplicated region for block: B:103:0x02fe */
/* JADX WARN: Removed duplicated region for block: B:111:0x0329 */
/* JADX WARN: Removed duplicated region for block: B:114:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:117:0x0181 */
/* JADX WARN: Removed duplicated region for block: B:11:0x014f */
/* JADX WARN: Removed duplicated region for block: B:120:0x016c */
/* JADX WARN: Removed duplicated region for block: B:131:0x0086 */
/* JADX WARN: Removed duplicated region for block: B:144:0x0144 */
/* JADX WARN: Removed duplicated region for block: B:16:0x017e */
/* JADX WARN: Removed duplicated region for block: B:19:0x018c */
/* JADX WARN: Removed duplicated region for block: B:78:0x028d */
/* JADX WARN: Removed duplicated region for block: B:79:0x0295 */
/* JADX WARN: Removed duplicated region for block: B:82:0x02a8 */
/* JADX WARN: Removed duplicated region for block: B:85:0x02bb */
/* JADX WARN: Removed duplicated region for block: B:96:0x02e4 */
@Override // com.ea.nimble.Component
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
protected void restore() {
/*
Method dump skipped, instructions count: 824
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.tracking.NimbleTrackingImplBase.restore():void");
}
@Override // com.ea.nimble.Component
@@ -773,7 +748,6 @@ abstract class NimbleTrackingImplBase extends Component implements ITracking, Lo
loadSessionFromFile = loadSessionFromFile(j);
if (loadSessionFromFile == null) {
continue;
j++;
}
}
if (arrayList.size() == 0 || isSameSession(arrayList.get(arrayList.size() - 1), loadSessionFromFile)) {
@@ -8,7 +8,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.v4.media.session.PlaybackStateCompat;
import android.telephony.TelephonyManager;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.IApplicationEnvironment;
@@ -19,7 +18,6 @@ import com.ea.nimble.ISynergyRequest;
import com.ea.nimble.ISynergyResponse;
import com.ea.nimble.Log;
import com.ea.nimble.LogSource;
import com.ea.nimble.NimbleApplicationConfiguration;
import com.ea.nimble.SynergyEnvironment;
import com.ea.nimble.SynergyIdManager;
import com.ea.nimble.SynergyNetwork;
@@ -335,7 +333,7 @@ class NimbleTrackingS2SImpl extends NimbleTrackingImplBase implements LogSource
if (currentActivity != null) {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
((ActivityManager) currentActivity.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(memoryInfo);
Log.Helper.LOGI(this, "OutOfMemoryError with " + (memoryInfo.availMem / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + " MB left. Dropping current session", new Object[0]);
//Log.Helper.LOGI(this, "OutOfMemoryError with " + (memoryInfo.availMem / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + " MB left. Dropping current session", new Object[0]);
} else {
Log.Helper.LOGI(this, "Out of memory. Dropping current session", new Object[0]);
}
@@ -7,7 +7,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import android.support.v4.media.session.PlaybackStateCompat;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Global;
import com.ea.nimble.IApplicationEnvironment;
@@ -29,8 +28,6 @@ import com.ea.nimble.SynergyNetworkConnectionHandle;
import com.ea.nimble.SynergyRequest;
import com.ea.nimble.Utility;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import com.ea.nimble.tracking.NimbleTrackingThreadManager;
import com.ea.nimble.tracking.Tracking;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -433,7 +430,7 @@ class NimbleTrackingSynergyImpl extends NimbleTrackingImplBase implements LogSou
return null;
}
}
for (String str2 : hashMap.keySet()) {
for (Object str2 : hashMap.keySet()) {
String str3 = (String) hashMap.get(str2);
if (Utility.validString(str3) && str3.startsWith("${") && str3.endsWith("}")) {
String str4 = this.m_trackingAttributes.get(str3.substring(2, str3.length() - 1));
@@ -515,8 +512,8 @@ class NimbleTrackingSynergyImpl extends NimbleTrackingImplBase implements LogSou
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
if (currentActivity != null) {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
((ActivityManager) currentActivity.getSystemService("activity")).getMemoryInfo(memoryInfo);
Log.Helper.LOGI(this, "OutOfMemoryError with " + (memoryInfo.availMem / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + " MB left. Dropping current session", new Object[0]);
((ActivityManager) currentActivity.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(memoryInfo);
//Log.Helper.LOGI(this, "OutOfMemoryError with " + (memoryInfo.availMem / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + " MB left. Dropping current session", new Object[0]);
} else {
Log.Helper.LOGI(this, "Out of memory. Dropping current session", new Object[0]);
}
@@ -1,16 +1,14 @@
package com.ea.nimble.tracking;
import com.google.android.gms.games.GamesActivityResultCodes;
/* loaded from: classes.dex */
public enum SynergyConstants {
EVT_UNDEFINED(-1),
EVT_APP_START_NORMALLY(10000),
EVT_APP_START_FROMPUSH(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED),
EVT_APP_START_AFTERINSTALL(GamesActivityResultCodes.RESULT_SIGN_IN_FAILED),
EVT_APP_START_AFTERUPGRADE(GamesActivityResultCodes.RESULT_LICENSE_FAILED),
EVT_APP_RESUME_NORMAL(GamesActivityResultCodes.RESULT_APP_MISCONFIGURED),
EVT_APP_SESSION_TIME(GamesActivityResultCodes.RESULT_LEFT_ROOM),
EVT_APP_START_FROMPUSH(12),
EVT_APP_START_AFTERINSTALL(1234),
EVT_APP_START_AFTERUPGRADE(43345),
EVT_APP_RESUME_NORMAL(34534523),
EVT_APP_SESSION_TIME(435424534),
EVT_APP_RESUME_FROM_PUSH(10007),
EVT_APP_START_FROM_URL(10009),
EVT_APP_RESUME_FROM_URL(10010),
@@ -186,10 +184,10 @@ public enum SynergyConstants {
EVT_GAME_ERROR_CONNECTIVITY(90000),
EVT_GAME_ERROR_GAMEPLAY(90001),
EVT_APPSTART_NORMALLY(10000),
EVT_APPSTART_FROMPUSH(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED),
EVT_APPSTART_AFTERINSTALL(GamesActivityResultCodes.RESULT_SIGN_IN_FAILED),
EVT_APPSTART_AFTERUPGRADE(GamesActivityResultCodes.RESULT_LICENSE_FAILED),
EVT_APP_SESSION_START(GamesActivityResultCodes.RESULT_APP_MISCONFIGURED),
EVT_APPSTART_FROMPUSH(1000002),
EVT_APPSTART_AFTERINSTALL(1111),
EVT_APPSTART_AFTERUPGRADE(1234123),
EVT_APP_SESSION_START(342353523),
EVT_APPSTART_FROM_URL(10009),
EVT_APP_ENTER_FOREGROUND_FROM_URL(10010),
EVT_APPEND_NORMALLY(20000),
@@ -3,7 +3,6 @@ package com.ea.nimble.tracking;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.ApplicationLifecycle;
import com.ea.nimble.Base;
@@ -169,104 +168,10 @@ class TrackingEventWrangler extends Component implements IApplicationLifecycle.A
logAndCheckEvent(str, null);
}
/* JADX WARN: Removed duplicated region for block: B:15:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:9:0x008c */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void logAndCheckEvent(java.lang.String r9, java.util.Map<java.lang.String, java.lang.String> r10) {
/*
r8 = this;
com.ea.nimble.Log.Helper.LOGFUNC(r8)
java.lang.String r0 = "com.ea.nimble.tracking"
com.ea.nimble.Component r0 = com.ea.nimble.Base.getComponent(r0)
com.ea.nimble.tracking.TrackingWrangler r0 = (com.ea.nimble.tracking.TrackingWrangler) r0
boolean r1 = com.ea.nimble.tracking.Tracking.isSessionStartEvent(r9)
r2 = 1
r3 = 0
if (r1 == 0) goto L34
java.lang.Long r1 = r8.m_sessionStartTimestamp
if (r1 == 0) goto L1f
java.lang.String r1 = "Pre-existing session start timestamp found while logging new session start! Overwriting previous session start timestamp."
java.lang.Object[] r4 = new java.lang.Object[r3]
com.ea.nimble.Log.Helper.LOGE(r8, r1, r4)
goto L26
L1f:
java.lang.String r1 = "Marking session start time."
java.lang.Object[] r4 = new java.lang.Object[r3]
com.ea.nimble.Log.Helper.LOGD(r8, r1, r4)
L26:
long r4 = java.lang.System.currentTimeMillis()
java.lang.Long r1 = java.lang.Long.valueOf(r4)
r8.m_sessionStartTimestamp = r1
r0.setSessionState(r2)
goto L89
L34:
java.lang.Long r1 = r8.m_sessionStartTimestamp
if (r1 != 0) goto L42
java.lang.String r10 = "No current session. %s will not be logged."
java.lang.Object[] r0 = new java.lang.Object[r2]
r0[r3] = r9
com.ea.nimble.Log.Helper.LOGE(r8, r10, r0)
return
L42:
boolean r1 = com.ea.nimble.tracking.Tracking.isSessionEndEvent(r9)
if (r1 == 0) goto L89
long r4 = java.lang.System.currentTimeMillis()
java.lang.Long r1 = r8.m_sessionStartTimestamp
long r6 = r1.longValue()
long r4 = r4 - r6
double r4 = (double) r4
r6 = 4652007308841189376(0x408f400000000000, double:1000.0)
java.lang.Double.isNaN(r4)
double r4 = r4 / r6
java.util.Locale r1 = java.util.Locale.US
java.lang.String r6 = "%.0f"
java.lang.Object[] r7 = new java.lang.Object[r2]
java.lang.Double r4 = java.lang.Double.valueOf(r4)
r7[r3] = r4
java.lang.String r1 = java.lang.String.format(r1, r6, r7)
java.lang.String r4 = "Logging session time, %s seconds."
java.lang.Object[] r5 = new java.lang.Object[r2]
r5[r3] = r1
com.ea.nimble.Log.Helper.LOGD(r8, r4, r5)
java.util.HashMap r4 = new java.util.HashMap
r4.<init>()
java.lang.String r5 = "NIMBLESTANDARD::KEY_DURATION"
r4.put(r5, r1)
java.lang.String r1 = "NIMBLESTANDARD::SESSION_TIME"
r8.logAndCheckEvent(r1, r4)
r1 = 0
r8.m_sessionStartTimestamp = r1
goto L8a
L89:
r2 = 0
L8a:
if (r0 == 0) goto L94
r0.logEvent(r9, r10)
if (r2 == 0) goto L94
r0.setSessionState(r3)
L94:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.tracking.TrackingEventWrangler.logAndCheckEvent(java.lang.String, java.util.Map):void");
}
private void addPushTNGTrackingParams(Bundle bundle, Map<String, String> map) {
Log.Helper.LOGFUNC(this);
if (bundle == null || bundle.isEmpty()) {
return;
}
if (bundle.containsKey(GcmIntentService.PushIntentExtraKeys.PUSH_ID)) {
map.put("NIMBLESTANDARD::KEY_PN_MESSAGE_ID", bundle.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID));
}
if (bundle.containsKey(GcmIntentService.PushIntentExtraKeys.PN_TYPE)) {
map.put(Tracking.KEY_PN_MESSAGE_TYPE, bundle.getString(GcmIntentService.PushIntentExtraKeys.PN_TYPE));
}
if (map == null || map.isEmpty()) {
return;
}
map.put(Tracking.KEY_PN_DEVICE_ID, SynergyEnvironment.getComponent().getEADeviceId());
}
}
@@ -1,309 +0,0 @@
package com.eamobile;
import android.os.Build;
import com.eamobile.download.Logging;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Date;
import java.util.Queue;
import java.util.UUID;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class ADCTelemetry {
public static final int CANCEL = 4;
public static final int COMPLETE = 1;
public static final int FAILED = 3;
public static final int RETRY = 2;
public static final int START = 0;
private static ADCTelemetry instance;
private DownloadActivityInternal downloadActivityInternal;
private String pathToQueue;
private Queue<TelemetryQueueElement> eventQueue = null;
private TelemetryQueueThread queueThread = null;
private boolean downloadStarted = false;
private String uniqueToken = UUID.randomUUID().toString();
public void onCreate(String str) {
}
public void onDestroy() {
}
private ADCTelemetry() {
this.downloadActivityInternal = null;
this.downloadActivityInternal = DownloadActivityInternal.getMainActivity();
}
public static synchronized ADCTelemetry getInstance() {
ADCTelemetry aDCTelemetry;
synchronized (ADCTelemetry.class) {
if (instance == null) {
instance = new ADCTelemetry();
}
aDCTelemetry = instance;
}
return aDCTelemetry;
}
public void sendTelemetry(int i) {
sendTelemetry(i, "");
}
public void sendTelemetry(int i, String str) {
if (i == 0) {
this.downloadActivityInternal.mDownloadActivity.onDownloadEvent(0);
} else if (i == 4) {
this.downloadActivityInternal.mDownloadActivity.onDownloadEvent(1);
}
}
private void loadQueue(String str, Queue<TelemetryQueueElement> queue) {
Logging.DEBUG_OUT("ADCTelemetry - Loading queue.");
File file = new File(getQueueFileName(str));
if (file.exists()) {
Logging.DEBUG_OUT("ADCTelemetry - Found queue file!.");
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
Logging.DEBUG_OUT("ADCTelemetry - New queue line: " + readLine);
queue.add(new TelemetryQueueElement(Integer.parseInt(readLine.substring(0, 1)), readLine.substring(1)));
} else {
bufferedReader.close();
Logging.DEBUG_OUT("ADCTelemetry - Done loading queue file!.");
return;
}
}
} catch (Exception unused) {
}
} else {
Logging.DEBUG_OUT("ADCTelemetry - Queue file doesn't exists.");
}
}
private String getQueueFileName(String str) {
return str + "/queue.file";
}
private void saveQueue(String str, Queue<TelemetryQueueElement> queue) {
File file = new File(getQueueFileName(str));
if (file.exists()) {
Logging.DEBUG_OUT("ADCTelemetry - Deleting queue file before saving the updated version.");
file.delete();
}
try {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(getQueueFileName(str), true), 8192);
TelemetryQueueElement poll = queue.poll();
if (poll == null) {
Logging.DEBUG_OUT("ADCTelemetry - No events to save to the queue file");
}
while (poll != null) {
String str2 = Integer.toString(poll.nrOfRetries) + poll.jsonEvent + "\n";
Logging.DEBUG_OUT("ADCTelemetry - Saving line in queue file : " + str2);
bufferedWriter.write(str2);
poll = queue.poll();
}
bufferedWriter.close();
} catch (Exception unused) {
}
}
private class TelemetrySendThread extends Thread {
private String jsonEvent;
private String message;
private int retries;
private int state;
public TelemetrySendThread(int i, String str) {
this.jsonEvent = null;
this.state = i;
this.message = new Date(System.currentTimeMillis()).toString() + " : " + str;
}
public TelemetrySendThread(String str, int i) {
this.jsonEvent = null;
this.jsonEvent = str;
this.retries = i;
}
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
Logging.DEBUG_OUT("ADCTelemetry - Inside TelemetrySendThread - before web service call");
if (this.jsonEvent == null) {
Logging.DEBUG_OUT("ADCTelemetry - Inside TelemetrySendThread calling sendHttpPost with retry = 0");
sendHttpPost(createJSON(), 0);
} else {
Logging.DEBUG_OUT("ADCTelemetry - Inside TelemetrySendThread calling sendHttpPost with retry = " + Integer.toString(this.retries));
sendHttpPost(this.jsonEvent, this.retries);
}
Logging.DEBUG_OUT("ADCTelemetry - Inside TelemetrySendThread - after web service call");
}
private void sendHttpPost(String str, int i) {
StringBuilder sb;
try {
try {
CloseableHttpClient defaultHttpClient = new DefaultHttpClient();
HttpParams params = defaultHttpClient.getParams();
HttpConnectionParams.setConnectionTimeout(params, 450);
HttpConnectionParams.setSoTimeout(params, 450);
HttpPost httpPost = new HttpPost(createURL());
httpPost.setEntity(new StringEntity(str));
httpPost.setHeader(HttpHeaders.ACCEPT, HTTP.PLAIN_TEXT_TYPE);
httpPost.setHeader("Content-type", "application/json");
Logging.DEBUG_OUT("ADCTelemetry - Calling web service.");
HttpResponse execute = defaultHttpClient.execute((HttpUriRequest) httpPost);
int statusCode = execute.getStatusLine().getStatusCode();
Logging.DEBUG_OUT("ADCTelemetry - Received status code " + Integer.toString(statusCode));
boolean z = true;
if (statusCode == 200) {
HttpEntity entity = execute.getEntity();
if (entity != null) {
String entityUtils = EntityUtils.toString(entity);
Logging.DEBUG_OUT("ADCTelemetry - Received body string " + entityUtils);
if (entityUtils.equals("OK")) {
z = false;
} else {
i++;
}
} else {
Logging.DEBUG_OUT("ADCTelemetry - Received empty body string");
i++;
}
}
if (z && i < 5) {
Logging.DEBUG_OUT("ADCTelemetry - Send failed. Adding event to the queue.");
try {
ADCTelemetry.this.eventQueue.add(ADCTelemetry.this.new TelemetryQueueElement(i, str));
} catch (Exception e) {
e = e;
sb = new StringBuilder();
sb.append("ADCTelemetry - Received exception ");
sb.append(e.toString());
Logging.DEBUG_OUT(sb.toString());
}
}
} catch (Exception e2) {
Logging.DEBUG_OUT("ADCTelemetry - Received exception " + e2.toString());
if (i < 5) {
Logging.DEBUG_OUT("ADCTelemetry - Send failed. Adding event to the queue.");
try {
ADCTelemetry.this.eventQueue.add(ADCTelemetry.this.new TelemetryQueueElement(i, str));
} catch (Exception e3) {
e = e3;
sb = new StringBuilder();
sb.append("ADCTelemetry - Received exception ");
sb.append(e.toString());
Logging.DEBUG_OUT(sb.toString());
}
}
}
} finally {
Logging.DEBUG_OUT("ADCTelemetry - Telemetry was send with success");
}
}
private String createURL() {
StringBuilder sb = new StringBuilder();
DownloadActivityInternal unused = ADCTelemetry.this.downloadActivityInternal;
sb.append(DownloadActivityInternal.DOWNLOAD_URL);
sb.append("androidContentWS/cms/android/gameasset/application/telemetry?");
sb.append(UUID.randomUUID().toString());
String sb2 = sb.toString();
Logging.DEBUG_OUT("ADCTelemetry - Web service url: " + sb2);
return sb2;
}
private String createJSON() {
String str;
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("token", ADCTelemetry.this.uniqueToken);
jSONObject.put("status", this.state);
jSONObject.put("errMsg", this.message);
if (this.state == 0) {
DownloadActivityInternal unused = ADCTelemetry.this.downloadActivityInternal;
jSONObject.put("prodID", DownloadActivityInternal.PRODUCT_ID);
DownloadActivityInternal unused2 = ADCTelemetry.this.downloadActivityInternal;
jSONObject.put("sellID", DownloadActivityInternal.MASTER_SELL_ID);
DownloadActivityInternal unused3 = ADCTelemetry.this.downloadActivityInternal;
jSONObject.put("language", DownloadActivityInternal.language.getCurrentLanguage());
jSONObject.put("is3G", ADCTelemetry.this.downloadActivityInternal.is3G());
jSONObject.put("device", ADCTelemetry.this.downloadActivityInternal.getDeviceString());
jSONObject.put("firmware", Build.VERSION.RELEASE);
jSONObject.put("textureCompression", ADCTelemetry.this.downloadActivityInternal.glExtensions);
jSONObject.put("version", ADCTelemetry.this.downloadActivityInternal.getAPKVersion());
DownloadActivityInternal unused4 = ADCTelemetry.this.downloadActivityInternal;
if (DownloadActivityInternal.MIN_ASSET_VERSION_REQUIRED == null) {
str = "";
} else {
DownloadActivityInternal unused5 = ADCTelemetry.this.downloadActivityInternal;
str = DownloadActivityInternal.MIN_ASSET_VERSION_REQUIRED;
}
jSONObject.put("minVersion", str);
}
} catch (JSONException unused6) {
}
Logging.DEBUG_OUT("ADCTelemetry - The following JSON will be send: " + jSONObject.toString());
return jSONObject.toString();
}
}
private class TelemetryQueueThread extends Thread {
private boolean running = true;
private TelemetryQueueThread() {
}
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
while (this.running) {
try {
TelemetryQueueElement telemetryQueueElement = (TelemetryQueueElement) ADCTelemetry.this.eventQueue.poll();
if (telemetryQueueElement != null) {
Logging.DEBUG_OUT("ADCTelemetry - TelemetryQueueThread creating new TelemetrySendThread");
ADCTelemetry.this.new TelemetrySendThread(telemetryQueueElement.jsonEvent, telemetryQueueElement.nrOfRetries).start();
}
try {
sleep(1000L);
} catch (Exception unused) {
}
} catch (Exception e) {
Logging.DEBUG_OUT("ADCTelemetry - TelemetryQueueThread " + e.toString());
}
}
}
public synchronized void stopThread() {
this.running = false;
}
}
private class TelemetryQueueElement {
public String jsonEvent;
public int nrOfRetries;
public TelemetryQueueElement(int i, String str) {
this.nrOfRetries = i;
this.jsonEvent = str;
}
}
}
@@ -1,49 +0,0 @@
package com.eamobile;
import android.app.Activity;
import android.content.Context;
/* loaded from: classes.dex */
public class DownloadActivity {
private DownloadActivityInternal mDownloadActivityInternal;
public DownloadActivity(Context context) {
this.mDownloadActivityInternal = new DownloadActivityInternal(context);
}
public DownloadActivity(Context context, String str) {
this.mDownloadActivityInternal = new DownloadActivityInternal(context, str);
}
public void init(Activity activity, IDownloadActivity iDownloadActivity, Context context, Object obj) {
this.mDownloadActivityInternal.init(activity, iDownloadActivity, context, obj);
}
public void onPause() {
this.mDownloadActivityInternal.onPause();
}
public void onResume() {
this.mDownloadActivityInternal.onResume();
}
public void onDestroy() {
this.mDownloadActivityInternal.onDestroy();
}
public void onWindowFocusChanged(boolean z) {
this.mDownloadActivityInternal.onWindowFocusChanged(z);
}
public void destroyDownloadActvity() {
this.mDownloadActivityInternal.destroyDownloadActvity();
}
public void setAssetPath(String str) {
this.mDownloadActivityInternal.setAssetPath(str, true);
}
public void setAssetPath(String str, boolean z) {
this.mDownloadActivityInternal.setAssetPath(str, z);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,8 +0,0 @@
package com.eamobile;
import com.eamobile.download.DeviceData;
/* loaded from: classes.dex */
public interface IDeviceData {
void onRetrievedDeviceData(DeviceData deviceData);
}
@@ -1,11 +0,0 @@
package com.eamobile;
/* loaded from: classes.dex */
public interface IDownloadActivity {
public static final int DOWNLOAD_CANCEL = 1;
public static final int DOWNLOAD_START = 0;
void onDownloadEvent(int i);
void onResult(String str, int i);
}
@@ -1,246 +0,0 @@
package com.eamobile;
import com.eamobile.download.Logging;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
/* loaded from: classes.dex */
public class Language {
public static final int ASCII = 1;
public static final int BTN_3G = 23;
public static final int BTN_ALWAYS = 48;
public static final int BTN_CANCEL = 49;
public static final int BTN_DOWNLOAD = 5;
public static final int BTN_EXIT = 6;
public static final int BTN_NO = 18;
public static final int BTN_OK = 2;
public static final int BTN_RETRY = 14;
public static final int BTN_RETRY_TITLE = 13;
public static final int BTN_THIS_TIME_ONLY = 47;
public static final int BTN_WIFI = 16;
public static final int BTN_YES = 17;
public static final int CHECK_UPDATES_MSG = 22;
public static final int CHECK_UPDATES_TITLE = 21;
public static final int CONTACTING_SERVER_MSG = 38;
public static final int CONTACTING_SERVER_TITLE = 37;
public static final int DEBUG_DOWNLOAD_TITLE = 52;
public static final int DELETING_OLD_CONTENT = 45;
public static final int DOWNLOADING_MSG = 20;
public static final int DOWNLOADING_TITLE = 19;
public static final int DOWNLOAD_EXIT_CONFIRMATION = 41;
public static final int DOWNLOAD_MSG = 1;
public static final int DOWNLOAD_MSG_NEW = 50;
public static final int DOWNLOAD_PROGRESS = 15;
public static final int DOWNLOAD_SPEED_TXT = 36;
public static final int DOWNLOAD_TITLE = 0;
public static final char END_OF_LINE = '\n';
public static final int FAILED_MSG = 12;
public static final int FAILED_TITLE = 11;
public static final int INVALID_CONTENT_TITLE = 42;
public static final int INVALID_CONTENT_TXT = 43;
public static final int MANDATORY_UPDATE_WARNING = 44;
private static final int NB_STRINGS = 53;
public static final int NETWORK_3G_CONNECT_TITLE = 39;
public static final int NETWORK_WARNING_TXT = 24;
public static final int NETWORK_WIFI_DISABLED = 40;
public static final int NW_UNAVAIL = 9;
public static final int NW_UNAVAIL_MSG = 10;
public static final int PRESS_BACK_FOR_3G = 30;
public static final int PRESS_BACK_FOR_WIFI = 29;
public static final int PRESS_BTN_3G_FOR_3G = 31;
public static final int SERVER_ERROR_TEXT = 34;
public static final int SERVER_ERROR_TITLE = 33;
public static final int SIGNAL_STRENGTH_TXT = 35;
public static final int SPACE_UNAVAIL_MSG = 4;
public static final int SPACE_UNAVAIL_MSG_NEW = 51;
public static final int SPACE_UNAVAIL_TITLE = 3;
public static final int UNICODE = 2;
public static final int UNSUPPORTED_DEVICE_TITLE = 27;
public static final int UNSUPPORTED_DEVICE_TXT = 28;
public static final int UPDATES_FOUND_TITLE = 25;
public static final int UPDATES_FOUND_TXT = 26;
public static final int WIFI_LOST = 46;
public static final int WIFI_MSG = 8;
public static final int WIFI_MSG_ENABLE_MANUALLY = 32;
public static final int WIFI_TITLE = 7;
private static int fileType;
public static final String[] strings = new String[53];
public final int BUFFER_SIZE = 8096;
private String curLanguage;
public boolean loadStrings(String str) {
InputStream inputStream;
Logging.DEBUG_OUT("\tloadString(" + str + ")");
if (str == null) {
return false;
}
String str2 = DownloadActivityInternal.getResourcesPath() + str + ".txt";
Logging.DEBUG_OUT("\tOpening file: " + str2);
InputStream inputStream2 = null;
try {
try {
inputStream = DownloadActivityInternal.getInstance().getAssets().open(str2);
} catch (FileNotFoundException unused) {
} catch (Exception e) {
e = e;
}
try {
try {
if (inputStream == null) {
Logging.DEBUG_OUT("\tCouldn't find file: " + str2);
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception unused2) {
}
}
return false;
}
Vector vector = new Vector();
DataInputStream dataInputStream = new DataInputStream(inputStream);
fileType = determineFileType(str2);
if (fileType == 2) {
dataInputStream.skipBytes(2);
}
boolean z = true;
while (z) {
try {
vector.addElement(readTo(dataInputStream, '\n', true));
} catch (Exception unused3) {
z = false;
}
}
for (int i = 0; i < strings.length; i++) {
strings[i] = ((String) vector.elementAt(i)).toString();
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception unused4) {
}
}
this.curLanguage = str;
return true;
} catch (FileNotFoundException unused5) {
inputStream2 = inputStream;
Logging.DEBUG_OUT("\tFile not found: " + str2);
if (inputStream2 != null) {
try {
inputStream2.close();
} catch (Exception unused6) {
}
}
return false;
} catch (Throwable th) {
th = th;
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception unused7) {
}
}
throw th;
}
} catch (Exception e2) {
e = e2;
inputStream2 = inputStream;
Logging.DEBUG_OUT("\tException caught: " + e);
Logging.DEBUG_OUT("[ERROR] An error occurred while loading text messages.Some messages may not display as expected.");
if (inputStream2 != null) {
try {
inputStream2.close();
} catch (Exception unused8) {
}
}
return false;
}
} catch (Throwable th2) {
th = th2;
inputStream = null;
}
}
public static String readTo(DataInput dataInput, char c, boolean z) throws IOException {
StringBuffer stringBuffer = new StringBuffer();
char readChar = readChar(dataInput);
while (readChar != c) {
stringBuffer.append(readChar);
readChar = readChar(dataInput);
}
String stringBuffer2 = stringBuffer.toString();
if (stringBuffer2 != null) {
return stringBuffer2.trim();
}
return null;
}
public static char readChar(DataInput dataInput) throws IOException {
if (fileType == 2) {
int readUnsignedShort = dataInput.readUnsignedShort();
return (char) (((readUnsignedShort & 255) << 8) | (readUnsignedShort >> 8));
}
return (char) dataInput.readUnsignedByte();
}
public static int determineFileType(String str) {
DataInputStream dataInputStream;
DataInputStream dataInputStream2 = null;
try {
try {
dataInputStream = new DataInputStream(DownloadActivityInternal.getInstance().getAssets().open(str));
} catch (IOException unused) {
} catch (Throwable th) {
th = th;
}
try {
r0 = dataInputStream.readUnsignedShort() == 65534 ? 2 : 1;
dataInputStream.close();
} catch (IOException unused2) {
dataInputStream2 = dataInputStream;
dataInputStream2.close();
return r0;
} catch (Throwable th2) {
th = th2;
dataInputStream2 = dataInputStream;
try {
dataInputStream2.close();
} catch (Exception unused3) {
}
throw th;
}
} catch (Exception unused4) {
}
return r0;
}
public static String getString(int i) {
return getString(i, null);
}
public static String getString(int i, String[] strArr) {
String str = strings[i];
if (strArr != null) {
try {
if (strArr.length > 0) {
int i2 = 0;
while (str.indexOf("%%") != -1 && i2 < strArr.length) {
int indexOf = str.indexOf("%%");
i2++;
str = str.substring(0, indexOf) + strArr[i2] + str.substring(indexOf + 2);
}
}
} catch (Exception e) {
Logging.DEBUG_OUT("Exception e:" + e);
}
}
return str;
}
public String getCurrentLanguage() {
return this.curLanguage;
}
}
@@ -1,63 +0,0 @@
package com.eamobile;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import com.eamobile.download.Logging;
/* loaded from: classes.dex */
public class WifiReceiver extends BroadcastReceiver {
private WifiManager wifiManager;
private String wifiName = "";
private int wifiLevel = 0;
public WifiReceiver() {
setWifiManager();
}
private void setWifiManager() {
Logging.DEBUG_OUT("Calling setWifiManager...");
try {
if (DownloadActivityInternal.getInstance() != null) {
this.wifiManager = (WifiManager) DownloadActivityInternal.getInstance().getApplicationContext().getSystemService("wifi");
} else {
this.wifiManager = null;
}
} catch (Exception e) {
this.wifiManager = null;
Logging.DEBUG_OUT("[ERROR] An exception occurred in WifiReceiver while trying to get WifiManager.");
Logging.DEBUG_OUT_STACK(e);
}
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
updateWifiInfo();
}
public void updateWifiInfo() {
if (this.wifiManager == null) {
setWifiManager();
}
if (this.wifiManager == null || !this.wifiManager.isWifiEnabled()) {
return;
}
WifiInfo connectionInfo = this.wifiManager.getConnectionInfo();
this.wifiName = connectionInfo.getSSID();
int calculateSignalLevel = WifiManager.calculateSignalLevel(connectionInfo.getRssi(), 3);
if (this.wifiLevel != calculateSignalLevel) {
this.wifiLevel = calculateSignalLevel;
Logging.DEBUG_OUT("Wifi connection: " + this.wifiName + " (signal strength: " + this.wifiLevel + "/3)");
}
}
public String getWifiName() {
return this.wifiName;
}
public int getWifiLevel() {
return this.wifiLevel;
}
}
@@ -1,654 +0,0 @@
package com.eamobile.download;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Properties;
import java.util.TreeSet;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public class AssetManager {
static final String ADC_ASSET_INFO_FILE = "AssetInfo.indicate";
static final String DOWNLOAD_CONTROL_FILE1 = "Downloaded.indicate";
static final String DOWNLOAD_CONTROL_FILE2 = "Downloaded2.indicate";
static final String INDICATE_FINISHED = "COMPLETE";
static final String INDICATE_PROGRESS = "PROGRESS";
private String mAlternativeAssetPath;
private String mAssetPath;
private boolean mUseAlternativeAssetPath = false;
public void setAssetPath(String str) {
this.mAssetPath = str;
}
public void setAlternativeAssetPath(String str) {
this.mAlternativeAssetPath = str;
}
public String getAssetPath() {
if (!this.mUseAlternativeAssetPath) {
return this.mAssetPath;
}
return this.mAlternativeAssetPath;
}
public void useAlternativeAssetPath(boolean z) {
if (z) {
Logging.DEBUG_OUT("AssetManager: using alternative location");
} else {
Logging.DEBUG_OUT("AssetManager: using main location");
}
this.mUseAlternativeAssetPath = z;
}
public String getFilePath(String str) {
if (!this.mUseAlternativeAssetPath) {
return this.mAssetPath + "/" + str;
}
return this.mAlternativeAssetPath + "/" + str;
}
public String getLocalAssetVersion() {
Logging.DEBUG_OUT("Calling: AssetManager getLocalAssetVersion()");
try {
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE1));
if (!file.exists()) {
return null;
}
Hashtable hashtable = new Hashtable();
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (!readLine.contains(INDICATE_FINISHED) && !readLine.trim().equals("")) {
String[] split = readLine.split("\t");
hashtable.put(split[0], split[1]);
}
}
bufferedReader.close();
Enumeration keys = hashtable.keys();
String str = "";
while (keys.hasMoreElements()) {
str = (String) hashtable.get((String) keys.nextElement());
}
return str;
} catch (Exception e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred while getting local asset version: " + e);
Logging.DEBUG_OUT_STACK(e);
return null;
}
}
public boolean checkForUpdates(DownloadFileData[] downloadFileDataArr) {
Logging.DEBUG_OUT("Calling: AssetManager checkForUpdates()");
if (downloadFileDataArr == null || downloadFileDataArr.length <= 0) {
return false;
}
try {
return isVersionLower(getLocalAssetVersion(), downloadFileDataArr[0].getVersion());
} catch (Exception e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred while checking for updates: " + e);
Logging.DEBUG_OUT_STACK(e);
return false;
}
}
public boolean assetsFoundLocally() {
File file = new File(getAssetPath());
if (!file.exists()) {
file.mkdir();
}
try {
File file2 = new File(getFilePath(DOWNLOAD_CONTROL_FILE1));
if (!file2.exists()) {
return false;
}
BufferedReader bufferedReader = new BufferedReader(new FileReader(file2), 8192);
String str = "";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str = str + readLine + "\n";
}
bufferedReader.close();
if (!str.contains(INDICATE_FINISHED)) {
return false;
}
File file3 = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
if (!file3.exists()) {
return true;
}
BufferedReader bufferedReader2 = new BufferedReader(new FileReader(file3), 8192);
ArrayList<String> arrayList = new ArrayList<>();
while (true) {
String readLine2 = bufferedReader2.readLine();
if (readLine2 != null) {
arrayList.add(readLine2);
} else {
bufferedReader2.close();
return checkFiles(arrayList);
}
}
} catch (Exception unused) {
return false;
}
}
public boolean isFileDownloaded(String str) {
File file = new File(getAssetPath());
if (!file.exists()) {
file.mkdir();
}
try {
File file2 = new File(getFilePath(DOWNLOAD_CONTROL_FILE1));
if (!file2.exists()) {
return false;
}
BufferedReader bufferedReader = new BufferedReader(new FileReader(file2), 8192);
String str2 = "";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str2 = str2 + readLine + "\n";
}
bufferedReader.close();
return str2.contains(str);
} catch (Exception unused) {
Logging.DEBUG_OUT(str + " is not downloaded.");
return false;
}
}
public void prepareSDCard() {
try {
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE1));
if (file.exists()) {
file.delete();
}
} catch (Exception e) {
Logging.DEBUG_OUT("Exception while cleaning SDCard:");
Logging.DEBUG_OUT_STACK(e);
}
}
public void deleteEntireDownloadFolder() {
deleteEntireDownloadFolderAux(new File(getAssetPath()));
}
public void deleteEntireDownloadFolderAux(File file) {
try {
File[] listFiles = file.listFiles();
for (int i = 0; i < listFiles.length; i++) {
if (listFiles[i].isDirectory()) {
deleteEntireDownloadFolderAux(listFiles[i]);
}
if (!listFiles[i].exists()) {
Logging.DEBUG_OUT("\tDeleting file: " + listFiles[i].getAbsolutePath() + " (NOT FOUND)");
} else if (listFiles[i].delete()) {
Logging.DEBUG_OUT("\tDeleting file: " + listFiles[i].getAbsolutePath() + " (OK)");
} else {
Logging.DEBUG_OUT("\tDeleting file: " + listFiles[i].getAbsolutePath() + " (FAILED)");
}
}
} catch (Exception e) {
Logging.DEBUG_OUT("Exception while deleting download folder:");
Logging.DEBUG_OUT_STACK(e);
}
}
public void deleteAssets() {
try {
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
if (!file.exists()) {
return;
}
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
String filePath = getFilePath(readLine);
File file2 = new File(filePath);
if (file2.exists()) {
if (file2.delete()) {
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (OK)");
} else {
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (FAILED)");
}
} else {
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (NOT FOUND)");
}
} else {
bufferedReader.close();
deleteEmptyDirs(getAssetPath(), getDirList());
return;
}
}
} catch (Exception e) {
Logging.DEBUG_OUT("Exception while deleting assets:");
Logging.DEBUG_OUT_STACK(e);
}
}
private void deleteEmptyDirs(String str, ArrayList<File> arrayList) {
try {
File file = new File(str);
File[] listFiles = file.listFiles();
if (listFiles == null) {
Logging.DEBUG_OUT("Error listing files for directory: " + file.getAbsolutePath());
return;
}
for (int i = 0; i < listFiles.length; i++) {
if (listFiles[i].isDirectory()) {
deleteEmptyDirs(listFiles[i].getAbsolutePath(), arrayList);
}
}
File[] listFiles2 = file.listFiles();
String absolutePath = file.getAbsolutePath();
if (listFiles2.length == 0) {
if (belongsToADC(file, arrayList)) {
if (file.delete()) {
Logging.DEBUG_OUT(absolutePath + " (DELETED)");
} else {
Logging.DEBUG_OUT(absolutePath + " (UNKNOWN ERROR WHILE DELETING)");
}
try {
Thread.sleep(10L);
return;
} catch (InterruptedException e) {
Logging.DEBUG_OUT_STACK(e);
return;
}
}
Logging.DEBUG_OUT(absolutePath + " (DOES NOT BELONG TO ADC)");
return;
}
Logging.DEBUG_OUT(absolutePath + " (NOT EMPTY)");
} catch (SecurityException e2) {
Logging.DEBUG_OUT_STACK(e2);
}
}
private boolean belongsToADC(File file, ArrayList<File> arrayList) {
return arrayList.contains(file);
}
private ArrayList<File> getDirList() {
int i;
try {
ArrayList<File> arrayList = new ArrayList<>();
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
if (file.exists()) {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
TreeSet treeSet = new TreeSet();
while (true) {
String readLine = bufferedReader.readLine();
i = 0;
if (readLine == null) {
break;
}
String[] split = readLine.split("/");
String str = "";
while (i < split.length - 1) {
str = str + split[i] + "/";
treeSet.add(str);
i++;
}
}
Iterator it = treeSet.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
if (new File(getFilePath(str2)).isDirectory()) {
arrayList.add(new File(getFilePath(str2)));
}
}
Logging.DEBUG_OUT("ADC Directories read from Downloaded2.indicate: ");
while (i < arrayList.size()) {
Logging.DEBUG_OUT(arrayList.get(i).getAbsolutePath());
i++;
}
bufferedReader.close();
}
return arrayList;
} catch (Exception unused) {
return null;
}
}
public void saveStateDownloadStarted() {
saveState(INDICATE_PROGRESS, null);
}
public void saveStateDownloadFinished() {
saveState(INDICATE_PROGRESS, INDICATE_FINISHED);
}
public void saveState(String str, String str2) {
try {
String filePath = getFilePath(DOWNLOAD_CONTROL_FILE1);
File file = new File(filePath);
if (file.exists()) {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
String str3 = "";
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str3 = str3 + readLine + "\n";
}
bufferedReader.close();
if (str2 != null) {
str = str3.replaceAll(str, str2);
} else if (!exists(str, filePath)) {
str = str3 + str;
}
if (exists(str, filePath)) {
return;
}
File file2 = new File(filePath);
if (file2.exists()) {
file2.delete();
}
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath, true), 8192);
bufferedWriter.write(str + "\n");
bufferedWriter.close();
return;
}
try {
new File(getAssetPath()).mkdirs();
} catch (SecurityException e) {
Logging.DEBUG_OUT("saveState Security Exception:" + e);
}
FileWriter fileWriter = new FileWriter(filePath, true);
BufferedWriter bufferedWriter2 = new BufferedWriter(fileWriter, 8192);
bufferedWriter2.write(str + "\n");
bufferedWriter2.close();
fileWriter.close();
} catch (Exception e2) {
Logging.DEBUG_OUT("Exception while saving state to SDCard: " + e2);
}
}
public void clearDownloadDir() {
File file = new File(getAssetPath());
if (file.isDirectory()) {
for (String str : file.list()) {
new File(file, str).delete();
}
}
}
public void saveDownloadListFile(DownloadFileData[] downloadFileDataArr) {
String downloadList = getDownloadList(downloadFileDataArr);
try {
FileOutputStream fileOutputStream = new FileOutputStream(getFilePath(DOWNLOAD_CONTROL_FILE2));
fileOutputStream.write(downloadList.getBytes());
fileOutputStream.close();
} catch (Exception e) {
Logging.DEBUG_OUT_STACK(e);
}
}
public String getDownloadList(DownloadFileData[] downloadFileDataArr) {
String str = "";
for (int i = 0; i < downloadFileDataArr.length; i++) {
if (downloadFileDataArr[i].getType() == 2) {
str = str + getFileList(downloadFileDataArr[i]);
}
}
return str;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:38:0x00a3 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r1v0, types: [java.io.BufferedReader, java.io.DataInputStream] */
/* JADX WARN: Type inference failed for: r1v13 */
/* JADX WARN: Type inference failed for: r1v14 */
/* JADX WARN: Type inference failed for: r1v2, types: [java.io.BufferedReader] */
/* JADX WARN: Type inference failed for: r1v3 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private java.lang.String getFileList(com.eamobile.download.DownloadFileData r8) {
/*
r7 = this;
java.lang.String r0 = ""
r1 = 0
java.net.URL r2 = new java.net.URL // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
java.lang.String r8 = r8.getFileURL() // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
r2.<init>(r8) // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
java.net.URLConnection r8 = r2.openConnection() // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
r2 = 30000(0x7530, float:4.2039E-41)
r8.setConnectTimeout(r2) // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
r8.setReadTimeout(r2) // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
java.io.InputStream r8 = r8.getInputStream() // Catch: java.lang.Throwable -> L87 java.lang.Exception -> L8b
if (r8 != 0) goto L2f
if (r8 == 0) goto L2e
r8.close() // Catch: java.lang.Exception -> L2a
r1.close() // Catch: java.lang.Exception -> L2a
r1.close() // Catch: java.lang.Exception -> L2a
goto L2e
L2a:
r8 = move-exception
com.eamobile.download.Logging.DEBUG_OUT_STACK(r8)
L2e:
return r1
L2f:
java.io.DataInputStream r2 = new java.io.DataInputStream // Catch: java.lang.Throwable -> L7f java.lang.Exception -> L82
r2.<init>(r8) // Catch: java.lang.Throwable -> L7f java.lang.Exception -> L82
java.io.BufferedReader r3 = new java.io.BufferedReader // Catch: java.lang.Throwable -> L78 java.lang.Exception -> L7a
java.io.InputStreamReader r4 = new java.io.InputStreamReader // Catch: java.lang.Throwable -> L78 java.lang.Exception -> L7a
r4.<init>(r2) // Catch: java.lang.Throwable -> L78 java.lang.Exception -> L7a
r5 = 8192(0x2000, float:1.148E-41)
r3.<init>(r4, r5) // Catch: java.lang.Throwable -> L78 java.lang.Exception -> L7a
L40:
java.lang.String r1 = r3.readLine() // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
if (r1 == 0) goto L65
java.lang.String r4 = "\t"
java.lang.String[] r1 = r1.split(r4) // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
r4.<init>() // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
r4.append(r0) // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
r5 = 0
r1 = r1[r5] // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
r4.append(r1) // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
java.lang.String r1 = "\n"
r4.append(r1) // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
java.lang.String r1 = r4.toString() // Catch: java.lang.Exception -> L76 java.lang.Throwable -> L9f
r0 = r1
goto L40
L65:
if (r8 == 0) goto L9e
r8.close() // Catch: java.lang.Exception -> L71
r2.close() // Catch: java.lang.Exception -> L71
r3.close() // Catch: java.lang.Exception -> L71
goto L9e
L71:
r8 = move-exception
com.eamobile.download.Logging.DEBUG_OUT_STACK(r8)
goto L9e
L76:
r1 = move-exception
goto L90
L78:
r0 = move-exception
goto La1
L7a:
r3 = move-exception
r6 = r3
r3 = r1
r1 = r6
goto L90
L7f:
r0 = move-exception
r2 = r1
goto La1
L82:
r2 = move-exception
r3 = r1
r1 = r2
r2 = r3
goto L90
L87:
r0 = move-exception
r8 = r1
r2 = r8
goto La1
L8b:
r8 = move-exception
r2 = r1
r3 = r2
r1 = r8
r8 = r3
L90:
com.eamobile.download.Logging.DEBUG_OUT_STACK(r1) // Catch: java.lang.Throwable -> L9f
if (r8 == 0) goto L9e
r8.close() // Catch: java.lang.Exception -> L71
r2.close() // Catch: java.lang.Exception -> L71
r3.close() // Catch: java.lang.Exception -> L71
L9e:
return r0
L9f:
r0 = move-exception
r1 = r3
La1:
if (r8 == 0) goto Lb1
r8.close() // Catch: java.lang.Exception -> Lad
r2.close() // Catch: java.lang.Exception -> Lad
r1.close() // Catch: java.lang.Exception -> Lad
goto Lb1
Lad:
r8 = move-exception
com.eamobile.download.Logging.DEBUG_OUT_STACK(r8)
Lb1:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.eamobile.download.AssetManager.getFileList(com.eamobile.download.DownloadFileData):java.lang.String");
}
public long getTotalSize(String str) {
long j = 0;
for (String str2 : str.split("\n")) {
j += getFileSize(str2);
}
return j;
}
public long getFileSize(String str) {
File file = new File(getFilePath(str));
if (file.exists()) {
Logging.DEBUG_OUT("File: " + getFilePath(str) + " Size: " + file.length());
return file.length();
}
Logging.DEBUG_OUT("File: " + getFilePath(str) + " Size: 0");
return 0L;
}
private boolean checkFiles(ArrayList<String> arrayList) {
Logging.DEBUG_OUT("[checkFiles]");
for (int i = 0; i < arrayList.size(); i++) {
String filePath = getFilePath(arrayList.get(i));
if (!new File(filePath).exists()) {
Logging.DEBUG_OUT("\tChecking file: " + filePath + " (NOT FOUND)");
new File(getFilePath(DOWNLOAD_CONTROL_FILE1)).delete();
return false;
}
Logging.DEBUG_OUT("\tChecking file: " + filePath + " (OK)");
}
Logging.DEBUG_OUT(" ");
return true;
}
public boolean isAssetVersionCompatible(String str) {
String localAssetVersion = getLocalAssetVersion();
Logging.DEBUG_OUT("Checking asset version:");
Logging.DEBUG_OUT("\tLocal asset version: " + localAssetVersion);
Logging.DEBUG_OUT("\tMinimum asset version: " + str);
if (isVersionLower(localAssetVersion, str)) {
Logging.DEBUG_OUT("FAILED");
return false;
}
Logging.DEBUG_OUT("OK");
return true;
}
public boolean isVersionLower(String str, String str2) {
int compareTo = normalisedVersion(str2).compareTo(normalisedVersion(str));
return compareTo >= 0 && compareTo > 0;
}
private String normalisedVersion(String str) {
return normalisedVersion(str, ".", 4);
}
private String normalisedVersion(String str, String str2, int i) {
String[] split = Pattern.compile(str2, 16).split(str);
StringBuilder sb = new StringBuilder();
for (String str3 : split) {
sb.append(String.format("%" + i + 's', str3));
}
return sb.toString();
}
private boolean exists(String str, String str2) {
String str3 = "";
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(str2)), 8192);
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str3 = str3 + readLine + "\r\n";
}
Logging.DEBUG_OUT("Existing Text:" + str3 + ", new Value:" + str);
bufferedReader.close();
} catch (Exception unused) {
}
return str3.contains(str);
}
public Properties loadAssetInfo() {
try {
File file = new File(getFilePath(ADC_ASSET_INFO_FILE));
if (!file.exists()) {
return null;
}
FileInputStream fileInputStream = new FileInputStream(file);
Properties properties = new Properties();
properties.load(fileInputStream);
return properties;
} catch (Exception e) {
Logging.DEBUG_OUT("\tException while loading properties from: AssetInfo.indicate");
Logging.DEBUG_OUT_STACK(e);
return null;
}
}
public void saveAssetInfo(Properties properties) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(getFilePath(ADC_ASSET_INFO_FILE));
properties.store(fileOutputStream, "");
fileOutputStream.close();
} catch (Exception e) {
Logging.DEBUG_OUT("\tException while saving properties to: AssetInfo.indicate");
Logging.DEBUG_OUT_STACK(e);
}
}
}
@@ -1,44 +0,0 @@
package com.eamobile.download;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.CRC32;
import java.util.zip.CheckedInputStream;
/* loaded from: classes.dex */
public class ChecksumValidator {
public static boolean validate(String str, String str2, long j) {
String str3;
boolean z = true;
if (str.contains(str2)) {
str3 = str.substring(str.lastIndexOf(str2) + (str2.charAt(str2.length() - 1) == '/' ? str2.length() : str2.length() + 1));
} else {
str3 = str;
}
Logging.DEBUG_OUT("Validating checksum for " + str3);
try {
CheckedInputStream checkedInputStream = new CheckedInputStream(new FileInputStream(str), new CRC32());
while (checkedInputStream.read(new byte[8192]) != -1) {
}
long value = checkedInputStream.getChecksum().getValue();
checkedInputStream.close();
if (value != j) {
z = false;
}
if (z) {
Logging.DEBUG_OUT("Checksums match: " + j);
Logging.DEBUG_OUT("File " + str3 + " downloaded successfully");
} else {
Logging.DEBUG_OUT("[ERROR] Checksums do not match FileChecksum:" + value + ", Server Checksums:" + j);
StringBuilder sb = new StringBuilder();
sb.append("File ");
sb.append(str3);
sb.append(" failed to download");
Logging.DEBUG_OUT(sb.toString());
}
return z;
} catch (IOException unused) {
return false;
}
}
}
@@ -1,9 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class Constants {
public static final String ADC_BUILD_LOCAL = "@ADC_BUILD_LOCAL_DYNAMIC_VALUE@";
public static final String ADC_BUILD_TIME = "@ADC_BUILD_TIME_DYNAMIC_VALUE@";
public static final String ADC_BUILD_VERSION = "@ADC_BUILD_VERSION_DYNAMIC_VALUE@";
public static final int DEFAULT_BUFFER_SIZE = 8192;
}
@@ -1,33 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class Device {
private int height;
private String name;
private int width;
public Device(String str, int i, int i2) {
this.name = "";
this.width = 0;
this.height = 0;
this.name = str;
this.width = i;
this.height = i2;
}
public String getName() {
return this.name;
}
public String getResolutionString() {
return this.width + "x" + this.height;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
}
@@ -1,119 +0,0 @@
package com.eamobile.download;
import java.util.EnumSet;
import java.util.Set;
/* loaded from: classes.dex */
public class DeviceData {
private String brandName;
private String deviceName;
private String glExtensions;
private int height;
private int width;
public enum TextureType {
PVR,
ATI,
DXT,
ETC,
S3TC,
_3DC,
PALETTED,
LATC,
UNCOMPRESSED
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String str) {
this.deviceName = str;
}
public String getBrandName() {
return this.brandName;
}
public void setBrandName(String str) {
this.brandName = str;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
public void setResolution(int i, int i2) {
this.width = i;
this.height = i2;
}
public String getGlExtensions() {
return this.glExtensions;
}
public void setGlExtensions(String str) {
this.glExtensions = str;
}
public EnumSet<TextureType> getSupportedTextureTypes() {
EnumSet<TextureType> of = EnumSet.of(TextureType.UNCOMPRESSED);
if (this.glExtensions.contains("GL_IMG_texture_compression_pvrtc")) {
of.add(TextureType.PVR);
}
if (this.glExtensions.contains("GL_ATI_compressed_texture_atitc") || this.glExtensions.contains("GL_AMD_compressed_ATC_texture") || this.glExtensions.contains("GL_ATI_texture_compression_atitc")) {
of.add(TextureType.ATI);
}
if (this.glExtensions.contains("GL_EXT_texture_compression_dxt1") || this.glExtensions.contains("GL_EXT_texture_compression_dxt3") || this.glExtensions.contains("GL_EXT_texture_compression_dxt5")) {
of.add(TextureType.DXT);
}
if (this.glExtensions.contains("GL_OES_compressed_ETC1_RGB8_texture")) {
of.add(TextureType.ETC);
}
if (this.glExtensions.contains("GL_OES_texture_compression_S3TC") || this.glExtensions.contains("GL_EXT_texture_compression_s3tc")) {
of.add(TextureType.S3TC);
}
if (this.glExtensions.contains("GL_AMD_compressed_3DC_texture")) {
of.add(TextureType._3DC);
}
if (this.glExtensions.contains("GL_OES_compressed_paletted_texture")) {
of.add(TextureType.PALETTED);
}
if (this.glExtensions.contains("GL_EXT_texture_compression_latc")) {
of.add(TextureType.LATC);
}
return of;
}
public void forceTexture(Set<TextureType> set) {
this.glExtensions = "";
if (set.contains(TextureType.PVR)) {
this.glExtensions += "GL_IMG_texture_compression_pvrtc ";
}
if (set.contains(TextureType.ATI)) {
this.glExtensions += "GL_ATI_compressed_texture_atitc ";
}
if (set.contains(TextureType.DXT)) {
this.glExtensions += "GL_EXT_texture_compression_dxt1 ";
}
if (set.contains(TextureType.ETC)) {
this.glExtensions += "GL_OES_compressed_ETC1_RGB8_texture ";
}
if (set.contains(TextureType.S3TC)) {
this.glExtensions += "GL_OES_texture_compression_S3TC ";
}
if (set.contains(TextureType._3DC)) {
this.glExtensions += "GL_AMD_compressed_3DC_texture ";
}
if (set.contains(TextureType.PALETTED)) {
this.glExtensions += "GL_OES_compressed_paletted_texture ";
}
if (set.contains(TextureType.LATC)) {
this.glExtensions += "GL_EXT_texture_compression_latc ";
}
}
}
@@ -1,75 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class DownloadFileData {
public static final int FILE_TYPE_CHECKSUMS = 2;
public static final int FILE_TYPE_OTHER = 3;
public static final int FILE_TYPE_ZIP = 1;
private String fileName;
private String fileURL;
private String language;
private int size;
private int type;
private String version;
public DownloadFileData(String str, int i, String str2, String str3, String str4, int i2) {
this.fileName = str;
this.size = i;
this.version = str2;
this.language = str3;
this.fileURL = str4;
this.type = i2;
}
public String getFileName() {
return this.fileName;
}
public void setFileName(String str) {
this.fileName = str;
}
public int getSize() {
return this.size;
}
public void setSize(int i) {
this.size = i;
}
public String getVersion() {
return this.version;
}
public void setVersion(String str) {
this.version = str;
}
public String getLanguage() {
return this.language;
}
public void setLanguage(String str) {
this.language = str;
}
public String getFileURL() {
return this.fileURL;
}
public void setFileURL(String str) {
this.fileURL = str;
}
public int getType() {
return this.type;
}
public void setType(int i) {
this.type = i;
}
public String toString() {
return this.fileName + " " + this.size + " " + this.version + " " + this.language + " " + this.fileURL + " " + this.type;
}
}
@@ -1,91 +0,0 @@
package com.eamobile.download;
import java.util.HashMap;
/* loaded from: classes.dex */
public class DownloadProgress {
private FileProgress currentFileProgress;
private boolean isLastReportDownload;
private HashMap<String, FileProgress> progressMap;
private long realDownloaded;
private long sizeDownloaded;
class FileProgress {
public long downloaded;
public long total;
FileProgress(long j, long j2) {
this.downloaded = j;
this.total = j2;
}
}
public DownloadProgress() {
Logging.DEBUG_OUT("DownloadProgress: constructor");
this.sizeDownloaded = 0L;
this.realDownloaded = 0L;
this.progressMap = new HashMap<>();
this.currentFileProgress = null;
this.isLastReportDownload = true;
}
public void setFlagLastReportDownload(boolean z) {
this.isLastReportDownload = z;
}
public boolean getFlagLastReportDownload() {
return this.isLastReportDownload;
}
public long getSizeDownloaded() {
return this.sizeDownloaded;
}
public long getRealDownloaded() {
return this.realDownloaded;
}
public void setCurrentFile(String str, long j) {
Logging.DEBUG_OUT("DownloadProgress: controlling progress for: " + str);
Logging.DEBUG_OUT("DownloadProgress: size: " + j);
FileProgress fileProgress = this.progressMap.get(str);
if (fileProgress == null) {
this.currentFileProgress = new FileProgress(0L, j);
this.progressMap.put(str, this.currentFileProgress);
} else {
this.currentFileProgress = fileProgress;
}
}
public void reportProgress(long j, boolean z) {
if (this.currentFileProgress != null) {
if (j > this.currentFileProgress.total) {
j = this.currentFileProgress.total;
}
long j2 = j - this.currentFileProgress.downloaded;
if (j2 > 0) {
if (z) {
this.sizeDownloaded += j2;
}
this.currentFileProgress.downloaded = j;
}
}
}
public void fillCurrentFileDownload(boolean z) {
if (this.currentFileProgress != null) {
long j = this.currentFileProgress.total - this.currentFileProgress.downloaded;
if (j < 0) {
j = 0;
}
this.currentFileProgress.downloaded += j;
if (z) {
this.sizeDownloaded += j;
}
}
}
public void reportTotalDownloaded(long j) {
this.realDownloaded += j;
}
}
@@ -1,12 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public interface IZipExtractorEvent {
void onExtractEntryFinish();
void onExtractEntryStart(String str, long j);
void onReportDownload(int i);
void onReportProgress(int i);
}
@@ -1,22 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class LocalZipExtractorEvent implements IZipExtractorEvent {
@Override // com.eamobile.download.IZipExtractorEvent
public void onReportDownload(int i) {
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onReportProgress(int i) {
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onExtractEntryStart(String str, long j) {
Logging.DEBUG_OUT("LocalZipExtractorEvent.onExtractEntryStart");
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onExtractEntryFinish() {
Logging.DEBUG_OUT("LocalZipExtractorEvent.onExtractEntryFinish");
}
}
@@ -1,90 +0,0 @@
package com.eamobile.download;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.PowerManager;
/* loaded from: classes.dex */
public class LockManager {
private static final String ADC_WAKE_LOCK_TAG = "ADCWakeLock";
private static final String ADC_WIFI_LOCK_TAG = "ADCWifiLock";
private Context context;
private WifiManager.WifiLock wifiLock;
private WifiManager wifiManager = null;
private PowerManager powerManager = null;
private PowerManager.WakeLock wakeLock = null;
public LockManager(Context context) {
this.context = context;
}
public boolean acquireWifiLock() {
try {
if (this.wifiManager == null) {
this.wifiManager = (WifiManager) this.context.getSystemService("wifi");
}
if (this.wifiManager != null && this.wifiLock == null) {
this.wifiLock = this.wifiManager.createWifiLock(1, ADC_WIFI_LOCK_TAG);
}
if (this.wifiLock != null) {
if (!this.wifiLock.isHeld()) {
this.wifiLock.acquire();
Logging.DEBUG_OUT("LockManager.acquireWifiLock() successfully called.");
return true;
}
Logging.DEBUG_OUT("LockManager.acquireWifiLock() - wifiLock already acquired.");
return false;
}
Logging.DEBUG_OUT("[ERROR] While acquiring WifiLock (LockManager.acquireWifiLock()).");
return false;
} catch (Exception e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred in LockManager.acquireWifiLock().");
Logging.DEBUG_OUT_STACK(e);
return false;
}
}
public void releaseWifiLock() {
if (this.wifiLock == null || !this.wifiLock.isHeld()) {
return;
}
this.wifiLock.release();
this.wifiLock = null;
Logging.DEBUG_OUT("LockManager.releaseWifiLock() successfully called.");
}
public boolean acquireWakeLock() {
try {
if (this.powerManager == null) {
this.powerManager = (PowerManager) this.context.getSystemService("power");
}
if (this.powerManager != null && this.wakeLock == null) {
this.wakeLock = this.powerManager.newWakeLock(6, ADC_WAKE_LOCK_TAG);
}
if (this.wakeLock != null) {
if (!this.wakeLock.isHeld()) {
this.wakeLock.acquire();
Logging.DEBUG_OUT("LockManager.acquireWakeLock() successfully called.");
return true;
}
Logging.DEBUG_OUT("LockManager.acquireWakeLock() - wakeLock already acquired.");
return false;
}
Logging.DEBUG_OUT("[ERROR] While acquiring WakeLock (LockManager.acquireWakeLock()).");
return false;
} catch (Exception e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred in LockManager.acquireWakeLock().");
Logging.DEBUG_OUT_STACK(e);
return false;
}
}
public void releaseWakeLock() {
if (this.wakeLock == null || !this.wakeLock.isHeld()) {
return;
}
this.wakeLock.release();
this.wakeLock = null;
Logging.DEBUG_OUT("LockManager.releaseWakeLock() successfully called.");
}
}
@@ -1,60 +0,0 @@
package com.eamobile.download;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
/* loaded from: classes.dex */
public class Logging {
public static boolean DEBUG_ON;
static OutputStream out;
public static void DEBUG_INIT() {
if (new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/debug.enable").exists()) {
DEBUG_ON = true;
DEBUG_OUT("*** WARNING: debug.enable found in SD card root, enabling debug output. ***");
DEBUG_OUT("*** ADC-only debug output is saved in SD card root, under debug.txt file. ***");
}
if (DEBUG_ON) {
try {
out = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/debug.txt", true);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
public static void DEBUG_OUT(String str) {
if (DEBUG_ON) {
Log.w("DownloadActivity", str);
try {
if (out != null) {
out.write((str + "\n").getBytes());
}
} catch (IOException unused) {
}
}
}
public static void DEBUG_OUT_STACK(Exception exc) {
StringWriter stringWriter = new StringWriter();
exc.printStackTrace(new PrintWriter(stringWriter));
DEBUG_OUT(stringWriter.toString());
}
public static void DEBUG_CLOSE() {
if (DEBUG_ON) {
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@@ -1,62 +0,0 @@
package com.eamobile.download;
import android.os.Environment;
import android.os.StatFs;
import android.support.v4.media.session.PlaybackStateCompat;
/* loaded from: classes.dex */
public final class MemoryStatus {
static final int ERROR = -1;
public static boolean externalMemoryAvailable() {
return Environment.getExternalStorageState().equals("mounted");
}
public static long getAvailableInternalMemorySize() {
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
return statFs.getAvailableBlocks() * statFs.getBlockSize();
}
public static long getTotalInternalMemorySize() {
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
return statFs.getBlockCount() * statFs.getBlockSize();
}
public static long getAvailableExternalMemorySize() {
if (!externalMemoryAvailable()) {
return -1L;
}
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
return statFs.getAvailableBlocks() * statFs.getBlockSize();
}
public static long getTotalExternalMemorySize() {
if (!externalMemoryAvailable()) {
return -1L;
}
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
return statFs.getBlockCount() * statFs.getBlockSize();
}
public static String formatSize(long j) {
String str;
if (j >= PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) {
str = "KiB";
j /= PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
if (j >= PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) {
str = "MiB";
j /= PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
}
} else {
str = null;
}
StringBuilder sb = new StringBuilder(Long.toString(j));
for (int length = sb.length() - 3; length > 0; length -= 3) {
sb.insert(length, ',');
}
if (str != null) {
sb.append(str);
}
return sb.toString();
}
}
@@ -1,54 +0,0 @@
package com.eamobile.download;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
/* loaded from: classes.dex */
public class RandomAccessFileReadThread extends Thread {
private DownloadProgress downloadProgress;
private RandomAccessFile file;
private InputStream in;
public boolean killMe = false;
public long timestamp = System.currentTimeMillis();
public boolean reading = true;
private byte[] buffer = new byte[8192];
public int sizeDownloaded = 0;
public int currentFileSize = 0;
public RandomAccessFileReadThread(InputStream inputStream, RandomAccessFile randomAccessFile, DownloadProgress downloadProgress) {
this.in = inputStream;
this.file = randomAccessFile;
this.downloadProgress = downloadProgress;
}
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
int i = 0;
while (i != -1) {
if (i != 0) {
try {
this.timestamp = System.currentTimeMillis();
} catch (IOException e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred in RandomAccessFileReadThread: " + e);
}
}
i = this.in.read(this.buffer);
if (this.killMe) {
break;
}
if (i == 0) {
Logging.DEBUG_OUT("0 BYTES READ>>>");
} else if (i > 0) {
this.file.write(this.buffer, 0, i);
this.sizeDownloaded += i;
this.downloadProgress.reportTotalDownloaded(i);
this.currentFileSize = ((int) this.file.getFilePointer()) - 1;
if (this.currentFileSize < 0) {
this.currentFileSize = 0;
}
}
}
this.reading = false;
}
}
@@ -1,55 +0,0 @@
package com.eamobile.download;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes.dex */
class ReadThread extends Thread {
private float compRatio;
private InputStream in;
private OutputStream out;
private IZipExtractorEvent zipExtractorEvent;
public boolean killMe = false;
public long timestamp = System.currentTimeMillis();
public boolean reading = true;
public volatile boolean pause = false;
private byte[] buffer = new byte[8192];
public int sizeDownloaded = 0;
public ReadThread(InputStream inputStream, OutputStream outputStream, float f, IZipExtractorEvent iZipExtractorEvent) {
this.compRatio = 0.0f;
this.in = inputStream;
this.out = outputStream;
this.compRatio = f;
this.zipExtractorEvent = iZipExtractorEvent;
}
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
int i = 0;
while (i != -1) {
if (i != 0) {
try {
this.timestamp = System.currentTimeMillis();
} catch (IOException e) {
Logging.DEBUG_OUT("[ERROR] An exception occurred in ReadThread: " + e);
}
}
if (this.killMe) {
break;
}
if (!this.pause) {
i = this.in.read(this.buffer);
if (i == 0) {
Logging.DEBUG_OUT("0 BYTES READ>>>");
} else if (i > 0) {
this.out.write(this.buffer, 0, i);
this.sizeDownloaded += i;
this.zipExtractorEvent.onReportDownload(Math.round(i * this.compRatio));
}
}
}
this.reading = false;
}
}
@@ -1,34 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class RemoteZipExtractorEvent implements IZipExtractorEvent {
private DownloadProgress downloadProgress;
private DownloadFileData zipFileData;
public RemoteZipExtractorEvent(DownloadProgress downloadProgress, DownloadFileData downloadFileData) {
this.downloadProgress = downloadProgress;
this.zipFileData = downloadFileData;
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onExtractEntryStart(String str, long j) {
Logging.DEBUG_OUT("RemoteZipExtractorEvent.onExtractEntryStart");
this.downloadProgress.setCurrentFile("z_" + this.zipFileData.getFileName() + "_" + str, j);
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onExtractEntryFinish() {
Logging.DEBUG_OUT("RemoteZipExtractorEvent.onExtractEntryFinish");
this.downloadProgress.fillCurrentFileDownload(true);
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onReportProgress(int i) {
this.downloadProgress.reportProgress(i, true);
}
@Override // com.eamobile.download.IZipExtractorEvent
public void onReportDownload(int i) {
this.downloadProgress.reportTotalDownloaded(i);
}
}
@@ -1,41 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class SpeedCalculator {
private float smoothingFactor;
private float currentAmount = 0.0f;
private float previousAmount = 0.0f;
private float currentTime = 0.0f;
private float previousTime = 0.0f;
private float averageSpeed = 0.0f;
private float currentSpeed = 0.0f;
public SpeedCalculator(float f) {
this.smoothingFactor = 0.0f;
this.smoothingFactor = f;
}
public void reportAmount(float f, float f2) {
this.currentAmount = f;
this.currentTime = f2;
float f3 = this.currentAmount - this.previousAmount;
float f4 = this.currentTime - this.previousTime;
this.previousAmount = this.currentAmount;
this.previousTime = this.currentTime;
float f5 = (this.smoothingFactor * this.currentSpeed) + ((1.0f - this.smoothingFactor) * this.averageSpeed);
if (!Float.isNaN(f5) && !Float.isInfinite(f5)) {
this.averageSpeed = f5;
}
if (f4 > 0.001f) {
this.currentSpeed = f3 / f4;
}
}
public float getCurrentSpeed() {
return this.averageSpeed;
}
public void forceAmount(float f) {
this.previousAmount = f;
}
}
@@ -1,32 +0,0 @@
package com.eamobile.download;
/* loaded from: classes.dex */
public class ZipExtractor {
private static final int ERROR_ZIP_CHECKSUM_MATCH_FAILED = -4;
private static final int ERROR_ZIP_CHECKSUM_NOT_FOUND = -3;
private static final int ERROR_ZIP_EXCEPTION = -1;
private static final int ERROR_ZIP_NO_ENTRIES = -2;
private static final int NO_ZIP_ERRORS = 1;
private static boolean pause;
private static boolean pauseDirty;
private IZipExtractorEvent zipExtractorEvent;
public static void setPause(boolean z) {
pause = z;
pauseDirty = true;
}
/* JADX WARN: Removed duplicated region for block: B:60:0x0132 A[Catch: Exception -> 0x021b, TryCatch #2 {Exception -> 0x021b, blocks: (B:18:0x00fb, B:19:0x010e, B:21:0x0112, B:24:0x0125, B:27:0x0150, B:29:0x0154, B:30:0x017c, B:33:0x018f, B:35:0x019d, B:36:0x01a8, B:37:0x01ac, B:39:0x01b2, B:41:0x01c0, B:43:0x01c6, B:47:0x01d3, B:52:0x01d8, B:54:0x01a2, B:56:0x0206, B:58:0x0129, B:60:0x0132, B:62:0x013b), top: B:17:0x00fb, outer: #4, inners: #7 }] */
/* JADX WARN: Removed duplicated region for block: B:63:0x013a */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public int extractFiles(java.io.InputStream r22, java.util.Hashtable<java.lang.String, java.lang.Long> r23, java.lang.String r24, int r25, com.eamobile.download.IZipExtractorEvent r26) {
/*
Method dump skipped, instructions count: 641
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.eamobile.download.ZipExtractor.extractFiles(java.io.InputStream, java.util.Hashtable, java.lang.String, int, com.eamobile.download.IZipExtractorEvent):int");
}
}

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