diff --git a/app/src/main/assets/licenseserver/de.txt b/app/src/main/assets/licenseserver/de.txt new file mode 100644 index 0000000..4a4b0cd --- /dev/null +++ b/app/src/main/assets/licenseserver/de.txt @@ -0,0 +1,4 @@ +OK +Diese Anwendung ist nicht fr den Gebrauch auf deinem Android-Gert autorisiert. +Bitte warten +Check-Lizenz diff --git a/app/src/main/assets/licenseserver/en.txt b/app/src/main/assets/licenseserver/en.txt new file mode 100644 index 0000000..e43de19 --- /dev/null +++ b/app/src/main/assets/licenseserver/en.txt @@ -0,0 +1,4 @@ +OK +This application is not authorized for use on your Android device. +Please wait +Checking license diff --git a/app/src/main/assets/licenseserver/es.txt b/app/src/main/assets/licenseserver/es.txt new file mode 100644 index 0000000..577e7e9 --- /dev/null +++ b/app/src/main/assets/licenseserver/es.txt @@ -0,0 +1,4 @@ +ACEPTAR +El uso de esta aplicacin no est autorizado en tu dispositivo Android. +Por favor espere +Verificacin de licencia diff --git a/app/src/main/assets/licenseserver/es_co.txt b/app/src/main/assets/licenseserver/es_co.txt new file mode 100644 index 0000000..a2ea7da --- /dev/null +++ b/app/src/main/assets/licenseserver/es_co.txt @@ -0,0 +1,4 @@ +ACEPTAR +El uso de esta aplicacin en su dispositivo Android no est autorizado. +Por favor espere +Verificacin de licencia diff --git a/app/src/main/assets/licenseserver/fr.txt b/app/src/main/assets/licenseserver/fr.txt new file mode 100644 index 0000000..a4fce33 --- /dev/null +++ b/app/src/main/assets/licenseserver/fr.txt @@ -0,0 +1,4 @@ +OK +L'utilisation de cette application sur votre appareil Android n'est pas autorise. +Patientez s'il vous plat +Permis de vrifier diff --git a/app/src/main/assets/licenseserver/it.txt b/app/src/main/assets/licenseserver/it.txt new file mode 100644 index 0000000..e35fd51 --- /dev/null +++ b/app/src/main/assets/licenseserver/it.txt @@ -0,0 +1,4 @@ +OK +L'applicazione non dispone dell'autorizzazione necessaria per l'utilizzo sul tuo dispositivo Android. +Si prega di attendere +Controllo di licenza diff --git a/app/src/main/assets/licenseserver/ja.txt b/app/src/main/assets/licenseserver/ja.txt new file mode 100644 index 0000000..529ff7b Binary files /dev/null and b/app/src/main/assets/licenseserver/ja.txt differ diff --git a/app/src/main/assets/licenseserver/ko.txt b/app/src/main/assets/licenseserver/ko.txt new file mode 100644 index 0000000..f243247 Binary files /dev/null and b/app/src/main/assets/licenseserver/ko.txt differ diff --git a/app/src/main/assets/licenseserver/pl.txt b/app/src/main/assets/licenseserver/pl.txt new file mode 100644 index 0000000..f39d2e0 Binary files /dev/null and b/app/src/main/assets/licenseserver/pl.txt differ diff --git a/app/src/main/assets/licenseserver/pt_BR.txt b/app/src/main/assets/licenseserver/pt_BR.txt new file mode 100644 index 0000000..a34f301 --- /dev/null +++ b/app/src/main/assets/licenseserver/pt_BR.txt @@ -0,0 +1,4 @@ +OK +Esta aplicao no est autorizada para utilizao no seu dispositivo Android. +Por favor, aguarde +Verifique licena diff --git a/app/src/main/assets/licenseserver/ru.txt b/app/src/main/assets/licenseserver/ru.txt new file mode 100644 index 0000000..0dc5499 Binary files /dev/null and b/app/src/main/assets/licenseserver/ru.txt differ diff --git a/app/src/main/assets/licenseserver/zh_CN.txt b/app/src/main/assets/licenseserver/zh_CN.txt new file mode 100644 index 0000000..6adf591 Binary files /dev/null and b/app/src/main/assets/licenseserver/zh_CN.txt differ diff --git a/app/src/main/assets/licenseserver/zh_TW.txt b/app/src/main/assets/licenseserver/zh_TW.txt new file mode 100644 index 0000000..251ab4a Binary files /dev/null and b/app/src/main/assets/licenseserver/zh_TW.txt differ diff --git a/app/src/main/assets/obb.size b/app/src/main/assets/obb.size new file mode 100644 index 0000000..e98bfb2 --- /dev/null +++ b/app/src/main/assets/obb.size @@ -0,0 +1 @@ +623470192 \ No newline at end of file diff --git a/app/src/main/assets/published/fonts/gothamblack.ttf b/app/src/main/assets/published/fonts/gothamblack.ttf new file mode 100644 index 0000000..69f50d8 Binary files /dev/null and b/app/src/main/assets/published/fonts/gothamblack.ttf differ diff --git a/app/src/main/assets/published/fonts/gothambold.ttf b/app/src/main/assets/published/fonts/gothambold.ttf new file mode 100644 index 0000000..b05a6dd Binary files /dev/null and b/app/src/main/assets/published/fonts/gothambold.ttf differ diff --git a/app/src/main/assets/published/fonts/gothamboldita.ttf b/app/src/main/assets/published/fonts/gothamboldita.ttf new file mode 100644 index 0000000..5919297 Binary files /dev/null and b/app/src/main/assets/published/fonts/gothamboldita.ttf differ diff --git a/app/src/main/assets/published/fonts/gothambook.ttf b/app/src/main/assets/published/fonts/gothambook.ttf new file mode 100644 index 0000000..132ac10 Binary files /dev/null and b/app/src/main/assets/published/fonts/gothambook.ttf differ diff --git a/app/src/main/assets/published/fonts/gothambook_mono.ttf b/app/src/main/assets/published/fonts/gothambook_mono.ttf new file mode 100644 index 0000000..ee03ad3 Binary files /dev/null and b/app/src/main/assets/published/fonts/gothambook_mono.ttf differ diff --git a/app/src/main/assets/published/fonts/hawaiidigitalnumbers.ttf b/app/src/main/assets/published/fonts/hawaiidigitalnumbers.ttf new file mode 100644 index 0000000..2884dbe Binary files /dev/null and b/app/src/main/assets/published/fonts/hawaiidigitalnumbers.ttf differ diff --git a/app/src/main/assets/splash.png b/app/src/main/assets/splash.png new file mode 100644 index 0000000..7b8f31b Binary files /dev/null and b/app/src/main/assets/splash.png differ diff --git a/app/src/main/java/com/bda/controller/BaseEvent.java b/app/src/main/java/com/bda/controller/BaseEvent.java new file mode 100644 index 0000000..06eac28 --- /dev/null +++ b/app/src/main/java/com/bda/controller/BaseEvent.java @@ -0,0 +1,57 @@ +package com.bda.controller; + +import android.os.Parcel; +import android.os.Parcelable; + +/* loaded from: classes.dex */ +class BaseEvent implements Parcelable { + public static final Parcelable.Creator CREATOR = new ParcelableCreator(); + final int mControllerId; + final long mEventTime; + + @Override // android.os.Parcelable + public int describeContents() { + return 0; + } + + public BaseEvent(long j, int i) { + this.mEventTime = j; + this.mControllerId = i; + } + + BaseEvent(Parcel parcel) { + this.mEventTime = parcel.readLong(); + this.mControllerId = parcel.readInt(); + } + + public final int getControllerId() { + return this.mControllerId; + } + + public final long getEventTime() { + return this.mEventTime; + } + + @Override // android.os.Parcelable + public void writeToParcel(Parcel parcel, int i) { + parcel.writeLong(this.mEventTime); + parcel.writeInt(this.mControllerId); + } + + static class ParcelableCreator implements Parcelable.Creator { + ParcelableCreator() { + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public BaseEvent createFromParcel(Parcel parcel) { + return new BaseEvent(parcel); + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public BaseEvent[] newArray(int i) { + return new BaseEvent[i]; + } + } +} diff --git a/app/src/main/java/com/bda/controller/Constants.java b/app/src/main/java/com/bda/controller/Constants.java new file mode 100644 index 0000000..c04690c --- /dev/null +++ b/app/src/main/java/com/bda/controller/Constants.java @@ -0,0 +1,22 @@ +package com.bda.controller; + +/* loaded from: classes.dex */ +public final class Constants { + public static final int MSG_SET_ACTIVITY_EVENT = 1; + + private Constants() { + } + + public static final class ActivityEvent { + public static final int CREATE = 1; + public static final int DESTROY = 2; + public static final int PAUSE = 6; + public static final int RESUME = 5; + public static final int SERVICE_CONNECTED = 7; + public static final int START = 3; + public static final int STOP = 4; + + private ActivityEvent() { + } + } +} diff --git a/app/src/main/java/com/bda/controller/Controller.java b/app/src/main/java/com/bda/controller/Controller.java new file mode 100644 index 0000000..30f716d --- /dev/null +++ b/app/src/main/java/com/bda/controller/Controller.java @@ -0,0 +1,381 @@ +package com.bda.controller; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.os.Handler; +import android.os.IBinder; +import android.os.RemoteException; +import com.bda.controller.IControllerListener; +import com.bda.controller.IControllerMonitor; +import com.bda.controller.IControllerService; + +/* loaded from: classes.dex */ +public final class Controller { + public static final int ACTION_CONNECTED = 1; + public static final int ACTION_CONNECTING = 2; + public static final int ACTION_DISCONNECTED = 0; + public static final int ACTION_DOWN = 0; + public static final int ACTION_FALSE = 0; + public static final int ACTION_TRUE = 1; + public static final int ACTION_UP = 1; + public static final int ACTION_VERSION_MOGA = 0; + public static final int ACTION_VERSION_MOGAPRO = 1; + public static final int AXIS_LTRIGGER = 17; + public static final int AXIS_RTRIGGER = 18; + public static final int AXIS_RZ = 14; + public static final int AXIS_X = 0; + public static final int AXIS_Y = 1; + public static final int AXIS_Z = 11; + static final int CONTROLLER_ID = 1; + public static final int INFO_ACTIVE_DEVICE_COUNT = 2; + public static final int INFO_KNOWN_DEVICE_COUNT = 1; + public static final int INFO_UNKNOWN = 0; + public static final int KEYCODE_BUTTON_A = 96; + public static final int KEYCODE_BUTTON_B = 97; + public static final int KEYCODE_BUTTON_L1 = 102; + public static final int KEYCODE_BUTTON_L2 = 104; + public static final int KEYCODE_BUTTON_R1 = 103; + public static final int KEYCODE_BUTTON_R2 = 105; + public static final int KEYCODE_BUTTON_SELECT = 109; + public static final int KEYCODE_BUTTON_START = 108; + public static final int KEYCODE_BUTTON_THUMBL = 106; + public static final int KEYCODE_BUTTON_THUMBR = 107; + public static final int KEYCODE_BUTTON_X = 99; + public static final int KEYCODE_BUTTON_Y = 100; + public static final int KEYCODE_DPAD_DOWN = 20; + public static final int KEYCODE_DPAD_LEFT = 21; + public static final int KEYCODE_DPAD_RIGHT = 22; + public static final int KEYCODE_DPAD_UP = 19; + public static final int KEYCODE_UNKNOWN = 0; + static final int LEGACY_KEYCODE_BUTTON_X = 98; + static final int LEGACY_KEYCODE_BUTTON_Y = 99; + public static final int STATE_CONNECTION = 1; + public static final int STATE_CURRENT_PRODUCT_VERSION = 4; + public static final int STATE_POWER_LOW = 2; + + @Deprecated + public static final int STATE_SELECTED_VERSION = 4; + public static final int STATE_SUPPORTED_PRODUCT_VERSION = 3; + + @Deprecated + public static final int STATE_SUPPORTED_VERSION = 3; + public static final int STATE_UNKNOWN = 0; + final Context mContext; + boolean mIsBound = false; + IControllerService mService = null; + final IControllerListener.Stub mListenerStub = new IControllerListenerStub(); + final IControllerMonitor.Stub mMonitorStub = new IControllerMonitorStub(); + final ServiceConnection mServiceConnection = new ServiceConnection(); + int mActivityEvent = 6; + Handler mHandler = null; + ControllerListener mListener = null; + ControllerMonitor mMonitor = null; + + public static final Controller getInstance(Context context) { + return new Controller(context); + } + + Controller(Context context) { + this.mContext = context; + } + + public final void exit() { + setListener(null, null); + setMonitor(null); + if (this.mIsBound) { + this.mContext.unbindService(this.mServiceConnection); + this.mIsBound = false; + } + } + + public final float getAxisValue(int i) { + if (this.mService == null) { + return 0.0f; + } + try { + return this.mService.getAxisValue(1, i); + } catch (RemoteException unused) { + return 0.0f; + } + } + + public final int getInfo(int i) { + if (this.mService == null) { + return 0; + } + try { + return this.mService.getInfo(i); + } catch (RemoteException unused) { + return 0; + } + } + + public final int getKeyCode(int i) { + if (this.mService != null) { + try { + return this.mService.getKeyCode2(1, i); + } catch (RemoteException unused) { + switch (i) { + case 99: + i = 98; + break; + case 100: + i = 99; + break; + } + try { + return this.mService.getKeyCode(1, i); + } catch (RemoteException unused2) { + } + } + } + return 1; + } + + public final int getState(int i) { + if (this.mService == null) { + return 0; + } + try { + return this.mService.getState(1, i); + } catch (RemoteException unused) { + return 0; + } + } + + public final boolean init() { + if (!this.mIsBound) { + Intent intent = new Intent(IControllerService.class.getName()); + this.mContext.startService(intent); + this.mContext.bindService(intent, this.mServiceConnection, 1); + this.mIsBound = true; + } + return this.mIsBound; + } + + public final void onPause() { + this.mActivityEvent = 6; + sendMessage(1, this.mActivityEvent); + registerListener(); + } + + public final void onResume() { + this.mActivityEvent = 5; + sendMessage(1, this.mActivityEvent); + registerListener(); + } + + void registerListener() { + if (this.mListener == null || this.mService == null) { + return; + } + try { + try { + this.mService.registerListener2(this.mListenerStub, this.mActivityEvent); + } catch (RemoteException ignored) { + } + this.mService.registerListener(this.mListenerStub, this.mActivityEvent); + } catch (RemoteException ignored) { + } + } + + void registerMonitor() { + if (this.mMonitor == null || this.mService == null) { + return; + } + try { + this.mService.registerMonitor(this.mMonitorStub, this.mActivityEvent); + } catch (RemoteException unused) { + } + } + + void sendMessage(int i, int i2) { + if (this.mService != null) { + try { + this.mService.sendMessage(i, i2); + } catch (RemoteException unused) { + } + } + } + + public final void setListener(ControllerListener controllerListener, Handler handler) { + unregisterListener(); + this.mListener = controllerListener; + this.mHandler = handler; + registerListener(); + } + + public final void setMonitor(ControllerMonitor controllerMonitor) { + unregisterMonitor(); + this.mMonitor = controllerMonitor; + registerMonitor(); + } + + void unregisterListener() { + if (this.mService != null) { + try { + this.mService.unregisterListener(this.mListenerStub, this.mActivityEvent); + } catch (RemoteException unused) { + } + } + } + + void unregisterMonitor() { + if (this.mService != null) { + try { + this.mService.unregisterMonitor(this.mMonitorStub, this.mActivityEvent); + } catch (RemoteException unused) { + } + } + } + + public void allowNewConnections() { + if (this.mService != null) { + try { + this.mService.allowNewConnections(); + } catch (RemoteException unused) { + } + } + } + + public void disallowNewConnections() { + if (this.mService != null) { + try { + this.mService.disallowNewConnections(); + } catch (RemoteException unused) { + } + } + } + + public void isAllowingNewConnections() { + if (this.mService != null) { + try { + this.mService.isAllowingNewConnections(); + } catch (RemoteException unused) { + } + } + } + + class IControllerListenerStub extends IControllerListener.Stub { + IControllerListenerStub() { + } + + @Override // com.bda.controller.IControllerListener + public void onKeyEvent(KeyEvent keyEvent) throws RemoteException { + if (keyEvent.getControllerId() != 1 || Controller.this.mListener == null) { + return; + } + KeyRunnable keyRunnable = Controller.this.new KeyRunnable(keyEvent); + if (Controller.this.mHandler != null) { + Controller.this.mHandler.post(keyRunnable); + } else { + keyRunnable.run(); + } + } + + @Override // com.bda.controller.IControllerListener + public void onMotionEvent(MotionEvent motionEvent) throws RemoteException { + if (motionEvent.getControllerId() != 1 || Controller.this.mListener == null) { + return; + } + MotionRunnable motionRunnable = Controller.this.new MotionRunnable(motionEvent); + if (Controller.this.mHandler != null) { + Controller.this.mHandler.post(motionRunnable); + } else { + motionRunnable.run(); + } + } + + @Override // com.bda.controller.IControllerListener + public void onStateEvent(StateEvent stateEvent) throws RemoteException { + if (stateEvent.getControllerId() != 1 || Controller.this.mListener == null) { + return; + } + StateRunnable stateRunnable = Controller.this.new StateRunnable(stateEvent); + if (Controller.this.mHandler != null) { + Controller.this.mHandler.post(stateRunnable); + } else { + stateRunnable.run(); + } + } + } + + class IControllerMonitorStub extends IControllerMonitor.Stub { + IControllerMonitorStub() { + } + + @Override // com.bda.controller.IControllerMonitor + public void onLog(int i, int i2, String str) throws RemoteException { + if (Controller.this.mMonitor != null) { + Controller.this.mMonitor.onLog(i, i2, str); + } + } + } + + class KeyRunnable implements Runnable { + final KeyEvent mEvent; + + public KeyRunnable(KeyEvent keyEvent) { + this.mEvent = keyEvent; + } + + @Override // java.lang.Runnable + public void run() { + if (Controller.this.mListener != null) { + Controller.this.mListener.onKeyEvent(this.mEvent); + } + } + } + + class MotionRunnable implements Runnable { + final MotionEvent mEvent; + + public MotionRunnable(MotionEvent motionEvent) { + this.mEvent = motionEvent; + } + + @Override // java.lang.Runnable + public void run() { + if (Controller.this.mListener != null) { + Controller.this.mListener.onMotionEvent(this.mEvent); + } + } + } + + class ServiceConnection implements android.content.ServiceConnection { + ServiceConnection() { + } + + @Override // android.content.ServiceConnection + public final void onServiceConnected(ComponentName componentName, IBinder iBinder) { + Controller.this.mService = IControllerService.Stub.asInterface(iBinder); + Controller.this.registerListener(); + Controller.this.registerMonitor(); + if (Controller.this.mActivityEvent == 5) { + Controller.this.sendMessage(1, 5); + Controller.this.sendMessage(1, 7); + } + } + + @Override // android.content.ServiceConnection + public final void onServiceDisconnected(ComponentName componentName) { + Controller.this.mService = null; + } + } + + class StateRunnable implements Runnable { + final StateEvent mEvent; + + public StateRunnable(StateEvent stateEvent) { + this.mEvent = stateEvent; + } + + @Override // java.lang.Runnable + public void run() { + if (Controller.this.mListener != null) { + Controller.this.mListener.onStateEvent(this.mEvent); + } + } + } +} diff --git a/app/src/main/java/com/bda/controller/ControllerListener.java b/app/src/main/java/com/bda/controller/ControllerListener.java new file mode 100644 index 0000000..02ef0b5 --- /dev/null +++ b/app/src/main/java/com/bda/controller/ControllerListener.java @@ -0,0 +1,10 @@ +package com.bda.controller; + +/* loaded from: classes.dex */ +public interface ControllerListener { + void onKeyEvent(KeyEvent keyEvent); + + void onMotionEvent(MotionEvent motionEvent); + + void onStateEvent(StateEvent stateEvent); +} diff --git a/app/src/main/java/com/bda/controller/ControllerMonitor.java b/app/src/main/java/com/bda/controller/ControllerMonitor.java new file mode 100644 index 0000000..536cf7c --- /dev/null +++ b/app/src/main/java/com/bda/controller/ControllerMonitor.java @@ -0,0 +1,6 @@ +package com.bda.controller; + +/* loaded from: classes.dex */ +public interface ControllerMonitor { + void onLog(int i, int i2, String str); +} diff --git a/app/src/main/java/com/bda/controller/IControllerListener.java b/app/src/main/java/com/bda/controller/IControllerListener.java new file mode 100644 index 0000000..16bd5ff --- /dev/null +++ b/app/src/main/java/com/bda/controller/IControllerListener.java @@ -0,0 +1,147 @@ +package com.bda.controller; + +import android.os.Binder; +import android.os.IBinder; +import android.os.IInterface; +import android.os.Parcel; +import android.os.RemoteException; + +/* loaded from: classes.dex */ +public interface IControllerListener extends IInterface { + void onKeyEvent(KeyEvent keyEvent) throws RemoteException; + + void onMotionEvent(MotionEvent motionEvent) throws RemoteException; + + void onStateEvent(StateEvent stateEvent) throws RemoteException; + + public static abstract class Stub extends Binder implements IControllerListener { + private static final String DESCRIPTOR = "com.bda.controller.IControllerListener"; + static final int TRANSACTION_onKeyEvent = 1; + static final int TRANSACTION_onMotionEvent = 2; + static final int TRANSACTION_onStateEvent = 3; + + @Override // android.os.IInterface + public IBinder asBinder() { + return this; + } + + public Stub() { + attachInterface(this, DESCRIPTOR); + } + + public static IControllerListener asInterface(IBinder iBinder) { + if (iBinder == null) { + return null; + } + IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR); + if (queryLocalInterface != null && (queryLocalInterface instanceof IControllerListener)) { + return (IControllerListener) queryLocalInterface; + } + return new Proxy(iBinder); + } + + @Override // android.os.Binder + public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException { + if (i == 1598968902) { + parcel2.writeString(DESCRIPTOR); + return true; + } + switch (i) { + case 1: + parcel.enforceInterface(DESCRIPTOR); + onKeyEvent(parcel.readInt() != 0 ? KeyEvent.CREATOR.createFromParcel(parcel) : null); + parcel2.writeNoException(); + return true; + case 2: + parcel.enforceInterface(DESCRIPTOR); + onMotionEvent(parcel.readInt() != 0 ? MotionEvent.CREATOR.createFromParcel(parcel) : null); + parcel2.writeNoException(); + return true; + case 3: + parcel.enforceInterface(DESCRIPTOR); + onStateEvent(parcel.readInt() != 0 ? StateEvent.CREATOR.createFromParcel(parcel) : null); + parcel2.writeNoException(); + return true; + default: + return super.onTransact(i, parcel, parcel2, i2); + } + } + + private static class Proxy implements IControllerListener { + private IBinder mRemote; + + public String getInterfaceDescriptor() { + return Stub.DESCRIPTOR; + } + + Proxy(IBinder iBinder) { + this.mRemote = iBinder; + } + + @Override // android.os.IInterface + public IBinder asBinder() { + return this.mRemote; + } + + @Override // com.bda.controller.IControllerListener + public void onKeyEvent(KeyEvent keyEvent) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + if (keyEvent != null) { + obtain.writeInt(1); + keyEvent.writeToParcel(obtain, 0); + } else { + obtain.writeInt(0); + } + this.mRemote.transact(1, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerListener + public void onMotionEvent(MotionEvent motionEvent) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + if (motionEvent != null) { + obtain.writeInt(1); + motionEvent.writeToParcel(obtain, 0); + } else { + obtain.writeInt(0); + } + this.mRemote.transact(2, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerListener + public void onStateEvent(StateEvent stateEvent) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + if (stateEvent != null) { + obtain.writeInt(1); + stateEvent.writeToParcel(obtain, 0); + } else { + obtain.writeInt(0); + } + this.mRemote.transact(3, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + } + } +} diff --git a/app/src/main/java/com/bda/controller/IControllerMonitor.java b/app/src/main/java/com/bda/controller/IControllerMonitor.java new file mode 100644 index 0000000..606b27c --- /dev/null +++ b/app/src/main/java/com/bda/controller/IControllerMonitor.java @@ -0,0 +1,86 @@ +package com.bda.controller; + +import android.os.Binder; +import android.os.IBinder; +import android.os.IInterface; +import android.os.Parcel; +import android.os.RemoteException; + +/* loaded from: classes.dex */ +public interface IControllerMonitor extends IInterface { + void onLog(int i, int i2, String str) throws RemoteException; + + public static abstract class Stub extends Binder implements IControllerMonitor { + private static final String DESCRIPTOR = "com.bda.controller.IControllerMonitor"; + static final int TRANSACTION_onLog = 1; + + @Override // android.os.IInterface + public IBinder asBinder() { + return this; + } + + public Stub() { + attachInterface(this, DESCRIPTOR); + } + + public static IControllerMonitor asInterface(IBinder iBinder) { + if (iBinder == null) { + return null; + } + IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR); + if (queryLocalInterface != null && (queryLocalInterface instanceof IControllerMonitor)) { + return (IControllerMonitor) queryLocalInterface; + } + return new Proxy(iBinder); + } + + @Override // android.os.Binder + public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException { + if (i != 1) { + if (i == 1598968902) { + parcel2.writeString(DESCRIPTOR); + return true; + } + return super.onTransact(i, parcel, parcel2, i2); + } + parcel.enforceInterface(DESCRIPTOR); + onLog(parcel.readInt(), parcel.readInt(), parcel.readString()); + parcel2.writeNoException(); + return true; + } + + private static class Proxy implements IControllerMonitor { + private IBinder mRemote; + + public String getInterfaceDescriptor() { + return Stub.DESCRIPTOR; + } + + Proxy(IBinder iBinder) { + this.mRemote = iBinder; + } + + @Override // android.os.IInterface + public IBinder asBinder() { + return this.mRemote; + } + + @Override // com.bda.controller.IControllerMonitor + public void onLog(int i, int i2, String str) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + obtain.writeString(str); + this.mRemote.transact(1, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + } + } +} diff --git a/app/src/main/java/com/bda/controller/IControllerService.java b/app/src/main/java/com/bda/controller/IControllerService.java new file mode 100644 index 0000000..4c1ea62 --- /dev/null +++ b/app/src/main/java/com/bda/controller/IControllerService.java @@ -0,0 +1,406 @@ +package com.bda.controller; + +import android.os.Binder; +import android.os.IBinder; +import android.os.IInterface; +import android.os.Parcel; +import android.os.RemoteException; +import com.bda.controller.IControllerListener; +import com.bda.controller.IControllerMonitor; + +/* loaded from: classes.dex */ +public interface IControllerService extends IInterface { + void allowNewConnections() throws RemoteException; + + void disallowNewConnections() throws RemoteException; + + float getAxisValue(int i, int i2) throws RemoteException; + + int getInfo(int i) throws RemoteException; + + int getKeyCode(int i, int i2) throws RemoteException; + + int getKeyCode2(int i, int i2) throws RemoteException; + + int getState(int i, int i2) throws RemoteException; + + boolean isAllowingNewConnections() throws RemoteException; + + void registerListener(IControllerListener iControllerListener, int i) throws RemoteException; + + void registerListener2(IControllerListener iControllerListener, int i) throws RemoteException; + + void registerMonitor(IControllerMonitor iControllerMonitor, int i) throws RemoteException; + + void sendMessage(int i, int i2) throws RemoteException; + + void unregisterListener(IControllerListener iControllerListener, int i) throws RemoteException; + + void unregisterMonitor(IControllerMonitor iControllerMonitor, int i) throws RemoteException; + + public static abstract class Stub extends Binder implements IControllerService { + private static final String DESCRIPTOR = "com.bda.controller.IControllerService"; + static final int TRANSACTION_allowNewConnections = 12; + static final int TRANSACTION_disallowNewConnections = 13; + static final int TRANSACTION_getAxisValue = 7; + static final int TRANSACTION_getInfo = 5; + static final int TRANSACTION_getKeyCode = 6; + static final int TRANSACTION_getKeyCode2 = 11; + static final int TRANSACTION_getState = 8; + static final int TRANSACTION_isAllowingNewConnections = 14; + static final int TRANSACTION_registerListener = 1; + static final int TRANSACTION_registerListener2 = 10; + static final int TRANSACTION_registerMonitor = 3; + static final int TRANSACTION_sendMessage = 9; + static final int TRANSACTION_unregisterListener = 2; + static final int TRANSACTION_unregisterMonitor = 4; + + @Override // android.os.IInterface + public IBinder asBinder() { + return this; + } + + public Stub() { + attachInterface(this, DESCRIPTOR); + } + + public static IControllerService asInterface(IBinder iBinder) { + if (iBinder == null) { + return null; + } + IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR); + if (queryLocalInterface != null && (queryLocalInterface instanceof IControllerService)) { + return (IControllerService) queryLocalInterface; + } + return new Proxy(iBinder); + } + + @Override // android.os.Binder + public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException { + if (i == 1598968902) { + parcel2.writeString(DESCRIPTOR); + return true; + } + switch (i) { + case 1: + parcel.enforceInterface(DESCRIPTOR); + registerListener(IControllerListener.Stub.asInterface(parcel.readStrongBinder()), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 2: + parcel.enforceInterface(DESCRIPTOR); + unregisterListener(IControllerListener.Stub.asInterface(parcel.readStrongBinder()), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 3: + parcel.enforceInterface(DESCRIPTOR); + registerMonitor(IControllerMonitor.Stub.asInterface(parcel.readStrongBinder()), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 4: + parcel.enforceInterface(DESCRIPTOR); + unregisterMonitor(IControllerMonitor.Stub.asInterface(parcel.readStrongBinder()), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 5: + parcel.enforceInterface(DESCRIPTOR); + int info = getInfo(parcel.readInt()); + parcel2.writeNoException(); + parcel2.writeInt(info); + return true; + case 6: + parcel.enforceInterface(DESCRIPTOR); + int keyCode = getKeyCode(parcel.readInt(), parcel.readInt()); + parcel2.writeNoException(); + parcel2.writeInt(keyCode); + return true; + case 7: + parcel.enforceInterface(DESCRIPTOR); + float axisValue = getAxisValue(parcel.readInt(), parcel.readInt()); + parcel2.writeNoException(); + parcel2.writeFloat(axisValue); + return true; + case 8: + parcel.enforceInterface(DESCRIPTOR); + int state = getState(parcel.readInt(), parcel.readInt()); + parcel2.writeNoException(); + parcel2.writeInt(state); + return true; + case 9: + parcel.enforceInterface(DESCRIPTOR); + sendMessage(parcel.readInt(), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 10: + parcel.enforceInterface(DESCRIPTOR); + registerListener2(IControllerListener.Stub.asInterface(parcel.readStrongBinder()), parcel.readInt()); + parcel2.writeNoException(); + return true; + case 11: + parcel.enforceInterface(DESCRIPTOR); + int keyCode2 = getKeyCode2(parcel.readInt(), parcel.readInt()); + parcel2.writeNoException(); + parcel2.writeInt(keyCode2); + return true; + case 12: + parcel.enforceInterface(DESCRIPTOR); + allowNewConnections(); + parcel2.writeNoException(); + return true; + case 13: + parcel.enforceInterface(DESCRIPTOR); + disallowNewConnections(); + parcel2.writeNoException(); + return true; + case 14: + parcel.enforceInterface(DESCRIPTOR); + boolean isAllowingNewConnections = isAllowingNewConnections(); + parcel2.writeNoException(); + parcel2.writeInt(isAllowingNewConnections ? 1 : 0); + return true; + default: + return super.onTransact(i, parcel, parcel2, i2); + } + } + + private static class Proxy implements IControllerService { + private IBinder mRemote; + + public String getInterfaceDescriptor() { + return Stub.DESCRIPTOR; + } + + Proxy(IBinder iBinder) { + this.mRemote = iBinder; + } + + @Override // android.os.IInterface + public IBinder asBinder() { + return this.mRemote; + } + + @Override // com.bda.controller.IControllerService + public void registerListener(IControllerListener iControllerListener, int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeStrongBinder(iControllerListener != null ? iControllerListener.asBinder() : null); + obtain.writeInt(i); + this.mRemote.transact(1, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void unregisterListener(IControllerListener iControllerListener, int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeStrongBinder(iControllerListener != null ? iControllerListener.asBinder() : null); + obtain.writeInt(i); + this.mRemote.transact(2, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void registerMonitor(IControllerMonitor iControllerMonitor, int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeStrongBinder(iControllerMonitor != null ? iControllerMonitor.asBinder() : null); + obtain.writeInt(i); + this.mRemote.transact(3, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void unregisterMonitor(IControllerMonitor iControllerMonitor, int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeStrongBinder(iControllerMonitor != null ? iControllerMonitor.asBinder() : null); + obtain.writeInt(i); + this.mRemote.transact(4, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public int getInfo(int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + this.mRemote.transact(5, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readInt(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public int getKeyCode(int i, int i2) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + this.mRemote.transact(6, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readInt(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public float getAxisValue(int i, int i2) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + this.mRemote.transact(7, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readFloat(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public int getState(int i, int i2) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + this.mRemote.transact(8, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readInt(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void sendMessage(int i, int i2) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + this.mRemote.transact(9, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void registerListener2(IControllerListener iControllerListener, int i) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeStrongBinder(iControllerListener != null ? iControllerListener.asBinder() : null); + obtain.writeInt(i); + this.mRemote.transact(10, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public int getKeyCode2(int i, int i2) throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + obtain.writeInt(i); + obtain.writeInt(i2); + this.mRemote.transact(11, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readInt(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void allowNewConnections() throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + this.mRemote.transact(12, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public void disallowNewConnections() throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + this.mRemote.transact(13, obtain, obtain2, 0); + obtain2.readException(); + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + + @Override // com.bda.controller.IControllerService + public boolean isAllowingNewConnections() throws RemoteException { + Parcel obtain = Parcel.obtain(); + Parcel obtain2 = Parcel.obtain(); + try { + obtain.writeInterfaceToken(Stub.DESCRIPTOR); + this.mRemote.transact(14, obtain, obtain2, 0); + obtain2.readException(); + return obtain2.readInt() != 0; + } finally { + obtain2.recycle(); + obtain.recycle(); + } + } + } + } +} diff --git a/app/src/main/java/com/bda/controller/KeyEvent.java b/app/src/main/java/com/bda/controller/KeyEvent.java new file mode 100644 index 0000000..2bbf996 --- /dev/null +++ b/app/src/main/java/com/bda/controller/KeyEvent.java @@ -0,0 +1,79 @@ +package com.bda.controller; + +import android.os.Parcel; +import android.os.Parcelable; + +/* loaded from: classes.dex */ +public final class KeyEvent extends BaseEvent implements Parcelable { + public static final int ACTION_DOWN = 0; + public static final int ACTION_UP = 1; + public static final Parcelable.Creator CREATOR = new ParcelableCreator(); + public static final int KEYCODE_BUTTON_A = 96; + public static final int KEYCODE_BUTTON_B = 97; + public static final int KEYCODE_BUTTON_L1 = 102; + public static final int KEYCODE_BUTTON_L2 = 104; + public static final int KEYCODE_BUTTON_R1 = 103; + public static final int KEYCODE_BUTTON_R2 = 105; + public static final int KEYCODE_BUTTON_SELECT = 109; + public static final int KEYCODE_BUTTON_START = 108; + public static final int KEYCODE_BUTTON_THUMBL = 106; + public static final int KEYCODE_BUTTON_THUMBR = 107; + public static final int KEYCODE_BUTTON_X = 99; + public static final int KEYCODE_BUTTON_Y = 100; + public static final int KEYCODE_DPAD_DOWN = 20; + public static final int KEYCODE_DPAD_LEFT = 21; + public static final int KEYCODE_DPAD_RIGHT = 22; + public static final int KEYCODE_DPAD_UP = 19; + public static final int KEYCODE_UNKNOWN = 0; + final int mAction; + final int mKeyCode; + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public int describeContents() { + return 0; + } + + public KeyEvent(long j, int i, int i2, int i3) { + super(j, i); + this.mKeyCode = i2; + this.mAction = i3; + } + + KeyEvent(Parcel parcel) { + super(parcel); + this.mKeyCode = parcel.readInt(); + this.mAction = parcel.readInt(); + } + + public final int getAction() { + return this.mAction; + } + + public final int getKeyCode() { + return this.mKeyCode; + } + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public void writeToParcel(Parcel parcel, int i) { + super.writeToParcel(parcel, i); + parcel.writeInt(this.mKeyCode); + parcel.writeInt(this.mAction); + } + + static class ParcelableCreator implements Parcelable.Creator { + ParcelableCreator() { + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public KeyEvent createFromParcel(Parcel parcel) { + return new KeyEvent(parcel); + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public KeyEvent[] newArray(int i) { + return new KeyEvent[i]; + } + } +} diff --git a/app/src/main/java/com/bda/controller/MotionEvent.java b/app/src/main/java/com/bda/controller/MotionEvent.java new file mode 100644 index 0000000..81b4d0e --- /dev/null +++ b/app/src/main/java/com/bda/controller/MotionEvent.java @@ -0,0 +1,151 @@ +package com.bda.controller; + +import android.os.Parcel; +import android.os.Parcelable; +import android.util.SparseArray; + +/* loaded from: classes.dex */ +public final class MotionEvent extends BaseEvent implements Parcelable { + public static final int AXIS_LTRIGGER = 17; + public static final int AXIS_RTRIGGER = 18; + public static final int AXIS_RZ = 14; + public static final int AXIS_X = 0; + public static final int AXIS_Y = 1; + public static final int AXIS_Z = 11; + public static final Parcelable.Creator CREATOR = new ParcelableCreator(); + final SparseArray mAxis; + final SparseArray mPrecision; + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public int describeContents() { + return 0; + } + + public final int findPointerIndex(int i) { + return -1; + } + + public final int getPointerCount() { + return 1; + } + + public final int getPointerId(int i) { + return 0; + } + + public MotionEvent(long j, int i, float f, float f2, float f3, float f4, float f5, float f6) { + super(j, i); + this.mAxis = new SparseArray<>(4); + this.mAxis.put(0, Float.valueOf(f)); + this.mAxis.put(1, Float.valueOf(f2)); + this.mAxis.put(11, Float.valueOf(f3)); + this.mAxis.put(14, Float.valueOf(f4)); + this.mPrecision = new SparseArray<>(2); + this.mPrecision.put(0, Float.valueOf(f5)); + this.mPrecision.put(1, Float.valueOf(f6)); + } + + public MotionEvent(long j, int i, int[] iArr, float[] fArr, int[] iArr2, float[] fArr2) { + super(j, i); + int length = iArr.length; + this.mAxis = new SparseArray<>(length); + for (int i2 = 0; i2 < length; i2++) { + this.mAxis.put(iArr[i2], Float.valueOf(fArr[i2])); + } + int length2 = iArr2.length; + this.mPrecision = new SparseArray<>(length2); + for (int i3 = 0; i3 < length2; i3++) { + this.mPrecision.put(iArr2[i3], Float.valueOf(fArr2[i3])); + } + } + + MotionEvent(Parcel parcel) { + super(parcel); + int readInt = parcel.readInt(); + this.mAxis = new SparseArray<>(readInt); + for (int i = 0; i < readInt; i++) { + this.mAxis.put(parcel.readInt(), Float.valueOf(parcel.readFloat())); + } + this.mPrecision = new SparseArray<>(parcel.readInt()); + for (int i2 = 0; i2 < readInt; i2++) { + this.mPrecision.put(parcel.readInt(), Float.valueOf(parcel.readFloat())); + } + } + + public final float getAxisValue(int i) { + return getAxisValue(i, 0); + } + + public final float getAxisValue(int i, int i2) { + if (i2 == 0) { + return this.mAxis.get(i, Float.valueOf(0.0f)).floatValue(); + } + return 0.0f; + } + + public final float getRawX() { + return getX(); + } + + public final float getRawY() { + return getY(); + } + + public final float getX() { + return getAxisValue(0, 0); + } + + public final float getX(int i) { + return getAxisValue(0, i); + } + + public final float getXPrecision() { + return this.mPrecision.get(0, Float.valueOf(0.0f)).floatValue(); + } + + public final float getY() { + return getAxisValue(1, 0); + } + + public final float getY(int i) { + return getAxisValue(1, i); + } + + public final float getYPrecision() { + return this.mPrecision.get(1, Float.valueOf(0.0f)).floatValue(); + } + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public void writeToParcel(Parcel parcel, int i) { + super.writeToParcel(parcel, i); + int size = this.mAxis.size(); + parcel.writeInt(size); + for (int i2 = 0; i2 < size; i2++) { + parcel.writeInt(this.mAxis.keyAt(i2)); + parcel.writeFloat(this.mAxis.valueAt(i2).floatValue()); + } + int size2 = this.mPrecision.size(); + parcel.writeInt(size2); + for (int i3 = 0; i3 < size2; i3++) { + parcel.writeInt(this.mPrecision.keyAt(i3)); + parcel.writeFloat(this.mPrecision.valueAt(i3).floatValue()); + } + } + + static class ParcelableCreator implements Parcelable.Creator { + ParcelableCreator() { + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public MotionEvent createFromParcel(Parcel parcel) { + return new MotionEvent(parcel); + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public MotionEvent[] newArray(int i) { + return new MotionEvent[i]; + } + } +} diff --git a/app/src/main/java/com/bda/controller/StateEvent.java b/app/src/main/java/com/bda/controller/StateEvent.java new file mode 100644 index 0000000..7ea4d67 --- /dev/null +++ b/app/src/main/java/com/bda/controller/StateEvent.java @@ -0,0 +1,78 @@ +package com.bda.controller; + +import android.os.Parcel; +import android.os.Parcelable; + +/* loaded from: classes.dex */ +public class StateEvent extends BaseEvent implements Parcelable { + public static final int ACTION_CONNECTED = 1; + public static final int ACTION_CONNECTING = 2; + public static final int ACTION_DISCONNECTED = 0; + public static final int ACTION_FALSE = 0; + public static final int ACTION_TRUE = 1; + public static final int ACTION_VERSION_MOGA = 0; + public static final int ACTION_VERSION_MOGAPRO = 1; + public static final Parcelable.Creator CREATOR = new ParcelableCreator(); + public static final int STATE_CONNECTION = 1; + public static final int STATE_CURRENT_PRODUCT_VERSION = 4; + public static final int STATE_POWER_LOW = 2; + + @Deprecated + public static final int STATE_SELECTED_VERSION = 4; + public static final int STATE_SUPPORTED_PRODUCT_VERSION = 3; + + @Deprecated + public static final int STATE_SUPPORTED_VERSION = 3; + public static final int STATE_UNKNOWN = 0; + final int mAction; + final int mState; + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public int describeContents() { + return 0; + } + + public StateEvent(long j, int i, int i2, int i3) { + super(j, i); + this.mState = i2; + this.mAction = i3; + } + + StateEvent(Parcel parcel) { + super(parcel); + this.mState = parcel.readInt(); + this.mAction = parcel.readInt(); + } + + public final int getAction() { + return this.mAction; + } + + public final int getState() { + return this.mState; + } + + @Override // com.bda.controller.BaseEvent, android.os.Parcelable + public void writeToParcel(Parcel parcel, int i) { + super.writeToParcel(parcel, i); + parcel.writeInt(this.mState); + parcel.writeInt(this.mAction); + } + + static class ParcelableCreator implements Parcelable.Creator { + ParcelableCreator() { + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public StateEvent createFromParcel(Parcel parcel) { + return new StateEvent(parcel); + } + + /* JADX WARN: Can't rename method to resolve collision */ + @Override // android.os.Parcelable.Creator + public StateEvent[] newArray(int i) { + return new StateEvent[i]; + } + } +} diff --git a/app/src/main/java/com/bda/controller/VersionInfo.java b/app/src/main/java/com/bda/controller/VersionInfo.java new file mode 100644 index 0000000..ff01122 --- /dev/null +++ b/app/src/main/java/com/bda/controller/VersionInfo.java @@ -0,0 +1,9 @@ +package com.bda.controller; + +/* loaded from: classes.dex */ +public class VersionInfo { + public static final String VERSION = "1.3.0.130130"; + + private VersionInfo() { + } +} diff --git a/app/src/main/java/com/ea/EAIO/EAIO.java b/app/src/main/java/com/ea/EAIO/EAIO.java new file mode 100644 index 0000000..eaba9f8 --- /dev/null +++ b/app/src/main/java/com/ea/EAIO/EAIO.java @@ -0,0 +1,16 @@ +package com.ea.EAIO; + +import android.app.Activity; +import android.content.res.AssetManager; +import android.os.Environment; + +/* loaded from: classes.dex */ +public class EAIO { + public static native void Shutdown(); + + private static native void StartupNativeImpl(AssetManager assetManager, String str, String str2, String str3); + + public static void Startup(Activity activity) { + StartupNativeImpl(activity.getAssets(), Environment.getDataDirectory().getAbsolutePath(), activity.getFilesDir().getAbsolutePath(), Environment.getExternalStorageDirectory().getAbsolutePath()); + } +} diff --git a/app/src/main/java/com/ea/EAMIO/StorageDirectory.java b/app/src/main/java/com/ea/EAMIO/StorageDirectory.java new file mode 100644 index 0000000..1ae4615 --- /dev/null +++ b/app/src/main/java/com/ea/EAMIO/StorageDirectory.java @@ -0,0 +1,42 @@ +package com.ea.EAMIO; + +import android.app.Activity; +import android.os.Environment; + +/* loaded from: classes.dex */ +public class StorageDirectory { + public static Activity sActivity; + + private static native void ShutdownNativeImpl(); + + private static native void StartupNativeImpl(); + + public static void Startup(Activity activity) { + sActivity = activity; + StartupNativeImpl(); + } + + public static void Shutdown() { + ShutdownNativeImpl(); + } + + public static String GetInternalStorageDirectory() { + return sActivity.getFilesDir().getAbsolutePath(); + } + + public static String GetPrimaryExternalStorageDirectory() { + return sActivity.getExternalFilesDir(null).getAbsolutePath(); + } + + public static String GetPrimaryExternalStorageDirectoryRoot() { + return Environment.getExternalStorageDirectory().getAbsolutePath(); + } + + public static int GetPrimaryExternalStorageState() { + String externalStorageState = Environment.getExternalStorageState(); + if ("mounted".equals(externalStorageState)) { + return 2; + } + return "mounted_ro".equals(externalStorageState) ? 1 : 0; + } +} diff --git a/app/src/main/java/com/ea/InAppWebBrowser/BrowserAndroid.java b/app/src/main/java/com/ea/InAppWebBrowser/BrowserAndroid.java new file mode 100644 index 0000000..cb25309 --- /dev/null +++ b/app/src/main/java/com/ea/InAppWebBrowser/BrowserAndroid.java @@ -0,0 +1,180 @@ +package com.ea.InAppWebBrowser; + +import android.app.Activity; +import android.graphics.Paint; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.widget.RelativeLayout; +import java.util.UUID; + +/* loaded from: classes.dex */ +public class BrowserAndroid { + public static int gInstanceCount; + public static Activity mActivity; + public static ViewGroup mViewGroup; + public RelativeLayout mLayout; + public WebView mWebView; + public InAppWebBrowserWebViewClient mWebViewClient; + public final int SCROLLBAR_VISIBLE = 0; + public final int SCROLLBAR_INVISIBLE = 1; + public final int JAVASCRIPT_DISABLE = 0; + public final int JAVASCRIPT_ENABLE = 1; + public final int SCROLLBARSTYLE_DEFAULT = 0; + public final int SCROLLBARSTYLE_INSIDE_OVERLAY = 1; + public final int SCROLLBARSTYLE_INSIDE_INSET = 2; + public final int SCROLLBARSTYLE_OUTSIDE_OVERLAY = 3; + public final int SCROLLBARSTYLE_OUTSIDE_INSET = 4; + public int mInstanceID = 0; + + private static native void ShutdownNativeImpl(); + + private static native void StartupNativeImpl(); + + public void BrowserAndroid() { + } + + public static void Startup(Activity activity, ViewGroup viewGroup) { + mActivity = activity; + mViewGroup = viewGroup; + StartupNativeImpl(); + } + + public static void Shutdown() { + ShutdownNativeImpl(); + } + + public void init(final int i, final int i2, final int i3, final int i4, final int i5, final int i6, final int i7, final boolean z, final boolean z2) { + int i8 = gInstanceCount; + gInstanceCount = i8 + 1; + this.mInstanceID = i8; + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.1 + @Override // java.lang.Runnable + public void run() { + BrowserAndroid.this.mLayout = new RelativeLayout(BrowserAndroid.mActivity); + BrowserAndroid.this.mWebView = new WebView(BrowserAndroid.mActivity); + BrowserAndroid.this.mWebViewClient = new InAppWebBrowserWebViewClient(); + BrowserAndroid.this.mWebViewClient.mInstanceID = BrowserAndroid.this.mInstanceID; + BrowserAndroid.this.mWebView.setWebViewClient(BrowserAndroid.this.mWebViewClient); + if (z2) { + BrowserAndroid.this.mWebView.setBackgroundColor(0); + Class cls = BrowserAndroid.this.mWebView.getClass(); + try { + cls.getMethod("setLayerType", Integer.TYPE, Paint.class).invoke(BrowserAndroid.this.mWebView, Integer.valueOf(((Integer) cls.getField("LAYER_TYPE_SOFTWARE").get(BrowserAndroid.this.mWebView)).intValue()), null); + } catch (Exception unused) { + } + } + if (!z) { + Class cls2 = BrowserAndroid.this.mWebView.getClass(); + try { + cls2.getMethod("setOverScrollMode", Integer.TYPE).invoke(BrowserAndroid.this.mWebView, Integer.valueOf(((Integer) cls2.getField("OVER_SCROLL_NEVER").get(BrowserAndroid.this.mWebView)).intValue())); + } catch (Exception unused2) { + } + } + BrowserAndroid.this.mWebView.requestFocus(130); + BrowserAndroid.this.mWebView.setOnTouchListener(new View.OnTouchListener() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.1.1 + @Override // android.view.View.OnTouchListener + public boolean onTouch(View view, MotionEvent motionEvent) { + switch (motionEvent.getAction()) { + case 0: + case 1: + if (!view.hasFocus()) { + view.requestFocus(); + break; + } + break; + } + return false; + } + }); + if (i5 == 1) { + BrowserAndroid.this.mWebView.getSettings().setJavaScriptEnabled(true); + } + BrowserAndroid.this.mWebView.setVerticalScrollBarEnabled(i6 == 0); + BrowserAndroid.this.mWebView.setHorizontalScrollBarEnabled(i6 == 0); + BrowserAndroid.this.mWebView.addJavascriptInterface(new JavascriptInterface(BrowserAndroid.this.mWebViewClient), "JavascriptCallback"); + switch (i7) { + case 1: + BrowserAndroid.this.mWebView.setScrollBarStyle(0); + break; + case 2: + BrowserAndroid.this.mWebView.setScrollBarStyle(16777216); + break; + case 3: + BrowserAndroid.this.mWebView.setScrollBarStyle(33554432); + break; + case 4: + BrowserAndroid.this.mWebView.setScrollBarStyle(50331648); + break; + } + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4); + layoutParams.leftMargin = i; + layoutParams.topMargin = i2; + BrowserAndroid.this.mLayout.addView(BrowserAndroid.this.mWebView, layoutParams); + BrowserAndroid.mViewGroup.addView(BrowserAndroid.this.mLayout); + } + }); + } + + public void OpenUrl(final String str) { + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.2 + @Override // java.lang.Runnable + public void run() { + BrowserAndroid.this.mWebView.loadUrl(str); + } + }); + } + + public void LoadHTML(final String str) { + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.3 + @Override // java.lang.Runnable + public void run() { + BrowserAndroid.this.mWebView.loadData(str, "text/html", null); + } + }); + } + + public void SetViewFrame(final int i, final int i2, final int i3, final int i4) { + if (this.mWebView == null) { + return; + } + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.4 + @Override // java.lang.Runnable + public void run() { + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4); + layoutParams.leftMargin = i; + layoutParams.topMargin = i2; + BrowserAndroid.this.mLayout.updateViewLayout(BrowserAndroid.this.mWebView, layoutParams); + } + }); + } + + public void EvaluateJavaScript(final String str) { + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.5 + @Override // java.lang.Runnable + public void run() { + UUID randomUUID; + do { + randomUUID = UUID.randomUUID(); + } while (!BrowserAndroid.this.mWebViewClient.addUUID(randomUUID)); + BrowserAndroid.this.mWebView.loadUrl("javascript: JavascriptCallback.ReceiveResult(eval(" + str + "), '" + randomUUID.toString() + "');"); + } + }); + } + + public void destroy() { + mActivity.runOnUiThread(new Runnable() { // from class: com.ea.InAppWebBrowser.BrowserAndroid.6 + @Override // java.lang.Runnable + public void run() { + BrowserAndroid.this.mWebView.stopLoading(); + BrowserAndroid.this.mWebView.setWebViewClient(null); + BrowserAndroid.this.mWebViewClient = null; + BrowserAndroid.this.mLayout.removeView(BrowserAndroid.this.mWebView); + BrowserAndroid.mViewGroup.removeView(BrowserAndroid.this.mLayout); + BrowserAndroid.this.mWebView = null; + BrowserAndroid.this.mLayout = null; + } + }); + } +} diff --git a/app/src/main/java/com/ea/InAppWebBrowser/InAppWebBrowserWebViewClient.java b/app/src/main/java/com/ea/InAppWebBrowser/InAppWebBrowserWebViewClient.java new file mode 100644 index 0000000..3b62293 --- /dev/null +++ b/app/src/main/java/com/ea/InAppWebBrowser/InAppWebBrowserWebViewClient.java @@ -0,0 +1,74 @@ +package com.ea.InAppWebBrowser; + +import android.graphics.Bitmap; +import android.util.Log; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import java.util.Collections; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.UUID; + +/* loaded from: classes.dex */ +public class InAppWebBrowserWebViewClient extends WebViewClient { + public int mInstanceID = 0; + private SortedSet mJavascriptIds = Collections.synchronizedSortedSet(new TreeSet()); + + public native void OnJavascriptResult(String str, int i); + + public native void OnLoadError(String str, int i); + + public native void OnLoadFinished(String str, int i); + + public native void OnLoadStarted(String str, int i); + + public native boolean ShouldLoadURL(String str, int i); + + @Override // android.webkit.WebViewClient + public boolean shouldOverrideUrlLoading(WebView webView, String str) { + Log.e("InAppWebBrowserWebViewClient", "shouldOverrideUrlLoading: " + str); + return !ShouldLoadURL(str, this.mInstanceID); + } + + @Override // android.webkit.WebViewClient + public void onLoadResource(WebView webView, String str) { + Log.e("InAppWebBrowserWebViewClient", "onLoadResource: " + str); + OnLoadStarted(str, this.mInstanceID); + } + + @Override // android.webkit.WebViewClient + public void onPageStarted(WebView webView, String str, Bitmap bitmap) { + Log.e("InAppWebBrowserWebViewClient", "onPageStarted: " + str); + OnLoadStarted(str, this.mInstanceID); + } + + @Override // android.webkit.WebViewClient + public void onPageFinished(WebView webView, String str) { + Log.e("InAppWebBrowserWebViewClient", "onPageFinished: " + str); + OnLoadFinished(str, this.mInstanceID); + } + + @Override // android.webkit.WebViewClient + public void onReceivedError(WebView webView, int i, String str, String str2) { + Log.e("InAppWebBrowserWebViewClient", "onReceivedError"); + OnLoadError("Loading Error. URL: " + str2 + " ErrorCode: " + i + " Description: " + str, this.mInstanceID); + } + + public void onJavascriptResult(String str, String str2) throws Exception { + UUID fromString = UUID.fromString(str2); + if (fromString != null && this.mJavascriptIds.contains(fromString)) { + this.mJavascriptIds.remove(fromString); + OnJavascriptResult(str, this.mInstanceID); + return; + } + throw new Exception("Unable to verify validity of script result."); + } + + public boolean addUUID(UUID uuid) { + if (this.mJavascriptIds.contains(uuid)) { + return false; + } + this.mJavascriptIds.add(uuid); + return true; + } +} diff --git a/app/src/main/java/com/ea/InAppWebBrowser/JavascriptInterface.java b/app/src/main/java/com/ea/InAppWebBrowser/JavascriptInterface.java new file mode 100644 index 0000000..0d84efd --- /dev/null +++ b/app/src/main/java/com/ea/InAppWebBrowser/JavascriptInterface.java @@ -0,0 +1,14 @@ +package com.ea.InAppWebBrowser; + +/* loaded from: classes.dex */ +public class JavascriptInterface { + private InAppWebBrowserWebViewClient mWebViewClient; + + public JavascriptInterface(InAppWebBrowserWebViewClient inAppWebBrowserWebViewClient) { + this.mWebViewClient = inAppWebBrowserWebViewClient; + } + + public void ReceiveResult(String str, String str2) throws Exception { + this.mWebViewClient.onJavascriptResult(str, str2); + } +} diff --git a/app/src/main/java/com/ea/InputMan/InputMan.java b/app/src/main/java/com/ea/InputMan/InputMan.java new file mode 100644 index 0000000..bf2704f --- /dev/null +++ b/app/src/main/java/com/ea/InputMan/InputMan.java @@ -0,0 +1,56 @@ +package com.ea.InputMan; + +import android.view.MotionEvent; + +/* loaded from: classes.dex */ +public class InputMan { + private boolean gbMotionEvent_GetSource; + + private static int GetEventType(int i) { + switch (i) { + } + return 0; + } + + private static native boolean InputMan_OnMotionEvent(int i, int i2, float f, float f2, int i3, float f3); + + public InputMan() { + this.gbMotionEvent_GetSource = false; + try { + MotionEvent.class.getMethod("getSource", new Class[0]); + this.gbMotionEvent_GetSource = true; + } catch (Exception unused) { + } + } + + private int GetSource(MotionEvent motionEvent) { + if (!this.gbMotionEvent_GetSource) { + return 0; + } + int source = motionEvent.getSource(); + if ((source & 2) != 0) { + return (source == 8194 || source != 1048584) ? 0 : 10; + } + return -1; + } + + public boolean onTouchEvent(int i, MotionEvent motionEvent) { + int historySize = motionEvent.getHistorySize(); + int pointerCount = motionEvent.getPointerCount(); + int GetSource = GetSource(motionEvent); + int GetEventType = GetEventType(motionEvent.getAction() & 255); + if (GetSource < 0) { + return false; + } + for (int i2 = 0; i2 < historySize; i2++) { + for (int i3 = 0; i3 < pointerCount; i3++) { + InputMan_OnMotionEvent(i, motionEvent.getPointerId(i3), motionEvent.getHistoricalX(i3, i2), motionEvent.getHistoricalY(i3, i2), GetEventType, motionEvent.getHistoricalPressure(i3, i2)); + } + } + boolean z = false; + for (int i4 = 0; i4 < pointerCount; i4++) { + z = InputMan_OnMotionEvent(i, motionEvent.getPointerId(i4), motionEvent.getX(i4), motionEvent.getY(i4), GetEventType, motionEvent.getPressure(i4)); + } + return z; + } +} diff --git a/app/src/main/java/com/ea/eadp/deviceid/DeviceIdService.java b/app/src/main/java/com/ea/eadp/deviceid/DeviceIdService.java new file mode 100644 index 0000000..b7120d2 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/deviceid/DeviceIdService.java @@ -0,0 +1,6 @@ +package com.ea.eadp.deviceid; + +/* loaded from: classes.dex */ +public interface DeviceIdService { + String getDeviceId(); +} diff --git a/app/src/main/java/com/ea/eadp/http/models/HttpRequest.java b/app/src/main/java/com/ea/eadp/http/models/HttpRequest.java new file mode 100644 index 0000000..252e899 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/http/models/HttpRequest.java @@ -0,0 +1,38 @@ +package com.ea.eadp.http.models; + +import java.net.URL; + +/* loaded from: classes.dex */ +public interface HttpRequest { + HttpResponse delete(); + + void deleteAsync(HttpRequestListener httpRequestListener); + + HttpResponse get(); + + void getAsync(HttpRequestListener httpRequestListener); + + URL getResource(); + + String getValueForHeader(String str); + + HttpResponse post(); + + void postAsync(HttpRequestListener httpRequestListener); + + HttpResponse put(); + + void putAsync(HttpRequestListener httpRequestListener); + + HttpRequest setBody(String str); + + HttpRequest setBody(String str, String str2); + + HttpRequest setHeader(String str, String str2); + + HttpRequest setJsonBody(String str); + + HttpRequest setJsonBody(String str, String str2); + + HttpRequest setResource(URL url); +} diff --git a/app/src/main/java/com/ea/eadp/http/models/HttpRequestListener.java b/app/src/main/java/com/ea/eadp/http/models/HttpRequestListener.java new file mode 100644 index 0000000..0972488 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/http/models/HttpRequestListener.java @@ -0,0 +1,6 @@ +package com.ea.eadp.http.models; + +/* loaded from: classes.dex */ +public interface HttpRequestListener { + void onComplete(HttpResponse httpResponse); +} diff --git a/app/src/main/java/com/ea/eadp/http/models/HttpResponse.java b/app/src/main/java/com/ea/eadp/http/models/HttpResponse.java new file mode 100644 index 0000000..8a5070a --- /dev/null +++ b/app/src/main/java/com/ea/eadp/http/models/HttpResponse.java @@ -0,0 +1,26 @@ +package com.ea.eadp.http.models; + +import java.util.Map; + +/* loaded from: classes.dex */ +public interface HttpResponse { + String getBody(); + + int getCode(); + + Map getHeaders(); + + String getMessage(); + + String getUrl(); + + void setBody(String str); + + void setCode(int i); + + void setHeaders(Map map); + + void setMessage(String str); + + void setUrl(String str); +} diff --git a/app/src/main/java/com/ea/eadp/http/services/HttpService.java b/app/src/main/java/com/ea/eadp/http/services/HttpService.java new file mode 100644 index 0000000..b0e18d2 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/http/services/HttpService.java @@ -0,0 +1,10 @@ +package com.ea.eadp.http.services; + +import com.ea.eadp.http.models.HttpRequest; +import java.io.IOException; +import java.net.MalformedURLException; + +/* loaded from: classes.dex */ +public interface HttpService { + HttpRequest getResource(String str) throws MalformedURLException, IOException; +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java new file mode 100644 index 0000000..be68ab9 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java @@ -0,0 +1,19 @@ +package com.ea.eadp.pushnotification.forwarding; + +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; + +/* loaded from: classes.dex */ +public class GcmBroadcastReceiver extends BroadcastReceiver { + @Override // android.content.BroadcastReceiver + public final void onReceive(Context context, Intent intent) { + intent.setComponent(new ComponentName(context.getPackageName(), getIntentServiceName())); + GcmIntentService.enqueueWork(context, getIntentServiceName(), intent); + } + + protected String getIntentServiceName() { + return GcmIntentService.class.getName(); + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java new file mode 100644 index 0000000..ef9e33f --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java @@ -0,0 +1,210 @@ +package com.ea.eadp.pushnotification.forwarding; + +import android.annotation.SuppressLint; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.content.res.Resources; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.JobIntentService; +import android.support.v4.app.NotificationCompat; +import com.ea.eadp.http.services.HttpService; +import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks; +import com.ea.eadp.pushnotification.services.AndroidPushService; +import com.ea.eadp.pushnotification.services.IPushService; +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.facebook.internal.NativeProtocol; +import com.google.android.gms.gcm.GoogleCloudMessaging; +import java.util.List; + +/* loaded from: classes.dex */ +public class GcmIntentService extends JobIntentService { + protected static final int JOB_ID = 5566; + private static final String LOG_TAG = "GcmIntentService"; + private IPushService pushManager; + + public interface EnsEventFlags { + public static final int ALL_DISABLED = 0; + public static final int ALL_ENABLED = 3; + public static final int CLICK_ENABLED = 1; + public static final int RECEIVED_ENABLED = 2; + } + + public interface PushIntentExtraKeys { + public static final String ALERT = "alert"; + public static final String COLLAPSE_KEY = "collapse_key"; + public static final String DEEP_LINK_URL = "deepLinkUrl"; + public static final String ENS_EVENTS = "ensEvents"; + public static final String PN_TYPE = "pnType"; + public static final String PUSH_ID = "pushId"; + } + + protected boolean displayNotification(Bundle bundle) { + return true; + } + + protected HttpService getHttpService() { + return null; + } + + public static void enqueueWork(Context context, String str, Intent intent) { + try { + enqueueWork(context, Class.forName(str), JOB_ID, intent); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + @Override // android.support.v4.app.JobIntentService + protected void onHandleWork(@NonNull Intent intent) { + Bundle extras = intent.getExtras(); + if (extras == null) { + Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]); + return; + } + String messageType = GoogleCloudMessaging.getInstance(getApplicationContext()).getMessageType(intent); + if (extras.isEmpty()) { + return; + } + if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { + Log.Helper.LOGIS(LOG_TAG, "Error received: " + extras.toString(), new Object[0]); + return; + } + if ("deleted_messages".equals(messageType)) { + Log.Helper.LOGIS(LOG_TAG, "Deleted messages on server: " + extras.toString(), new Object[0]); + return; + } + if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { + onHandleMessage(intent); + } + } + + protected void onHandleMessage(Intent intent) { + Bundle extras = intent.getExtras(); + if (extras == null) { + Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]); + return; + } + Log.Helper.LOGIS(LOG_TAG, "Message received: " + extras.toString(), new Object[0]); + if (displayNotification(extras)) { + postNotification(getApplicationContext(), extras); + } + int i = 3; + String string = extras.getString(PushIntentExtraKeys.ENS_EVENTS); + if (string != null) { + try { + i = Integer.parseInt(string); + } catch (NumberFormatException unused) { + Log.Helper.LOGWS(LOG_TAG, "ensEvents flag found but not parseable as integer", new Object[0]); + } + } + if (extras.containsKey(PushIntentExtraKeys.PUSH_ID)) { + if (i >= 2 || i < 0) { + if (this.pushManager == null) { + this.pushManager = new AndroidPushService(getApplicationContext(), getHttpService()); + } + if (ApplicationEnvironment.isMainApplicationRunning()) { + this.pushManager.sendTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED); + } else { + this.pushManager.persistTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED); + } + } + } + } + + @SuppressLint({"InlinedApi"}) + private void postNotification(Context context, Bundle bundle) { + Intent intent = new Intent(); + if (Build.VERSION.SDK_INT >= 12) { + intent.addFlags(32); + } + intent.putExtras(bundle); + intent.setPackage(context.getPackageName()); + ComponentName broadcastForwarderComponent = getBroadcastForwarderComponent(); + if (isInForeground()) { + if (broadcastForwarderComponent != null) { + intent.setComponent(broadcastForwarderComponent); + sendBroadcast(intent); + return; + } else { + Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not sending broadcast", new Object[0]); + return; + } + } + String string = bundle.getString(PushIntentExtraKeys.PUSH_ID); + int hashCode = string != null ? string.hashCode() : 0; + String str = Global.NOTIFICATION_CHANNEL_DEFAULT_ID; + try { + ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128); + if (applicationInfo.metaData.containsKey(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) { + str = applicationInfo.metaData.getString(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY); + } + } catch (PackageManager.NameNotFoundException e) { + android.util.Log.e(Global.NIMBLE_ID, String.format("%s>GcmIntentService.postNotification():\n%s", LOG_TAG, e.getMessage())); + } + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, str); + if (broadcastForwarderComponent != null) { + String string2 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY); + if (string2 != null && !string2.equalsIgnoreCase("do_not_collapse")) { + intent.putExtra(PushIntentExtraKeys.COLLAPSE_KEY, string2); + } + intent.setComponent(broadcastForwarderComponent); + builder.setContentIntent(PendingIntent.getBroadcast(context, hashCode, intent, 134217728)); + } else { + Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not setting ContentIntent", new Object[0]); + } + customizeNotification(builder, bundle); + NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification"); + if (notificationManager != null) { + String string3 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY); + if (string3 != null && !string3.equalsIgnoreCase("do_not_collapse")) { + notificationManager.notify(string3, 0, builder.build()); + return; + } else { + notificationManager.notify(hashCode, builder.build()); + return; + } + } + Log.Helper.LOGE(this, "Notification Manager is not available or is inaccessible. Skipping Notification formatting.", new Object[0]); + } + + protected boolean isInForeground() { + return PushLifecycleCallbacks.inForeground; + } + + protected void customizeNotification(NotificationCompat.Builder builder, Bundle bundle) { + String string = bundle.getString(PushIntentExtraKeys.ALERT); + Resources resources = getApplicationContext().getResources(); + String packageName = getApplicationContext().getPackageName(); + String string2 = getApplicationContext().getResources().getString(resources.getIdentifier(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, "string", packageName)); + try { + builder.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName)); + } catch (Exception e) { + Log.Helper.LOGE(LOG_TAG, "PN NOT DISPLAYED: Unable to set application icon due to exception: " + e.toString(), new Object[0]); + } + builder.setContentTitle(string2).setStyle(new NotificationCompat.BigTextStyle().bigText(string)).setContentText(string).setAutoCancel(true).setDefaults(getApplicationContext().checkCallingOrSelfPermission("android.permission.VIBRATE") == 0 ? 7 : 5); + } + + protected ComponentName getBroadcastForwarderComponent() { + Log.Helper.LOGFUNC(this); + PackageManager packageManager = getApplicationContext().getPackageManager(); + Intent intent = new Intent("com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST"); + intent.setPackage(getApplicationContext().getPackageName()); + List queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0); + if (queryBroadcastReceivers.isEmpty()) { + return null; + } + ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo; + return new ComponentName(activityInfo.packageName, activityInfo.name); + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java new file mode 100644 index 0000000..6f22754 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java @@ -0,0 +1,139 @@ +package com.ea.eadp.pushnotification.forwarding; + +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Bundle; +import com.ea.eadp.http.services.HttpService; +import com.ea.eadp.pushnotification.forwarding.GcmIntentService; +import com.ea.eadp.pushnotification.services.IPushService; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class PushBroadcastForwarder extends BroadcastReceiver { + private static final String LOG_TAG = "PushBroadcastForwarder"; + private IPushService pushManager; + + protected HttpService getHttpService() { + return null; + } + + /* JADX WARN: Removed duplicated region for block: B:17:0x003a */ + /* JADX WARN: Removed duplicated region for block: B:20:0x004f */ + /* JADX WARN: Removed duplicated region for block: B:21:0x0063 */ + @Override // android.content.BroadcastReceiver + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public final void onReceive(android.content.Context r5, android.content.Intent r6) { + /* + r4 = this; + android.os.Bundle r6 = r6.getExtras() + r0 = 0 + if (r6 != 0) goto Lf + java.lang.String r5 = "Unable to get extras from Intent" + java.lang.Object[] r6 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGE(r4, r5, r6) + return + Lf: + java.lang.String r1 = "ensEvents" + java.lang.String r1 = r6.getString(r1) + r2 = 3 + if (r1 == 0) goto L26 + int r1 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L1d + goto L27 + L1d: + java.lang.String r1 = "PushBroadcastForwarder" + java.lang.String r3 = "ensEvents flag found but not parseable as integer" + java.lang.Object[] r0 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGWS(r1, r3, r0) + L26: + r1 = 3 + L27: + java.lang.String r0 = "pushId" + boolean r0 = r6.containsKey(r0) + if (r0 == 0) goto L76 + if (r1 >= r2) goto L36 + r0 = 1 + if (r1 == r0) goto L36 + if (r1 >= 0) goto L76 + L36: + com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager + if (r0 != 0) goto L49 + com.ea.eadp.pushnotification.services.AndroidPushService r0 = new com.ea.eadp.pushnotification.services.AndroidPushService + android.content.Context r1 = r5.getApplicationContext() + com.ea.eadp.http.services.HttpService r2 = r4.getHttpService() + r0.(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 ""; + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java b/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java new file mode 100644 index 0000000..d5742c0 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java @@ -0,0 +1,47 @@ +package com.ea.eadp.pushnotification.lifecycles; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.Application; +import android.os.Bundle; + +@TargetApi(14) +/* loaded from: classes.dex */ +public class PushLifecycleCallbacks implements Application.ActivityLifecycleCallbacks { + public static final int LIFECYCLE_API_VERSION = 14; + public static boolean inForeground; + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityCreated(Activity activity, Bundle bundle) { + inForeground = true; + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityStarted(Activity activity) { + inForeground = true; + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityResumed(Activity activity) { + inForeground = true; + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityPaused(Activity activity) { + inForeground = false; + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityStopped(Activity activity) { + inForeground = false; + } + + @Override // android.app.Application.ActivityLifecycleCallbacks + public void onActivityDestroyed(Activity activity) { + inForeground = false; + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/listeners/IPushListener.java b/app/src/main/java/com/ea/eadp/pushnotification/listeners/IPushListener.java new file mode 100644 index 0000000..3c65e97 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/listeners/IPushListener.java @@ -0,0 +1,12 @@ +package com.ea.eadp.pushnotification.listeners; + +/* loaded from: classes.dex */ +public interface IPushListener { + void onConnectionError(int i, String str); + + void onGetInAppSuccess(int i, String str); + + void onRegistrationSuccess(int i, String str); + + void onTrackingSuccess(int i, String str); +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java b/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java new file mode 100644 index 0000000..9b72d74 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java @@ -0,0 +1,162 @@ +package com.ea.eadp.pushnotification.models; + +import android.os.Build; +import java.util.Locale; +import java.util.TimeZone; + +/* loaded from: classes.dex */ +public class PushNotificationConfig { + private String appId; + private String appVersion; + private String country; + private String dateOfBirth; + private String deviceIdentifier; + private boolean disabled; + private String disabledReason; + private String registrationIdentifier; + private Integer silentIntervalEnd; + private Integer silentIntervalStart; + private String userAlias; + private String manufacturer = Build.MANUFACTURER; + private String operatingSystem = Build.VERSION.RELEASE; + private String model = Build.MODEL; + private String deviceType = "android"; + private String locale = Locale.getDefault().toString(); + private TimeZone timezone = TimeZone.getDefault(); + + public String getUserAlias() { + return this.userAlias; + } + + public void setUserAlias(String str) { + this.userAlias = str; + } + + public String getDeviceType() { + return this.deviceType; + } + + public void setDeviceType(String str) { + this.deviceType = str; + } + + public String getOperatingSystem() { + return this.operatingSystem; + } + + public void setOperatingSystem(String str) { + this.operatingSystem = str; + } + + public String getManufacturer() { + return this.manufacturer; + } + + public void setManufacturer(String str) { + this.manufacturer = str; + } + + public String getRegistrationIdentifier() { + return this.registrationIdentifier; + } + + public void setRegistrationIdentifier(String str) { + this.registrationIdentifier = str; + } + + public String getDeviceIdentifier() { + return this.deviceIdentifier; + } + + public void setDeviceIdentifier(String str) { + this.deviceIdentifier = str; + } + + public String getModel() { + return this.model; + } + + public void setModel(String str) { + this.model = str; + } + + public String getAppId() { + return this.appId; + } + + public void setAppId(String str) { + this.appId = str; + } + + public String getAppVersion() { + return this.appVersion; + } + + public void setAppVersion(String str) { + this.appVersion = str; + } + + public String getCountry() { + return this.country; + } + + public void setCountry(String str) { + this.country = str; + } + + public String getLocale() { + return this.locale; + } + + public void setLocale(String str) { + this.locale = str; + } + + public TimeZone getTimezone() { + return this.timezone; + } + + public void setTimezone(TimeZone timeZone) { + this.timezone = timeZone; + } + + public Integer getSilentIntervalStart() { + return this.silentIntervalStart; + } + + public void setSilentIntervalStart(Integer num) { + this.silentIntervalStart = num; + } + + public Integer getSilentIntervalEnd() { + return this.silentIntervalEnd; + } + + public void setSilentIntervalEnd(Integer num) { + this.silentIntervalEnd = num; + } + + public String getDateOfBirth() { + return this.dateOfBirth; + } + + public void setDateOfBirth(String str) { + this.dateOfBirth = str; + } + + public String getDisabledReason() { + return this.disabledReason; + } + + public void setDisabledReason(String str) { + this.disabledReason = str; + } + + public boolean isDisabled() { + return this.disabled; + } + + public void setDisabled(boolean z) { + this.disabled = z; + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java b/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java new file mode 100644 index 0000000..abaf1a2 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java @@ -0,0 +1,414 @@ +package com.ea.eadp.pushnotification.services; + +import android.annotation.TargetApi; +import android.app.Application; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Build; +import android.util.Base64; +import com.ea.eadp.deviceid.DeviceIdService; +import com.ea.eadp.http.models.HttpRequest; +import com.ea.eadp.http.models.HttpRequestListener; +import com.ea.eadp.http.models.HttpResponse; +import com.ea.eadp.http.services.HttpService; +import com.ea.eadp.pushnotification.forwarding.GcmIntentService; +import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks; +import com.ea.eadp.pushnotification.listeners.IPushListener; +import com.ea.eadp.pushnotification.models.PushNotificationConfig; +import com.ea.nimble.Log; +import com.ea.nimble.pushtng.PushNotification; +import com.google.android.gms.common.GoogleApiAvailability; +import com.google.android.gms.gcm.GoogleCloudMessaging; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; +import java.util.Timer; +import java.util.TimerTask; +import org.apache.http.protocol.HTTP; + +/* loaded from: classes.dex */ +public final class AndroidPushService implements IPushService { + private static final String API_KEY_KEY = "apiKey"; + private static final String API_SECRET_KEY = "apiSecret"; + public static final String AUTHORIZATION = "Authorization"; + private static final String DEVICE_ID_KEY = "deviceId"; + private static final String EVENT_LIST_KEY = "eventListKey"; + private static final String GAME_ID_KEY = "gameId"; + private static final String LOG_TAG = "PushManager"; + private static final String PUSH_SERVER_URL_KEY = "pushNotificationServerUrl"; + private static final String SHARED_PREFS_FILENAME = "PushManagerConfigurationData"; + private static final String TRACKING_PREFS_FILENAME = "PushManagerTrackingData"; + private static final String TRACKING_STATE_KEY = "state"; + private String apiKey; + private String apiSecret; + private String appId; + private Context context; + private DeviceIdService deviceIdService; + private String gameId; + private GoogleCloudMessaging googleCloudMessaging; + private HttpService httpService; + private long inAppNotificationInterval; + private Timer inAppTimer; + private IPushListener pushListener; + private String pushNotificationServerUrl; + private String senderId; + private String startClientToken; + private PushNotificationConfig startConfig; + + public AndroidPushService(GoogleCloudMessaging googleCloudMessaging, HttpService httpService, DeviceIdService deviceIdService, Context context, IPushListener iPushListener, String str, String str2, String str3, String str4, String str5, String str6, int i) { + Log.Helper.LOGIS(LOG_TAG, "Instantiating new push mgr", new Object[0]); + this.googleCloudMessaging = googleCloudMessaging; + this.httpService = httpService; + this.deviceIdService = deviceIdService; + this.context = context; + this.pushListener = iPushListener; + this.senderId = str; + this.pushNotificationServerUrl = str2; + this.gameId = str3; + this.appId = str4; + this.apiKey = str5; + this.apiSecret = str6; + this.inAppNotificationInterval = i * 1000; + } + + public AndroidPushService(Context context, HttpService httpService) { + this.context = context; + this.httpService = httpService; + this.pushNotificationServerUrl = loadConfigData(PUSH_SERVER_URL_KEY); + this.gameId = loadConfigData(GAME_ID_KEY); + this.apiKey = loadConfigData(API_KEY_KEY); + this.apiSecret = loadConfigData(API_SECRET_KEY); + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public IPushListener getPushListener() { + return this.pushListener; + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public void setPushListener(IPushListener iPushListener) { + this.pushListener = iPushListener; + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + @TargetApi(14) + public void startWithConfig(final PushNotificationConfig pushNotificationConfig, final String str) { + if (pushNotificationConfig == null) { + Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]); + if (this.pushListener != null) { + this.pushListener.onConnectionError(0, "Config data is null"); + return; + } + return; + } + if (this.inAppNotificationInterval > 0) { + this.inAppTimer = new Timer(); + this.inAppTimer.schedule(new TimerTask() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.1 + @Override // java.util.TimerTask, java.lang.Runnable + public void run() { + AndroidPushService.this.getInAppNotifications(pushNotificationConfig.getUserAlias(), str); + } + }, this.inAppNotificationInterval, this.inAppNotificationInterval); + } + if (pushNotificationConfig.isDisabled()) { + registerDevice(pushNotificationConfig); + } else { + new Thread(new Runnable() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.2 + @Override // java.lang.Runnable + public void run() { + if (AndroidPushService.this.checkPlayServices()) { + Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Attempt to register device with GCM", new Object[0]); + try { + String register = AndroidPushService.this.googleCloudMessaging.register(AndroidPushService.this.senderId); + pushNotificationConfig.setRegistrationIdentifier(register); + pushNotificationConfig.setDisabled(false); + pushNotificationConfig.setDisabledReason(null); + Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registered on GCM. Registration id: %s", register), new Object[0]); + try { + if (Build.VERSION.SDK_INT >= 14) { + ((Application) AndroidPushService.this.context.getApplicationContext()).registerActivityLifecycleCallbacks(new PushLifecycleCallbacks()); + } + } catch (Exception e) { + Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to register activity lifecycle callbacks: %s", e.getLocalizedMessage()); + } + } catch (Exception e2) { + Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to get registration ID from GCM: %s", e2.getLocalizedMessage()); + pushNotificationConfig.setDisabled(true); + pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE); + } + } else { + Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to find appropriate Google Play Service SDK on device. Registering as disabled", new Object[0]); + pushNotificationConfig.setDisabled(true); + pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE); + } + AndroidPushService.this.registerDevice(pushNotificationConfig); + } + }, "startWithConfig thread").start(); + } + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public void registerDevice(final PushNotificationConfig pushNotificationConfig) { + if (pushNotificationConfig == null) { + Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]); + if (this.pushListener != null) { + this.pushListener.onConnectionError(0, "Config data is null"); + return; + } + return; + } + if (pushNotificationConfig.getDeviceIdentifier() == null) { + pushNotificationConfig.setDeviceIdentifier(this.deviceIdService.getDeviceId()); + } + Log.Helper.LOGIS(LOG_TAG, "Attempt to register device with EADP push notification service", new Object[0]); + try { + try { + HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/devices", this.pushNotificationServerUrl, this.gameId)); + resource.setHeader("Authorization", createAuthorizationHeader()); + pushNotificationConfig.setAppId(this.appId); + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.registerTypeAdapter(TimeZone.class, new TimeZoneSerializer()); + resource.setJsonBody(gsonBuilder.create().toJson(pushNotificationConfig)); + resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.3 + @Override // com.ea.eadp.http.models.HttpRequestListener + public void onComplete(HttpResponse httpResponse) { + int code = httpResponse.getCode(); + String body = httpResponse.getBody(); + if (code >= 200 && code < 300) { + Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Registration request successful!", new Object[0]); + Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]); + Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registration with server complete. Registered id: %s", pushNotificationConfig.getRegistrationIdentifier()), new Object[0]); + if (AndroidPushService.this.pushListener != null) { + AndroidPushService.this.pushListener.onRegistrationSuccess(code, body); + return; + } + return; + } + String format = String.format("Registration request failed! Status: %s, Message: %s", Integer.valueOf(code), httpResponse.getMessage()); + Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]); + Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]); + if (AndroidPushService.this.pushListener != null) { + AndroidPushService.this.pushListener.onConnectionError(code, format); + } + } + }); + } catch (Exception e) { + String format = String.format("Failed to register device with Exception: %s", e.getLocalizedMessage()); + Log.Helper.LOGES(LOG_TAG, format, new Object[0]); + if (this.pushListener != null) { + this.pushListener.onConnectionError(0, format); + } + } + } finally { + saveConfigData(pushNotificationConfig); + } + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public void sendTrackingEvent(String str, String str2, String str3) { + try { + HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/events", this.pushNotificationServerUrl, this.gameId)); + TrackingEvent trackingEvent = new TrackingEvent(str, str2, str3, loadConfigData(DEVICE_ID_KEY)); + resource.setHeader("Authorization", createAuthorizationHeader()); + resource.setJsonBody(new Gson().toJson(trackingEvent)); + resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.4 + @Override // com.ea.eadp.http.models.HttpRequestListener + public void onComplete(HttpResponse httpResponse) { + int code = httpResponse.getCode(); + if (code >= 200 && code < 300) { + Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Tracking request successful!", new Object[0]); + Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]); + if (AndroidPushService.this.pushListener != null) { + AndroidPushService.this.pushListener.onTrackingSuccess(code, httpResponse.getBody()); + return; + } + return; + } + String format = String.format("Tracking request failed! Status: %s, Message: %s", Integer.valueOf(httpResponse.getCode()), httpResponse.getMessage()); + Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]); + Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]); + if (AndroidPushService.this.pushListener != null) { + AndroidPushService.this.pushListener.onConnectionError(code, format); + } + } + }); + } catch (Exception e) { + String format = String.format("Tracking request failed with Exception: %s", e.getMessage()); + Log.Helper.LOGES(LOG_TAG, format, new Object[0]); + if (this.pushListener != null) { + this.pushListener.onConnectionError(0, format); + } + } + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public void persistTrackingEvent(String str, String str2, String str3) { + List arrayList; + SharedPreferences sharedPreferences = this.context.getApplicationContext().getSharedPreferences(TRACKING_PREFS_FILENAME, 0); + String string = sharedPreferences.getString(EVENT_LIST_KEY, null); + if (string != null) { + arrayList = (List) new Gson().fromJson(string, List.class); + } else { + arrayList = new ArrayList(); + } + HashMap hashMap = new HashMap(); + hashMap.put(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str); + hashMap.put(GcmIntentService.PushIntentExtraKeys.PN_TYPE, str2); + hashMap.put("state", str3); + if (arrayList == null) { + Log.Helper.LOGE(this, "Unexpected Event List. Skipping Tracking event persistence.", new Object[0]); + return; + } + arrayList.add(hashMap); + SharedPreferences.Editor edit = sharedPreferences.edit(); + edit.putString(EVENT_LIST_KEY, new Gson().toJson(arrayList)); + edit.commit(); + } + + @Override // com.ea.eadp.pushnotification.services.IPushService + public void sendPendingTrackingRequests() { + Gson gson = new Gson(); + SharedPreferences sharedPreferences = this.context.getSharedPreferences(TRACKING_PREFS_FILENAME, 0); + String string = sharedPreferences.getString(EVENT_LIST_KEY, null); + if (string != null) { + List 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 { + private TimeZoneSerializer() { + } + + @Override // com.google.gson.JsonSerializer + public JsonElement serialize(TimeZone timeZone, Type type, JsonSerializationContext jsonSerializationContext) { + return new JsonPrimitive(timeZone.getID()); + } + } +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/services/IPushService.java b/app/src/main/java/com/ea/eadp/pushnotification/services/IPushService.java new file mode 100644 index 0000000..783a356 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/services/IPushService.java @@ -0,0 +1,30 @@ +package com.ea.eadp.pushnotification.services; + +import com.ea.eadp.pushnotification.listeners.IPushListener; +import com.ea.eadp.pushnotification.models.PushNotificationConfig; + +/* loaded from: classes.dex */ +public interface IPushService { + public static final String NOTIFICATION_TYPE_OPENED = "NOTIFICATION_OPENED"; + public static final String NOTIFICATION_TYPE_RECEIVED = "NOTIFICATION_RECEIVED"; + + void getInAppNotifications(String str, String str2); + + IPushListener getPushListener(); + + void onRestart(); + + void onStop(); + + void persistTrackingEvent(String str, String str2, String str3); + + void registerDevice(PushNotificationConfig pushNotificationConfig); + + void sendPendingTrackingRequests(); + + void sendTrackingEvent(String str, String str2, String str3); + + void setPushListener(IPushListener iPushListener); + + void startWithConfig(PushNotificationConfig pushNotificationConfig, String str); +} diff --git a/app/src/main/java/com/ea/eadp/pushnotification/services/TrackingEvent.java b/app/src/main/java/com/ea/eadp/pushnotification/services/TrackingEvent.java new file mode 100644 index 0000000..67d08d9 --- /dev/null +++ b/app/src/main/java/com/ea/eadp/pushnotification/services/TrackingEvent.java @@ -0,0 +1,27 @@ +package com.ea.eadp.pushnotification.services; + +import com.ea.eadp.pushnotification.forwarding.GcmIntentService; +import com.google.gson.annotations.Expose; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +class TrackingEvent { + + @Expose + private String name; + + @Expose + private Map 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())); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/Accelerometer.java b/app/src/main/java/com/ea/ironmonkey/Accelerometer.java new file mode 100644 index 0000000..244b53f --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/Accelerometer.java @@ -0,0 +1,143 @@ +package com.ea.ironmonkey; + +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; + +/* loaded from: classes.dex */ +public class Accelerometer implements SensorEventListener { + private int bufferReadIndex; + private int bufferSize; + private int[] bufferTimesteps; + private float[] bufferValues; + private int bufferWriteIndex; + private long lastTimestamp = 0; + private int naturalOrientation; + private boolean registered; + private float samplesPerSecond; + private Sensor sensor; + private SensorManager sensorManager; + + @Override // android.hardware.SensorEventListener + public void onAccuracyChanged(Sensor sensor, int i) { + } + + public Accelerometer(SensorManager sensorManager, Sensor sensor, int i) { + this.sensorManager = sensorManager; + this.sensor = sensor; + this.naturalOrientation = i; + setBufferSize(1); + } + + public void setFrequency(float f) { + this.samplesPerSecond = f; + register(); + } + + public float getFrequency() { + return this.samplesPerSecond; + } + + public void setBufferSize(int i) { + this.bufferSize = i; + this.bufferTimesteps = new int[i]; + this.bufferValues = new float[i * 3]; + this.bufferWriteIndex = 0; + this.bufferReadIndex = 0; + } + + public void updateOrientation(int i) { + this.naturalOrientation = i; + } + + public int getBufferSize() { + return this.bufferSize; + } + + public void pause() { + unregister(); + } + + public void resume() { + register(); + } + + private int getSensorDelay() { + return this.samplesPerSecond < 20.0f ? 3 : 1; + } + + private void register() { + if (!this.registered && this.samplesPerSecond > 0.0f) { + this.sensorManager.registerListener(this, this.sensor, getSensorDelay()); + this.registered = true; + } else if (this.registered && this.samplesPerSecond == 0.0f) { + this.sensorManager.unregisterListener(this); + this.registered = false; + } + } + + private void unregister() { + if (this.registered) { + this.sensorManager.unregisterListener(this); + this.registered = false; + } + } + + public int getSamples(int i, int[] iArr, float[] fArr) { + int i2; + synchronized (this) { + i2 = 0; + while (this.bufferReadIndex != this.bufferWriteIndex) { + if (this.bufferReadIndex >= this.bufferSize) { + this.bufferReadIndex = 0; + } + if (i2 >= i) { + break; + } + iArr[i2] = this.bufferTimesteps[this.bufferReadIndex]; + for (int i3 = 0; i3 < 3; i3++) { + fArr[(i2 * 3) + i3] = this.bufferValues[(this.bufferReadIndex * 3) + i3]; + } + i2++; + this.bufferReadIndex++; + } + } + return i2; + } + + @Override // android.hardware.SensorEventListener + public void onSensorChanged(SensorEvent sensorEvent) { + int i = (int) ((sensorEvent.timestamp - this.lastTimestamp) / 1000000); + this.lastTimestamp = sensorEvent.timestamp; + synchronized (this) { + this.bufferWriteIndex++; + if (this.bufferWriteIndex >= this.bufferSize) { + this.bufferWriteIndex = 0; + } + if (this.bufferWriteIndex == this.bufferReadIndex) { + this.bufferReadIndex++; + } + this.bufferTimesteps[this.bufferWriteIndex] = i; + switch (this.naturalOrientation) { + case 0: + this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[0]; + this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[1]; + break; + case 1: + this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[1]; + this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[0]; + break; + case 2: + this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[0]; + this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[1]; + break; + case 3: + this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[1]; + this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[0]; + break; + } + this.bufferValues[(this.bufferWriteIndex * 3) + 2] = sensorEvent.values[2]; + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.java b/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.java new file mode 100644 index 0000000..ee0e740 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.java @@ -0,0 +1,61 @@ +package com.ea.ironmonkey; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.Typeface; + +/* loaded from: classes.dex */ +public class BitmapGraphics { + private Bitmap bitmap; + private Canvas canvas = new Canvas(); + + public BitmapGraphics(int i, int i2) { + this.bitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888); + this.canvas.setBitmap(this.bitmap); + } + + public Bitmap getBitmap() { + return this.bitmap; + } + + public Canvas getCanvas() { + return this.canvas; + } + + public void clear() { + this.canvas.drawColor(0, PorterDuff.Mode.CLEAR); + } + + private static Paint createPaint(Typeface typeface, float f) { + Paint paint = new Paint(); + paint.setTypeface(typeface); + paint.setTextSize(f); + paint.setColor(-1); + paint.setAntiAlias(true); + return paint; + } + + public static Paint createPaintFromFamilyName(String str, float f) { + return createPaint(Typeface.create(str, 0), f); + } + + public static Paint createPaintFromFile(String str, float f) { + return createPaint(internalCreateFromFile(str), f); + } + + private static Typeface internalCreateFromFile(String str) { + if (GameActivityMain.instance.useAssetsFileSystem()) { + if (str.startsWith("/")) { + str = str.substring(1); + } + return Typeface.createFromAsset(GameActivityMain.instance.getAssetManager(), str); + } + return Typeface.createFromFile(str); + } + + public void drawString(Paint paint, String str, int i, int i2) { + this.canvas.drawText(str, i, i2, paint); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java b/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java new file mode 100644 index 0000000..a4a1871 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java @@ -0,0 +1,16 @@ +package com.ea.ironmonkey; + +/* loaded from: classes.dex */ +public class C2DMConstants { + public static final String ACTION_ERROR = "com.ea.ironmonkey.ERROR"; + public static final String ACTION_MESSAGE = "com.ea.ironmonkey.MESSAGE"; + public static final String ACTION_REGISTER = "com.ea.ironmonkey.REGISTER"; + public static final String ACTION_UNREGISTER = "com.ea.ironmonkey.UNREGISTER"; + public static final String EXTRA_ERROR_ID = "ERROR_ID"; + public static final String EXTRA_REGISTRATION_ID = "REGISTRATION_ID"; + public static final String LAUNCH_TYPE_TAG = "app_launch"; + public static final String SENDER_EMAIL = "927779459434"; + public static final String SYSTEM_MSG_CLASS_RECIPIENT = "com.ea.ironmonkey.GameActivityMain"; + public static final String SYSTEM_MSG_PACKAGE_RECIPIENT = "com.ea.games.nfs13_row"; + public static final String SYSTEM_MSG_TITLE = "NFS Most Wanted"; +} diff --git a/app/src/main/java/com/ea/ironmonkey/DownloaderService.java b/app/src/main/java/com/ea/ironmonkey/DownloaderService.java new file mode 100644 index 0000000..aaafe1f --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/DownloaderService.java @@ -0,0 +1,19 @@ +package com.ea.ironmonkey; + +/* loaded from: classes.dex */ +public class DownloaderService extends com.google.android.vending.expansion.downloader.impl.DownloaderService { + @Override // com.google.android.vending.expansion.downloader.impl.DownloaderService + public String getPublicKey() { + return getPackageName().endsWith("_row") ? SkuConfig.ROW_BASE64_PUBLIC_KEY : SkuConfig.NA_BASE64_PUBLIC_KEY; + } + + @Override // com.google.android.vending.expansion.downloader.impl.DownloaderService + public byte[] getSALT() { + return SkuConfig.SALT; + } + + @Override // com.google.android.vending.expansion.downloader.impl.DownloaderService + public String getAlarmReceiverClassName() { + return DownloaderServiceBroadcastReceiver.class.getName(); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/DownloaderServiceBroadcastReceiver.java b/app/src/main/java/com/ea/ironmonkey/DownloaderServiceBroadcastReceiver.java new file mode 100644 index 0000000..750f5e2 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/DownloaderServiceBroadcastReceiver.java @@ -0,0 +1,19 @@ +package com.ea.ironmonkey; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; + +/* loaded from: classes.dex */ +public class DownloaderServiceBroadcastReceiver extends BroadcastReceiver { + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + try { + DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent, (Class) DownloaderService.class); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.java b/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.java new file mode 100644 index 0000000..2cdc5e7 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.java @@ -0,0 +1,8 @@ +package com.ea.ironmonkey; + +import javax.microedition.khronos.opengles.GL10; + +/* loaded from: classes.dex */ +public interface DrawFrameListener { + void onDrawFrame(GL10 gl10); +} diff --git a/app/src/main/java/com/ea/ironmonkey/GameActivityMain.java b/app/src/main/java/com/ea/ironmonkey/GameActivityMain.java new file mode 100644 index 0000000..02a9abd --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/GameActivityMain.java @@ -0,0 +1,1388 @@ +package com.ea.ironmonkey; + +import android.app.Activity; +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.app.PendingIntent; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.res.AssetManager; +import android.content.res.Configuration; +import android.graphics.Rect; +import android.hardware.Sensor; +import android.hardware.SensorManager; +import android.media.AudioManager; +import android.net.Uri; +import android.opengl.GLES20; +import android.os.Build; +import android.os.Bundle; +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; +import android.view.KeyEvent; +import android.view.OrientationEventListener; +import android.view.View; +import android.view.ViewParent; +import android.view.inputmethod.InputMethodManager; +import android.widget.FrameLayout; +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.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.TimeUnit; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; +import org.fmod.FMODAudioDevice; + +/* loaded from: classes.dex */ +public class GameActivityMain extends Activity 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; + public static final int LIFECYCLE_NONE = 0; + public static final int LIFECYCLE_RUNNING = 3; + public static final int LIFECYCLE_STARTED = 2; + public static final int LIFECYCLE_STOPPED = 4; + private static String SDCARD_DATA_FOLDER = ""; + public static final int STATE_ADC_PROCESS = 4; + public static final int STATE_ADC_START = 3; + public static final int STATE_FULL_PROCESS = 6; + public static final int STATE_FULL_START = 5; + public static final int STATE_GAME_START = 8; + public static final int STATE_GOOGLE_DRM = 2; + public static final int STATE_RESTORE_CONTEXT = 7; + public static final int STATE_SPLASH = 0; + public static final int STATE_SPLASH_PROCESS = 1; + public static final String TAG = "GameActivityMain"; + private static boolean assetsReady; + public static GameActivityMain instance; + private static boolean isAmazonDev; + private static AudioManager mAudioManager; + private static int oldState; + private static boolean sIsOtherMusicPlaying; + public static int state; + private Accelerometer accelerometer; + private GameGLSurfaceView gameGLSurfaceView; + private GameRenderer gameRenderer; + private GoogleDrm googleDrm; + private Handler handler; + private int laststate; + private int lifecycle; + private AlertDialog.Builder mAd; + private FMODAudioDevice mFMODAudioDevice; + private FrameLayout mFrameLayout; + private OrientationEventListener mOrientationListener; + private Map> mResources; + private PowerManager.WakeLock mWakeLock; + public int naturalOrientation; + private RunLoop runLoop; + private SplashScreen splash; + private int splashCounter; + private long splashDelay; + private long splashTimer; + private boolean isXperiaPlay = false; + private boolean isSleepModeEnabled = true; + private int mRotation = 0; + private AssetLocationType mAssetLocationType = AssetLocationType.EXTERNAL; + private String[] lifecycleNames = {"LIFECYCLE_NONE", "LIFECYCLE_CREATED", "LIFECYCLE_STARTED", "LIFECYCLE_RUNNING", "LIFECYCLE_STOPPED", "LIFECYCLE_DESTROYED"}; + + enum AssetLocationType { + EXTERNAL, + ASSETS, + OBB + } + + private void updateRequestedOrientation(int i) { + } + + public boolean IsSystemKey(int i) { + if (i == 3 || i == 91) { + return true; + } + switch (i) { + case 5: + case 6: + return true; + default: + switch (i) { + case 24: + case 25: + case 26: + case 27: + return true; + default: + return false; + } + } + } + + public native void nativeOnCreate(); + + public native void nativeOnDestroy(); + + public native void nativeOnMusicPlayerStateChanged(); + + public native void nativeOnOrientationChange(int i); + + public native void nativeOnPause(); + + public native void nativeOnPhysicalKeyDown(int i, int i2); + + public native void nativeOnPhysicalKeyUp(int i, int i2); + + public native void nativeOnPhysicalKeyboardVisibilityChanged(boolean z); + + public native void nativeOnPhysicalNavigationVisibilityChanged(boolean z); + + public native void nativeOnRestart(); + + public native void nativeOnResume(); + + public native void nativeOnStart(); + + public native void nativeOnStop(); + + public native boolean nativeRestoreContext(); + + public native void nativeSurfaceChanged(GL10 gl10, int i, int i2); + + public native void nativeSurfaceCreated(GL10 gl10, EGLConfig eGLConfig); + + @Override // android.app.Activity + public void onCreate(Bundle bundle) { + Log.setEnable(true); + Log.i(TAG, "onCreate"); + super.onCreate(bundle); + instance = this; + if (this.lifecycle == 5) { + Log.w(TAG, "onCreate called on destroyed app, finishing"); + finish(); + return; + } + if (this.lifecycle >= 1) { + Log.w(TAG, "onCreate ignored, lifecycle is already " + this.lifecycleNames[this.lifecycle]); + return; + } + this.handler = new Handler(); + setLifecycle(1); + Log.d("Model", Build.MODEL); + if (Build.MODEL.length() > 4 && Build.MODEL.substring(0, 4).equals("R800")) { + this.isXperiaPlay = true; + } + String packageName = getPackageName(); + if (packageName.endsWith("_azn_na") || packageName.endsWith("_azn_row")) { + Log.d(TAG, "It's Amazon dev"); + isAmazonDev = true; + } + if (!isAtLeastAPI(18) && getRequestedOrientation() != 6) { + setRequestedOrientation(6); + } + if (isAtLeastAPI(28)) { + getWindow().getAttributes().layoutInDisplayCutoutMode = 1; + getWindow().addFlags(67108864); + } + getWindow().setFlags(1024, 1024); + requestWindowFeature(1); + this.mOrientationListener = new OrientationEventListener(getApplicationContext()) { // from class: com.ea.ironmonkey.GameActivityMain.1 + @Override // android.view.OrientationEventListener + public void onOrientationChanged(int i) { + int rotation; + if (GameActivityMain.this.accelerometer == null || GameActivityMain.this.mRotation == (rotation = GameActivityMain.this.getWindow().getWindowManager().getDefaultDisplay().getRotation())) { + return; + } + GameActivityMain.this.mRotation = rotation; + if (Settings.System.getInt(GameActivityMain.this.getContentResolver(), "accelerometer_rotation", 0) == 1 || !GameActivityMain.isAtLeastAPI(18) || GameActivityMain.isAmazonDev) { + GameActivityMain.this.accelerometer.updateOrientation(GameActivityMain.this.mRotation); + GameActivityMain.this.nativeOnOrientationChange(GameActivityMain.this.mRotation); + Log.d(GameActivityMain.TAG, "OrientationEventListener::onOrientationChanged mRotation = " + Integer.toString(GameActivityMain.this.mRotation)); + return; + } + Log.d(GameActivityMain.TAG, "OrientationEventListener::onOrientationChanged rotation disabled!"); + } + }; + if (this.mOrientationListener.canDetectOrientation()) { + this.mOrientationListener.enable(); + } + mAudioManager = (AudioManager) getSystemService("audio"); + sIsOtherMusicPlaying = mAudioManager.isMusicActive(); + Log.i(TAG, "onCreate() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying)); + this.mFMODAudioDevice = new FMODAudioDevice(); + if (isAmazonDev) { + 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>>() { // from class: com.ea.ironmonkey.GameActivityMain.2 + }.getType()); + Log.d(TAG, "onCreate resources.json contains " + Integer.toString(this.mResources.size()) + " items"); + open.close(); + this.mAssetLocationType = AssetLocationType.ASSETS; + } catch (Exception e) { + Log.d(TAG, "onCreate exception on opening resources.json"); + Log.e(TAG, e.getMessage()); + this.mResources = new HashMap(); + } + } + if (this.mAssetLocationType != AssetLocationType.ASSETS) { + try { + InputStream open2 = getResources().getAssets().open("obb.size"); + if (open2 != null) { + this.mAssetLocationType = AssetLocationType.OBB; + open2.close(); + } + } catch (IOException e2) { + Log.e(TAG, e2.getMessage()); + } + } + SensorManager sensorManager = (SensorManager) getSystemService("sensor"); + Sensor defaultSensor = sensorManager.getDefaultSensor(1); + int rotation = getWindow().getWindowManager().getDefaultDisplay().getRotation(); + switch (rotation) { + case 0: + Log.d(TAG, "Orientation: ROTATION_0"); + break; + case 1: + Log.d(TAG, "Orientation: ROTATION_90"); + break; + case 2: + Log.d(TAG, "Orientation: ROTATION_180"); + break; + case 3: + Log.d(TAG, "Orientation: ROTATION_270"); + break; + } + this.mRotation = rotation; + updateRequestedOrientation(rotation); + if (defaultSensor != null) { + this.accelerometer = new Accelerometer(sensorManager, defaultSensor, rotation); + } + this.gameGLSurfaceView = new GameGLSurfaceView(this); + this.gameRenderer = new GameRenderer(this); + this.gameRenderer.setDrawFrameListener(this); + this.gameGLSurfaceView.setRenderer(this.gameRenderer); + this.runLoop = new RunLoop(this.gameGLSurfaceView); + 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); + ApplicationLifecycle.onActivityCreate(bundle, this); + Log.d(TAG, "nativeOnCreate"); + 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 int getAssetSize(String str) { + Log.d(TAG, "getAssetSize filename = " + str); + File file = new File(str); + String parent = file.getParent(); + if (parent == null) { + if (this.mResources.containsKey(str)) { + Log.d(TAG, "getAssetSize mResources contains " + str); + return -1; + } + Log.d(TAG, "getAssetSize mResources not contains " + str); + } else { + Log.d(TAG, "getAssetSize path = " + parent); + if (this.mResources.containsKey(parent)) { + Log.d(TAG, "getAssetSize mResources contains " + parent); + Map map = this.mResources.get(parent); + String name = file.getName(); + Log.d(TAG, "getAssetSize name = " + name); + if (map.containsKey(name)) { + Log.d(TAG, "getAssetSize dir contains " + name); + FSNode fSNode = map.get(name); + int i = fSNode.directory ? -1 : fSNode.size; + Log.d(TAG, "getAssetSize filename = " + str + ", directory = " + Boolean.toString(fSNode.directory) + ", size = " + Integer.toString(fSNode.size)); + return i; + } + Log.d(TAG, "getAssetSize dir not contains " + name); + } else { + Log.d(TAG, "getAssetSize mResources not contains " + parent); + } + } + return -2; + } + + public boolean isObbAssets() { + return this.mAssetLocationType == AssetLocationType.OBB; + } + + public boolean isFullApkAssets() { + return this.mAssetLocationType == AssetLocationType.ASSETS; + } + + public boolean useAssetsFileSystem() { + return this.mAssetLocationType != AssetLocationType.EXTERNAL; + } + + private int getVersionCode() { + try { + return getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + return 0; + } + } + + public String getObbFullPath() { + return getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode()); + } + + public AssetManager getAssetManager() { + return getResources().getAssets(); + } + + public static boolean isAnyMusicPlaying() { + return sIsOtherMusicPlaying; + } + + public static boolean isAmazon() { + return isAmazonDev; + } + + public static boolean isAtLeastAPI(int i) { + return Build.VERSION.SDK_INT >= i; + } + + public void enableSleepMode() { + if (this.isSleepModeEnabled) { + return; + } + this.isSleepModeEnabled = true; + wakeLockRelease(); + } + + public void disableSleepMode() { + if (this.isSleepModeEnabled) { + this.isSleepModeEnabled = false; + wakeLockAcquire(); + } + } + + private void checkAnyMusicActive() { + if (mAudioManager != null) { + sIsOtherMusicPlaying = mAudioManager.isMusicActive(); + nativeOnMusicPlayerStateChanged(); + } + } + + 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(); + Log.i(TAG, "onStart"); + super.onStart(); + Log.i(TAG, "onStart 1"); + wakeLockAcquire(); + Log.i(TAG, "onStart 2"); + if (this.lifecycle >= 2 && this.lifecycle < 4) { + Log.w(TAG, "onStart ignored, lifecycle is already " + this.lifecycleNames[this.lifecycle]); + return; + } + Log.i(TAG, "onStart 3"); + setLifecycle(2); + Log.i(TAG, "nativeOnStart"); + nativeOnStart(); + Log.i(TAG, "nativeOnStart - end"); + if (this.isXperiaPlay) { + switch (getResources().getConfiguration().navigationHidden) { + case 1: + nativeOnPhysicalNavigationVisibilityChanged(true); + break; + case 2: + nativeOnPhysicalNavigationVisibilityChanged(false); + break; + } + } + Log.i(TAG, "ApplicationLifecycle"); + ApplicationLifecycle.onActivityStart(this); + } + + @Override // android.app.Activity + public void onRestart() { + Log.i(TAG, "onRestart"); + super.onRestart(); + ApplicationLifecycle.onActivityRestart(this); + nativeOnRestart(); + } + + @Override // android.app.Activity + public void onPause() { + Log.i(TAG, "onPause state=" + state); + super.onPause(); + this.mFMODAudioDevice.stop(); + if (this.mOrientationListener.canDetectOrientation()) { + this.mOrientationListener.disable(); + } + if (this.lifecycle != 3) { + Log.w(TAG, "onPause ignored, lifecycle is currently " + this.lifecycleNames[this.lifecycle]); + return; + } + setLifecycle(2); + this.gameGLSurfaceView.onPause(); + ApplicationLifecycle.onActivityPause(this); + nativeOnPause(); + this.splash = null; + } + + private void ForceHideVirtualKeyboard() { + View currentFocus = getCurrentFocus(); + if (currentFocus != null) { + ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0); + } + getWindow().setSoftInputMode(3); + } + + @Override // android.app.Activity + public void onResume() { + Log.i(TAG, "onResume"); + super.onResume(); + if (state != 7) { + oldState = state; + state = 7; + this.gameRenderer.setDrawFrameListener(this); + } + if (this.mOrientationListener.canDetectOrientation()) { + this.mOrientationListener.enable(); + } + if (this.lifecycle == 3) { + Log.w(TAG, "onResume ignored, lifecycle is currently " + this.lifecycleNames[this.lifecycle]); + return; + } + setLifecycle(3); + this.gameGLSurfaceView.onResume(); + ApplicationLifecycle.onActivityResume(this); + nativeOnResume(); + checkAnyMusicActive(); + this.mFMODAudioDevice.start(); + Log.i(TAG, "onResume() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying)); + } + + @Override // android.app.Activity + public void onStop() { + Log.i(TAG, "onStop"); + super.onStop(); + if (this.lifecycle >= 4) { + Log.w(TAG, "onStop ignored, lifecycle is already " + this.lifecycleNames[this.lifecycle]); + return; + } + setLifecycle(4); + wakeLockRelease(); + nativeOnStop(); + } + + @Override // android.app.Activity + public void onDestroy() { + Log.i(TAG, "onDestroy"); + super.onDestroy(); + if (this.lifecycle >= 5) { + Log.w(TAG, "onDestroy ignored, lifecycle is already " + this.lifecycleNames[this.lifecycle]); + return; + } + setLifecycle(5); + if (this.googleDrm.isEnable()) { + this.googleDrm.destroy(); + } + if (state == 8) { + ApplicationLifecycle.onActivityDestroy(this); + nativeOnDestroy(); + } + StorageDirectory.Shutdown(); + EAIO.Shutdown(); + System.exit(0); + } + + public void wakeLockAcquire() { + if (this.isSleepModeEnabled) { + return; + } + if (this.mWakeLock == null) { + this.mWakeLock = ((PowerManager) getSystemService("power")).newWakeLock(10, TAG); + } + if (this.mWakeLock.isHeld()) { + return; + } + try { + this.mWakeLock.acquire(); + } catch (SecurityException unused) { + Log.w(TAG, "Missing WAKE_LOCK permission."); + } + } + + public void wakeLockRelease() { + if (this.isSleepModeEnabled) { + return; + } + try { + if (this.mWakeLock == null || !this.mWakeLock.isHeld()) { + return; + } + this.mWakeLock.release(); + } catch (SecurityException unused) { + Log.w(TAG, "Missing WAKE_LOCK permission."); + } + } + + @Override // android.app.Activity + protected void onSaveInstanceState(Bundle bundle) { + super.onSaveInstanceState(bundle); + ApplicationLifecycle.onActivitySaveInstanceState(bundle, this); + } + + @Override // android.app.Activity + public void onActivityResult(int i, int i2, Intent intent) { + super.onActivityResult(i, i2, intent); + ApplicationLifecycle.onActivityResult(i, i2, intent, this); + } + + @Override // android.app.Activity, android.view.KeyEvent.Callback + public boolean onKeyDown(final int i, KeyEvent keyEvent) { + super.onKeyDown(i, keyEvent); + if (state != 8) { + return true; + } + if ((i == 4 || i == 108) && keyEvent.getRepeatCount() > 0) { + return true; + } + final int scanCode = keyEvent.getScanCode(); + this.gameGLSurfaceView.queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.3 + @Override // java.lang.Runnable + public void run() { + GameActivityMain.this.nativeOnPhysicalKeyDown(i, scanCode); + } + }); + return !IsSystemKey(i); + } + + @Override // android.app.Activity, android.view.KeyEvent.Callback + public boolean onKeyUp(final int i, KeyEvent keyEvent) { + super.onKeyUp(i, keyEvent); + if (state != 8) { + return true; + } + final int scanCode = keyEvent.getScanCode(); + this.gameGLSurfaceView.queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.4 + @Override // java.lang.Runnable + public void run() { + GameActivityMain.this.nativeOnPhysicalKeyUp(i, scanCode); + } + }); + return !IsSystemKey(i); + } + + @Override // android.app.Activity + public void onBackPressed() { + if (state == 1 || state == 0 || state == 7) { + finish(); + } + ApplicationLifecycle.onBackPressed(); + } + + @Override // android.app.Activity, android.content.ComponentCallbacks + public void onConfigurationChanged(Configuration configuration) { + Log.d(TAG, "onConfigurationChanged(" + configuration.toString() + ")"); + super.onConfigurationChanged(configuration); + if (this.accelerometer != null) { + int rotation = getWindow().getWindowManager().getDefaultDisplay().getRotation(); + switch (rotation) { + case 0: + Log.i(TAG, "Orientation: ROTATION_0"); + break; + case 1: + Log.i(TAG, "Orientation: ROTATION_90"); + break; + case 2: + Log.i(TAG, "Orientation: ROTATION_180"); + break; + case 3: + Log.i(TAG, "Orientation: ROTATION_270"); + break; + } + if (isAmazonDev) { + this.accelerometer.updateOrientation(rotation); + } + } + if (this.isXperiaPlay) { + switch (configuration.navigationHidden) { + case 1: + nativeOnPhysicalNavigationVisibilityChanged(true); + break; + case 2: + nativeOnPhysicalNavigationVisibilityChanged(false); + break; + } + } + } + + @Override // android.app.Activity, android.view.Window.Callback + public void onWindowFocusChanged(boolean z) { + super.onWindowFocusChanged(z); + Log.i(TAG, "onWindowsFocusChanged(" + z + ") state=" + state); + if (getGameGLSurfaceView() != null) { + getGameGLSurfaceView().setRenderMode(z ? 1 : 0); + } + if (!z) { + if (this.mFMODAudioDevice.isMixing()) { + this.mFMODAudioDevice.stop(); + checkAnyMusicActive(); + } + Log.i(TAG, "onWindowFocusChanged() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying)); + ForceHideVirtualKeyboard(); + nativeOnPhysicalKeyDown(131, 0); + nativeOnPhysicalKeyUp(131, 0); + if (state == 8 && !isAmazonDev) { + oldState = state; + state = 7; + this.gameRenderer.setDrawFrameListener(this); + } + } else { + if (!this.mFMODAudioDevice.isMixing()) { + checkAnyMusicActive(); + this.mFMODAudioDevice.start(); + } + Log.i(TAG, "onWindowFocusChanged() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying)); + if (!isAmazonDev) { + getWindow().getDecorView().setSystemUiVisibility(5894); + } + } + ApplicationLifecycle.onActivityWindowFocusChanged(z, this); + } + + private void setLifecycle(int i) { + if (i == this.lifecycle) { + return; + } + Log.i(TAG, this.lifecycleNames[this.lifecycle] + " -> " + this.lifecycleNames[i]); + this.lifecycle = i; + } + + public RunLoop getRunLoop() { + return this.runLoop; + } + + public GameGLSurfaceView getGameGLSurfaceView() { + return this.gameGLSurfaceView; + } + + public ViewParent GetViewRoot() { + return getWindow().getDecorView().getRootView().getParent(); + } + + public void CallGC() { + Log.d(TAG, "Call garbage collector"); + System.gc(); + } + + public static String GetDeviceName() { + return Build.MODEL; + } + + public static String getOsVersion() { + return Build.VERSION.RELEASE; + } + + public static String GetDefaultLanguage() { + return Locale.getDefault().toString().substring(0, 2); + } + + public static String GetDeviceLocale() { + String upperCase = Locale.getDefault().toString().replace('_', '-').toUpperCase(); + Log.d(TAG, "GetDeviceLocale locale = " + upperCase); + return upperCase; + } + + public void ShowMessage(String str, String[] strArr, final boolean z) { + Log.d(TAG, "ShowMessage msg=" + str + " finish=" + z); + this.mAd = new AlertDialog.Builder(this); + this.mAd.setMessage(str); + this.mAd.setCancelable(false); + this.mAd.setPositiveButton(strArr[0], new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.GameActivityMain.5 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + if (z) { + GameActivityMain.this.finish(); + } + } + }); + this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.6 + @Override // java.lang.Runnable + public void run() { + GameActivityMain.this.mAd.show(); + } + }, 20L); + } + + @Override // android.app.Activity, android.content.ComponentCallbacks + public void onLowMemory() { + ActivityManager activityManager = (ActivityManager) getSystemService("activity"); + 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 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(); + } + + public static String GetApplicationVersion() { + try { + return instance.getPackageManager().getPackageInfo(instance.getPackageName(), 0).versionName; + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + return "1.0.1"; + } + } + + public int GetNaturalOrientation() { + int width; + int height; + Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay(); + switch (defaultDisplay.getRotation()) { + case 0: + case 2: + width = defaultDisplay.getWidth(); + height = defaultDisplay.getHeight(); + break; + case 1: + case 3: + width = defaultDisplay.getHeight(); + height = defaultDisplay.getWidth(); + break; + default: + height = 0; + width = 0; + break; + } + if (width > height) { + Log.d(TAG, "NaturalOrientation = LANDSCAPE"); + return 0; + } + Log.d(TAG, "NaturalOrientation = PORTRAIT"); + return 1; + } + + public Accelerometer getAccelerometer() { + return this.accelerometer; + } + + public DisplayMetrics getDisplayMetrics() { + if (Build.VERSION.SDK_INT >= 17) { + DisplayMetrics displayMetrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics); + return displayMetrics; + } + return getResources().getDisplayMetrics(); + } + + public boolean isAssetsReady() { + return assetsReady; + } + + @Override // android.app.Activity + public void setContentView(View view) { + Log.d(TAG, "setContentView(" + view + ")"); + if (view != null) { + if (view == this.mFrameLayout) { + super.setContentView(view); + return; + } + int childCount = this.mFrameLayout.getChildCount(); + for (int i = 0; i < childCount; i++) { + View childAt = this.mFrameLayout.getChildAt(i); + if (childAt != this.gameGLSurfaceView) { + this.mFrameLayout.removeView(childAt); + } + } + if (view != this.gameGLSurfaceView) { + this.mFrameLayout.addView(view); + } + this.mFrameLayout.bringChildToFront(view); + } + } + + @Override // com.ea.ironmonkey.DrawFrameListener + public void onDrawFrame(GL10 gl10) { + InputStream inputStream; + if (state != this.laststate) { + Log.d(TAG, "onDrawFrame state=" + state); + this.laststate = state; + } + boolean z = false; + switch (state) { + 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; + } + this.splashCounter = 3; + break; + case 1: + if (this.splashCounter > 0) { + this.splashCounter--; + break; + } else { + this.splashTimer = System.currentTimeMillis() + 2500; + if (!assetsReady) { + try { + inputStream = getAssets().open(DOWNLOAD_PROPERTIES); + try { + inputStream.close(); + } catch (Exception unused) { + } + } catch (Exception unused2) { + inputStream = null; + } + if (inputStream != null) { + this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.8 + @Override // java.lang.Runnable + public void run() { + } + }, 20L); + Log.i(TAG, "state ADC start"); + state = 3; + break; + } else { + Log.i(TAG, "STATE_GAME_START 1"); + state = 8; + break; + } + } else { + Log.i(TAG, "STATE_GAME_START 2"); + state = 8; + break; + } + } + case 3: + Log.i(TAG, "ADC start"); + break; + case 7: + if (this.splash == null) { + this.splash = new SplashScreen(this); + this.splash.init(gl10, this.gameRenderer.getWidth(), this.gameRenderer.getHeight()); + this.splashDelay = System.currentTimeMillis() + 2000; + } + if (this.splashDelay < System.currentTimeMillis() && hasWindowFocus()) { + if (oldState == 8) { + this.splashTimer = System.currentTimeMillis() + 300; + state = 8; + break; + } else { + state = oldState; + break; + } + } + break; + case 8: + if (this.splashTimer < System.currentTimeMillis() && nativeRestoreContext()) { + assetsReady = true; + nativeOnStart(); + nativeOnResume(); + this.gameRenderer.setDrawFrameListener(null); + z = true; + break; + } + break; + } + GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + GLES20.glClear(16640); + if (this.splash != null) { + this.splash.draw(gl10, this.gameRenderer.getWidth(), this.gameRenderer.getHeight()); + } + if (!z || this.splash == null) { + return; + } + this.splash.destroy(gl10); + this.splash = null; + } + + 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()) { + try { + file.createNewFile(); + } catch (Exception unused) { + } + } + this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.9 + @Override // java.lang.Runnable + public void run() { + GameActivityMain.this.setContentView(GameActivityMain.this.gameGLSurfaceView); + } + }, 20L); + if (hasWindowFocus()) { + state = 8; + return; + } else { + oldState = 8; + state = 7; + return; + } + } + finish(); + 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.(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.(r0) // Catch: java.lang.Exception -> L7f + java.io.BufferedReader r4 = new java.io.BufferedReader // Catch: java.lang.Exception -> L7f + r4.(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.() + 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"); + } + + public void openURL(String str) { + openURLinBrowser(str); + } + + public void openURLinBrowser(String str) { + String replace = str.replace("http://", "https://"); + Log.d("OpenURLinBrowser", replace); + try { + startActivity(new Intent("android.intent.action.VIEW", Uri.parse(replace))); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public float getPerformanceScore() { + String readCpuFile = readCpuFile("present"); + int i = 0; + float f = 0.0f; + if (readCpuFile.length() > 0) { + List parseCpuList = parseCpuList(readCpuFile); + Iterator 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 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; + } + + public boolean needInstallWallpaper() { + Log.i(TAG, "needInstallWallpaper()"); + 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.(r1) + java.lang.String r1 = new java.lang.String + java.lang.StringBuilder r2 = new java.lang.StringBuilder + r2.() + 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.(r2) + r2 = 0 + java.io.File r3 = new java.io.File // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d + r3.(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.(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.(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.() + r3.append(r1) + java.lang.String r1 = "wallpaper.apk" + r3.append(r1) + java.lang.String r1 = r3.toString() + r2.(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 long getUtcTime() { + return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis()); + } + + public int[][] getNotchesBoundingRects() { + DisplayCutout displayCutout; + int[][] iArr = (int[][]) Array.newInstance((Class) int.class, 0, 0); + if (Build.VERSION.SDK_INT < 28 || (displayCutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout()) == null) { + return iArr; + } + List boundingRects = displayCutout.getBoundingRects(); + int[][] iArr2 = (int[][]) Array.newInstance((Class) int.class, boundingRects.size(), 4); + for (int i = 0; i < boundingRects.size(); i++) { + iArr2[i][0] = boundingRects.get(i).left; + iArr2[i][1] = boundingRects.get(i).top; + iArr2[i][2] = boundingRects.get(i).width(); + iArr2[i][3] = boundingRects.get(i).height(); + } + return iArr2; + } + + class FSNode { + + @SerializedName("directory") + public boolean directory; + + @SerializedName("size") + public int size; + + FSNode() { + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java b/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java new file mode 100644 index 0000000..fc96465 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java @@ -0,0 +1,223 @@ +package com.ea.ironmonkey; + +import android.opengl.GLSurfaceView; +import android.os.Build; +import android.view.MotionEvent; +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.egl.EGLContext; +import javax.microedition.khronos.egl.EGLDisplay; + +/* loaded from: classes.dex */ +public class GameGLSurfaceView extends GLSurfaceView { + private static final String TAG = "GameGLSurfaceView"; + private boolean enableHistoricalEvents; + private boolean kMotionEvent_GetSource; + private GameActivityMain mActivity; + + /* JADX INFO: Access modifiers changed from: private */ + public native void nativeTouchPadEvent(int i, int i2, float f, float f2); + + /* JADX INFO: Access modifiers changed from: private */ + public native void nativeTouchScreenEvent(int i, int i2, float f, float f2); + + public GameGLSurfaceView(GameActivityMain gameActivityMain) { + super(gameActivityMain); + this.enableHistoricalEvents = false; + this.kMotionEvent_GetSource = false; + this.mActivity = null; + this.mActivity = gameActivityMain; + try { + MotionEvent.class.getMethod("getSource", new Class[0]); + this.kMotionEvent_GetSource = true; + } catch (Exception unused) { + } + setGLESVersion2(); + setFocusable(true); + setFocusableInTouchMode(true); + if (Build.VERSION.SDK_INT >= 11) { + try { + Log.i(TAG, "setPreserveEGLContextOnPause"); + getClass().getMethod("setPreserveEGLContextOnPause", Boolean.TYPE).invoke(this, false); + Log.e(TAG, "setPreserveEGLContextOnPause(false) success"); + } catch (Exception unused2) { + Log.e(TAG, "setPreserveEGLContextOnPause failed"); + } + } + } + + public void setEnableHistoricalEvents(boolean z) { + this.enableHistoricalEvents = z; + } + + private void setGLESVersion2() { + setEGLContextFactory(new GLSurfaceView.EGLContextFactory() { // from class: com.ea.ironmonkey.GameGLSurfaceView.1 + private static final int EGL_CONTEXT_CLIENT_VERSION = 12440; + + @Override // android.opengl.GLSurfaceView.EGLContextFactory + public EGLContext createContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig) { + return egl10.eglCreateContext(eGLDisplay, eGLConfig, EGL10.EGL_NO_CONTEXT, new int[]{EGL_CONTEXT_CLIENT_VERSION, 2, 12344}); + } + + @Override // android.opengl.GLSurfaceView.EGLContextFactory + public void destroyContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLContext eGLContext) { + egl10.eglDestroyContext(eGLDisplay, eGLContext); + } + }); + setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0)); + } + + @Override // android.view.View + public boolean onTouchEvent(MotionEvent motionEvent) { + GameActivityMain gameActivityMain = this.mActivity; + int i = GameActivityMain.state; + GameActivityMain gameActivityMain2 = this.mActivity; + if (i != 8) { + return true; + } + motionEvent.getHistorySize(); + final int pointerCount = motionEvent.getPointerCount(); + final MotionEvent obtain = MotionEvent.obtain(motionEvent); + queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameGLSurfaceView.2 + @Override // java.lang.Runnable + public void run() { + int i2 = 0; + if (GameGLSurfaceView.this.kMotionEvent_GetSource) { + if (obtain.getSource() == 4098) { + if (obtain.getAction() == 2) { + while (i2 < pointerCount) { + GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2)); + i2++; + } + return; + } else { + int actionIndex = obtain.getActionIndex(); + GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex), obtain.getX(actionIndex), obtain.getY(actionIndex)); + return; + } + } + if (obtain.getSource() == 1048584) { + if (obtain.getAction() == 2) { + while (i2 < pointerCount) { + GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2)); + i2++; + } + return; + } else { + int actionIndex2 = obtain.getActionIndex(); + GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(actionIndex2), obtain.getX(actionIndex2), obtain.getY(actionIndex2)); + return; + } + } + return; + } + if (obtain.getAction() == 2) { + while (i2 < pointerCount) { + GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2)); + i2++; + } + } else { + int actionIndex3 = obtain.getActionIndex(); + GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex3), obtain.getX(actionIndex3), obtain.getY(actionIndex3)); + } + } + }); + return true; + } + + private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser { + private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515; + private static final int EGL_DEPTH_ENCODING_NV = 12514; + protected int mAlphaSize; + protected int mBlueSize; + protected int mDepthSize; + protected int mGreenSize; + protected int mRedSize; + protected int mStencilSize; + private int[] mValue = new int[1]; + + public ConfigChooser(int i, int i2, int i3, int i4, int i5, int i6) { + this.mRedSize = i; + this.mGreenSize = i2; + this.mBlueSize = i3; + this.mAlphaSize = i4; + this.mDepthSize = i5; + this.mStencilSize = i6; + } + + @Override // android.opengl.GLSurfaceView.EGLConfigChooser + public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay) { + int[] iArr = {12352, 4, 12324, 4, 12323, 4, 12322, 4, 12344}; + int[] iArr2 = new int[1]; + egl10.eglChooseConfig(eGLDisplay, iArr, null, 0, iArr2); + int i = iArr2[0]; + if (i <= 0) { + throw new IllegalArgumentException("No configs match configSpec"); + } + EGLConfig[] eGLConfigArr = new EGLConfig[i]; + egl10.eglChooseConfig(eGLDisplay, iArr, eGLConfigArr, i, iArr2); + return chooseConfig(egl10, eGLDisplay, eGLConfigArr); + } + + public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig[] eGLConfigArr) { + EGLConfig eGLConfig = null; + while (true) { + int i = 0; + if (eGLConfig == null) { + int length = eGLConfigArr.length; + while (true) { + if (i >= length) { + break; + } + EGLConfig eGLConfig2 = eGLConfigArr[i]; + int findConfigAttrib = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12325, 0); + int findConfigAttrib2 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12326, 0); + if (findConfigAttrib >= this.mDepthSize && findConfigAttrib2 >= this.mStencilSize) { + int findConfigAttrib3 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12324, 0); + int findConfigAttrib4 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12323, 0); + int findConfigAttrib5 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12322, 0); + int findConfigAttrib6 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12321, 0); + if (findConfigAttrib3 == this.mRedSize && findConfigAttrib4 == this.mGreenSize && findConfigAttrib5 == this.mBlueSize && findConfigAttrib6 == this.mAlphaSize) { + if (findConfigAttrib(egl10, eGLDisplay, eGLConfig2, EGL_DEPTH_ENCODING_NV, 0) == 0) { + eGLConfig = eGLConfig2; + break; + } + eGLConfig = eGLConfig2; + } + } + i++; + } + if (eGLConfig == null) { + if (this.mDepthSize <= 0) { + return null; + } + this.mDepthSize -= 8; + } + } else { + StringBuilder sb = new StringBuilder(); + sb.append("depth="); + EGLConfig eGLConfig3 = eGLConfig; + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12325, 0)); + sb.append(" stencil="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12326, 0)); + sb.append(" red="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12324, 0)); + sb.append(" green="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12323, 0)); + sb.append(" blue="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12322, 0)); + sb.append(" alpha="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12321, 0)); + sb.append(" nonLinear="); + sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, EGL_DEPTH_ENCODING_NV, 0) == EGL_DEPTH_ENCODING_NONLINEAR_NV); + Log.i(GameGLSurfaceView.TAG, sb.toString()); + return eGLConfig; + } + } + } + + private int findConfigAttrib(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig, int i, int i2) { + return egl10.eglGetConfigAttrib(eGLDisplay, eGLConfig, i, this.mValue) ? this.mValue[0] : i2; + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/GameRenderer.java b/app/src/main/java/com/ea/ironmonkey/GameRenderer.java new file mode 100644 index 0000000..04c50e6 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/GameRenderer.java @@ -0,0 +1,54 @@ +package com.ea.ironmonkey; + +import android.opengl.GLSurfaceView; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +/* loaded from: classes.dex */ +public class GameRenderer implements GLSurfaceView.Renderer { + static GL10 _gl; + private int _height; + private int _width; + private GameActivityMain activity; + private DrawFrameListener drawFrameListener; + + public GameRenderer(GameActivityMain gameActivityMain) { + this.activity = gameActivityMain; + } + + public void setDrawFrameListener(DrawFrameListener drawFrameListener) { + this.drawFrameListener = drawFrameListener; + } + + public int getWidth() { + return this._width; + } + + public int getHeight() { + return this._height; + } + + @Override // android.opengl.GLSurfaceView.Renderer + public void onSurfaceCreated(GL10 gl10, EGLConfig eGLConfig) { + this.activity.nativeSurfaceCreated(gl10, eGLConfig); + } + + @Override // android.opengl.GLSurfaceView.Renderer + public void onSurfaceChanged(GL10 gl10, int i, int i2) { + if (gl10 != _gl) { + this.activity.nativeSurfaceChanged(gl10, i, i2); + _gl = gl10; + } + this._width = i; + this._height = i2; + } + + @Override // android.opengl.GLSurfaceView.Renderer + public void onDrawFrame(GL10 gl10) { + if (this.drawFrameListener != null) { + this.drawFrameListener.onDrawFrame(gl10); + } else { + this.activity.getRunLoop().onRunLoopTick(); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/GoogleDrm.java b/app/src/main/java/com/ea/ironmonkey/GoogleDrm.java new file mode 100644 index 0000000..063d2d2 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/GoogleDrm.java @@ -0,0 +1,49 @@ +package com.ea.ironmonkey; + +import android.provider.Settings; +import com.eamobile.licensing.ILicenseServerActivityCallback; +import com.eamobile.licensing.LicenseServerActivity; + +/* loaded from: classes.dex */ +class GoogleDrm implements ILicenseServerActivityCallback { + private GameActivityMain _activity; + private String publicKey; + + public boolean isEnable() { + return false; + } + + public GoogleDrm(GameActivityMain gameActivityMain) { + this._activity = gameActivityMain; + this.publicKey = SkuConfig.NA_BASE64_PUBLIC_KEY; + if (this._activity.getPackageName().endsWith("_row")) { + this.publicKey = SkuConfig.ROW_BASE64_PUBLIC_KEY; + } + } + + public void start() { + LicenseServerActivity.getInstance().initLicenseServerActivity(this._activity, this, this._activity, SkuConfig.SALT, this._activity.getPackageName(), this.publicKey, Settings.Secure.getString(this._activity.getContentResolver(), "android_id")); + } + + public void destroy() { + LicenseServerActivity.getInstance().destroyLicenseServerActvity(); + } + + /* JADX WARN: Unreachable blocks removed: 1, instructions: 2 */ + @Override // com.eamobile.licensing.ILicenseServerActivityCallback + public void onLicenseResultStart() { + GameActivityMain gameActivityMain = this._activity; + LicenseServerActivity.getInstance().LastCheckPointCheck(); + GameActivityMain gameActivityMain2 = this._activity; + gameActivityMain.onResult("GOOGL_DRM", -1); + LicenseServerActivity.getInstance().destroyLicenseServerActvity(); + } + + @Override // com.eamobile.licensing.ILicenseServerActivityCallback + public void onLicenseResultEnd() { + GameActivityMain gameActivityMain = this._activity; + GameActivityMain gameActivityMain2 = this._activity; + gameActivityMain.onResult("GOOGL_DRM", 0); + LicenseServerActivity.getInstance().destroyLicenseServerActvity(); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/Log.java b/app/src/main/java/com/ea/ironmonkey/Log.java new file mode 100644 index 0000000..a2cfeaa --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/Log.java @@ -0,0 +1,46 @@ +package com.ea.ironmonkey; + +/* loaded from: classes.dex */ +public class Log { + private static boolean enable; + + public static void setEnable(boolean z) { + enable = z; + } + + public static void i(String str, String str2) { + if (enable) { + android.util.Log.i(str, str2); + } + } + + public static void e(String str, String str2) { + if (enable) { + android.util.Log.e(str, str2); + } + } + + public static void w(String str, String str2) { + if (enable) { + android.util.Log.w(str, str2); + } + } + + public static void d(String str, String str2) { + if (enable) { + android.util.Log.d(str, str2); + } + } + + public static void v(String str, String str2) { + if (enable) { + android.util.Log.v(str, str2); + } + } + + public static void e(String str, String str2, Exception exc) { + if (enable) { + android.util.Log.e(str, str2, exc); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/MogaController.java b/app/src/main/java/com/ea/ironmonkey/MogaController.java new file mode 100644 index 0000000..196535d --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/MogaController.java @@ -0,0 +1,30 @@ +package com.ea.ironmonkey; + +import com.bda.controller.ControllerListener; +import com.bda.controller.KeyEvent; +import com.bda.controller.MotionEvent; +import com.bda.controller.StateEvent; + +/* loaded from: classes.dex */ +public class MogaController implements ControllerListener { + native void nativeOnKeyEvent(KeyEvent keyEvent); + + native void nativeOnMotionEvent(MotionEvent motionEvent); + + native void nativeOnStateEvent(StateEvent stateEvent); + + @Override // com.bda.controller.ControllerListener + public void onKeyEvent(KeyEvent keyEvent) { + nativeOnKeyEvent(keyEvent); + } + + @Override // com.bda.controller.ControllerListener + public void onMotionEvent(MotionEvent motionEvent) { + nativeOnMotionEvent(motionEvent); + } + + @Override // com.bda.controller.ControllerListener + public void onStateEvent(StateEvent stateEvent) { + nativeOnStateEvent(stateEvent); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/ObbActivity.java b/app/src/main/java/com/ea/ironmonkey/ObbActivity.java new file mode 100644 index 0000000..c38fdc0 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/ObbActivity.java @@ -0,0 +1,489 @@ +package com.ea.ironmonkey; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.AlertDialog; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.ConnectivityManager; +import android.os.Build; +import android.os.Bundle; +import android.os.Messenger; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; +import com.ea.games.nfs13_row.R; +import com.google.android.vending.expansion.downloader.DownloadProgressInfo; +import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; +import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller; +import com.google.android.vending.expansion.downloader.Helpers; +import com.google.android.vending.expansion.downloader.IDownloaderClient; +import com.google.android.vending.expansion.downloader.IDownloaderService; +import com.google.android.vending.expansion.downloader.IStub; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +/* loaded from: classes.dex */ +public class ObbActivity extends Activity implements IDownloaderClient { + static final String LOGTAG = "ObbActivity"; + static final int NOTIFICATION_ID = LOGTAG.hashCode(); + public static String PACKAGE_NAME; + private View RLayout; + private Button mCancel; + private IStub mDownloaderClientStub; + private TextView mMessageText; + private View mMessageView; + private Button mOK; + private Button mPause; + private TextView mProgressText; + private TextView mProgressTextSmall; + private View mProgressView; + private IDownloaderService mRemoteService; + private boolean mShowingMessage; + private int mState; + Bundle m_savedInstanceState; + NotificationManager myNotificationManager; + private boolean isFirstTime3GCheck = true; + private boolean pausedFor3GCheck = false; + private ProgressBar mProgressBar = null; + private long m_TotalDownloadSize = 0; + private boolean mIsDownloading = false; + public ObbActivity mInstance = null; + private boolean mhasFocus = false; + private boolean ENABLE_LOG = true; + private final Runnable HideSystemKeys = new Runnable() { // from class: com.ea.ironmonkey.ObbActivity.6 + @Override // java.lang.Runnable + @TargetApi(18) + public void run() { + if (ObbActivity.this.isAtLeastAPI(19)) { + ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(5894); + } else { + if (!ObbActivity.this.isAtLeastAPI(14) || (ObbActivity.this.getWindow().getDecorView().getSystemUiVisibility() & 1) == 1) { + return; + } + ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(1); + } + } + }; + + public void setUpNotification() { + } + + public void startGameActivity() { + try { + startActivity(new Intent(this, (Class) GameActivityMain.class)); + finish(); + } catch (Exception e) { + logError(e.toString()); + } + } + + private void log(String str) { + if (this.ENABLE_LOG) { + android.util.Log.d(LOGTAG, str); + } + } + + private void logError(String str) { + if (this.ENABLE_LOG) { + android.util.Log.e(LOGTAG, str); + } + } + + @Override // android.app.Activity + protected void onCreate(Bundle bundle) { + requestWindowFeature(1); + super.onCreate(bundle); + log("................onCreate of ObbActivity ............."); + getWindow().setFlags(1024, 1024); + getWindow().addFlags(128); + this.mInstance = this; + setupUI(); + checkAndDownloadFilesIfNeeded(); + } + + @Override // android.app.Activity + protected void onStart() { + log("obbactivity onStart called "); + super.onStart(); + if (this.mDownloaderClientStub != null) { + this.mDownloaderClientStub.connect(this); + } + } + + @Override // android.app.Activity + protected void onResume() { + super.onResume(); + log("obbactivity onResume called "); + } + + @Override // android.app.Activity + protected void onPause() { + super.onPause(); + log("obbactivity on Pause called"); + } + + @Override // android.app.Activity + protected void onStop() { + log("obbactivity onStop called"); + if (this.mDownloaderClientStub != null) { + log("..... disconnected the client stub ....."); + this.mDownloaderClientStub.disconnect(this); + } + super.onStop(); + } + + @Override // android.app.Activity + protected void onDestroy() { + super.onDestroy(); + log("obbactivity on Destroy called "); + } + + private void doTerminate(String str) { + new AlertDialog.Builder(this.mInstance).setMessage(str).setPositiveButton("Ok", new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.1 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + ObbActivity.this.mInstance.finish(); + System.exit(0); + } + }).show(); + } + + public void checkAndDownloadFilesIfNeeded() { + log("obbactivity checkAndDownloadFilesIfNeeded called "); + if (expansionFilesDelivered(true)) { + log("................Main.obb present and hence launching Game Activity................"); + startGameActivity(); + return; + } + log("................ Expansion files were not delivered ................"); + this.mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, DownloaderService.class); + startDownload(); + if (this.mIsDownloading) { + return; + } + startGameActivity(); + } + + public void setupUI() { + setContentView(R.layout.downloader); + this.mProgressBar = (ProgressBar) findViewById(R.id.progressBar); + this.mProgressText = (TextView) findViewById(R.id.statusText); + this.mProgressTextSmall = (TextView) findViewById(R.id.progressText); + this.mMessageText = (TextView) findViewById(R.id.messageText); + this.mMessageView = findViewById(R.id.messageView); + this.mProgressView = findViewById(R.id.progressView); + this.mPause = (Button) findViewById(R.id.pauseButton); + this.mOK = (Button) findViewById(R.id.okButton); + this.mCancel = (Button) findViewById(R.id.cancelButton); + this.mOK.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.2 + @Override // android.view.View.OnClickListener + public void onClick(View view) { + if (ObbActivity.this.mState == 9 || ObbActivity.this.mState == 8) { + ObbActivity.this.mRemoteService.setDownloadFlags(1); + } + if (ObbActivity.this.mRemoteService != null) { + ObbActivity.this.mRemoteService.requestContinueDownload(); + } + } + }); + this.mPause.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.3 + @Override // android.view.View.OnClickListener + public void onClick(View view) { + if (ObbActivity.this.mRemoteService == null) { + return; + } + if (7 == ObbActivity.this.mState) { + ObbActivity.this.mRemoteService.requestContinueDownload(); + ObbActivity.this.mPause.setText(R.string.downloader_Pause); + } else { + ObbActivity.this.mRemoteService.requestPauseDownload(); + } + } + }); + this.mCancel.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.4 + @Override // android.view.View.OnClickListener + public void onClick(View view) { + if (ObbActivity.this.mRemoteService != null) { + ObbActivity.this.mRemoteService.requestAbortDownload(); + } + ObbActivity.this.finish(); + } + }); + } + + @Override // com.google.android.vending.expansion.downloader.IDownloaderClient + public void onDownloadProgress(DownloadProgressInfo downloadProgressInfo) { + log("Download Progress ...........!"); + if (this.isFirstTime3GCheck) { + try { + if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) { + this.isFirstTime3GCheck = false; + if (this.mRemoteService != null) { + this.pausedFor3GCheck = true; + this.mRemoteService.requestPauseDownload(); + showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit); + return; + } + } + } catch (Exception unused) { + logError(".............................error at 3G check............................."); + this.isFirstTime3GCheck = false; + this.pausedFor3GCheck = false; + } + } + if (this.m_TotalDownloadSize == 0) { + this.m_TotalDownloadSize = downloadProgressInfo.mOverallTotal / 1048576; + } + this.mProgressBar.setMax((int) (downloadProgressInfo.mOverallTotal >> 8)); + this.mProgressBar.setProgress((int) (downloadProgressInfo.mOverallProgress >> 8)); + this.mProgressTextSmall.setText((downloadProgressInfo.mOverallProgress / 1048576) + " MB/ " + this.m_TotalDownloadSize + " MB"); + int parseInt = Integer.parseInt(Helpers.getDownloadProgressPercent(downloadProgressInfo.mOverallProgress, downloadProgressInfo.mOverallTotal).replaceAll("[\\D]", "")); + if (parseInt >= 0 && parseInt < 25) { + log("Download Progress 0 .. 25"); + this.mProgressText.setText(R.string.text_0_24); + return; + } + if (parseInt >= 25 && parseInt < 50) { + log("Download Progress 25 .. 49"); + this.mProgressText.setText(R.string.text_25_49); + return; + } + if (parseInt >= 50 && parseInt < 75) { + log("Download Progress 50 .. 75"); + this.mProgressText.setText(R.string.text_50_74); + } else if (parseInt >= 75 && parseInt < 95) { + log("Download Progress 75 .. 95"); + this.mProgressText.setText(R.string.text_75_99); + } else { + log("Download Progress 100 !"); + this.mProgressText.setText(R.string.text_100); + } + } + + @Override // com.google.android.vending.expansion.downloader.IDownloaderClient + public void onDownloadStateChanged(int i) { + if (this.mState != i) { + log("onDownloadStateChanged newstate = " + i); + this.mState = i; + this.mProgressText.setText(Helpers.getDownloaderStringResourceIDFromState(i)); + boolean z = false; + switch (i) { + case 1: + log(".............................STATE_IDLE............................."); + hideMessage(); + z = true; + this.mProgressBar.setIndeterminate(z); + break; + case 2: + case 3: + log(".............................STATE_CONNECTING/STATE_FETCHING_URL............................."); + hideMessage(); + z = true; + this.mProgressBar.setIndeterminate(z); + break; + case 4: + log(".............................STATE_DOWNLOADING............................."); + hideMessage(); + this.mProgressBar.setIndeterminate(z); + break; + case 5: + log(".............................STATE_COMPLETED............................."); + setUpNotification(); + this.mProgressTextSmall.setText(this.m_TotalDownloadSize + "/" + this.m_TotalDownloadSize + " MBs"); + this.mProgressText.setText(R.string.text_100); + this.mProgressBar.setMax(1); + this.mProgressBar.setProgress(1); + disablePauseButton(); + hideMessage(); + this.mIsDownloading = false; + startGameActivity(); + break; + case 6: + case 10: + case 11: + case 13: + case 17: + default: + hideMessage(); + z = true; + this.mProgressBar.setIndeterminate(z); + break; + case 7: + log(".............................STATE_PAUSED_BY_REQUEST............................."); + this.mPause.setText(R.string.downloader_Resume); + if (!this.pausedFor3GCheck) { + hideMessage(); + } else { + this.pausedFor3GCheck = false; + } + this.mProgressBar.setIndeterminate(z); + break; + case 8: + case 9: + log(".............................STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION............................."); + try { + if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) { + this.isFirstTime3GCheck = false; + if (this.mRemoteService != null) { + showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit); + break; + } + } else { + showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit); + } + } catch (Exception unused) { + this.isFirstTime3GCheck = false; + logError(".............................error at 3G check............................."); + showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit); + } + this.mProgressBar.setIndeterminate(z); + break; + case 12: + case 14: + log("............................STATE_PAUSED_ROAMING/STATE_PAUSED_SDCARD_UNAVAILABLE.............................."); + showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit); + this.mProgressBar.setIndeterminate(z); + break; + case 15: + log(".............................License check failed............................."); + showMessage(getString(R.string.license_failed), R.string.downloader_Retry, R.string.downloader_Quit); + this.mProgressBar.setIndeterminate(z); + break; + case 16: + case 18: + case 19: + log(".............................STATE_FAILED............................."); + showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit); + this.mProgressBar.setIndeterminate(z); + break; + } + } + } + + @Override // com.google.android.vending.expansion.downloader.IDownloaderClient + public void onServiceConnected(Messenger messenger) { + this.mRemoteService = DownloaderServiceMarshaller.CreateProxy(messenger); + this.mRemoteService.onClientUpdated(this.mDownloaderClientStub.getMessenger()); + log("............................. onServiceConnected! ............................."); + } + + boolean expansionFilesDelivered(boolean z) { + String expansionAPKFileName = Helpers.getExpansionAPKFileName(this, z, getVersionCode()); + log("expansionFilesDelivered ... " + expansionAPKFileName + "............................."); + long j = 0; + try { + InputStream open = getResources().getAssets().open("obb.size"); + if (open != null) { + try { + j = Long.parseLong(new BufferedReader(new InputStreamReader(open)).readLine()); + } catch (NumberFormatException e) { + logError(e.getMessage()); + } + open.close(); + } + } catch (IOException e2) { + logError(e2.getMessage()); + } + log("checking file " + expansionAPKFileName + " of expected size bytes " + Long.toString(j)); + if (!Helpers.doesFileExist(this, expansionAPKFileName, j, false)) { + log("file " + expansionAPKFileName + "of expected size bytes " + j + "was NOT FOUND"); + return false; + } + log("EXPANSION FILE DELIVERED!"); + return true; + } + + private void startDownload() { + try { + Intent intent = new Intent(this, (Class) ObbActivity.class); + intent.setFlags(335544320); + if (DownloaderClientMarshaller.startDownloadServiceIfRequired(this, PendingIntent.getActivity(this, 0, intent, 134217728), (Class) DownloaderService.class) != 0) { + log(".............................Should start downloading!............................."); + this.mIsDownloading = true; + setRequestedOrientation(0); + return; + } + log(".............................No download required!............................."); + } catch (PackageManager.NameNotFoundException e) { + logError(".............................Cannot find package " + e.toString()); + } + } + + public void showMessage(String str, int i, int i2) { + if (!this.mShowingMessage) { + this.mMessageView.setVisibility(0); + this.mProgressView.setVisibility(8); + log("SHOW MESSAGE " + str + " b1: " + i + " b2: " + i2); + this.mShowingMessage = true; + } + this.mMessageText.setText(str); + this.mOK.setText(i); + this.mCancel.setText(i2); + } + + public void hideMessage() { + if (this.mShowingMessage) { + this.mMessageView.setVisibility(8); + this.mProgressView.setVisibility(0); + this.mShowingMessage = false; + } + } + + public int getVersionCode() { + try { + return getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; + } catch (PackageManager.NameNotFoundException unused) { + logError(".............................Cannot read value in manifest. Expected android:versionCode............................."); + return 0; + } + } + + public void disablePauseButton() { + this.mPause.setClickable(false); + } + + @TargetApi(18) + private void setupSystemUiVisibility() { + if (isAtLeastAPI(19)) { + getWindow().addFlags(33554432); + getWindow().addFlags(134217728); + } + if (isAtLeastAPI(14)) { + getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { // from class: com.ea.ironmonkey.ObbActivity.5 + @Override // android.view.View.OnSystemUiVisibilityChangeListener + public void onSystemUiVisibilityChange(int i) { + if (ObbActivity.this.mhasFocus) { + ObbActivity.this.onSystemUiVisibilityChanged(); + } + } + }); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onSystemUiVisibilityChanged() { + ((LinearLayout) findViewById(R.id.OBBLayout)).postDelayed(this.HideSystemKeys, 1000L); + } + + public boolean isAtLeastAPI(int i) { + return Build.VERSION.SDK_INT >= i; + } + + @Override // android.app.Activity, android.view.Window.Callback + public void onWindowFocusChanged(boolean z) { + log("................onWindowFocusChanged to ............." + z); + super.onWindowFocusChanged(z); + this.mhasFocus = z; + if (this.mhasFocus) { + onSystemUiVisibilityChanged(); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/ObbHelper.java b/app/src/main/java/com/ea/ironmonkey/ObbHelper.java new file mode 100644 index 0000000..d70e465 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/ObbHelper.java @@ -0,0 +1,14 @@ +package com.ea.ironmonkey; + +import android.content.Context; +import com.google.android.vending.expansion.downloader.Helpers; + +/* loaded from: classes.dex */ +class ObbHelper { + ObbHelper() { + } + + public static String getObbFileName(Context context, int i) { + return Helpers.getExpansionAPKFileName(context, true, i); + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/PermissionsActivity.java b/app/src/main/java/com/ea/ironmonkey/PermissionsActivity.java new file mode 100644 index 0000000..fe396a0 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/PermissionsActivity.java @@ -0,0 +1,132 @@ +package com.ea.ironmonkey; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; +import android.view.KeyEvent; +import com.ea.games.nfs13_row.R; + +/* loaded from: classes.dex */ +public class PermissionsActivity extends Activity { + private static final int PERMISSIONS_REQUEST = 3; + + protected void onCreate() { + if (Build.VERSION.SDK_INT >= 23) { + checkPermissions(); + } else { + initActivity(); + } + } + + public void checkPermissions() { + if (Build.VERSION.SDK_INT >= 23) { + if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) { + if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) { + showPermissionDialog(false); + return; + } else { + requestSecurityPermissions(); + return; + } + } + initActivity(); + return; + } + initActivity(); + } + + @Override // android.app.Activity + public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { + if (i != 3) { + return; + } + if (iArr.length == 1 && iArr[0] == 0) { + initActivity(); + } else { + showPermissionDialog(true); + } + } + + private void showPermissionDialog(final boolean z) { + runOnUiThread(new Runnable() { // from class: com.ea.ironmonkey.PermissionsActivity.1 + @Override // java.lang.Runnable + public void run() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(R.string.STR_PERMISSION_TEXT); + builder.setPositiveButton(R.string.STR_PERMISSION_OK, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.1 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + if (!z) { + PermissionsActivity.this.requestSecurityPermissions(); + return; + } + Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + PermissionsActivity.this.getPackageName())); + intent.addFlags(8388608); + PermissionsActivity.this.startActivityForResult(intent, 3); + } + }); + builder.setNegativeButton(R.string.STR_PERMISSION_CANCEL, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.2 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + PermissionsActivity.this.finish(); + } + }); + AlertDialog create = builder.create(); + create.setCanceledOnTouchOutside(false); + create.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + if (i != 4) { + return true; + } + PermissionsActivity.this.finish(); + dialogInterface.dismiss(); + return true; + } + }); + create.show(); + } + }); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void requestSecurityPermissions() { + ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 3); + } + + @Override // android.app.Activity + public void onCreate(Bundle bundle) { + super.onCreate(bundle); + onCreate(); + } + + @Override // android.app.Activity + public void onActivityResult(int i, int i2, Intent intent) { + super.onActivityResult(i, i2, intent); + if (i == 3) { + if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) { + initActivity(); + return; + } else { + showPermissionDialog(true); + return; + } + } + initActivity(); + } + + private void initActivity() { + try { + startActivity(new Intent(this, (Class) ObbActivity.class)); + finish(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/RunLoop.java b/app/src/main/java/com/ea/ironmonkey/RunLoop.java new file mode 100644 index 0000000..33a340c --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/RunLoop.java @@ -0,0 +1,57 @@ +package com.ea.ironmonkey; + +import android.opengl.GLSurfaceView; + +/* loaded from: classes.dex */ +public class RunLoop { + public static final int STATE_RUNNING = 1; + public static final int STATE_STOPPED = 0; + private GLSurfaceView glSurfaceView; + private int state; + + private native void nativeOnRunLoopTick(); + + public RunLoop(GLSurfaceView gLSurfaceView) { + this.glSurfaceView = gLSurfaceView; + updateRenderMode(); + } + + public int getState() { + return this.state; + } + + public void start() { + setState(1); + } + + public void stop() { + setState(0); + } + + public void join() { + setState(0); + } + + private void setState(int i) { + this.state = i; + updateRenderMode(); + } + + private void updateRenderMode() { + Log.v("RunLoop", "RunLoop.state = " + this.state); + switch (this.state) { + case 0: + this.glSurfaceView.setRenderMode(0); + break; + case 1: + this.glSurfaceView.setRenderMode(1); + break; + } + } + + public void onRunLoopTick() { + if (this.state == 1) { + nativeOnRunLoopTick(); + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/SkuConfig.java b/app/src/main/java/com/ea/ironmonkey/SkuConfig.java new file mode 100644 index 0000000..a129ca6 --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/SkuConfig.java @@ -0,0 +1,8 @@ +package com.ea.ironmonkey; + +/* loaded from: classes.dex */ +public class SkuConfig { + public static final String NA_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsPSqZyfa7iZ9DOslXqDVPiyjsIjCCCDsp1x4pcuH9gFiivyVWhIAHrfMdLlg+6UmlbUoSyKwNRUKJA+H5N/L792/PewpOe2yXSvsqtdROJ12O34q8DPC2D7ezL8M/Io3bp9x18u/D5lf2PEQq4uBNEV1W1iK3PtsdWdpmNKMvnPDQXT3vciWdKa1R0g2xRHCXEK2Ft1Tlkx38ejAAmYvpvoP2e8IqnlwH2fz89G5nxnKdmGop1mz4KTZ8REmBCnmTb07fRkSd4N7S64W2zu8lktMUUbGvCmRbt4zE48AzXEWmyHNW+mqx+IUKyK5wHObnDM9RSwKLWsDe++rrGgROQIDAQAB"; + public static final String ROW_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjDe1oWKcLp/Rtm1ezKa9G+fHdqKvWExNR1aYuudU5VGX9gTby6w8UPKLHXeWxuOq2mS2hWxjIXVsOanspXWJbnBaqydpXmNz+0qZ0K6VlEiL7YvVL9KHNpVAck1bz4toLrmrjM6E/RyphBl+3W5+XSGOJ4Z3dabuz/TQdgNlYAr9nd1NlLg8S2Pu1FsFygy79kpwKBDZFUiCTDwzmGgLSetFnOfr0NwC+NnF/bEB6gE3REcdtT0zyFj0SR8ZWIKRvRPu5BYXe9nKguLN0AUvshXm/MjhrxKmRWTjTTKZkax+f3zFut/yq8UDxMwGA15Ex60xkCcELgCcNPBrWdFDtQIDAQAB"; + public static final byte[] SALT = {13, -1, 23, -45, 11, -28, 56, -1, -14, 24, -12, 98, -13, 49, 11, 15, -27, 93, 86, -24}; +} diff --git a/app/src/main/java/com/ea/ironmonkey/SplashScreen.java b/app/src/main/java/com/ea/ironmonkey/SplashScreen.java new file mode 100644 index 0000000..a171aea --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/SplashScreen.java @@ -0,0 +1,171 @@ +package com.ea.ironmonkey; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.opengl.GLES20; +import android.opengl.GLUtils; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import javax.microedition.khronos.opengles.GL10; + +/* loaded from: classes.dex */ +public class SplashScreen { + private static final String TAG = "SplashScreen"; + private static final int floatSize = 4; + private Activity _activity; + private int _attPosition; + private int _attSampler; + private int _attTexCoord; + private int _fragmentShader; + private int _program; + private int _vertexShader; + private FloatBuffer vBuffer; + private final String vShaderStr = "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n"; + private final String fShaderStr = "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n"; + private int[] _textureId = new int[1]; + + public SplashScreen(Activity activity) { + this._activity = activity; + } + + public void init(GL10 gl10, int i, int i2) { + Bitmap bitmap; + if (!initRenderer()) { + destroy(gl10); + return; + } + GLES20.glGetError(); + GLES20.glGenTextures(1, this._textureId, 0); + GLES20.glBindTexture(3553, this._textureId[0]); + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inPreferredConfig = Bitmap.Config.ARGB_4444; + try { + bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options); + } catch (Exception e) { + Log.e(TAG, "loadBitmap ", e); + bitmap = null; + } + GLUtils.texImage2D(3553, 0, bitmap, 0); + GLES20.glTexParameterf(3553, 10241, 9729.0f); + GLES20.glTexParameterf(3553, 10240, 9729.0f); + GLES20.glTexParameterf(3553, 10242, 33071.0f); + GLES20.glTexParameterf(3553, 10243, 33071.0f); + bitmap.recycle(); + int glGetError = GLES20.glGetError(); + if (glGetError != 0) { + Log.e(TAG, "Texture Load GLError: " + glGetError); + destroy(gl10); + } + } + + private boolean initRenderer() { + this._vertexShader = LoadShader(35633, "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n"); + this._fragmentShader = LoadShader(35632, "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n"); + this._program = GLES20.glCreateProgram(); + if (this._program == 0 || this._vertexShader == 0 || this._fragmentShader == 0) { + Log.e(TAG, "InitRender() - fail\n"); + return false; + } + GLES20.glAttachShader(this._program, this._vertexShader); + GLES20.glAttachShader(this._program, this._fragmentShader); + GLES20.glLinkProgram(this._program); + int[] iArr = new int[1]; + GLES20.glGetProgramiv(this._program, 35714, iArr, 0); + if (iArr[0] == 0) { + Log.e(TAG, "InitRender() - fail link program"); + Log.e(TAG, GLES20.glGetProgramInfoLog(this._program)); + GLES20.glDeleteProgram(this._program); + this._program = 0; + return false; + } + this._attPosition = GLES20.glGetAttribLocation(this._program, "a_position"); + this._attTexCoord = GLES20.glGetAttribLocation(this._program, "a_texCoord"); + this._attSampler = GLES20.glGetAttribLocation(this._program, "s_texture"); + return true; + } + + private int LoadShader(int i, String str) { + int glCreateShader = GLES20.glCreateShader(i); + if (glCreateShader == 0) { + Log.e(TAG, "LoadShader(" + i + ", " + str + " - create shader fail\n"); + return 0; + } + GLES20.glShaderSource(glCreateShader, str); + GLES20.glCompileShader(glCreateShader); + int[] iArr = new int[1]; + GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0); + if (iArr[0] != 0) { + return glCreateShader; + } + Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n"); + GLES20.glDeleteShader(glCreateShader); + Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader)); + return 0; + } + + public boolean draw(GL10 gl10, int i, int i2) { + float f; + if (this._textureId[0] == 0) { + return false; + } + float f2 = 0.8f; + if (i > i2) { + f2 = (i2 / i) * 0.8f; + f = 0.8f; + } else { + f = (i / i2) * 0.8f; + } + float f3 = -f2; + float f4 = -f; + float[][] fArr = {new float[]{f3, f4, 0.0f, 1.0f, f2, f4, 1.0f, 1.0f, f3, f, 0.0f, 0.0f, f2, f, 1.0f, 0.0f}, new float[]{f3, f4, 1.0f, 1.0f, f2, f4, 1.0f, 0.0f, f3, f, 0.0f, 1.0f, f2, f, 0.0f, 0.0f}}; + this.vBuffer = ByteBuffer.allocateDirect(fArr[0].length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); + if (i < i2) { + this.vBuffer.put(fArr[1]); + } else { + this.vBuffer.put(fArr[0]); + } + GLES20.glViewport(0, 0, i, i2); + GLES20.glUseProgram(this._program); + GLES20.glEnable(3553); + GLES20.glActiveTexture(33984); + GLES20.glBindTexture(3553, this._textureId[0]); + GLES20.glUniform1i(this._attSampler, 0); + this.vBuffer.position(0); + GLES20.glVertexAttribPointer(this._attPosition, 2, 5126, false, 16, (Buffer) this.vBuffer); + GLES20.glEnableVertexAttribArray(this._attPosition); + this.vBuffer.position(2); + GLES20.glVertexAttribPointer(this._attTexCoord, 2, 5126, false, 16, (Buffer) this.vBuffer); + GLES20.glEnableVertexAttribArray(this._attTexCoord); + GLES20.glDrawArrays(5, 0, 4); + GLES20.glDisableVertexAttribArray(this._attPosition); + GLES20.glDisableVertexAttribArray(this._attTexCoord); + GLES20.glUseProgram(0); + return true; + } + + public void destroy(GL10 gl10) { + if (this._textureId[0] != 0) { + GLES20.glDeleteTextures(1, this._textureId, 0); + this._textureId[0] = 0; + } + if (this._program != 0) { + GLES20.glDeleteProgram(this._program); + this._program = 0; + } + if (this._vertexShader != 0) { + GLES20.glDeleteShader(this._vertexShader); + this._vertexShader = 0; + } + if (this._fragmentShader != 0) { + GLES20.glDeleteShader(this._fragmentShader); + this._fragmentShader = 0; + } + if (this.vBuffer != null) { + this.vBuffer.clear(); + this.vBuffer = null; + } + } +} diff --git a/app/src/main/java/com/ea/ironmonkey/WebActivity.java b/app/src/main/java/com/ea/ironmonkey/WebActivity.java new file mode 100644 index 0000000..3f24d6b --- /dev/null +++ b/app/src/main/java/com/ea/ironmonkey/WebActivity.java @@ -0,0 +1,149 @@ +package com.ea.ironmonkey; + +import android.app.Activity; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; +import com.ea.games.nfs13_row.R; +import java.util.Locale; + +/* loaded from: classes.dex */ +public class WebActivity extends Activity { + public static String m_Language; + private static volatile Runnable m_RunnableBuildAndShowHTML; + public static String m_URL; + public static boolean m_bWorkingState; + private Bitmap backButton; + private Bitmap backButtonPressed; + private ImageView backImage; + private String m_PageURL = null; + private ProgressBar m_progressBar = null; + final Handler progressHandler = new Handler() { // from class: com.ea.ironmonkey.WebActivity.1 + @Override // android.os.Handler + public void handleMessage(Message message) { + WebActivity.this.setProgress(message.arg1); + WebActivity.this.m_progressBar.setProgress(message.arg1); + } + }; + private WebView webview; + + @Override // android.app.Activity + public void onCreate(Bundle bundle) { + m_bWorkingState = true; + super.onCreate(bundle); + requestWindowFeature(2); + getWindow().setFlags(1024, 1024); + setRequestedOrientation(0); + requestWindowFeature(1); + setProgressBarVisibility(true); + setContentView(R.layout.webview); + this.webview = (WebView) findViewById(R.id.mainWebView); + this.webview.getSettings().setJavaScriptEnabled(true); + this.m_progressBar = (ProgressBar) findViewById(R.id.progressBarWeb); + this.backButton = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back); + this.backButtonPressed = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back_pressed); + this.backImage = (ImageView) findViewById(R.id.backButton); + this.backImage.setOnTouchListener(new View.OnTouchListener() { // from class: com.ea.ironmonkey.WebActivity.2 + @Override // android.view.View.OnTouchListener + public boolean onTouch(View view, MotionEvent motionEvent) { + if (motionEvent.getAction() == 0) { + WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButtonPressed); + return false; + } + if (motionEvent.getAction() != 1) { + return false; + } + WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButton); + return false; + } + }); + this.backImage.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.WebActivity.3 + @Override // android.view.View.OnClickListener + public void onClick(View view) { + WebActivity.m_bWorkingState = false; + WebActivity.this.finish(); + } + }); + Bundle extras = getIntent().getExtras(); + String string = extras.getString("URL"); + this.m_PageURL = string; + m_URL = string; + String string2 = extras.getString("Language"); + m_Language = string2; + if (string2 != null) { + try { + Configuration configuration = new Configuration(getResources().getConfiguration()); + configuration.locale = new Locale(string2); + ((TextView) findViewById(R.id.appName)).setText(new Resources(getResources().getAssets(), getResources().getDisplayMetrics(), configuration).getString(R.string.app_full_name)); + } catch (Throwable unused) { + } + } + this.webview.setWebChromeClient(new WebChromeClient() { // from class: com.ea.ironmonkey.WebActivity.4 + @Override // android.webkit.WebChromeClient + public void onProgressChanged(WebView webView, int i) { + Message obtainMessage = WebActivity.this.progressHandler.obtainMessage(); + obtainMessage.arg1 = i; + WebActivity.this.progressHandler.sendMessage(obtainMessage); + } + }); + this.webview.setWebViewClient(new WebViewClient() { // from class: com.ea.ironmonkey.WebActivity.5 + @Override // android.webkit.WebViewClient + public void onPageFinished(WebView webView, String str) { + WebActivity.this.m_progressBar.setVisibility(8); + } + + @Override // android.webkit.WebViewClient + public void onReceivedError(WebView webView, int i, String str, String str2) { + Toast.makeText(WebActivity.this, "Error ! " + str, 0).show(); + } + }); + m_RunnableBuildAndShowHTML = new Runnable() { // from class: com.ea.ironmonkey.WebActivity.6 + @Override // java.lang.Runnable + public void run() { + WebActivity.this.BuildAndShowHTML(); + } + }; + runOnUiThread(m_RunnableBuildAndShowHTML); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void BuildAndShowHTML() { + if (this.m_PageURL != null) { + this.webview.loadUrl(this.m_PageURL); + } + } + + @Override // android.app.Activity, android.view.KeyEvent.Callback + public boolean onKeyDown(int i, KeyEvent keyEvent) { + if (i == 4) { + this.backImage.setImageBitmap(this.backButtonPressed); + return true; + } + return super.onKeyDown(i, keyEvent); + } + + @Override // android.app.Activity, android.view.KeyEvent.Callback + public boolean onKeyUp(int i, KeyEvent keyEvent) { + if (i == 4) { + this.backImage.setImageBitmap(this.backButton); + m_bWorkingState = false; + finish(); + return true; + } + return super.onKeyUp(i, keyEvent); + } +} diff --git a/app/src/main/java/com/ea/nimble/ApplicationEnvironment.java b/app/src/main/java/com/ea/nimble/ApplicationEnvironment.java new file mode 100644 index 0000000..8859f69 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ApplicationEnvironment.java @@ -0,0 +1,44 @@ +package com.ea.nimble; + +import android.app.Activity; + +/* loaded from: classes.dex */ +public class ApplicationEnvironment { + public static final String COMPONENT_ID = "com.ea.nimble.applicationEnvironment"; + public static final String NIMBLE_PARAMETER_ANDROID_ID = "androidId"; + public static final String NIMBLE_PARAMETER_ATTRIBUTION_DATA = "attributionData"; + public static final String NIMBLE_PARAMETER_COUNTRY_CODE = "countryCode"; + public static final String NIMBLE_PARAMETER_DEVICE_BRAND = "deviceBrand"; + public static final String NIMBLE_PARAMETER_DEVICE_CODENAME = "deviceCodename"; + public static final String NIMBLE_PARAMETER_DEVICE_LANGUAGE = "deviceLanguage"; + public static final String NIMBLE_PARAMETER_DEVICE_LOCALE = "deviceLocale"; + public static final String NIMBLE_PARAMETER_DEVICE_MODEL = "deviceModel"; + public static final String NIMBLE_PARAMETER_FB_ATTR_ID = "fbAttrId"; + public static final String NIMBLE_PARAMETER_GAID = "gaid"; + public static final String NIMBLE_PARAMETER_IMEI = "imei"; + public static final String NIMBLE_PARAMETER_LIMIT_AD_TRACKING = "limitAdTracking"; + public static final String NIMBLE_PARAMETER_PLATFORM = "platform"; + public static final String NIMBLE_PARAMETER_SYSTEM_NAME = "systemName"; + public static final String NIMBLE_PARAMETER_SYSTEM_VERSION = "systemVersion"; + public static final String NOTIFICATION_AGE_COMPLIANCE_REFRESHED = "nimble.notification.age_compliance_refreshed"; + + public static IApplicationEnvironment getComponent() { + return BaseCore.getInstance().getApplicationEnvironment(); + } + + public static Activity getCurrentActivity() { + return ApplicationEnvironmentImpl.getCurrentActivity(); + } + + public static void setCurrentActivity(Activity activity) { + ApplicationEnvironmentImpl.setCurrentActivity(activity); + } + + public static boolean isMainApplicationRunning() { + return ApplicationEnvironmentImpl.isMainApplicationRunning(); + } + + public static boolean isMainApplicationActive() { + return ApplicationEnvironmentImpl.isMainApplicationActive(); + } +} diff --git a/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java b/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java new file mode 100644 index 0000000..81507d1 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java @@ -0,0 +1,1115 @@ +package com.ea.nimble; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.database.Cursor; +import android.net.Uri; +import android.os.Build; +import android.provider.Settings; +import android.telephony.TelephonyManager; +import android.util.Patterns; +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Currency; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class ApplicationEnvironmentImpl extends Component implements IApplicationEnvironment, LogSource { + private static final String KEY_GAME_PLAYER_ID = "gamePlayerId"; + private static final int MILLIS_IN_AN_HOUR = 3600000; + private static final String NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID = "nimble_applicationenvironment_game_specified_id"; + private static final String PERSISTENCE_AGE_REQUIREMENTS = "ageRequirement"; + private static final String PERSISTENCE_ATTRIBUTION_DATA = "attributionData"; + private static final String PERSISTENCE_LANGUAGE = "language"; + private static final String PERSISTENCE_TIME_RETRIEVED = "timeRetrieved"; + private static final String SUPERUSER_APK_LOCATION = "/system/app/Superuser.apk"; + private static final String SYNERGY_API_GET_AGE_REQUIREMENTS = "/rest/agerequirements/ip"; + private static boolean isMainApplicationActive; + private static boolean isMainApplicationRunning; + private static Activity s_currentActivity; + private List m_advertisingIdCallbacks; + private String m_androidId; + private BroadcastReceiver m_attributionDataNetworkListener; + private Context m_context; + private BaseCore m_core; + private String m_language; + private BroadcastReceiver m_networkListener; + private String m_packageId; + private Map m_parameters; + private Map m_playerIdMap; + private InstallReferrerClient m_referrerClient; + private String m_version; + private String m_advertisingId = null; + private boolean m_limitAdTrackingEnabled = true; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return ApplicationEnvironment.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "AppEnv"; + } + + ApplicationEnvironmentImpl(BaseCore baseCore) { + if (s_currentActivity == null) { + throw new AssertionError("Cannot create a ApplicationEnvironment without a valid current activity"); + } + this.m_core = baseCore; + this.m_context = s_currentActivity.getApplicationContext(); + this.m_language = null; + this.m_playerIdMap = new HashMap(); + this.m_parameters = generateParameterDictionary(); + String documentPath = getDocumentPath(); + File file = documentPath != null ? new File(documentPath) : null; + File file2 = new File(getTempPath()); + if (file == null || ((!file.exists() && !file.mkdirs()) || (!file2.exists() && !file2.mkdirs()))) { + throw new AssertionError("APP_ENV: Cannot create necessary folder"); + } + File[] listFiles = file2.listFiles(); + if (listFiles != null) { + for (File file3 : listFiles) { + if (file3.delete()) { + android.util.Log.d(Global.NIMBLE_ID, "APP_ENV: Delete temp file " + file3.getName()); + } + } + } + this.m_androidId = Settings.Secure.getString(this.m_context.getContentResolver(), "android_id"); + } + + private Map generateParameterDictionary() { + Log.Helper.LOGFUNC(this); + HashMap hashMap = new HashMap(); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, Utility.safeString(Settings.Secure.getString(this.m_context.getContentResolver(), "android_id"))); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_NAME, "Android"); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_VERSION, Build.VERSION.RELEASE); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_PLATFORM, "android"); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_CODENAME, Build.DEVICE); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_MODEL, Build.MODEL); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_BRAND, Build.BRAND); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LANGUAGE, Utility.safeString(Locale.getDefault().getLanguage())); + 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]); + } + } + try { + Cursor query = this.m_context.getContentResolver().query(Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider"), null, null, null, null); + if (query != null) { + query.moveToFirst(); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_FB_ATTR_ID, query.getString(0)); + query.close(); + } + } catch (Exception e) { + Log.Helper.LOGI(this, e.toString(), new Object[0]); + } + return hashMap; + } + + @Override // com.ea.nimble.Component + protected void setup() { + Log.Helper.LOGD(this, "Setting application to active in setup", new Object[0]); + isMainApplicationActive = true; + this.m_context = s_currentActivity.getApplicationContext(); + retrieveAdvertisingIdImpl(null); + } + + @Override // com.ea.nimble.Component + protected void resume() { + Log.Helper.LOGD(this, "Setting application to active in resume", new Object[0]); + isMainApplicationActive = true; + retrieveAdvertisingIdImpl(null); + } + + @Override // com.ea.nimble.Component + protected void restore() { + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + setApplicationLanguageCode(getDeviceLanguage(), true); + Log.Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't read Game Specified Player ID or Language from Persistence", new Object[0]); + } else { + String stringValue = persistenceForNimbleComponent.getStringValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID); + if (Utility.validString(stringValue)) { + Log.Helper.LOGDS("ApplicationEnvironment", "Current game specified player ID is empty, reload from persistence", new Object[0]); + setPlayerId(KEY_GAME_PLAYER_ID, stringValue); + } + String stringValue2 = persistenceForNimbleComponent.getStringValue(PERSISTENCE_LANGUAGE); + if (Utility.validString(stringValue2)) { + this.m_language = stringValue2; + Log.Helper.LOGD(this, "Restored language %s from persistence.", this.m_language); + } else { + Log.Helper.LOGD(this, "Unable to restore language from persistence. Setting language to device language.", new Object[0]); + setApplicationLanguageCode(getDeviceLanguage(), true); + } + } + requestAttributionData(); + } + + @Override // com.ea.nimble.Component + protected void suspend() { + Log.Helper.LOGD(this, "Setting application to NOT active in suspend", new Object[0]); + isMainApplicationActive = false; + this.m_advertisingId = null; + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGD(this, "Setting application to NOT active in teardown", new Object[0]); + this.m_context = null; + isMainApplicationActive = false; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public Context getApplicationContext() { + return this.m_context; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getApplicationVersion() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_version == null) { + Context applicationContext = getApplicationContext(); + if (applicationContext == null) { + return null; + } + try { + PackageManager packageManager = applicationContext.getPackageManager(); + if (packageManager == null) { + Log.Helper.LOGE(this, "PackageManager could not be obtained", new Object[0]); + return null; + } + this.m_version = packageManager.getPackageInfo(applicationContext.getPackageName(), 0).versionName; + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGE(this, "Package name %s not found", applicationContext.getPackageName()); + return null; + } + } + return this.m_version; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getApplicationLanguageCode() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_language; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getShortApplicationLanguageCode() { + int indexOf; + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_language != null && (indexOf = this.m_language.indexOf(45)) != -1) { + return this.m_language.substring(0, indexOf); + } + return this.m_language; + } + + private String validatedLanguageCode(String str, boolean z) { + Log.Helper.LOGFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGI(this, "AppEnv: Language parameter is null or empty; keeping language at previous value.", new Object[0]); + return null; + } + String replace = str.replace('_', '-'); + Matcher matcher = Pattern.compile("^([a-z]{2,3})?(-([A-Z][a-z]{3}))?(-([A-Z]{2}))?(-.*)*$").matcher(replace); + if (matcher.find()) { + String group = matcher.group(1); + if (Utility.validString(group)) { + if (group.equals("iw")) { + group = "he"; + } else if (group.equals("in")) { + group = "id"; + } else if (group.equals("ji")) { + group = "yi"; + } + if (!Arrays.asList(Locale.getISOLanguages()).contains(group)) { + Log.Helper.LOGE(this, "Unknown language code " + group + " in language code " + replace + "; backend system will likely treat it as en-US.", new Object[0]); + } + } + String group2 = matcher.group(5); + if (Utility.validString(group2) && !Arrays.asList(Locale.getISOCountries()).contains(group2)) { + Log.Helper.LOGE(this, "Unknown region code " + group2 + " in language code " + replace + "; backend system will likely treat it as en-US.", new Object[0]); + } + return replace; + } + Log.Helper.LOGE(this, "Malformed language code " + replace + " cannot be validated; backend system will likely treat it as en-US.", new Object[0]); + return replace; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void setApplicationLanguageCode(String str) { + Log.Helper.LOGPUBLICFUNC(this); + setApplicationLanguageCode(str, false); + } + + private void setApplicationLanguageCode(String str, boolean z) { + Log.Helper.LOGFUNC(this); + String validatedLanguageCode = validatedLanguageCode(str, z); + if (validatedLanguageCode == null) { + return; + } + if (this.m_language == null || !this.m_language.equals(validatedLanguageCode)) { + this.m_language = validatedLanguageCode; + Log.Helper.LOGI(this, "Successfully set language to %s.", this.m_language); + Utility.sendBroadcast(Global.NOTIFICATION_LANGUAGE_CHANGE); + } else if (z) { + Log.Helper.LOGD(this, "Setting the same language %s, skipping assignment", this.m_language); + return; + } + if (z) { + return; + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + Log.Helper.LOGD(this, "Saving language data to persistence.", new Object[0]); + persistenceForNimbleComponent.setValue(PERSISTENCE_LANGUAGE, this.m_language); + } else { + Log.Helper.LOGE(this, "Could not get application environment persistence object to save to.", new Object[0]); + } + } + + private String getDeviceLanguage() { + Log.Helper.LOGFUNC(this); + return Locale.getDefault().toString(); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDocumentPath() { + String path; + Log.Helper.LOGPUBLICFUNC(this); + Context applicationContext = getApplicationContext(); + if (applicationContext == null) { + path = System.getProperty("user.dir") + File.separator + "doc"; + } else { + File filesDir = applicationContext.getFilesDir(); + if (filesDir != null) { + path = filesDir.getPath(); + } else { + Log.Helper.LOGE(this, "Could not build files path", new Object[0]); + return null; + } + } + return path + File.separator + Global.NIMBLE_ID + File.separator + this.m_core.getConfiguration().toString(); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getCachePath() { + String path; + Log.Helper.LOGPUBLICFUNC(this); + Context applicationContext = getApplicationContext(); + if (applicationContext == null) { + path = System.getProperty("user.dir") + File.separator + "cache"; + } else { + File cacheDir = applicationContext.getCacheDir(); + if (cacheDir != null) { + path = cacheDir.getPath(); + } else { + Log.Helper.LOGE(this, "Could not build cache path", new Object[0]); + return null; + } + } + return path + File.separator + Global.NIMBLE_ID + File.separator + this.m_core.getConfiguration().toString(); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getTempPath() { + Log.Helper.LOGPUBLICFUNC(this); + return getCachePath() + File.separator + "temp"; + } + + @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; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getApplicationBundleId() { + Context applicationContext; + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_packageId == null && (applicationContext = getApplicationContext()) != null) { + this.m_packageId = applicationContext.getPackageName(); + } + return this.m_packageId; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceString() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.MANUFACTURER + Build.MODEL; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceCodename() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.DEVICE; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceManufacturer() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.MANUFACTURER; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceModel() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.MODEL; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceBrand() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.BRAND; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getDeviceFingerprint() { + Log.Helper.LOGPUBLICFUNC(this); + return Build.FINGERPRINT; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getOsVersion() { + Log.Helper.LOGPUBLICFUNC(this); + return String.valueOf(Build.VERSION.SDK_INT); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getApplicationName() { + PackageManager packageManager; + Log.Helper.LOGPUBLICFUNC(this); + Context applicationContext = getApplicationContext(); + if (applicationContext == null || (packageManager = applicationContext.getPackageManager()) == null) { + return null; + } + return packageManager.getApplicationLabel(applicationContext.getApplicationInfo()).toString(); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public 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; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public boolean isAppCracked() { + Log.Helper.LOGPUBLICFUNC(this); + Log.Helper.LOGDS("FraudDetection", "Returning false for isAppCracked() since it hasn't been implemented yet", new Object[0]); + return false; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public boolean isDeviceRooted() { + Log.Helper.LOGPUBLICFUNC(this); + String str = Build.TAGS; + return (str != null && str.contains("test-keys")) || new File(SUPERUSER_APK_LOCATION).exists() || commandExists("su"); + } + + private static boolean commandExists(String str) { + Log.Helper.LOGFUNCS("BaseCore"); + String str2 = System.getenv("PATH"); + if (str2 == null) { + return false; + } + for (String str3 : str2.split(Pattern.quote(File.pathSeparator))) { + if (new File(str3, str).exists()) { + return true; + } + } + return false; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public int getAgeCompliance() { + Serializable serializable; + Log.Helper.LOGPUBLICFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE); + if (persistenceForNimbleComponent != null) { + serializable = persistenceForNimbleComponent.getValue(PERSISTENCE_TIME_RETRIEVED); + } else { + Log.Helper.LOGE(this, "Could not get persistence object", new Object[0]); + serializable = null; + } + if (serializable != null) { + if (((int) (new Date().getTime() - ((Long) serializable).longValue())) / MILLIS_IN_AN_HOUR > 24) { + Log.Helper.LOGI(this, "getAgeCompliance- Stored value is older than 24 hours. Call refreshAgeCompliance to retrieve minAgeCompliance", null); + return -1; + } + return ((Integer) persistenceForNimbleComponent.getValue(PERSISTENCE_AGE_REQUIREMENTS)).intValue(); + } + Log.Helper.LOGI(this, "getAgeCompliance- No stored value in persistance. Call refreshAgeCompliance to retrieve minAgeCompliance.", null); + return -1; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void refreshAgeCompliance() { + Log.Helper.LOGPUBLICFUNC(this); + if (Network.getComponent().getStatus() != Network.Status.OK) { + Log.Helper.LOGD(this, "Adding network observer for age compliance refresh", new Object[0]); + if (this.m_networkListener == null) { + this.m_networkListener = new BroadcastReceiver() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Utility.unregisterReceiver(ApplicationEnvironmentImpl.this.m_networkListener); + ApplicationEnvironmentImpl.this.m_networkListener = null; + ApplicationEnvironmentImpl.this.refreshAgeCompliance(); + } + }; + Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkListener); + return; + } + return; + } + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.2 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + synergyRequest.baseUrl = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_CENTRAL_IP_GEOLOCATION); + synergyRequest.send(); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.3 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + HashMap hashMap = new HashMap(); + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + Map 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); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getCurrencyCode() { + Log.Helper.LOGPUBLICFUNC(this); + try { + Currency currency = Currency.getInstance(Locale.getDefault()); + return currency != null ? currency.toString() : ""; + } catch (IllegalArgumentException unused) { + return ""; + } + } + + public static Activity getCurrentActivity() { + return s_currentActivity; + } + + public static void setCurrentActivity(Activity activity) { + isMainApplicationRunning = true; + s_currentActivity = activity; + } + + public static boolean isMainApplicationRunning() { + return isMainApplicationRunning; + } + + public static boolean isMainApplicationActive() { + return isMainApplicationActive; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getAdvertisingId() { + Log.Helper.LOGFUNC(this); + return this.m_advertisingId; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getGoogleAdvertisingId() { + Log.Helper.LOGFUNC(this); + return getAdvertisingId(); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getAndroidId() { + Log.Helper.LOGFUNC(this); + return this.m_androidId; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public boolean isLimitAdTrackingEnabled() { + Log.Helper.LOGFUNC(this); + return this.m_limitAdTrackingEnabled; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void retrieveAdvertisingId(IApplicationEnvironment.AdvertisingIdCalback advertisingIdCalback) { + String str; + boolean z; + Log.Helper.LOGFUNC(this); + synchronized (this) { + str = this.m_advertisingId; + z = this.m_limitAdTrackingEnabled; + } + if (str == null) { + retrieveAdvertisingIdImpl(advertisingIdCalback); + } else if (advertisingIdCalback != null) { + advertisingIdCalback.onCallback(str, z); + } + } + + private void retrieveAdvertisingIdImpl(IApplicationEnvironment.AdvertisingIdCalback advertisingIdCalback) { + Log.Helper.LOGFUNC(this); + try { + 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 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 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 + public Map getPlayerIdMap() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_playerIdMap; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void setPlayerId(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGW(this, "setPlayerId: Empty/Null key", new Object[0]); + return; + } + String safeString = Utility.safeString(this.m_playerIdMap.get(str)); + String safeString2 = Utility.safeString(str2); + if (!safeString.equals(safeString2)) { + if (Utility.validString(safeString2)) { + this.m_playerIdMap.put(str, safeString2); + Log.Helper.LOGV(this, "setPlayerId: [" + str + " = " + str2 + "] success.", new Object[0]); + } else { + Log.Helper.LOGV(this, "setPlayerId: Empty value. Removed entry for key " + str, new Object[0]); + this.m_playerIdMap.remove(str); + } + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_PLAYERIDMAP_CHANGE); + return; + } + Log.Helper.LOGV(this, "setPlayerId: [" + str + " = " + str2 + "] skipped. Same key/value exists or the new value is empty!", new Object[0]); + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getGameSpecifiedPlayerId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_playerIdMap != null) { + return this.m_playerIdMap.get(KEY_GAME_PLAYER_ID); + } + return null; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void setGameSpecifiedPlayerId(String str) { + Log.Helper.LOGPUBLICFUNC(this); + setPlayerId(KEY_GAME_PLAYER_ID, str); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + Log.Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't save Game Specified Player ID to Persistence", new Object[0]); + } else { + persistenceForNimbleComponent.setValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID, str); + } + } + + @Override // com.ea.nimble.IApplicationEnvironment + public boolean getIadAttribution() { + Log.Helper.LOGPUBLICFUNC(this); + return false; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public String getParameter(String str) { + String str2; + Log.Helper.LOGPUBLICFUNC(this); + synchronized (this) { + str2 = this.m_parameters.get(str); + } + return str2; + } + + @Override // com.ea.nimble.IApplicationEnvironment + public void 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() { // 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 */ + public void requestAttributionData() { + Log.Helper.LOGFUNC(this); + String stringValue = PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).getStringValue("attributionData"); + if (stringValue != null) { + Log.Helper.LOGD(this, "requestAttributionData(): Google Play Referrer data found in persistance.\nData = " + stringValue, new Object[0]); + this.m_parameters.put("attributionData", stringValue); + return; + } + if (Network.getComponent().getStatus() != Network.Status.OK) { + Log.Helper.LOGV(this, "requestAttributionData(): NetworkStatus is NOT OK. We'll retry later.", new Object[0]); + this.m_attributionDataNetworkListener = new BroadcastReceiver() { // from class: com.ea.nimble.ApplicationEnvironmentImpl.7 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + if (Network.getComponent().getStatus() == Network.Status.OK) { + Utility.unregisterReceiver(ApplicationEnvironmentImpl.this.m_attributionDataNetworkListener); + ApplicationEnvironmentImpl.this.m_attributionDataNetworkListener = null; + ApplicationEnvironmentImpl.this.requestAttributionData(); + } + } + }; + 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); + } + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void setAttributionData(String str, String str2, long j, long j2) { + String jSONObject; + StringBuilder sb; + JSONObject jSONObject2 = new JSONObject(); + try { + try { + jSONObject2.put("status", Utility.safeString(str)); + jSONObject2.put("referrer", Utility.safeString(str2)); + jSONObject2.put("install_begin_time", j); + jSONObject2.put("referrer_click_time", j2); + jSONObject = jSONObject2.toString(); + sb = new StringBuilder(); + } catch (Exception e) { + Log.Helper.LOGE(this, "setAttributionData(): Failed with exception. " + e.toString(), new Object[0]); + jSONObject = jSONObject2.toString(); + sb = new StringBuilder(); + } + sb.append("setAttributionData(): Attribution Data = "); + sb.append(jSONObject); + Log.Helper.LOGD(this, sb.toString(), new Object[0]); + this.m_parameters.put("attributionData", jSONObject); + PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).setValue("attributionData", jSONObject); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE); + } catch (Throwable th) { + String jSONObject3 = jSONObject2.toString(); + Log.Helper.LOGD(this, "setAttributionData(): Attribution Data = " + jSONObject3, new Object[0]); + this.m_parameters.put("attributionData", jSONObject3); + PersistenceService.getPersistenceForNimbleComponent(ApplicationEnvironment.COMPONENT_ID, Persistence.Storage.CACHE).setValue("attributionData", jSONObject3); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE); + throw th; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/ApplicationLifecycle.java b/app/src/main/java/com/ea/nimble/ApplicationLifecycle.java new file mode 100644 index 0000000..24a9182 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ApplicationLifecycle.java @@ -0,0 +1,71 @@ +package com.ea.nimble; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +/* loaded from: classes.dex */ +public class ApplicationLifecycle { + public static final String COMPONENT_ID = "com.ea.nimble.applicationlifecycle"; + + public static IApplicationLifecycle getComponent() { + return BaseCore.getInstance().getApplicationLifecycle(); + } + + public static void onActivityCreate(Bundle bundle, Activity activity) { + ApplicationEnvironment.setCurrentActivity(activity); + getComponent().notifyActivityCreate(bundle, activity); + } + + public static void onActivityRestart(Activity activity) { + getComponent().notifyActivityRestart(activity); + } + + public static void onActivityStart(Activity activity) { + getComponent().notifyActivityStart(activity); + } + + public static void onActivityRestoreInstanceState(Bundle bundle, Activity activity) { + getComponent().notifyActivityRestoreInstanceState(bundle, activity); + } + + public static void onActivityPause(Activity activity) { + getComponent().notifyActivityPause(activity); + } + + public static void onActivityResume(Activity activity) { + getComponent().notifyActivityResume(activity); + } + + public static void onActivitySaveInstanceState(Bundle bundle, Activity activity) { + getComponent().notifyActivitySaveInstanceState(bundle, activity); + } + + public static void onActivityStop(Activity activity) { + getComponent().notifyActivityStop(activity); + } + + public static void onActivityDestroy(Activity activity) { + getComponent().notifyActivityDestroy(activity); + } + + public static void onActivityResult(int i, int i2, Intent intent, Activity activity) { + getComponent().notifyActivityResult(i, i2, intent, activity); + } + + public static void onActivityWindowFocusChanged(boolean z, Activity activity) { + getComponent().notifyActivityWindowFocusChanged(z, activity); + } + + public static void onNewIntent(Intent intent, Activity activity) { + getComponent().notifyActivityOnNewIntent(intent, activity); + } + + public static boolean onBackPressed() { + return getComponent().handleBackPressed(); + } + + public static void onActivityRetainNonConfigurationInstance() { + getComponent().notifyActivityRetainNonConfigurationInstance(); + } +} diff --git a/app/src/main/java/com/ea/nimble/ApplicationLifecycleImpl.java b/app/src/main/java/com/ea/nimble/ApplicationLifecycleImpl.java new file mode 100644 index 0000000..b6d288f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ApplicationLifecycleImpl.java @@ -0,0 +1,395 @@ +package com.ea.nimble; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.Log; +import java.util.ArrayList; +import java.util.Iterator; + +/* loaded from: classes.dex */ +class ApplicationLifecycleImpl extends Component implements IApplicationLifecycle, LogSource { + private static final boolean RESTART_ON_CONFIG_CHANGE; + private BaseCore m_core; + private State m_state = State.INIT; + private int m_createdActivityCount = 0; + private int m_runningActivityCount = 0; + private ArrayList m_activityLifecycleCallbacks = new ArrayList<>(); + private ArrayList m_activityEventCallbacks = new ArrayList<>(); + private ArrayList m_applicationLifecycleCallbacks = new ArrayList<>(); + + private enum State { + INIT, + LAUNCH, + RESUME, + RUN, + PAUSE, + SUSPEND, + QUIT, + CONFIG_CHANGE + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return ApplicationLifecycle.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "AppLifecycle"; + } + + static { + RESTART_ON_CONFIG_CHANGE = Build.VERSION.SDK_INT < 11; + } + + ApplicationLifecycleImpl(BaseCore baseCore) { + this.m_core = baseCore; + } + + @Override // com.ea.nimble.Component + protected void teardown() { + this.m_activityLifecycleCallbacks.clear(); + this.m_activityEventCallbacks.clear(); + this.m_applicationLifecycleCallbacks.clear(); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void registerActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) { + this.m_activityLifecycleCallbacks.add(activityLifecycleCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void unregisterActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) { + this.m_activityLifecycleCallbacks.remove(activityLifecycleCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void registerActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) { + this.m_activityEventCallbacks.add(activityEventCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void unregisterActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) { + this.m_activityEventCallbacks.remove(activityEventCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void registerApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) { + this.m_applicationLifecycleCallbacks.add(applicationLifecycleCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void unregisterApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) { + this.m_applicationLifecycleCallbacks.remove(applicationLifecycleCallbacks); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityCreate(Bundle bundle, Activity activity) { + Log.Helper.LOGV(this, "Activity %s CREATE", activity.getLocalClassName()); + if (this.m_state == State.INIT || this.m_state == State.QUIT) { + Log.Helper.LOGD(this, "Activity created clearly with state %s", this.m_state.toString()); + this.m_core.onApplicationLaunch(activity.getIntent()); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityCreated(activity, bundle); + } + notifyApplicationLaunch(activity.getIntent()); + this.m_createdActivityCount = 1; + this.m_state = State.LAUNCH; + if (this.m_runningActivityCount != 0) { + Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount)); + this.m_runningActivityCount = 0; + } + } else if (this.m_state == State.CONFIG_CHANGE) { + if (ApplicationEnvironment.getCurrentActivity() != activity) { + Log.Helper.LOGE(this, "Activity created with state CONFIG_CHANGE but different activity %s and %s", ApplicationEnvironment.getCurrentActivity().getLocalClassName(), activity.getLocalClassName()); + } else { + Log.Helper.LOGD(this, "Activity created from CONFIG_CHANGE, activity configuration changed", new Object[0]); + } + if (RESTART_ON_CONFIG_CHANGE) { + this.m_core.onApplicationResume(); + } + Iterator it2 = this.m_activityLifecycleCallbacks.iterator(); + while (it2.hasNext()) { + it2.next().onActivityCreated(activity, bundle); + } + if (this.m_runningActivityCount != 0) { + Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount)); + this.m_runningActivityCount = 0; + } + } else if (this.m_state == State.PAUSE) { + Log.Helper.LOGD(this, "Activity created from PAUSE, normal activity switch", new Object[0]); + Iterator it3 = this.m_activityLifecycleCallbacks.iterator(); + while (it3.hasNext()) { + it3.next().onActivityCreated(activity, bundle); + } + this.m_createdActivityCount++; + } else if (this.m_state == State.SUSPEND) { + Log.Helper.LOGD(this, "Activity created from SUSPEND, external activity switch; (new) app restart", new Object[0]); + this.m_core.onApplicationResume(); + this.m_state = State.RESUME; + Iterator it4 = this.m_activityLifecycleCallbacks.iterator(); + while (it4.hasNext()) { + it4.next().onActivityCreated(activity, bundle); + } + this.m_createdActivityCount++; + if (this.m_runningActivityCount != 0) { + Log.Helper.LOGE(this, "Invalid running acitivity count %d", Integer.valueOf(this.m_runningActivityCount)); + this.m_runningActivityCount = 0; + } + } else { + Log.Helper.LOGE(this, "Activity created with %s state, shouldn't happen", this.m_state.toString()); + } + Log.Helper.LOGV(this, "State after created %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityRestart(Activity activity) { + Log.Helper.LOGV(this, "Activity %s RESTART", activity.getLocalClassName()); + ApplicationEnvironment.setCurrentActivity(activity); + if (this.m_state == State.PAUSE) { + Log.Helper.LOGD(this, "Activity restart from PAUSE, normal activity switch", new Object[0]); + } else if (this.m_state == State.SUSPEND) { + this.m_core.onApplicationResume(); + this.m_state = State.RESUME; + Log.Helper.LOGD(this, "Activity restart from SUSPEND, external activity switch; (new) app restart", new Object[0]); + } else { + Log.Helper.LOGE(this, "Activity restart with invalid state %s", this.m_state.toString()); + } + Log.Helper.LOGV(this, "State after restart %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityStart(Activity activity) { + Log.Helper.LOGV(this, "Activity %s START", activity.getLocalClassName()); + ApplicationEnvironment.setCurrentActivity(activity); + if (this.m_state == State.LAUNCH) { + this.m_state = State.PAUSE; + Log.Helper.LOGD(this, "Activity start with LAUNCH state, normal app start", new Object[0]); + } else if (this.m_state == State.RESUME) { + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityStarted(activity); + } + notifyApplicationResume(activity.getIntent()); + this.m_state = State.PAUSE; + Log.Helper.LOGD(this, "Activity start with RESUME state, set to PAUSE", new Object[0]); + } else if (this.m_state == State.CONFIG_CHANGE) { + Iterator it2 = this.m_activityLifecycleCallbacks.iterator(); + while (it2.hasNext()) { + it2.next().onActivityStarted(activity); + } + if (RESTART_ON_CONFIG_CHANGE) { + notifyApplicationResume(activity.getIntent()); + } + this.m_state = State.PAUSE; + Log.Helper.LOGD(this, "Activity start with CONFIG_CHANGE state, set to PAUSE", new Object[0]); + } else if (this.m_state == State.PAUSE) { + Log.Helper.LOGD(this, "Activity start with PAUSE state, normal activity switch", new Object[0]); + } else { + Iterator it3 = this.m_activityLifecycleCallbacks.iterator(); + while (it3.hasNext()) { + it3.next().onActivityStarted(activity); + } + Log.Helper.LOGE(this, "Activity start with invalid state %s", this.m_state.toString()); + } + this.m_runningActivityCount++; + Log.Helper.LOGV(this, "State after start %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityRestoreInstanceState(Bundle bundle, Activity activity) { + Log.Helper.LOGV(this, "Activity %s RESTORE_STATE", activity.getLocalClassName()); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityResume(Activity activity) { + Log.Helper.LOGV(this, "Activity %s RESUME", activity.getLocalClassName()); + ApplicationEnvironment.setCurrentActivity(activity); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityResumed(activity); + } + if (this.m_state != State.PAUSE) { + Log.Helper.LOGE(this, "Activity resume on invalid state %s", this.m_state.toString()); + Log.Helper.LOGE(this, "Please double check if the game's activity hooks ApplicationLifecycle.onActivityRestart() correctly.", new Object[0]); + } + this.m_state = State.RUN; + Log.Helper.LOGV(this, "State after resume %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityPause(Activity activity) { + Log.Helper.LOGV(this, "Activity %s PAUSE", activity.getLocalClassName()); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityPaused(activity); + } + if (this.m_state != State.RUN) { + Log.Helper.LOGE(this, "Activity pause on invalid state %s", activity.getLocalClassName()); + } + this.m_state = State.PAUSE; + Log.Helper.LOGV(this, "State after pause %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivitySaveInstanceState(Bundle bundle, Activity activity) { + Log.Helper.LOGV(this, "Activity %s SAVE_STATE", activity.getLocalClassName()); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivitySaveInstanceState(activity, bundle); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle + @SuppressLint({"NewApi"}) + public void notifyActivityStop(Activity activity) { + Log.Helper.LOGV(this, "Activity %s STOP", activity.getLocalClassName()); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityStopped(activity); + } + this.m_runningActivityCount--; + if (!RESTART_ON_CONFIG_CHANGE && activity.isChangingConfigurations()) { + this.m_state = State.CONFIG_CHANGE; + } else if (this.m_runningActivityCount == 0) { + if (this.m_state != State.PAUSE && this.m_state != State.SUSPEND) { + Log.Helper.LOGW(this, "Interesting case %s, HIGHLIGHT!!", this.m_state); + } + this.m_state = State.SUSPEND; + if (!activity.isFinishing()) { + notifyApplicationSuspend(); + this.m_core.onApplicationSuspend(); + } + } else if (this.m_state == State.PAUSE) { + this.m_state = State.SUSPEND; + if (!activity.isFinishing()) { + Log.Helper.LOGW(this, "running activity count may be messed", new Object[0]); + notifyApplicationSuspend(); + this.m_core.onApplicationSuspend(); + } + } else if (this.m_state != State.RUN) { + Log.Helper.LOGE(this, "Activity stop on invalid state %s", this.m_state.toString()); + } + Log.Helper.LOGV(this, "State after stop %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityDestroy(Activity activity) { + Log.Helper.LOGV(this, "Activity %s DESTROY", activity.getLocalClassName()); + Iterator it = this.m_activityLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityDestroyed(activity); + } + if (this.m_state != State.CONFIG_CHANGE) { + if (this.m_state != State.SUSPEND && this.m_state != State.RUN) { + Log.Helper.LOGE(this, "Activity destroy on invalid state %s", this.m_state.toString()); + } + this.m_createdActivityCount--; + if (this.m_createdActivityCount == 0) { + this.m_state = State.QUIT; + notifyApplicationQuit(); + this.m_core.onApplicationQuit(); + ApplicationEnvironment.setCurrentActivity(null); + } + } + Log.Helper.LOGV(this, "State after destroy %s (%d, %d)", this.m_state.toString(), Integer.valueOf(this.m_createdActivityCount), Integer.valueOf(this.m_runningActivityCount)); + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityResult(int i, int i2, Intent intent, Activity activity) { + Iterator it = this.m_activityEventCallbacks.iterator(); + while (it.hasNext()) { + it.next().onActivityResult(activity, i, i2, intent); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityWindowFocusChanged(boolean z, Activity activity) { + Iterator it = this.m_activityEventCallbacks.iterator(); + while (it.hasNext()) { + it.next().onWindowFocusChanged(z); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityOnNewIntent(Intent intent, Activity activity) { + Iterator it = this.m_activityEventCallbacks.iterator(); + while (it.hasNext()) { + it.next().onNewIntent(activity, intent); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle + public boolean handleBackPressed() { + Iterator it = this.m_activityEventCallbacks.iterator(); + boolean z = true; + while (it.hasNext()) { + if (!it.next().onBackPressed()) { + z = false; + } + } + return z; + } + + @Override // com.ea.nimble.IApplicationLifecycle + public void notifyActivityRetainNonConfigurationInstance() { + Log.Helper.LOGFUNC(this); + if (RESTART_ON_CONFIG_CHANGE) { + if (this.m_state != State.SUSPEND) { + Log.Helper.LOGW(this, "configuration change should happen between onStop() and onDestroy(), but state is %s", this.m_state.toString()); + } + this.m_state = State.CONFIG_CHANGE; + } + } + + private void deleteConsumedDataFromIntent(Intent intent) { + if (intent != null) { + if (intent.getData() != null && intent.getDataString().startsWith("ea://socialsharing")) { + intent.removeExtra("key"); + intent.setData(null); + } + if (intent.getStringExtra("PushNotification") != null) { + intent.removeExtra("PushNotification"); + } + } + } + + private void notifyApplicationLaunch(Intent intent) { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_applicationLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onApplicationLaunch(intent); + } + deleteConsumedDataFromIntent(intent); + } + + private void notifyApplicationSuspend() { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_applicationLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onApplicationSuspend(); + } + } + + private void notifyApplicationResume(Intent intent) { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_applicationLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onApplicationResume(); + } + deleteConsumedDataFromIntent(intent); + } + + private void notifyApplicationQuit() { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_applicationLifecycleCallbacks.iterator(); + while (it.hasNext()) { + it.next().onApplicationQuit(); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/BackgroundNetworkConnection.java b/app/src/main/java/com/ea/nimble/BackgroundNetworkConnection.java new file mode 100644 index 0000000..6b5eb42 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/BackgroundNetworkConnection.java @@ -0,0 +1,72 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class BackgroundNetworkConnection extends NetworkConnection { + @Override // com.ea.nimble.NetworkConnection + void cancelForAppSuspend() { + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ void cancel() { + super.cancel(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ NetworkConnectionCallback getCompletionCallback() { + return super.getCompletionCallback(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ NetworkConnectionCallback getHeaderCallback() { + return super.getHeaderCallback(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.LogSource + public /* bridge */ /* synthetic */ String getLogSourceTitle() { + return super.getLogSourceTitle(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ NetworkConnectionCallback getProgressCallback() { + return super.getProgressCallback(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ HttpRequest getRequest() { + return super.getRequest(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ HttpResponse getResponse() { + return super.getResponse(); + } + + @Override // com.ea.nimble.NetworkConnection, java.lang.Runnable + public /* bridge */ /* synthetic */ void run() { + super.run(); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback) { + super.setCompletionCallback(networkConnectionCallback); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback) { + super.setHeaderCallback(networkConnectionCallback); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ void setProgressCallback(NetworkConnectionCallback networkConnectionCallback) { + super.setProgressCallback(networkConnectionCallback); + } + + @Override // com.ea.nimble.NetworkConnection, com.ea.nimble.NetworkConnectionHandle + public /* bridge */ /* synthetic */ void waitOn() { + super.waitOn(); + } + + public BackgroundNetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) { + super(networkImpl, httpRequest, iOperationalTelemetryDispatch); + } +} diff --git a/app/src/main/java/com/ea/nimble/Base.java b/app/src/main/java/com/ea/nimble/Base.java new file mode 100644 index 0000000..3ba7e15 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Base.java @@ -0,0 +1,52 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class Base { + public static void setupNimble() { + Log.Helper.LOGPUBLICFUNCS("Base"); + BaseCore.getInstance().setup(); + } + + public static void teardownNimble() { + Log.Helper.LOGPUBLICFUNCS("Base"); + BaseCore.getInstance().teardown(); + } + + public static void registerComponent(Component component, String str) { + Log.Helper.LOGFUNCS("Base"); + BaseCore.getInstance().getComponentManager().registerComponent(component, str); + } + + public static Component getComponent(String str) { + Log.Helper.LOGFUNCS("Base"); + BaseCore activeValidate = BaseCore.getInstance().activeValidate(); + if (activeValidate == null) { + return null; + } + return activeValidate.getComponentManager().getComponent(str); + } + + public static Component[] getComponentList(String str) { + Log.Helper.LOGFUNCS("Base"); + BaseCore activeValidate = BaseCore.getInstance().activeValidate(); + if (activeValidate == null) { + return null; + } + return activeValidate.getComponentManager().getComponentList(str); + } + + public static NimbleConfiguration getConfiguration() { + Log.Helper.LOGFUNCS("Base"); + return BaseCore.getInstance().getConfiguration(); + } + + public static void restartWithConfiguration(NimbleConfiguration nimbleConfiguration) { + Log.Helper.LOGPUBLICFUNCS("Base"); + BaseCore activeValidate = BaseCore.getInstance().activeValidate(); + if (activeValidate != null) { + activeValidate.restartWithConfiguration(nimbleConfiguration); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/BaseCore.java b/app/src/main/java/com/ea/nimble/BaseCore.java new file mode 100644 index 0000000..2be2707 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/BaseCore.java @@ -0,0 +1,422 @@ +package com.ea.nimble; + +import android.content.Intent; +import android.os.Handler; +import android.os.Looper; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.Log; +import com.ea.nimble.bridge.NimbleCppApplicationLifeCycle; +import com.ea.nimble.bridge.NimbleCppComponentRegistrar; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Map; + +/* loaded from: classes.dex */ +class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks { + public static final String NIMBLE_COMPONENT_LIST = "setting::components"; + public static final String NIMBLE_LOG_SETTING = "setting::log"; + public static final String NIMBLE_SERVER_CONFIG = "com.ea.nimble.configuration"; + protected ApplicationEnvironmentImpl m_applicationEnvironment; + protected IApplicationLifecycle m_applicationLifecycle; + protected ComponentManager m_componentManager; + protected NimbleConfiguration m_configuration; + protected LogImpl m_log; + protected PersistenceServiceImpl m_persistenceService; + protected State m_state; + public static final String[] NIMBLE_COMPONENTS = {"com.ea.nimble.tracking.Tracking", "com.ea.nimble.tracking.NimbleTrackingSynergyComponent", "com.ea.nimble.tracking.NimbleTrackingS2SComponent", "com.ea.nimble.tracking.TrackingEventWrangler", "com.ea.nimble.identity.NimbleIdentityImpl", "com.ea.nimble.identity.AuthenticatorOrigin", "com.ea.nimble.identity.AuthenticatorFacebook", "com.ea.nimble.identity.AuthenticatorAnonymous", "com.ea.nimble.friends.NimbleFriendsImpl", "com.ea.nimble.friends.NimbleOriginFriendsServiceImpl", "com.ea.nimble.origin.Origin", "com.ea.nimble.Facebook", "com.ea.nimble.NimbleAndroidFacebook", "com.ea.nimble.NimbleAndroidGoogleServiceImpl", "com.ea.nimble.mtx.googleplay.GooglePlay", "com.ea.nimble.mtx.amazon.AmazonStore", "com.ea.nimble.pushtng.PushNotification", NimbleCppApplicationLifeCycle.COMPONENT_ID, NimbleCppComponentRegistrar.COMPONENT_ID}; + protected static BaseCore s_core = null; + protected static boolean s_coreDestroyed = false; + + private enum State { + INACTIVE, + AUTO_SETUP, + MANUAL_SETUP, + MANUAL_TEARDOWN, + QUITTING, + DESTROY, + FAKE_DESTROY + } + + BaseCore() { + } + + private void initialize() { + this.m_state = State.INACTIVE; + loadConfiguration(); + this.m_componentManager = new ComponentManager(); + this.m_applicationLifecycle = new ApplicationLifecycleImpl(this); + this.m_applicationEnvironment = new ApplicationEnvironmentImpl(this); + this.m_log = (LogImpl) Log.getComponent(); + this.m_log.connectToCore(this); + this.m_persistenceService = new PersistenceServiceImpl(); + NetworkImpl networkImpl = new NetworkImpl(); + SynergyEnvironmentImpl synergyEnvironmentImpl = new SynergyEnvironmentImpl(this); + SynergyNetworkImpl synergyNetworkImpl = new SynergyNetworkImpl(); + SynergyIdManagerImpl synergyIdManagerImpl = new SynergyIdManagerImpl(); + OperationalTelemetryDispatchImpl operationalTelemetryDispatchImpl = new OperationalTelemetryDispatchImpl(); + NimbleLocalNotificationsImpl nimbleLocalNotificationsImpl = new NimbleLocalNotificationsImpl(); + this.m_componentManager.registerComponent(this.m_applicationEnvironment, ApplicationEnvironment.COMPONENT_ID); + this.m_componentManager.registerComponent(this.m_log, Log.COMPONENT_ID); + this.m_componentManager.registerComponent(this.m_persistenceService, PersistenceService.COMPONENT_ID); + this.m_componentManager.registerComponent(networkImpl, "com.ea.nimble.network"); + this.m_componentManager.registerComponent(synergyIdManagerImpl, SynergyIdManager.COMPONENT_ID); + this.m_componentManager.registerComponent(synergyEnvironmentImpl, SynergyEnvironment.COMPONENT_ID); + this.m_componentManager.registerComponent(synergyNetworkImpl, SynergyNetwork.COMPONENT_ID); + this.m_componentManager.registerComponent(operationalTelemetryDispatchImpl, OperationalTelemetryDispatch.COMPONENT_ID); + this.m_componentManager.registerComponent(nimbleLocalNotificationsImpl, NimbleLocalNotifications.COMPONENT_ID); + for (String str : NIMBLE_COMPONENTS) { + try { + Method declaredMethod = Class.forName(str).getDeclaredMethod("initialize", new Class[0]); + declaredMethod.setAccessible(true); + declaredMethod.invoke(null, new Object[0]); + } catch (ClassNotFoundException unused) { + Log.Helper.LOGD(this, "Component " + str + " not found", new Object[0]); + } catch (IllegalAccessException unused2) { + Log.Helper.LOGE(this, "Method " + str + ".initialize() is not accessible", new Object[0]); + } catch (IllegalArgumentException unused3) { + Log.Helper.LOGE(this, "Method " + str + ".initialize() should take no arguments", new Object[0]); + } catch (NoSuchMethodException unused4) { + Log.Helper.LOGE(this, "No method " + str + ".initialize()", new Object[0]); + } catch (NullPointerException unused5) { + Log.Helper.LOGE(this, "Method " + str + ".initialize() should be static", new Object[0]); + } catch (InvocationTargetException e) { + Log.Helper.LOGE(this, "Method " + str + ".initialize() threw an exception", new Object[0]); + e.printStackTrace(); + } + } + try { + if (!isAppSigned(ApplicationEnvironment.getComponent().getApplicationContext())) { + android.util.Log.e(Global.NIMBLE_ID, "This application is NOT signed with a valid certificate. MTX may not work correctly with this application"); + } else { + android.util.Log.i(Global.NIMBLE_ID, "This application is signed with a valid certificate."); + } + } catch (Exception e2) { + android.util.Log.e(Global.NIMBLE_ID, String.format("Unable to verify application signature. Message: %s", e2.getMessage())); + } + } + + public NimbleConfiguration getConfiguration() { + return this.m_configuration; + } + + public Map getSettings(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (!str.equals(NIMBLE_LOG_SETTING)) { + return null; + } + int identifier = ApplicationEnvironment.getComponent().getApplicationContext().getResources().getIdentifier("nimble_log", "xml", ApplicationEnvironment.getCurrentActivity().getPackageName()); + if (identifier == 0) { + return null; + } + return Utility.parseXmlFile(identifier); + } + + public ComponentManager getComponentManager() { + return this.m_componentManager; + } + + public ILog getLog() { + return this.m_log; + } + + public IApplicationEnvironment getApplicationEnvironment() { + return this.m_applicationEnvironment; + } + + public IApplicationLifecycle getApplicationLifecycle() { + return this.m_applicationLifecycle; + } + + public IPersistenceService getPersistenceService() { + return this.m_persistenceService; + } + + public static synchronized BaseCore getInstance() { + BaseCore baseCore; + synchronized (BaseCore.class) { + if (s_core == null) { + if (s_coreDestroyed) { + throw new AssertionError("Cannot revive destroyed BaseCore, please utilizesetupNimble() and tearDownNimble() explicitly to extend longevity to match your expectation."); + } + android.util.Log.d(Global.NIMBLE_ID, String.format("NIMBLE VERSION %s (Build %s)", Global.NIMBLE_RELEASE_VERSION, Global.NIMBLE_SDK_VERSION)); + s_core = new BaseCore(); + s_core.initialize(); + } + baseCore = s_core; + } + return baseCore; + } + + public BaseCore activeValidate() { + Log.Helper.LOGPUBLICFUNC(this); + switch (this.m_state) { + case INACTIVE: + Log.Helper.LOGF(this, "Access NimbleBaseCore before setup, call setupNimble() explicitly to activate it.", new Object[0]); + return null; + case MANUAL_TEARDOWN: + Log.Helper.LOGF(this, "Access NimbleBaseCore after clean up, call setupNimble() explicitly again to activate it.", new Object[0]); + return null; + case DESTROY: + Log.Helper.LOGF(this, "Accessing component after destroy, only static components are available right now.", new Object[0]); + return null; + default: + return this; + } + } + + public void setup() { + Log.Helper.LOGPUBLICFUNC(this); + switch (this.m_state) { + case INACTIVE: + case MANUAL_TEARDOWN: + this.m_componentManager.setup(); + this.m_state = State.MANUAL_SETUP; + Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED); + this.m_componentManager.restore(); + break; + case DESTROY: + case MANUAL_SETUP: + case QUITTING: + case FAKE_DESTROY: + Log.Helper.LOGF(this, "Multiple setupNimble() calls without teardownNimble().", new Object[0]); + break; + case AUTO_SETUP: + this.m_state = State.MANUAL_SETUP; + break; + } + } + + public void teardown() { + Log.Helper.LOGPUBLICFUNC(this); + switch (this.m_state) { + case INACTIVE: + case AUTO_SETUP: + Log.Helper.LOGF(this, "Cannot teardownNimble() before setupNimble().", new Object[0]); + break; + case MANUAL_TEARDOWN: + case DESTROY: + Log.Helper.LOGF(this, "Multiple teardownNimble() calls without setupNibmle().", new Object[0]); + break; + case MANUAL_SETUP: + this.m_componentManager.cleanup(); + this.m_state = State.MANUAL_TEARDOWN; + this.m_componentManager.teardown(); + break; + case QUITTING: + case FAKE_DESTROY: + this.m_componentManager.cleanup(); + this.m_state = State.MANUAL_TEARDOWN; + this.m_componentManager.teardown(); + destroy(); + break; + } + } + + public void restartWithConfiguration(final NimbleConfiguration nimbleConfiguration) { + Log.Helper.LOGPUBLICFUNC(this); + Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]); + Log.Helper.LOGE(this, "restartWithConfiguration should not be used in an integration. This function is for QA testing purposes.", new Object[0]); + Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]); + if (nimbleConfiguration == NimbleConfiguration.UNKNOWN) { + Log.Helper.LOGE(this, "Cannot restart nimble with unknown configuration", new Object[0]); + } else { + new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.ea.nimble.BaseCore.1 + @Override // java.lang.Runnable + public void run() { + switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[BaseCore.this.m_state.ordinal()]) { + case 1: + case 2: + case 3: + Log.Helper.LOGF(this, "Should not happen, getInstance should ensure active instance", new Object[0]); + break; + case 4: + case 5: + BaseCore.this.m_componentManager.cleanup(); + BaseCore.this.m_componentManager.teardown(); + BaseCore.this.m_configuration = nimbleConfiguration; + BaseCore.this.m_componentManager.setup(); + Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED); + BaseCore.this.m_componentManager.restore(); + break; + case 6: + case 7: + Log.Helper.LOGF(this, "Cannot restart Nimble when app is quiting", new Object[0]); + break; + } + } + }); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationLaunch(Intent intent) { + if (this.m_state == State.INACTIVE || this.m_state == State.DESTROY) { + this.m_componentManager.setup(); + Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED); + this.m_state = State.AUTO_SETUP; + try { + this.m_componentManager.restore(); + return; + } catch (AssertionError e) { + this.m_state = State.INACTIVE; + throw e; + } + } + if (this.m_state == State.FAKE_DESTROY) { + this.m_componentManager.resume(); + this.m_state = State.AUTO_SETUP; + } else if (this.m_state == State.QUITTING) { + this.m_componentManager.resume(); + this.m_state = State.MANUAL_SETUP; + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationSuspend() { + if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) { + this.m_componentManager.suspend(); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationResume() { + if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) { + this.m_componentManager.resume(); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationQuit() { + switch (this.m_state) { + case INACTIVE: + Log.Helper.LOGF(this, "No app start before app quit, something must be wrong.", new Object[0]); + break; + case DESTROY: + case QUITTING: + Log.Helper.LOGF(this, "Double app quit, something must be wrong.", new Object[0]); + break; + case AUTO_SETUP: + this.m_componentManager.suspend(); + this.m_state = State.FAKE_DESTROY; + break; + case MANUAL_SETUP: + this.m_componentManager.suspend(); + this.m_state = State.QUITTING; + break; + } + } + + protected static void injectMock(BaseCore baseCore) { + Log.Helper.LOGFUNCS("BaseCore"); + if (baseCore == null) { + s_core = null; + s_coreDestroyed = false; + } else { + s_core = baseCore; + s_coreDestroyed = false; + } + } + + private void destroy() { + Log.Helper.LOGD(this, "NIMBLE DESTROY for Android will keep Core and Static components alive", new Object[0]); + } + + private void loadConfiguration() { + Log.Helper.LOGFUNCS("BaseCore"); + String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(NIMBLE_SERVER_CONFIG); + if (Utility.validString(configValueAsString)) { + this.m_configuration = NimbleConfiguration.fromName(configValueAsString); + if (this.m_configuration != NimbleConfiguration.UNKNOWN && this.m_configuration != NimbleConfiguration.CUSTOMIZED) { + return; + } + } + android.util.Log.e(Global.NIMBLE_ID, "WARNING! Cannot find valid NimbleConfiguration from AndroidManifest.xml"); + this.m_configuration = NimbleConfiguration.LIVE; + } + + /* JADX WARN: Removed duplicated region for block: B:18:0x0067 A[ORIG_RETURN, RETURN] */ + /* JADX WARN: Removed duplicated region for block: B:19:? A[RETURN, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private boolean isAppSigned(android.content.Context r9) { + /* + r8 = this; + javax.security.auth.x500.X500Principal r0 = new javax.security.auth.x500.X500Principal + java.lang.String r1 = "CN=Android Debug,O=Android,C=US" + r0.(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.(r5) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52 + java.security.cert.Certificate r5 = r6.generateCertificate(r7) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52 + java.security.cert.X509Certificate r5 = (java.security.cert.X509Certificate) r5 // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52 + javax.security.auth.x500.X500Principal r5 = r5.getSubjectX500Principal() // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52 + boolean r5 = r5.equals(r0) // Catch: java.lang.Exception -> L4e java.security.cert.CertificateException -> L50 android.content.pm.PackageManager.NameNotFoundException -> L52 + if (r5 == 0) goto L4a + r4 = r5 + goto L65 + L4a: + int r3 = r3 + 1 + r4 = r5 + goto L25 + L4e: + r9 = move-exception + goto L56 + L50: + r9 = move-exception + goto L5c + L52: + r9 = move-exception + goto L62 + L54: + r9 = move-exception + r4 = 0 + L56: + r9.printStackTrace() + goto L65 + L5a: + r9 = move-exception + r4 = 0 + L5c: + r9.printStackTrace() + goto L65 + L60: + r9 = move-exception + r4 = 0 + L62: + r9.printStackTrace() + L65: + if (r4 != 0) goto L68 + r1 = 1 + L68: + return r1 + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.BaseCore.isAppSigned(android.content.Context):boolean"); + } + + public boolean isActive() { + Log.Helper.LOGPUBLICFUNCS("BaseCore"); + return this.m_state == State.AUTO_SETUP || this.m_state == State.MANUAL_SETUP; + } +} diff --git a/app/src/main/java/com/ea/nimble/ByteBufferIOStream.java b/app/src/main/java/com/ea/nimble/ByteBufferIOStream.java new file mode 100644 index 0000000..e481940 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ByteBufferIOStream.java @@ -0,0 +1,284 @@ +package com.ea.nimble; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.ListIterator; + +/* loaded from: classes.dex */ +public class ByteBufferIOStream { + protected static final int SEGMENT_SIZE = 4096; + protected int m_availableSegment; + protected LinkedList m_buffer; + protected boolean m_closed; + protected ByteBufferInputStream m_input; + protected ByteBufferOutputStream m_output; + protected int m_readPosition; + protected int m_writePosition; + + public ByteBufferIOStream() { + this(1); + } + + public ByteBufferIOStream(int i) { + this.m_closed = false; + this.m_availableSegment = 0; + this.m_writePosition = 0; + this.m_readPosition = 0; + this.m_buffer = new LinkedList<>(); + this.m_input = new ByteBufferInputStream(); + this.m_output = new ByteBufferOutputStream(); + int i2 = (((i <= 0 ? 1 : i) - 1) / 4096) + 1; + for (int i3 = 0; i3 < i2; i3++) { + this.m_buffer.add(new byte[4096]); + } + } + + public InputStream getInputStream() { + return this.m_input; + } + + public OutputStream getOutputStream() { + return this.m_output; + } + + public void clear() { + this.m_closed = false; + this.m_availableSegment = 0; + this.m_writePosition = 0; + this.m_readPosition = 0; + } + + public int available() throws IOException { + return this.m_input.available(); + } + + public byte[] prepareSegment() { + if (this.m_availableSegment + 1 >= this.m_buffer.size()) { + return new byte[4096]; + } + if (this.m_buffer.size() == 0) { + return null; + } + return this.m_buffer.removeLast(); + } + + public void appendSegmentToBuffer(byte[] bArr, int i) throws IOException { + if (this.m_writePosition == 0 && bArr.length == 4096) { + ListIterator listIterator = this.m_buffer.listIterator(); + for (int i2 = 0; i2 < this.m_availableSegment; i2++) { + listIterator.next(); + } + listIterator.add(bArr); + if (i != 4096) { + this.m_writePosition = i; + return; + } else { + this.m_availableSegment++; + return; + } + } + getOutputStream().write(bArr, 0, i); + } + + public byte[] growBufferBySegment() throws IOException { + if (this.m_writePosition != 0) { + throw new IOException("Bad location to grow buffer"); + } + ListIterator listIterator = this.m_buffer.listIterator(); + for (int i = 0; i < this.m_availableSegment; i++) { + listIterator.next(); + } + byte[] bArr = new byte[4096]; + listIterator.add(bArr); + this.m_availableSegment++; + return bArr; + } + + protected class ByteBufferInputStream extends InputStream { + @Override // java.io.InputStream + public boolean markSupported() { + return false; + } + + protected ByteBufferInputStream() { + } + + @Override // java.io.InputStream + public int available() throws IOException { + if (ByteBufferIOStream.this.m_closed) { + throw new IOException("ByteBufferIOStream is closed"); + } + return ((ByteBufferIOStream.this.m_availableSegment * 4096) + ByteBufferIOStream.this.m_writePosition) - ByteBufferIOStream.this.m_readPosition; + } + + @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable + public void close() throws IOException { + ByteBufferIOStream.this.closeIOStream(); + } + + @Override // java.io.InputStream + public int read(byte[] bArr) throws IOException { + return read(bArr, 0, bArr.length); + } + + @Override // java.io.InputStream + public int read() throws IOException { + if (available() <= 0) { + throw new IOException("Nothing to read in ByteBufferIOStream"); + } + byte b = ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_readPosition]; + ByteBufferIOStream.this.m_readPosition++; + if (ByteBufferIOStream.this.m_readPosition >= 4096) { + ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll()); + ByteBufferIOStream.this.m_readPosition = 0; + ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this; + byteBufferIOStream.m_availableSegment--; + } + return b; + } + + @Override // java.io.InputStream + public int read(byte[] bArr, int i, int i2) throws IOException { + if (i < 0 || i2 < 0 || i + i2 > bArr.length) { + throw new IndexOutOfBoundsException("The reading range of out of buffer boundary."); + } + int available = available(); + if (available <= 0) { + return -1; + } + if (i2 > available) { + i2 = available; + } + int i3 = 4096 - ByteBufferIOStream.this.m_readPosition; + if (i2 < i3) { + System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i2); + ByteBufferIOStream.this.m_readPosition += i2; + } else { + System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, bArr, i, i3); + ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll()); + int i4 = i2 - i3; + int i5 = i + i3; + int i6 = i4 / 4096; + int i7 = i4; + int i8 = i5; + for (int i9 = 0; i9 < i6; i9++) { + System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i8, 4096); + ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll()); + i7 -= 4096; + i8 += 4096; + } + System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, bArr, i8, i7); + ByteBufferIOStream.this.m_readPosition = i7; + ByteBufferIOStream.this.m_availableSegment -= i6 + 1; + } + return i2; + } + + @Override // java.io.InputStream + public long skip(long j) throws IOException { + int available = available(); + if (available <= 0) { + return 0L; + } + long j2 = available; + if (j > j2) { + j = j2; + } + int i = (int) j; + int i2 = 4096 - ByteBufferIOStream.this.m_readPosition; + if (i < i2) { + ByteBufferIOStream.this.m_readPosition += i; + } else { + ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll()); + int i3 = i - i2; + int i4 = i3 / 4096; + for (int i5 = 0; i5 < i4; i5++) { + ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll()); + i3 -= 4096; + } + ByteBufferIOStream.this.m_readPosition = i3; + ByteBufferIOStream.this.m_availableSegment -= i4 + 1; + } + return j; + } + } + + protected class ByteBufferOutputStream extends OutputStream { + protected ByteBufferOutputStream() { + } + + @Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable + public void close() throws IOException { + ByteBufferIOStream.this.closeIOStream(); + } + + @Override // java.io.OutputStream + public void write(byte[] bArr, int i, int i2) throws IOException { + byte[] bArr2; + if (i < 0 || i2 < 0 || i + i2 > bArr.length) { + throw new IndexOutOfBoundsException("The writing range is out of buffer boundary."); + } + if (ByteBufferIOStream.this.m_closed) { + throw new IOException("ByteBufferIOStream is closed"); + } + int i3 = 4096 - ByteBufferIOStream.this.m_writePosition; + Iterator it = ByteBufferIOStream.this.m_buffer.iterator(); + for (int i4 = 0; i4 < ByteBufferIOStream.this.m_availableSegment; i4++) { + it.next(); + } + if (i2 < i3) { + System.arraycopy(bArr, i, it.next(), ByteBufferIOStream.this.m_writePosition, i2); + ByteBufferIOStream.this.m_writePosition += i2; + return; + } + System.arraycopy(bArr, i, it.next(), ByteBufferIOStream.this.m_writePosition, i3); + int i5 = i2 - i3; + int i6 = i + i3; + ByteBufferIOStream.this.m_availableSegment++; + ByteBufferIOStream.this.m_writePosition = 0; + while (i5 > 0) { + if (it.hasNext()) { + bArr2 = it.next(); + } else { + bArr2 = new byte[4096]; + ByteBufferIOStream.this.m_buffer.add(bArr2); + } + if (i5 < 4096) { + System.arraycopy(bArr, i6, bArr2, 0, i5); + ByteBufferIOStream.this.m_writePosition = i5; + i5 = 0; + } else { + System.arraycopy(bArr, i6, bArr2, 0, 4096); + i5 -= 4096; + i6 += 4096; + ByteBufferIOStream.this.m_availableSegment++; + } + } + } + + @Override // java.io.OutputStream + public void write(byte[] bArr) throws IOException { + write(bArr, 0, bArr.length); + } + + @Override // java.io.OutputStream + public void write(int i) throws IOException { + if (ByteBufferIOStream.this.m_closed) { + throw new IOException("ByteBufferIOStream is closed"); + } + ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_writePosition] = (byte) i; + ByteBufferIOStream.this.m_writePosition++; + if (ByteBufferIOStream.this.m_writePosition == 4096) { + ByteBufferIOStream.this.m_writePosition = 0; + ByteBufferIOStream.this.m_availableSegment++; + } + } + } + + protected void closeIOStream() { + this.m_closed = true; + } +} diff --git a/app/src/main/java/com/ea/nimble/Component.java b/app/src/main/java/com/ea/nimble/Component.java new file mode 100644 index 0000000..4667b1b --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Component.java @@ -0,0 +1,24 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public abstract class Component { + protected void cleanup() { + } + + public abstract String getComponentId(); + + protected void restore() { + } + + protected void resume() { + } + + protected void setup() { + } + + protected void suspend() { + } + + protected void teardown() { + } +} diff --git a/app/src/main/java/com/ea/nimble/ComponentManager.java b/app/src/main/java/com/ea/nimble/ComponentManager.java new file mode 100644 index 0000000..64221cd --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ComponentManager.java @@ -0,0 +1,134 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.ListIterator; +import java.util.Map; + +/* loaded from: classes.dex */ +class ComponentManager implements LogSource { + private Map m_components = new LinkedHashMap(); + private Stage m_stage = Stage.CREATE; + + public enum Stage { + CREATE, + SETUP, + READY, + SUSPEND + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Component"; + } + + ComponentManager() { + } + + public Stage getStage() { + return this.m_stage; + } + + void registerComponent(Component component, String str) { + Log.Helper.LOGFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGF(this, "Cannot register component without valid componentId", new Object[0]); + return; + } + if (component == null) { + Log.Helper.LOGF(this, "Try to register invalid component with id: " + str, new Object[0]); + return; + } + Component component2 = this.m_components.get(str); + if (component2 == null) { + Log.Helper.LOGI(this, "Register module: " + str, new Object[0]); + } else { + Log.Helper.LOGI(this, "Register module(overwrite): " + str, new Object[0]); + } + this.m_components.put(str, component); + if (this.m_stage.compareTo(Stage.SETUP) < 0) { + return; + } + if (component2 != null) { + if (this.m_stage.compareTo(Stage.SETUP) >= 0) { + if (this.m_stage.compareTo(Stage.SUSPEND) >= 0) { + component2.resume(); + } + component2.cleanup(); + } + component2.teardown(); + } + component.setup(); + if (this.m_stage.compareTo(Stage.READY) >= 0) { + component.restore(); + if (this.m_stage.compareTo(Stage.SUSPEND) >= 0) { + component.suspend(); + } + } + } + + Component getComponent(String str) { + return this.m_components.get(str); + } + + Component[] getComponentList(String str) { + Log.Helper.LOGFUNC(this); + ArrayList arrayList = new ArrayList(this.m_components.size()); + for (Map.Entry entry : this.m_components.entrySet()) { + if (entry.getKey().startsWith(str)) { + arrayList.add(entry.getValue()); + } + } + return (Component[]) arrayList.toArray(new Component[arrayList.size()]); + } + + void setup() { + this.m_stage = Stage.SETUP; + Iterator it = this.m_components.values().iterator(); + while (it.hasNext()) { + it.next().setup(); + } + } + + void restore() { + this.m_stage = Stage.READY; + Iterator it = this.m_components.values().iterator(); + while (it.hasNext()) { + it.next().restore(); + } + } + + void suspend() { + ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size()); + this.m_stage = Stage.SUSPEND; + while (listIterator.hasPrevious()) { + ((Component) listIterator.previous()).suspend(); + } + } + + void resume() { + this.m_stage = Stage.READY; + Iterator it = this.m_components.values().iterator(); + while (it.hasNext()) { + it.next().resume(); + } + } + + void cleanup() { + ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size()); + this.m_stage = Stage.CREATE; + while (listIterator.hasPrevious()) { + ((Component) listIterator.previous()).cleanup(); + } + } + + void teardown() { + ListIterator listIterator = new ArrayList(this.m_components.values()).listIterator(this.m_components.size()); + this.m_stage = Stage.CREATE; + while (listIterator.hasPrevious()) { + ((Component) listIterator.previous()).teardown(); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/EASPDataLoader.java b/app/src/main/java/com/ea/nimble/EASPDataLoader.java new file mode 100644 index 0000000..7471ef9 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/EASPDataLoader.java @@ -0,0 +1,159 @@ +package com.ea.nimble; + +import android.content.Context; +import com.ea.nimble.Log; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.ByteBuffer; +import org.apache.http.protocol.HTTP; + +/* loaded from: classes.dex */ +public class EASPDataLoader { + + public static class LogEvent { + public int m_EAUID; + public long m_dateTimeInNanoseconds; + public int m_indexInsideSession; + public int m_keyType01; + public int m_keyType02; + public int m_keyType03; + public String m_randomPart; + public long m_timestamp; + public int m_type; + public int m_userLevel; + public String m_value01; + public String m_value02; + public String m_value03; + } + + public static class EASPDataBuffer { + public ByteBuffer m_decryptedByteBuffer; + public String m_version; + + public EASPDataBuffer(String str, ByteBuffer byteBuffer) { + this.m_version = str; + this.m_decryptedByteBuffer = byteBuffer; + } + } + + public static String readString(ByteBuffer byteBuffer) throws IOException { + String str; + int i = byteBuffer.getInt(); + if (i <= 0) { + return null; + } + if (i > byteBuffer.remaining()) { + Log.Helper.LOGES("Legacy", "String length greater than buffer remaining bytes.", new Object[0]); + throw new IOException("String length uint32 corrupt, longer than remaining bytes."); + } + byte[] bArr = new byte[i]; + byteBuffer.get(bArr, 0, i); + try { + str = new String(bArr, HTTP.UTF_8); + try { + Log.Helper.LOGDS("Legacy", "Read string (%s)", str); + } catch (Exception e) { + e = e; + Log.Helper.LOGES("Legacy", "Read string exception: " + e, new Object[0]); + return str; + } + } catch (Exception e2) { + e = e2; + str = null; + } + return str; + } + + public static boolean readBooleanByte(ByteBuffer byteBuffer) { + return byteBuffer.get() != 0; + } + + public static LogEvent readLogEvent(ByteBuffer byteBuffer) throws IOException { + LogEvent logEvent = new LogEvent(); + try { + if (!readBooleanByte(byteBuffer)) { + return null; + } + logEvent.m_type = byteBuffer.getInt(); + logEvent.m_indexInsideSession = byteBuffer.getInt(); + logEvent.m_dateTimeInNanoseconds = byteBuffer.getLong(); + logEvent.m_EAUID = byteBuffer.getInt(); + logEvent.m_randomPart = readString(byteBuffer); + logEvent.m_keyType01 = byteBuffer.getInt(); + logEvent.m_value01 = readString(byteBuffer); + logEvent.m_keyType02 = byteBuffer.getInt(); + logEvent.m_value02 = readString(byteBuffer); + logEvent.m_timestamp = byteBuffer.getLong(); + logEvent.m_keyType03 = byteBuffer.getInt(); + logEvent.m_value03 = readString(byteBuffer); + logEvent.m_userLevel = byteBuffer.getInt(); + return logEvent; + } catch (IOException e) { + Log.Helper.LOGES("Legacy", "Exception reading LogEvent: " + e, new Object[0]); + throw e; + } + } + + public static boolean deleteDatFile(String str) { + File file = new File(str); + if (file.exists()) { + return file.delete(); + } + return true; + } + + /* JADX WARN: Removed duplicated region for block: B:38:0x00e8 A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* JADX WARN: Removed duplicated region for block: B:44:? A[SYNTHETIC] */ + /* JADX WARN: Removed duplicated region for block: B:45:0x00d7 A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public static com.ea.nimble.EASPDataLoader.EASPDataBuffer loadDatFile(java.lang.String r12) throws java.lang.Exception { + /* + Method dump skipped, instructions count: 342 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.EASPDataLoader.loadDatFile(java.lang.String):com.ea.nimble.EASPDataLoader$EASPDataBuffer"); + } + + public static String getTrackingDatFilePath() { + String path; + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + if (applicationContext == null) { + path = System.getProperty("user.dir") + File.separator + "doc"; + } else { + File filesDir = applicationContext.getFilesDir(); + if (filesDir != null) { + path = filesDir.getPath(); + } else { + Log.Helper.LOGES("Legacy", "Could not get Android files directory", new Object[0]); + return null; + } + } + return path + File.separator + "EASP" + File.separator + "Tracking" + File.separator + "tracking.dat"; + } + + public static String loadEADeviceId() { + File filesDir = ApplicationEnvironment.getComponent().getApplicationContext().getFilesDir(); + try { + if (filesDir == null) { + throw new Exception(); + } + EASPDataBuffer loadDatFile = loadDatFile(filesDir.getPath() + "/EASP/commoninfo.dat"); + if (!loadDatFile.m_version.equals("1.00.02")) { + return null; + } + ByteBuffer byteBuffer = loadDatFile.m_decryptedByteBuffer; + readString(byteBuffer); + readBooleanByte(byteBuffer); + return readString(byteBuffer); + } catch (FileNotFoundException unused) { + return null; + } catch (Exception e) { + Log.Helper.LOGES("Legacy", "Exception when trying to load EASP data: %s", e); + return null; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/Encryptor.java b/app/src/main/java/com/ea/nimble/Encryptor.java new file mode 100644 index 0000000..8c5d9b2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Encryptor.java @@ -0,0 +1,80 @@ +package com.ea.nimble; + +import android.annotation.SuppressLint; +import com.ea.nimble.Log; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.security.GeneralSecurityException; +import java.security.Provider; +import java.security.Security; +import java.util.Iterator; +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.CipherOutputStream; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; +import javax.crypto.spec.PBEParameterSpec; + +/* loaded from: classes.dex */ +class Encryptor { + private static int ENCRYPTION_KEY_LENGHT = 128; + private static int ENCRYPTION_KEY_ROUND = 997; + private Cipher m_encryptor = null; + private Cipher m_decryptor = null; + + @SuppressLint({"NewApi"}) + private void initialize() throws GeneralSecurityException { + for (Provider provider : Security.getProviders()) { + Log.Helper.LOGIS(null, "Cryptor Provider: " + provider.getName(), new Object[0]); + Iterator it = provider.getServices().iterator(); + while (it.hasNext()) { + Log.Helper.LOGIS(null, "Cryptor Algorithm: " + it.next().getAlgorithm(), new Object[0]); + } + } + try { + String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId(); + byte[] bytes = "02:00:00:00:00:00".getBytes(); + byte[] bArr = new byte[8]; + int i = 0; + int i2 = 0; + while (i < bArr.length) { + int i3 = i2 + 1; + if (i3 % 3 == 0) { + i2 = i3; + } + bArr[i] = bytes[i2]; + i++; + i2++; + } + SecretKey generateSecret = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(applicationBundleId.toCharArray(), bArr, ENCRYPTION_KEY_ROUND, ENCRYPTION_KEY_LENGHT)); + PBEParameterSpec pBEParameterSpec = new PBEParameterSpec(bArr, ENCRYPTION_KEY_ROUND); + this.m_encryptor = Cipher.getInstance("PBEWithMD5AndDES"); + this.m_encryptor.init(1, generateSecret, pBEParameterSpec); + this.m_decryptor = Cipher.getInstance("PBEWithMD5AndDES"); + this.m_decryptor.init(2, generateSecret, pBEParameterSpec); + } catch (GeneralSecurityException e) { + Log.Helper.LOGFS(null, "Can't initialize Encryptor: " + e.toString(), new Object[0]); + throw e; + } + } + + public ObjectInputStream encryptInputStream(InputStream inputStream) throws IOException, GeneralSecurityException { + Log.Helper.LOGFUNC(this); + if (this.m_encryptor == null || this.m_decryptor == null) { + initialize(); + } + return new ObjectInputStream(new CipherInputStream(inputStream, this.m_decryptor)); + } + + public ObjectOutputStream encryptOutputStream(OutputStream outputStream) throws IOException, GeneralSecurityException { + Log.Helper.LOGFUNC(this); + if (this.m_encryptor == null || this.m_decryptor == null) { + initialize(); + } + return new ObjectOutputStream(new CipherOutputStream(outputStream, this.m_encryptor)); + } +} diff --git a/app/src/main/java/com/ea/nimble/EnvironmentDataContainer.java b/app/src/main/java/com/ea/nimble/EnvironmentDataContainer.java new file mode 100644 index 0000000..9e6978a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/EnvironmentDataContainer.java @@ -0,0 +1,294 @@ +package com.ea.nimble; + +import com.ea.nimble.Error; +import com.ea.nimble.Log; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +class EnvironmentDataContainer implements ISynergyEnvironment, Externalizable, LogSource { + private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_OK = 0; + private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_RECOMMENDED = 1; + private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_REQUIRED = 2; + private String m_eaDeviceId; + private Long m_lastDirectorResponseTimestamp; + private Map m_serverUrls; + private String m_synergyAnonymousId; + private Map m_overrideUrls = new HashMap(); + private Map m_getDirectionResponseDictionary = new HashMap(); + private String m_applicationLanguageCode = "en"; + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "SynergyEnv"; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getEADeviceId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_eaDeviceId; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSynergyId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_synergyAnonymousId; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSellId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get(SynergyCatalog.MTX_INFO_KEY_SELLID); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getProductId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get("productId"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getEAHardwareId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get("hwId"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getNexusClientId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get("clientId"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getNexusClientSecret() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get("clientSecret"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getGosMdmAppKey() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return null; + } + return (String) this.m_getDirectionResponseDictionary.get("mdmAppKey"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public Error setServerUrl(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "Provided override URL key is not a valid string, unable to set URL", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Provided override URL key is not a valid string, unable to set URL"); + } + if (!Utility.validString(str2)) { + Log.Helper.LOGD(this, "Empty or null value provided for key \"" + str + "\", removing key from map", new Object[0]); + if (this.m_overrideUrls.remove(str) != null) { + return null; + } + Log.Helper.LOGW(this, "No matching key found in override URLs", new Object[0]); + return null; + } + this.m_overrideUrls.put(str, str2); + Log.Helper.LOGD(this, "Successfully set Override URL pair: (%s,%s)", str, this.m_overrideUrls.get(str)); + return null; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getServerUrlWithKey(String str) { + Log.Helper.LOGPUBLICFUNC(this); + String str2 = this.m_overrideUrls.get(str); + return str2 != null ? str2 : this.m_serverUrls.get(str); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) { + Log.Helper.LOGPUBLICFUNC(this); + return SynergyEnvironment.getComponent().getSynergyDirectorServerUrl(nimbleConfiguration); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public int getLatestAppVersionCheckResult() { + int parseInt; + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty()) { + return -1; + } + Object obj = this.m_getDirectionResponseDictionary.get("appUpgrade"); + if (obj instanceof Integer) { + parseInt = ((Integer) obj).intValue(); + } else { + parseInt = obj instanceof String ? Integer.parseInt((String) obj) : 0; + } + switch (parseInt) { + case 0: + default: + return 0; + case 1: + return 1; + case 2: + return 2; + } + } + + @Override // com.ea.nimble.ISynergyEnvironment + public int getTrackingPostInterval() { + Integer num; + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || this.m_getDirectionResponseDictionary.isEmpty() || (num = (Integer) this.m_getDirectionResponseDictionary.get("telemetryFreq")) == null) { + return -1; + } + return num.intValue(); + } + + Map getGetDirectionResponseDictionary() { + return this.m_getDirectionResponseDictionary; + } + + void setGetDirectionResponseDictionary(Map map) { + Log.Helper.LOGFUNC(this); + if (map != null) { + map.put(SynergyCatalog.MTX_INFO_KEY_SELLID, ((Integer) map.get(SynergyCatalog.MTX_INFO_KEY_SELLID)).toString()); + map.put("productId", ((Integer) map.get("productId")).toString()); + map.put("hwId", ((Integer) map.get("hwId")).toString()); + this.m_getDirectionResponseDictionary = map; + return; + } + this.m_getDirectionResponseDictionary = new HashMap(); + } + + Map getServerUrls() { + return this.m_serverUrls; + } + + void setServerUrls(Map map) { + Log.Helper.LOGFUNC(this); + this.m_serverUrls = map; + } + + void setEADeviceId(String str) { + Log.Helper.LOGFUNC(this); + this.m_eaDeviceId = str; + } + + String getSynergyAnonymousId() { + Log.Helper.LOGFUNC(this); + return this.m_synergyAnonymousId; + } + + void setSynergyAnonymousId(String str) { + Log.Helper.LOGFUNC(this); + this.m_synergyAnonymousId = str; + } + + Long getMostRecentDirectorResponseTimestamp() { + Log.Helper.LOGFUNC(this); + return this.m_lastDirectorResponseTimestamp; + } + + void setMostRecentDirectorResponseTimestamp(Long l) { + Log.Helper.LOGFUNC(this); + this.m_lastDirectorResponseTimestamp = l; + } + + @Override // java.io.Externalizable + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + this.m_getDirectionResponseDictionary = (Map) objectInput.readObject(); + if (this.m_getDirectionResponseDictionary.isEmpty()) { + this.m_getDirectionResponseDictionary = null; + } + this.m_serverUrls = (Map) objectInput.readObject(); + if (this.m_serverUrls.isEmpty()) { + this.m_serverUrls = null; + } + this.m_eaDeviceId = (String) objectInput.readObject(); + if (this.m_eaDeviceId.length() == 0) { + this.m_eaDeviceId = null; + } + this.m_synergyAnonymousId = (String) objectInput.readObject(); + if (this.m_synergyAnonymousId.length() == 0) { + this.m_synergyAnonymousId = null; + } + this.m_lastDirectorResponseTimestamp = Long.valueOf(objectInput.readLong()); + if (this.m_lastDirectorResponseTimestamp.longValue() == 0) { + this.m_lastDirectorResponseTimestamp = null; + } + this.m_applicationLanguageCode = (String) objectInput.readObject(); + if (this.m_applicationLanguageCode.length() == 0) { + this.m_applicationLanguageCode = null; + } + } + + @Override // java.io.Externalizable + public void writeExternal(ObjectOutput objectOutput) throws IOException { + objectOutput.writeObject(this.m_getDirectionResponseDictionary == null ? new HashMap() : this.m_getDirectionResponseDictionary); + objectOutput.writeObject(this.m_serverUrls == null ? new HashMap() : this.m_serverUrls); + objectOutput.writeObject(this.m_eaDeviceId == null ? "" : this.m_eaDeviceId); + objectOutput.writeObject(this.m_synergyAnonymousId == null ? "" : this.m_synergyAnonymousId); + objectOutput.writeLong(this.m_lastDirectorResponseTimestamp == null ? 0L : this.m_lastDirectorResponseTimestamp.longValue()); + objectOutput.writeObject(this.m_applicationLanguageCode == null ? "" : this.m_applicationLanguageCode); + } + + /* JADX WARN: Removed duplicated region for block: B:78:0x0273 A[RETURN] */ + /* JADX WARN: Removed duplicated region for block: B:80:0x0274 A[RETURN] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public java.util.Set getKeysOfDifferences(com.ea.nimble.ISynergyEnvironment r4) { + /* + Method dump skipped, instructions count: 630 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.EnvironmentDataContainer.getKeysOfDifferences(com.ea.nimble.ISynergyEnvironment):java.util.Set"); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isDataAvailable() { + Log.Helper.LOGPUBLICFUNC(this); + return true; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isUpdateInProgress() { + Log.Helper.LOGPUBLICFUNC(this); + return false; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public Error checkAndInitiateSynergyEnvironmentUpdate() { + Log.Helper.LOGPUBLICFUNC(this); + return null; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isFeatureDisabled(String str) { + List list; + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_getDirectionResponseDictionary == null || (list = (List) this.m_getDirectionResponseDictionary.get("disabledFeatures")) == null) { + return false; + } + return list.contains(str); + } +} diff --git a/app/src/main/java/com/ea/nimble/Error.java b/app/src/main/java/com/ea/nimble/Error.java new file mode 100644 index 0000000..25e80ff --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Error.java @@ -0,0 +1,180 @@ +/* + * Decompiled with CFR 0.152. + * + * Could not load the following classes: + * android.os.Parcel + * android.os.Parcelable + * android.os.Parcelable$Creator + */ +package com.ea.nimble; + +import android.os.Parcel; +import android.os.Parcelable; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; + +public class Error + extends Exception + implements Parcelable, + Externalizable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator(){ + + public Error createFromParcel(Parcel parcel) { + return new Error(parcel); + } + + public Error[] newArray(int n2) { + return new Error[n2]; + } + }; + public static final String ERROR_DOMAIN = "NimbleError"; + private static final long serialVersionUID = 1L; + private int m_code; + private String m_domain; + + public Error() { + } + + public Error(Parcel parcel) { + this.readFromParcel(parcel); + } + + public Error(Code code, String string2) { + this(code, string2, null); + } + + public Error(Code code, String string2, Throwable throwable) { + this(ERROR_DOMAIN, code.intValue(), string2, throwable); + } + + public Error(String string2, int n2, String string3) { + this(string2, n2, string3, null); + } + + public Error(String string2, int n2, String string3, Throwable throwable) { + super(string3, throwable); + this.m_domain = string2; + this.m_code = n2; + } + + public int describeContents() { + return 0; + } + + public int getCode() { + return this.m_code; + } + + public String getDomain() { + return this.m_domain; + } + + public boolean isError(Code code) { + if (this.m_code != code.intValue()) return false; + return true; + } + + @Override + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + this.m_domain = objectInput.readUTF(); + this.m_code = objectInput.readInt(); + this.initCause((Throwable)objectInput.readObject()); + } + + public void readFromParcel(Parcel parcel) { + this.m_domain = parcel.readString(); + this.m_code = parcel.readInt(); + this.initCause((Throwable)parcel.readSerializable()); + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + if (this.m_domain != null && this.m_domain.length() > 0) { + stringBuilder.append(this.m_domain).append("("); + } else { + stringBuilder.append("Error").append("("); + } + stringBuilder.append(this.m_code).append(")"); + Object object = this.getLocalizedMessage(); + if (object != null && ((String)object).length() > 0) { + stringBuilder.append(": ").append((String)object); + } + if ((object = this.getCause()) == null) return stringBuilder.toString(); + stringBuilder.append("\nCaused by: "); + StringWriter stringWriter = new StringWriter(); + ((Throwable)object).printStackTrace(new PrintWriter(stringWriter)); + stringBuilder.append(stringWriter.toString()); + return stringBuilder.toString(); + } + + @Override + public void writeExternal(ObjectOutput objectOutput) throws IOException { + if (this.m_domain != null && this.m_domain.length() > 0) { + objectOutput.writeUTF(this.m_domain); + } else { + objectOutput.writeUTF(""); + } + objectOutput.writeInt(this.m_code); + objectOutput.writeObject(this.getCause()); + } + + public void writeToParcel(Parcel parcel, int n2) { + if (this.m_domain != null && this.m_domain.length() > 0) { + parcel.writeString(this.m_domain); + } else { + parcel.writeString(""); + } + parcel.writeInt(this.m_code); + Throwable throwable = this.getCause(); + if (throwable != null) { + parcel.writeSerializable((Serializable)throwable); + return; + } + parcel.writeSerializable((Serializable)((Object)"")); + } + + public static enum Code { + UNKNOWN(0), + SYSTEM_UNEXPECTED(100), + NOT_READY(101), + UNSUPPORTED(102), + NOT_AVAILABLE(103), + NOT_IMPLEMENTED(104), + INVALID_ARGUMENT(301), + MISSING_CALLBACK(300), + NETWORK_UNSUPPORTED_CONNECTION_TYPE(1001), + NETWORK_NO_CONNECTION(1002), + NETWORK_UNREACHABLE(1003), + NETWORK_OVERSIZE_DATA(1004), + NETWORK_OPERATION_CANCELLED(1005), + NETWORK_INVALID_SERVER_RESPONSE(1006), + NETWORK_TIMEOUT(1007), + NETWORK_CONNECTION_ERROR(1010), + SYNERGY_SERVER_FULL(2001), + SYNERGY_GET_DIRECTION_TIMEOUT(2002), + SYNERGY_GET_EA_DEVICE_ID_FAILURE(2003), + SYNERGY_VALIDATE_EA_DEVICE_ID_FAILURE(2004), + SYNERGY_GET_ANONYMOUS_ID_FAILURE(2005), + SYNERGY_ENVIRONMENT_UPDATE_FAILURE(2006), + SYNERGY_PURCHASE_VERIFICATION_FAILURE(2007), + SYNERGY_GET_NONCE_FAILURE(2008), + SYNERGY_GET_AGE_COMPLIANCE_FAILURE(2009); + + private int m_value; + + private Code(int n3) { + this.m_value = n3; + } + + public int intValue() { + return this.m_value; + } + } +} + diff --git a/app/src/main/java/com/ea/nimble/Facebook.java b/app/src/main/java/com/ea/nimble/Facebook.java new file mode 100644 index 0000000..1037346 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Facebook.java @@ -0,0 +1,14 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class Facebook { + public static final String COMPONENT_ID = "com.ea.nimble.facebook"; + + private static void initialize() { + Base.registerComponent(new FacebookImpl(), "com.ea.nimble.facebook"); + } + + public static IFacebook getComponent() { + return (IFacebook) Base.getComponent("com.ea.nimble.facebook"); + } +} diff --git a/app/src/main/java/com/ea/nimble/FacebookCallback.java b/app/src/main/java/com/ea/nimble/FacebookCallback.java new file mode 100644 index 0000000..a81c513 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/FacebookCallback.java @@ -0,0 +1,6 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface FacebookCallback { + void callback(IFacebook iFacebook, boolean z, Exception exc); +} diff --git a/app/src/main/java/com/ea/nimble/FacebookImpl.java b/app/src/main/java/com/ea/nimble/FacebookImpl.java new file mode 100644 index 0000000..eecc6ed --- /dev/null +++ b/app/src/main/java/com/ea/nimble/FacebookImpl.java @@ -0,0 +1,386 @@ +package com.ea.nimble; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import com.ea.nimble.Error; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.IFacebook; +import com.ea.nimble.Log; +import com.ea.nimble.NimbleFacebookError; +import com.facebook.AccessToken; +import com.facebook.CallbackManager; +import com.facebook.FacebookException; +import com.facebook.FacebookSdk; +import com.facebook.GraphRequest; +import com.facebook.HttpMethod; +import com.facebook.Profile; +import com.facebook.login.LoginManager; +import com.facebook.login.LoginResult; +import com.facebook.share.internal.ShareConstants; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.http.client.methods.HttpGet; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class FacebookImpl extends Component implements IFacebook, LogSource, IApplicationLifecycle.ActivityLifecycleCallbacks, IApplicationLifecycle.ActivityEventCallbacks { + private CallbackManager m_callbackManager = null; + private IFacebook.RequestCallback m_loginCallback = null; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.facebook"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "FB-Android"; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityDestroyed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityPaused(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityResumed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStarted(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStopped(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public boolean onBackPressed() { + return true; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onNewIntent(Activity activity, Intent intent) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onWindowFocusChanged(boolean z) { + } + + FacebookImpl() { + } + + @Override // com.ea.nimble.Component + protected void setup() { + Log.Helper.LOGV(this, "Using Facebook SDK version " + FacebookSdk.getSdkVersion() + ".", new Object[0]); + } + + @Override // com.ea.nimble.Component + public void restore() { + ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this); + ApplicationLifecycle.getComponent().registerActivityLifecycleCallbacks(this); + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + ApplicationLifecycle.getComponent().unregisterActivityLifecycleCallbacks(this); + ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onActivityResult(Activity activity, int i, int i2, Intent intent) { + if (this.m_callbackManager != null) { + this.m_callbackManager.onActivityResult(i, i2, intent); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityCreated(Activity activity, Bundle bundle) { + this.m_callbackManager = CallbackManager.Factory.create(); + LoginManager.getInstance().registerCallback(this.m_callbackManager, new com.facebook.FacebookCallback() { // 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 list, IFacebook.RequestCallback requestCallback) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_loginCallback = requestCallback; + while (!FacebookSdk.isInitialized()) { + try { + Thread.sleep(10L); + } catch (InterruptedException unused) { + } + } + synchronized (this) { + LoginManager.getInstance().logInWithReadPermissions(ApplicationEnvironment.getCurrentActivity(), list); + } + } + + @Override // com.ea.nimble.IFacebook + public void logout() { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (this) { + LoginManager.getInstance().logOut(); + AccessToken.setCurrentAccessToken(null); + Profile.setCurrentProfile(null); + HashMap hashMap = new HashMap(); + hashMap.put("status", "loggedOut"); + Utility.sendBroadcast(IFacebook.NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED, hashMap); + } + } + + private void sendGraphRequest(final String str, final HashMap 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.(r2, r3, r4) + java.lang.String r2 = "Facebook" + java.lang.StringBuilder r3 = new java.lang.StringBuilder + r3.() + 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.() + java.lang.String r3 = "Response of FB Graph request " + r2.append(r3) + com.ea.nimble.FacebookImpl$2 r3 = com.ea.nimble.FacebookImpl.AnonymousClass2.this + java.lang.String r3 = r3 + r2.append(r3) + java.lang.String r3 = " returned with data: " + r2.append(r3) + org.json.JSONObject r3 = r6.getJSONObject() + r2.append(r3) + java.lang.String r2 = r2.toString() + java.lang.Object[] r1 = new java.lang.Object[r1] + com.ea.nimble.Log.Helper.LOGDS(r0, r2, r1) + L6b: + r0 = 0 + L6c: + com.ea.nimble.FacebookImpl$2 r1 = com.ea.nimble.FacebookImpl.AnonymousClass2.this + com.ea.nimble.IFacebook$RequestCallback r1 = r4 + if (r1 == 0) goto L7d + com.ea.nimble.FacebookImpl$2 r1 = com.ea.nimble.FacebookImpl.AnonymousClass2.this + com.ea.nimble.IFacebook$RequestCallback r1 = r4 + java.lang.String r6 = r6.getRawResponse() + r1.callback(r6, r0) + L7d: + return + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.FacebookImpl.AnonymousClass2.AnonymousClass1.onCompleted(com.facebook.GraphResponse):void"); + } + }).executeAsync(); + } + }); + } + + @Override // com.ea.nimble.IFacebook + public void requestUserInfo(HashMap hashMap, IFacebook.RequestCallback requestCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (hashMap == null || !hashMap.containsKey(GraphRequest.FIELDS_PARAM)) { + hashMap = new HashMap<>(); + hashMap.put(GraphRequest.FIELDS_PARAM, "id, email, name, first_name, last_name, gender, link, locale, timezone, updated_time, verified"); + } + sendGraphRequest("/me", hashMap, HttpGet.METHOD_NAME, requestCallback); + } + + @Override // com.ea.nimble.IFacebook + public void requestFriends(HashMap hashMap, IFacebook.RequestCallback requestCallback) { + Log.Helper.LOGPUBLICFUNC(this); + sendGraphRequest("/me/friends", hashMap, HttpGet.METHOD_NAME, requestCallback); + } + + @Override // com.ea.nimble.IFacebook + public boolean hasOpenSession() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken currentAccessToken = AccessToken.getCurrentAccessToken(); + return (currentAccessToken == null || currentAccessToken.isExpired()) ? false : true; + } + + @Override // com.ea.nimble.IFacebook + public String getAccessToken() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken currentAccessToken = AccessToken.getCurrentAccessToken(); + if (currentAccessToken != null) { + return currentAccessToken.getToken(); + } + return null; + } + + @Override // com.ea.nimble.IFacebook + public List getPermissions() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken currentAccessToken = AccessToken.getCurrentAccessToken(); + if (currentAccessToken != null) { + return new ArrayList(currentAccessToken.getPermissions()); + } + return null; + } + + @Override // com.ea.nimble.IFacebook + public Date getTokenExpirationDate() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken currentAccessToken = AccessToken.getCurrentAccessToken(); + if (currentAccessToken != null) { + return currentAccessToken.getExpires(); + } + return null; + } + + @Override // com.ea.nimble.IFacebook + public String getApplicationId() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken currentAccessToken = AccessToken.getCurrentAccessToken(); + if (currentAccessToken != null) { + return currentAccessToken.getApplicationId(); + } + return null; + } + + @Override // com.ea.nimble.IFacebook + public void refreshToken() { + Log.Helper.LOGPUBLICFUNC(this); + AccessToken.refreshCurrentAccessTokenAsync(); + } + + @Override // com.ea.nimble.IFacebook + public Map getGraphUser() { + Log.Helper.LOGPUBLICFUNC(this); + Profile currentProfile = Profile.getCurrentProfile(); + if (currentProfile == null) { + return null; + } + HashMap hashMap = new HashMap(); + hashMap.put("first_name", currentProfile.getFirstName()); + hashMap.put("last_name", currentProfile.getLastName()); + hashMap.put("link", currentProfile.getLinkUri()); + hashMap.put("avatar", "https://graph.facebook.com/" + currentProfile.getId() + "/picture"); + hashMap.put("id", currentProfile.getId()); + return hashMap; + } + + @Override // com.ea.nimble.IFacebook + public void retrieveFriends(int i, int i2, final IFacebook.FacebookFriendsCallback facebookFriendsCallback) { + Log.Helper.LOGPUBLICFUNC(this); + HashMap 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); + } + }); + } +} diff --git a/app/src/main/java/com/ea/nimble/Global.java b/app/src/main/java/com/ea/nimble/Global.java new file mode 100644 index 0000000..673ed0a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Global.java @@ -0,0 +1,37 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class Global { + public static final String NIMBLE_AUTHENTICATOR_ANONYMOUS = "anonymous"; + public static final String NIMBLE_AUTHENTICATOR_FACEBOOK = "facebook"; + public static final String NIMBLE_AUTHENTICATOR_ORIGIN = "origin"; + public static final String NIMBLE_DOMAIN = "com.ea.nimble"; + public static final String NIMBLE_ID = "Nimble"; + public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID = "authenticatorId"; + public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_PIDMAP_ID = "pidMapId"; + public static final String NIMBLE_NOTIFICATION_AGE_COMPLIANCE_DOB_UPDATE = "nimble.notification.ageCompliance.dobUpdate"; + public static final String NIMBLE_NOTIFICATION_ATTRIBUTION_DATA_AVAILABLE = "nimble.notification.attributionDataAvailable"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE = "nimble.notification.identity.authentication.update"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_MAIN_AUTHENTICATOR_CHANGE = "nimble.notification.identity.main.authenticator.change"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_PERSONA_INFO_UPDATE = "nimble.notification.identity.authenticator.persona.info.update"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE = "nimble.notification.identity.authenticator.pid.info.update"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_USER_INFO_UPDATE = "nimble.notification.identity.authenticator.user.info.update"; + public static final String NIMBLE_NOTIFICATION_PLAYERIDMAP_CHANGE = "nimble.notification.playerIdMapChange"; + public static final String NIMBLE_RELEASE_VERSION = "1.40.0.39"; + public static final String NIMBLE_SDK_VERSION = "1.40.0.39.0921"; + public static final String NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY = "com.ea.nimble.pushtng.channel.description"; + public static final String NOTIFICATION_CHANNEL_DEFAULT_ID = "nimble_default"; + public static final String NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY = "com.ea.nimble.pushtng.channel.name"; + public static final String NOTIFICATION_CHANNEL_DEFAULT_NAME_VALUE = "Default"; + public static final String NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY = "com.ea.nimble.NimbleLocalNotifications.channel.id"; + public static final String NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY = "com.ea.nimble.pushtng.channel.id"; + public static final String NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED = "nimble.notification.componentIndependentSetupFinished"; + public static final String NOTIFICATION_DICTIONARY_KEY_DETAIL_ERROR = "detailError"; + public static final String NOTIFICATION_DICTIONARY_KEY_ERROR = "error"; + public static final String NOTIFICATION_DICTIONARY_KEY_RESULT = "result"; + public static final String NOTIFICATION_DICTIONARY_RESULT_FAIL = "0"; + public static final String NOTIFICATION_DICTIONARY_RESULT_SUCCESS = "1"; + public static final String NOTIFICATION_LANGUAGE_CHANGE = "nimble.notification.languageChange"; + public static final String NOTIFICATION_LOGIN_STATUS_CHANGE = "nimble.notification.loginStatusChange"; + public static final String NOTIFICATION_NETWORK_STATUS_CHANGE = "nimble.notification.networkStatusChange"; +} diff --git a/app/src/main/java/com/ea/nimble/HttpError.java b/app/src/main/java/com/ea/nimble/HttpError.java new file mode 100644 index 0000000..562aaee --- /dev/null +++ b/app/src/main/java/com/ea/nimble/HttpError.java @@ -0,0 +1,15 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class HttpError extends Error { + public static final String ERROR_DOMAIN = "HttpError"; + private static final long serialVersionUID = 1; + + public HttpError(int i, String str, Throwable th) { + super(ERROR_DOMAIN, i, str, th); + } + + public HttpError(int i, String str) { + super(ERROR_DOMAIN, i, str, null); + } +} diff --git a/app/src/main/java/com/ea/nimble/HttpRequest.java b/app/src/main/java/com/ea/nimble/HttpRequest.java new file mode 100644 index 0000000..a0ac49f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/HttpRequest.java @@ -0,0 +1,75 @@ +package com.ea.nimble; + +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import java.io.ByteArrayOutputStream; +import java.net.URL; +import java.util.HashMap; + +/* loaded from: classes.dex */ +public class HttpRequest implements IHttpRequest { + private static int DEFAULT_NETWORK_TIMEOUT = 30; + public ByteArrayOutputStream data; + public HashMap headers; + public IHttpRequest.Method method; + public boolean runInBackground; + public String targetFilePath; + public double timeout; + public URL url; + + public HttpRequest() { + this.url = null; + this.method = IHttpRequest.Method.GET; + this.data = new ByteArrayOutputStream(); + this.headers = new HashMap<>(); + this.timeout = DEFAULT_NETWORK_TIMEOUT; + this.targetFilePath = null; + } + + public HttpRequest(URL url) { + this(); + this.url = url; + } + + @Override // com.ea.nimble.IHttpRequest + public URL getUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.url; + } + + @Override // com.ea.nimble.IHttpRequest + public IHttpRequest.Method getMethod() { + Log.Helper.LOGPUBLICFUNC(this); + return this.method; + } + + @Override // com.ea.nimble.IHttpRequest + public byte[] getData() { + Log.Helper.LOGPUBLICFUNC(this); + return this.data.toByteArray(); + } + + @Override // com.ea.nimble.IHttpRequest + public HashMap getHeaders() { + Log.Helper.LOGPUBLICFUNC(this); + return this.headers; + } + + @Override // com.ea.nimble.IHttpRequest + public double getTimeout() { + Log.Helper.LOGPUBLICFUNC(this); + return this.timeout; + } + + @Override // com.ea.nimble.IHttpRequest + public String getTargetFilePath() { + Log.Helper.LOGPUBLICFUNC(this); + return this.targetFilePath; + } + + @Override // com.ea.nimble.IHttpRequest + public boolean getRunInBackground() { + Log.Helper.LOGPUBLICFUNC(this); + return this.runInBackground; + } +} diff --git a/app/src/main/java/com/ea/nimble/HttpResponse.java b/app/src/main/java/com/ea/nimble/HttpResponse.java new file mode 100644 index 0000000..324085a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/HttpResponse.java @@ -0,0 +1,81 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import java.io.InputStream; +import java.net.URL; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class HttpResponse implements IHttpResponse { + public Exception error; + public URL url = null; + public boolean isCompleted = false; + public int statusCode = 0; + public HashMap headers = new HashMap<>(); + public long expectedContentLength = 0; + public long downloadedContentLength = 0; + public long lastModified = -1; + public ByteBufferIOStream data = new ByteBufferIOStream(); + + @Override // com.ea.nimble.IHttpResponse + public boolean isCompleted() { + Log.Helper.LOGPUBLICFUNC(this); + return this.isCompleted; + } + + @Override // com.ea.nimble.IHttpResponse + public URL getUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.url; + } + + @Override // com.ea.nimble.IHttpResponse + public int getStatusCode() { + Log.Helper.LOGPUBLICFUNC(this); + return this.statusCode; + } + + @Override // com.ea.nimble.IHttpResponse + public Map getHeaders() { + Log.Helper.LOGPUBLICFUNC(this); + return this.headers; + } + + @Override // com.ea.nimble.IHttpResponse + public long getExpectedContentLength() { + Log.Helper.LOGPUBLICFUNC(this); + return this.expectedContentLength; + } + + @Override // com.ea.nimble.IHttpResponse + public long getDownloadedContentLength() { + Log.Helper.LOGPUBLICFUNC(this); + return this.downloadedContentLength; + } + + @Override // com.ea.nimble.IHttpResponse + public Date getLastModified() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.lastModified == 0) { + return new Date(); + } + if (this.lastModified > 0) { + return new Date(this.lastModified); + } + return null; + } + + @Override // com.ea.nimble.IHttpResponse + public InputStream getDataStream() { + Log.Helper.LOGPUBLICFUNC(this); + return this.data.getInputStream(); + } + + @Override // com.ea.nimble.IHttpResponse + public Exception getError() { + Log.Helper.LOGPUBLICFUNC(this); + return this.error; + } +} diff --git a/app/src/main/java/com/ea/nimble/IApplicationEnvironment.java b/app/src/main/java/com/ea/nimble/IApplicationEnvironment.java new file mode 100644 index 0000000..9c241a4 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IApplicationEnvironment.java @@ -0,0 +1,89 @@ +package com.ea.nimble; + +import android.content.Context; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface IApplicationEnvironment { + public static final String UNAVAILABLE_ADVERTISING_ID = ""; + + public interface AdvertisingIdCalback { + void onCallback(String str, boolean z); + } + + public interface SafetyNetAttestationCallback { + void onCallback(String str, Error error); + } + + String getAdvertisingId(); + + int getAgeCompliance(); + + String getAndroidId(); + + String getApplicationBundleId(); + + Context getApplicationContext(); + + String getApplicationLanguageCode(); + + String getApplicationName(); + + String getApplicationVersion(); + + String getCachePath(); + + String getCarrier(); + + String getCurrencyCode(); + + String getDeviceBrand(); + + String getDeviceCodename(); + + String getDeviceFingerprint(); + + String getDeviceManufacturer(); + + String getDeviceModel(); + + String getDeviceString(); + + String getDocumentPath(); + + String getGameSpecifiedPlayerId(); + + String getGoogleAdvertisingId(); + + String getGoogleEmail(); + + boolean getIadAttribution(); + + String getOsVersion(); + + String getParameter(String str); + + Map getPlayerIdMap(); + + String getShortApplicationLanguageCode(); + + String getTempPath(); + + boolean isAppCracked(); + + boolean isDeviceRooted(); + + boolean isLimitAdTrackingEnabled(); + + void refreshAgeCompliance(); + + void requestSafetyNetAttestation(byte[] bArr, SafetyNetAttestationCallback safetyNetAttestationCallback); + + void retrieveAdvertisingId(AdvertisingIdCalback advertisingIdCalback); + + void setApplicationLanguageCode(String str); + + void setGameSpecifiedPlayerId(String str); + + void setPlayerId(String str, String str2); +} diff --git a/app/src/main/java/com/ea/nimble/IApplicationLifecycle.java b/app/src/main/java/com/ea/nimble/IApplicationLifecycle.java new file mode 100644 index 0000000..39082b9 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IApplicationLifecycle.java @@ -0,0 +1,134 @@ +package com.ea.nimble; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +/* loaded from: classes.dex */ +public interface IApplicationLifecycle { + + public interface ActivityEventCallbacks { + void onActivityResult(Activity activity, int i, int i2, Intent intent); + + boolean onBackPressed(); + + void onNewIntent(Activity activity, Intent intent); + + void onWindowFocusChanged(boolean z); + } + + public static class ActivityEventHandler implements ActivityEventCallbacks { + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onActivityResult(Activity activity, int i, int i2, Intent intent) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public boolean onBackPressed() { + return true; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onNewIntent(Activity activity, Intent intent) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onWindowFocusChanged(boolean z) { + } + } + + public interface ActivityLifecycleCallbacks { + void onActivityCreated(Activity activity, Bundle bundle); + + void onActivityDestroyed(Activity activity); + + void onActivityPaused(Activity activity); + + void onActivityResumed(Activity activity); + + void onActivitySaveInstanceState(Activity activity, Bundle bundle); + + void onActivityStarted(Activity activity); + + void onActivityStopped(Activity activity); + } + + public static class ActivityLifecycleHandler implements ActivityLifecycleCallbacks { + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityCreated(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityDestroyed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityPaused(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityResumed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStarted(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStopped(Activity activity) { + } + } + + public interface ApplicationLifecycleCallbacks { + void onApplicationLaunch(Intent intent); + + void onApplicationQuit(); + + void onApplicationResume(); + + void onApplicationSuspend(); + } + + boolean handleBackPressed(); + + void notifyActivityCreate(Bundle bundle, Activity activity); + + void notifyActivityDestroy(Activity activity); + + void notifyActivityOnNewIntent(Intent intent, Activity activity); + + void notifyActivityPause(Activity activity); + + void notifyActivityRestart(Activity activity); + + void notifyActivityRestoreInstanceState(Bundle bundle, Activity activity); + + void notifyActivityResult(int i, int i2, Intent intent, Activity activity); + + void notifyActivityResume(Activity activity); + + void notifyActivityRetainNonConfigurationInstance(); + + void notifyActivitySaveInstanceState(Bundle bundle, Activity activity); + + void notifyActivityStart(Activity activity); + + void notifyActivityStop(Activity activity); + + void notifyActivityWindowFocusChanged(boolean z, Activity activity); + + void registerActivityEventCallbacks(ActivityEventCallbacks activityEventCallbacks); + + void registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks activityLifecycleCallbacks); + + void registerApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks applicationLifecycleCallbacks); + + void unregisterActivityEventCallbacks(ActivityEventCallbacks activityEventCallbacks); + + void unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks activityLifecycleCallbacks); + + void unregisterApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks applicationLifecycleCallbacks); +} diff --git a/app/src/main/java/com/ea/nimble/IFacebook.java b/app/src/main/java/com/ea/nimble/IFacebook.java new file mode 100644 index 0000000..2dfc7ea --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IFacebook.java @@ -0,0 +1,44 @@ +package com.ea.nimble; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.json.JSONArray; + +/* loaded from: classes.dex */ +public interface IFacebook { + public static final String NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED = "nimble.notification.facebook.statuschanged"; + + public interface FacebookFriendsCallback { + void callback(IFacebook iFacebook, JSONArray jSONArray, Error error); + } + + public interface RequestCallback { + void callback(String str, Error error); + } + + String getAccessToken(); + + String getApplicationId(); + + Map getGraphUser(); + + List getPermissions(); + + Date getTokenExpirationDate(); + + boolean hasOpenSession(); + + void login(List list, RequestCallback requestCallback); + + void logout(); + + void refreshToken(); + + void requestFriends(HashMap hashMap, RequestCallback requestCallback); + + void requestUserInfo(HashMap hashMap, RequestCallback requestCallback); + + void retrieveFriends(int i, int i2, FacebookFriendsCallback facebookFriendsCallback); +} diff --git a/app/src/main/java/com/ea/nimble/IHttpRequest.java b/app/src/main/java/com/ea/nimble/IHttpRequest.java new file mode 100644 index 0000000..e954062 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IHttpRequest.java @@ -0,0 +1,60 @@ +/* + * Decompiled with CFR 0.152. + */ +package com.ea.nimble; + +import java.net.URL; +import java.util.EnumSet; +import java.util.Map; + +public interface IHttpRequest { + byte[] getData(); + + Map getHeaders(); + + Method getMethod(); + + EnumSet getOverwritePolicy(); + + boolean getRunInBackground(); + + String getTargetFilePath(); + + double getTimeout(); + + URL getUrl(); + + static enum Method { + GET("GET"), + HEAD("HEAD"), + POST("POST"), + PUT("PUT"), + DELETE("DELETE"), + UNRECOGNIZED("UNRECOGNIZED"); + + private String title; + + Method(String title) { + this.title = title; + } + + public String toString() { + return title; + } + } + + enum OverwritePolicy { + RESUME_DOWNLOAD, + DATE_CHECK, + LENGTH_CHECK; + + static final EnumSet OVERWRITE; + static final EnumSet SMART; + + static { + OVERWRITE = EnumSet.noneOf(OverwritePolicy.class); + SMART = EnumSet.allOf(OverwritePolicy.class); + } + } +} + diff --git a/app/src/main/java/com/ea/nimble/IHttpResponse.java b/app/src/main/java/com/ea/nimble/IHttpResponse.java new file mode 100644 index 0000000..a562a57 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IHttpResponse.java @@ -0,0 +1,27 @@ +package com.ea.nimble; + +import java.io.InputStream; +import java.net.URL; +import java.util.Date; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface IHttpResponse { + InputStream getDataStream(); + + long getDownloadedContentLength(); + + Exception getError(); + + long getExpectedContentLength(); + + Map getHeaders(); + + Date getLastModified(); + + int getStatusCode(); + + URL getUrl(); + + boolean isCompleted(); +} diff --git a/app/src/main/java/com/ea/nimble/ILog.java b/app/src/main/java/com/ea/nimble/ILog.java new file mode 100644 index 0000000..90f1124 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ILog.java @@ -0,0 +1,21 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface ILog { + + public interface LogCallback { + void callback(int i, String str, String str2); + } + + String getLogFilePath(); + + int getThresholdLevel(); + + void setLogCallback(LogCallback logCallback); + + void setThresholdLevel(int i); + + void writeWithSource(int i, Object obj, String str, Object... objArr); + + void writeWithTitle(int i, String str, String str2, Object... objArr); +} diff --git a/app/src/main/java/com/ea/nimble/INetwork.java b/app/src/main/java/com/ea/nimble/INetwork.java new file mode 100644 index 0000000..158fafe --- /dev/null +++ b/app/src/main/java/com/ea/nimble/INetwork.java @@ -0,0 +1,24 @@ +package com.ea.nimble; + +import com.ea.nimble.Network; +import java.net.URL; +import java.util.HashMap; + +/* loaded from: classes.dex */ +public interface INetwork { + void forceRedetectNetworkStatus(); + + Network.Status getStatus(); + + boolean isNetworkWifi(); + + NetworkConnectionHandle sendDeleteRequest(URL url, HashMap hashMap, NetworkConnectionCallback networkConnectionCallback); + + NetworkConnectionHandle sendGetRequest(URL url, HashMap hashMap, NetworkConnectionCallback networkConnectionCallback); + + NetworkConnectionHandle sendPostRequest(URL url, HashMap hashMap, byte[] bArr, NetworkConnectionCallback networkConnectionCallback); + + NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback); + + NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback, IOperationalTelemetryDispatch iOperationalTelemetryDispatch); +} diff --git a/app/src/main/java/com/ea/nimble/INimbleBadgeProvider.java b/app/src/main/java/com/ea/nimble/INimbleBadgeProvider.java new file mode 100644 index 0000000..a645fe6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/INimbleBadgeProvider.java @@ -0,0 +1,8 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface INimbleBadgeProvider { + int getBadgeCount(); + + Error setBadgeCount(int i, String str, String str2); +} diff --git a/app/src/main/java/com/ea/nimble/INimbleLocalNotifications.java b/app/src/main/java/com/ea/nimble/INimbleLocalNotifications.java new file mode 100644 index 0000000..33b3c0e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/INimbleLocalNotifications.java @@ -0,0 +1,22 @@ +package com.ea.nimble; + +import java.util.Date; + +/* loaded from: classes.dex */ +public interface INimbleLocalNotifications { + void cancelAllNotifications(); + + void cancelNotification(String str); + + int getBadgeCount(); + + boolean isEnabled(); + + Error scheduleNotification(String str, String str2, String str3, Date date); + + Error setBadgeCount(int i, String str, String str2); + + void setBadgeProvider(INimbleBadgeProvider iNimbleBadgeProvider); + + void setEnabled(boolean z); +} diff --git a/app/src/main/java/com/ea/nimble/IOperationalTelemetryDispatch.java b/app/src/main/java/com/ea/nimble/IOperationalTelemetryDispatch.java new file mode 100644 index 0000000..7d22b84 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IOperationalTelemetryDispatch.java @@ -0,0 +1,20 @@ +package com.ea.nimble; + +import java.util.List; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public interface IOperationalTelemetryDispatch { + public static final String EVENTTYPE_NETWORK_METRICS = "com.ea.nimble.network"; + public static final String EVENTTYPE_TRACKING_SYNERGY_PAYLOADS = "com.ea.nimble.trackingimpl.synergy"; + public static final int NIMBLE_DEFAULT_MAX_OT_EVENT_COUNT = 100; + public static final String NOTIFICATION_OT_EVENT_THRESHOLD_WARNING = "nimble.notification.ot.eventthresholdwarning"; + + List getEvents(String str); + + int getMaxEventCount(String str); + + void logEvent(String str, JSONObject jSONObject); + + void setMaxEventCount(String str, int i); +} diff --git a/app/src/main/java/com/ea/nimble/IPersistenceService.java b/app/src/main/java/com/ea/nimble/IPersistenceService.java new file mode 100644 index 0000000..6267c05 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/IPersistenceService.java @@ -0,0 +1,17 @@ +package com.ea.nimble; + +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; + +/* loaded from: classes.dex */ +public interface IPersistenceService { + void cleanPersistenceReference(String str, Persistence.Storage storage); + + Persistence getPersistence(String str, Persistence.Storage storage); + + void migratePersistence(String str, Persistence.Storage storage, String str2, PersistenceService.PersistenceMergePolicy persistenceMergePolicy); + + void removePersistence(String str, Persistence.Storage storage); + + void wipeAllDataAndForceTerminate(); +} diff --git a/app/src/main/java/com/ea/nimble/ISynergyEnvironment.java b/app/src/main/java/com/ea/nimble/ISynergyEnvironment.java new file mode 100644 index 0000000..55d807e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ISynergyEnvironment.java @@ -0,0 +1,46 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface ISynergyEnvironment { + public static final int NETWORK_CONNECTION_NONE = 1; + public static final int NETWORK_CONNECTION_UNKNOWN = 0; + public static final int NETWORK_CONNECTION_WIFI = 2; + public static final int NETWORK_CONNECTION_WIRELESS = 3; + public static final int SYNERGY_APP_VERSION_OK = 0; + public static final int SYNERGY_APP_VERSION_UPDATE_RECOMMENDED = 1; + public static final int SYNERGY_APP_VERSION_UPDATE_REQUIRED = 2; + + Error checkAndInitiateSynergyEnvironmentUpdate(); + + String getEADeviceId(); + + String getEAHardwareId(); + + String getGosMdmAppKey(); + + int getLatestAppVersionCheckResult(); + + String getNexusClientId(); + + String getNexusClientSecret(); + + String getProductId(); + + String getSellId(); + + String getServerUrlWithKey(String str); + + String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration); + + String getSynergyId(); + + int getTrackingPostInterval(); + + boolean isDataAvailable(); + + boolean isFeatureDisabled(String str); + + boolean isUpdateInProgress(); + + Error setServerUrl(String str, String str2); +} diff --git a/app/src/main/java/com/ea/nimble/ISynergyIdManager.java b/app/src/main/java/com/ea/nimble/ISynergyIdManager.java new file mode 100644 index 0000000..ad4711e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ISynergyIdManager.java @@ -0,0 +1,12 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface ISynergyIdManager { + String getAnonymousSynergyId(); + + String getSynergyId(); + + SynergyIdManagerError login(String str, String str2); + + SynergyIdManagerError logout(String str); +} diff --git a/app/src/main/java/com/ea/nimble/ISynergyNetwork.java b/app/src/main/java/com/ea/nimble/ISynergyNetwork.java new file mode 100644 index 0000000..193c794 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ISynergyNetwork.java @@ -0,0 +1,15 @@ +package com.ea.nimble; + +import com.ea.nimble.ISynergyRequest; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface ISynergyNetwork { + SynergyNetworkConnectionHandle sendGetRequest(String str, String str2, Map map, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); + + SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); + + SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback, Map map2); + + void sendRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); +} diff --git a/app/src/main/java/com/ea/nimble/ISynergyRequest.java b/app/src/main/java/com/ea/nimble/ISynergyRequest.java new file mode 100644 index 0000000..b40b575 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ISynergyRequest.java @@ -0,0 +1,23 @@ +package com.ea.nimble; + +import java.util.Map; + +/* loaded from: classes.dex */ +public interface ISynergyRequest { + + public interface IJsonData { + Object getData(); + + int size(); + } + + String getApi(); + + String getBaseUrl(); + + IHttpRequest getHttpRequest(); + + IJsonData getJsonData(); + + Map getUrlParameters(); +} diff --git a/app/src/main/java/com/ea/nimble/ISynergyResponse.java b/app/src/main/java/com/ea/nimble/ISynergyResponse.java new file mode 100644 index 0000000..409cea8 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ISynergyResponse.java @@ -0,0 +1,14 @@ +package com.ea.nimble; + +import java.util.Map; + +/* loaded from: classes.dex */ +public interface ISynergyResponse { + Exception getError(); + + IHttpResponse getHttpResponse(); + + Map getJsonData(); + + boolean isCompleted(); +} diff --git a/app/src/main/java/com/ea/nimble/Log.java b/app/src/main/java/com/ea/nimble/Log.java new file mode 100644 index 0000000..583a380 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Log.java @@ -0,0 +1,113 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class Log { + public static final String COMPONENT_ID = "com.ea.nimble.NimbleLog"; + public static final int LEVEL_ALL = 0; + public static final int LEVEL_DEBUG = 200; + public static final int LEVEL_ERROR = 500; + public static final int LEVEL_FATAL = 600; + public static final int LEVEL_INFO = 300; + public static final int LEVEL_SILENT = 700; + public static final int LEVEL_VERBOSE = 100; + public static final int LEVEL_WARN = 400; + private static ILog s_instance; + + public static class Helper { + public static void LOGV(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(100, obj, str, objArr); + } + + public static void LOGD(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(200, obj, str, objArr); + } + + public static void LOGI(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(300, obj, str, objArr); + } + + public static void LOGW(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(400, obj, str, objArr); + } + + public static void LOGE(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(500, obj, str, objArr); + } + + public static void LOGF(Object obj, String str, Object... objArr) { + Log.getComponent().writeWithSource(Log.LEVEL_FATAL, obj, str, objArr); + } + + public static void LOGVS(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(100, str, str2, objArr); + } + + public static void LOGDS(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(200, str, str2, objArr); + } + + public static void LOGIS(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(300, str, str2, objArr); + } + + public static void LOGWS(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(400, str, str2, objArr); + } + + public static void LOGES(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(500, str, str2, objArr); + } + + public static void LOGFS(String str, String str2, Object... objArr) { + Log.getComponent().writeWithTitle(Log.LEVEL_FATAL, str, str2, objArr); + } + + public static void LOG(int i, String str, Object... objArr) { + Log.getComponent().writeWithTitle(i, null, str, objArr); + } + + private static String getMethodString() { + StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[4]; + return stackTraceElement.getMethodName() + " [Line " + stackTraceElement.getLineNumber() + "] called..."; + } + + public static void LOGFUNC(Object obj) { + ILog component = Log.getComponent(); + if (component.getThresholdLevel() <= 0) { + component.writeWithSource(0, obj, getMethodString(), new Object[0]); + } + } + + public static void LOGPUBLICFUNC(Object obj) { + ILog component = Log.getComponent(); + if (component.getThresholdLevel() <= 100) { + component.writeWithSource(100, obj, getMethodString(), new Object[0]); + } + } + + public static void LOGFUNCS(String str) { + ILog component = Log.getComponent(); + if (component.getThresholdLevel() <= 0) { + component.writeWithTitle(0, str, getMethodString(), new Object[0]); + } + } + + public static void LOGPUBLICFUNCS(String str) { + ILog component = Log.getComponent(); + if (component.getThresholdLevel() <= 100) { + component.writeWithTitle(100, str, getMethodString(), new Object[0]); + } + } + } + + public static synchronized ILog getComponent() { + ILog iLog; + synchronized (Log.class) { + if (s_instance == null) { + s_instance = new LogImpl(); + } + iLog = s_instance; + } + return iLog; + } +} diff --git a/app/src/main/java/com/ea/nimble/LogImpl.java b/app/src/main/java/com/ea/nimble/LogImpl.java new file mode 100644 index 0000000..3b64f77 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/LogImpl.java @@ -0,0 +1,461 @@ +package com.ea.nimble; + +import android.content.pm.PackageManager; +import android.os.Environment; +import android.support.v4.media.session.PlaybackStateCompat; +import com.ea.nimble.ILog; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.Charset; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map; +import org.apache.http.HttpHeaders; +import org.apache.http.protocol.HTTP; + +/* loaded from: classes.dex */ +public class LogImpl extends Component implements ILog { + private static final int DEFAULT_CHECK_INTERVAL = 3600; + private static final int DEFAULT_CONSOLE_OUTPUT_LIMIT = 4000; + private static final int DEFAULT_MESSAGE_LENGTH_LIMIT = 1000; + private static final int DEFAULT_SIZE_LIMIT = 1024; + private int m_messageLengthLimit; + private int m_sizeLimit; + private BaseCore m_core = null; + private int m_level = 0; + private File m_filePath = null; + private FileOutputStream m_logFileStream = null; + private DateFormat m_format = null; + private Timer m_guardTimer = null; + private int m_interval = 0; + private ArrayList m_cache = new ArrayList<>(); + private ILog.LogCallback m_callback = null; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return Log.COMPONENT_ID; + } + + private class GuardTask implements Runnable { + private GuardTask() { + } + + @Override // java.lang.Runnable + public void run() { + if (LogImpl.this.m_filePath == null || LogImpl.this.m_filePath.length() <= LogImpl.this.m_sizeLimit * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) { + return; + } + LogImpl.this.clearLog(); + } + } + + private static class LogRecord { + public int level; + public String message; + + private LogRecord() { + } + } + + LogImpl() { + } + + @Override // com.ea.nimble.Component + public void setup() { + configure(); + } + + @Override // com.ea.nimble.Component + public void suspend() { + if (this.m_guardTimer != null) { + this.m_guardTimer.pause(); + } + } + + @Override // com.ea.nimble.Component + public void resume() { + if (this.m_guardTimer != null) { + this.m_guardTimer.fire(); + this.m_guardTimer.resume(); + } + } + + @Override // com.ea.nimble.Component + public void teardown() { + if (this.m_guardTimer != null) { + this.m_guardTimer.cancel(); + this.m_guardTimer = null; + } + if (this.m_logFileStream != null) { + try { + this.m_logFileStream.close(); + } catch (IOException unused) { + android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't close log file"); + } + this.m_logFileStream = null; + } + } + + @Override // com.ea.nimble.ILog + public int getThresholdLevel() { + return this.m_level; + } + + @Override // com.ea.nimble.ILog + public void setThresholdLevel(int i) { + this.m_level = i; + } + + @Override // com.ea.nimble.ILog + public String getLogFilePath() { + if (this.m_filePath != null) { + return this.m_filePath.toString(); + } + return null; + } + + @Override // com.ea.nimble.ILog + public void setLogCallback(ILog.LogCallback logCallback) { + this.m_callback = logCallback; + } + + @Override // com.ea.nimble.ILog + public void writeWithSource(int i, Object obj, String str, Object... objArr) { + String str2 = ""; + if (obj instanceof LogSource) { + str2 = ((LogSource) obj).getLogSourceTitle(); + } else if (obj != null) { + str2 = obj.getClass().getName(); + } + writeWithTitle(i, str2, str, objArr); + } + + @Override // com.ea.nimble.ILog + public void writeWithTitle(int i, String str, String str2, Object... objArr) { + if (i < this.m_level || !Utility.validString(str2)) { + return; + } + if (objArr.length > 0) { + str2 = String.format(str2, objArr); + } + write(i, str, str2); + if (this.m_callback != null) { + this.m_callback.callback(i, str, str2); + } + } + + protected void connectToCore(BaseCore baseCore) { + this.m_core = baseCore; + configure(); + flushCache(); + } + + protected void disconnectFromCore() { + this.m_core = null; + } + + private void configure() { + boolean z = this.m_level == 0; + Map settings = this.m_core.getSettings(BaseCore.NIMBLE_LOG_SETTING); + if (settings == null) { + int parseLevel = parseLevel(null); + if (parseLevel != this.m_level) { + this.m_level = parseLevel; + android.util.Log.i(Global.NIMBLE_ID, String.format("LOG: Default Log level(%d) without log configuration file", Integer.valueOf(this.m_level))); + return; + } + return; + } + int parseLevel2 = parseLevel(settings.get("Level")); + if (parseLevel2 != this.m_level) { + this.m_level = parseLevel2; + android.util.Log.i(Global.NIMBLE_ID, String.format("LOG: Log level(%d)", Integer.valueOf(this.m_level))); + } + if (this.m_level <= 100) { + this.m_messageLengthLimit = 0; + } else { + String str = settings.get("MessageLengthLimit"); + if (str == null) { + this.m_messageLengthLimit = 1000; + } else { + try { + this.m_messageLengthLimit = Integer.parseInt(str); + if (this.m_messageLengthLimit < 0) { + this.m_messageLengthLimit = 1000; + } + } catch (NumberFormatException unused) { + this.m_messageLengthLimit = 1000; + } + } + } + String str2 = settings.get("File"); + if (!Utility.validString(str2)) { + if (z || this.m_filePath != null) { + this.m_filePath = null; + this.m_logFileStream = null; + this.m_interval = 0; + android.util.Log.i(Global.NIMBLE_ID, "LOG: Disable log to file since no filename provided"); + return; + } + return; + } + String str3 = settings.get(HttpHeaders.LOCATION); + String str4 = ApplicationEnvironment.getComponent().getCachePath() + File.separator + str2; + if (Utility.validString(str3) && str3.equalsIgnoreCase("external") && Environment.getExternalStorageState().equals("mounted")) { + String name = ApplicationEnvironment.getCurrentActivity().getClass().getPackage().getName(); + try { + PackageManager packageManager = ApplicationEnvironment.getCurrentActivity().getPackageManager(); + if (packageManager != null) { + name = packageManager.getPackageInfo(ApplicationEnvironment.getCurrentActivity().getPackageName(), 0).packageName; + } + } catch (Exception unused2) { + } + File file = new File(Environment.getExternalStorageDirectory(), name); + boolean exists = file.exists(); + if (!exists) { + exists = file.mkdir(); + } + if (exists) { + str4 = file + File.separator + str2; + } + } + File file2 = new File(str4); + if (file2 != this.m_filePath) { + this.m_filePath = file2; + try { + this.m_logFileStream = new FileOutputStream(this.m_filePath, true); + android.util.Log.d(Global.NIMBLE_ID, "LOG: File path: " + this.m_filePath.toString()); + } catch (FileNotFoundException unused3) { + android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't create log file at " + str4); + this.m_filePath = null; + return; + } + } + String str5 = settings.get("DateFormat"); + if (str5 != null && str5.length() > 0) { + this.m_format = new SimpleDateFormat(str5, Locale.getDefault()); + } else { + this.m_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault()); + } + try { + this.m_interval = Integer.parseInt(settings.get("FileCheckInterval")); + if (this.m_interval <= 0) { + this.m_interval = DEFAULT_CHECK_INTERVAL; + } + } catch (NumberFormatException unused4) { + this.m_interval = DEFAULT_CHECK_INTERVAL; + } + try { + this.m_sizeLimit = Integer.parseInt(settings.get("MaxFileSize")); + if (this.m_sizeLimit <= 0) { + this.m_sizeLimit = 1024; + } + } catch (NumberFormatException unused5) { + this.m_sizeLimit = 1024; + } + GuardTask guardTask = new GuardTask(); + guardTask.run(); + this.m_guardTimer = new Timer(guardTask); + this.m_guardTimer.schedule(this.m_interval, true); + } + + private void flushCache() { + Iterator it = this.m_cache.iterator(); + while (it.hasNext()) { + LogRecord next = it.next(); + writeLine(next.level, next.message); + } + this.m_cache = null; + } + + private int parseLevel(String str) { + try { + if (Utility.validString(str)) { + int parseInt = Integer.parseInt(str); + if (parseInt != 0) { + return parseInt; + } + } + } catch (NumberFormatException unused) { + if (str.equalsIgnoreCase("all")) { + return 0; + } + if (str.equalsIgnoreCase("verbose")) { + return 100; + } + if (str.equalsIgnoreCase("debug")) { + return 200; + } + if (str.equalsIgnoreCase("info")) { + return 300; + } + if (str.equalsIgnoreCase("warn")) { + return 400; + } + if (str.equalsIgnoreCase("error")) { + return 500; + } + if (str.equalsIgnoreCase("fatal")) { + return Log.LEVEL_FATAL; + } + if (str.equalsIgnoreCase("silent")) { + return Log.LEVEL_SILENT; + } + } + return (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION || this.m_core.getConfiguration() == NimbleConfiguration.STAGE) ? 100 : 500; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void clearLog() { + try { + this.m_logFileStream.close(); + this.m_logFileStream = new FileOutputStream(this.m_filePath, false); + } catch (IOException unused) { + android.util.Log.e(Global.NIMBLE_ID, "LOG: Can't clear log file"); + } + } + + private void writeLine(int i, String str) { + int i2 = 0; + if (i == 0) { + String[] formatLine = formatLine("NIM_ALL", str); + int length = formatLine.length; + while (i2 < length) { + String str2 = formatLine[i2]; + android.util.Log.v(Global.NIMBLE_ID, str2); + outputMessageToFile(str2); + i2++; + } + } else if (i == 100) { + String[] formatLine2 = formatLine("NIM_VERBOSE", str); + int length2 = formatLine2.length; + while (i2 < length2) { + String str3 = formatLine2[i2]; + android.util.Log.v(Global.NIMBLE_ID, str3); + outputMessageToFile(str3); + i2++; + } + } else if (i == 200) { + String[] formatLine3 = formatLine("NIM_DEBUG", str); + int length3 = formatLine3.length; + while (i2 < length3) { + String str4 = formatLine3[i2]; + android.util.Log.d(Global.NIMBLE_ID, str4); + outputMessageToFile(str4); + i2++; + } + } else if (i == 300) { + String[] formatLine4 = formatLine("NIM_INFO", str); + int length4 = formatLine4.length; + while (i2 < length4) { + String str5 = formatLine4[i2]; + android.util.Log.i(Global.NIMBLE_ID, str5); + outputMessageToFile(str5); + i2++; + } + } else if (i == 400) { + String[] formatLine5 = formatLine("NIM_WARN", str); + int length5 = formatLine5.length; + while (i2 < length5) { + String str6 = formatLine5[i2]; + android.util.Log.w(Global.NIMBLE_ID, str6); + outputMessageToFile(str6); + i2++; + } + } else if (i == 500) { + String[] formatLine6 = formatLine("NIM_ERROR", str); + int length6 = formatLine6.length; + while (i2 < length6) { + String str7 = formatLine6[i2]; + android.util.Log.e(Global.NIMBLE_ID, str7); + outputMessageToFile(str7); + i2++; + } + } else if (i == 600) { + String[] formatLine7 = formatLine("NIM_FATAL", str); + String str8 = formatLine7[0]; + while (i2 < formatLine7.length - 1) { + android.util.Log.e(Global.NIMBLE_ID, str8); + outputMessageToFile(str8); + i2++; + str8 = formatLine7[i2]; + } + android.util.Log.wtf(Global.NIMBLE_ID, str8); + outputMessageToFile(str8); + } else { + String[] formatLine8 = formatLine(String.format("NIM(%d)", Integer.valueOf(i)), str); + String str9 = formatLine8[0]; + while (i2 < formatLine8.length - 1) { + android.util.Log.e(Global.NIMBLE_ID, str9); + outputMessageToFile(str9); + i2++; + str9 = formatLine8[i2]; + } + android.util.Log.wtf(Global.NIMBLE_ID, str9); + outputMessageToFile(str9); + } + if (i >= 600) { + if (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION || this.m_core.getConfiguration() == NimbleConfiguration.STAGE) { + throw new AssertionError(str); + } + } + } + + private void write(int i, String str, String str2) { + String str3; + if (Utility.validString(str)) { + str3 = str + "> " + str2; + } else { + str3 = " " + str2; + } + if (this.m_cache != null) { + LogRecord logRecord = new LogRecord(); + logRecord.level = i; + logRecord.message = str3; + this.m_cache.add(logRecord); + return; + } + writeLine(i, str3); + } + + private String[] formatLine(String str, String str2) { + String str3 = str + ">" + str2; + int length = str3.length(); + int i = 0; + if (length > this.m_messageLengthLimit && this.m_messageLengthLimit != 0) { + str3 = str3.substring(0, this.m_messageLengthLimit) + String.format("... and %d chars more", Integer.valueOf(length - this.m_messageLengthLimit)); + length = str3.length(); + } + double d = length; + Double.isNaN(d); + String[] strArr = new String[(int) Math.ceil(d / 4000.0d)]; + while (i < length) { + int i2 = i + DEFAULT_CONSOLE_OUTPUT_LIMIT; + if (i2 < length) { + strArr[i / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i, i2); + } else { + strArr[i / DEFAULT_CONSOLE_OUTPUT_LIMIT] = str3.substring(i); + } + i = i2; + } + return strArr; + } + + private void outputMessageToFile(String str) { + String property = System.getProperty("line.separator"); + if (this.m_logFileStream != null) { + try { + this.m_logFileStream.write((this.m_format.format(new Date()) + " " + str + property).getBytes(Charset.forName(HTTP.UTF_8))); + this.m_logFileStream.flush(); + } catch (IOException e) { + android.util.Log.e(Global.NIMBLE_ID, "Error writing to log file: " + e.toString()); + } + } + } +} diff --git a/app/src/main/java/com/ea/nimble/LogSource.java b/app/src/main/java/com/ea/nimble/LogSource.java new file mode 100644 index 0000000..0520279 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/LogSource.java @@ -0,0 +1,6 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface LogSource { + String getLogSourceTitle(); +} diff --git a/app/src/main/java/com/ea/nimble/Network.java b/app/src/main/java/com/ea/nimble/Network.java new file mode 100644 index 0000000..6abe9a5 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Network.java @@ -0,0 +1,112 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Map; +import org.apache.http.protocol.HTTP; + +/* loaded from: classes.dex */ +public class Network { + public static final String COMPONENT_ID = "com.ea.nimble.network"; + + public enum Status { + UNKNOWN, + NONE, + DEAD, + OK; + + @Override // java.lang.Enum + public String toString() { + switch (this) { + case NONE: + return "NET NONE"; + case DEAD: + return "NET DEAD"; + case OK: + return "NET OK"; + default: + return "NET UNKNOWN"; + } + } + } + + public static INetwork getComponent() { + return (INetwork) Base.getComponent("com.ea.nimble.network"); + } + + public static String generateParameterString(Map map) { + Log.Helper.LOGPUBLICFUNCS("NimbleNetwork"); + if (map == null || map.size() == 0) { + return null; + } + String str = ""; + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if ("".equals(key)) { + Log.Helper.LOGWS("Network", "URL parameters map contains invalid key", new Object[0]); + } else { + try { + String encode = URLEncoder.encode(key, HTTP.UTF_8); + if ("".equals(value)) { + Log.Helper.LOGWS("Network", "URL parameters map contains invalid value", new Object[0]); + } else { + try { + str = (((str + encode) + "=") + URLEncoder.encode(value, HTTP.UTF_8)) + "&"; + } catch (UnsupportedEncodingException unused) { + Log.Helper.LOGWS("Network", "URL parameters map contains invalid value", new Object[0]); + } + } + } catch (UnsupportedEncodingException unused2) { + Log.Helper.LOGWS("Network", "URL parameters map contains invalid key", new Object[0]); + } + } + } + if (str.length() == 0) { + return null; + } + return str.substring(0, str.length() - 1); + } + + public static URL generateURL(String str, Map map) { + Log.Helper.LOGPUBLICFUNCS("NimbleNetwork"); + if ("".equals(str)) { + Log.Helper.LOGWS("Network", "Base url is blank, return null", new Object[0]); + return null; + } + String generateParameterString = generateParameterString(map); + if (generateParameterString == null) { + Log.Helper.LOGWS("Network", "Generated URL with only base url = %s", str); + } else { + str = str + "?" + generateParameterString; + Log.Helper.LOGVS("Network", "Generated URL = %s", str); + } + try { + return new URL(str); + } catch (MalformedURLException unused) { + Log.Helper.LOGES("Network", "Malformed URL from %s", str); + return null; + } + } + + public static String getHttpProxy() { + Log.Helper.LOGPUBLICFUNCS("NimbleNetwork"); + try { + String property = System.getProperty("http.proxyHost"); + if (property == null) { + return null; + } + String property2 = System.getProperty("http.proxyPort"); + if (property2 == null) { + return property; + } + return property + ":" + property2; + } catch (Exception e) { + Log.Helper.LOGES("Network", "Unable to get system proxy settings. %s", e.toString()); + return null; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/NetworkConnection.java b/app/src/main/java/com/ea/nimble/NetworkConnection.java new file mode 100644 index 0000000..2c6e6a0 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NetworkConnection.java @@ -0,0 +1,591 @@ +package com.ea.nimble; + +import com.ea.nimble.Error; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import com.ea.nimble.Network; +import java.io.IOException; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.Date; +import java.util.Map; +import org.apache.http.message.TokenParser; +import org.apache.http.protocol.HTTP; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + +/* loaded from: classes.dex */ +class NetworkConnection implements NetworkConnectionHandle, Runnable, LogSource { + private static final int MAXIMUM_RAW_DATA_LENGTH = 1048576; + static int s_loggingIdCount = 100; + private NetworkConnectionCallback m_completionCallback; + private Date m_connectionStartTimestamp; + private NetworkConnectionCallback m_headerCallback; + private String m_loggingId; + private NetworkImpl m_manager; + private IOperationalTelemetryDispatch m_otDispatch; + private NetworkConnectionCallback m_progressCallback; + private HttpRequest m_request; + private String m_requestDataForLog; + private HttpResponse m_response; + private StringBuilder m_responseDataForLog; + private Thread m_thread; + + public String getLogSourceTitle() { + return "Network"; + } + + public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest) { + this(networkImpl, httpRequest, null); + } + + public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) { + this.m_manager = networkImpl; + this.m_thread = null; + this.m_request = httpRequest; + this.m_response = new HttpResponse(); + this.m_headerCallback = null; + this.m_progressCallback = null; + this.m_completionCallback = null; + this.m_connectionStartTimestamp = null; + this.m_otDispatch = iOperationalTelemetryDispatch; + this.m_loggingId = String.valueOf(s_loggingIdCount); + int i = s_loggingIdCount; + s_loggingIdCount = i + 1; + if (i >= 1000) { + s_loggingIdCount = 100; + } + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public HttpRequest getRequest() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + return this.m_request; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public HttpResponse getResponse() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + return this.m_response; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public NetworkConnectionCallback getHeaderCallback() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + return this.m_headerCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + this.m_headerCallback = networkConnectionCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public NetworkConnectionCallback getProgressCallback() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + return this.m_progressCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public void setProgressCallback(NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + this.m_progressCallback = networkConnectionCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public NetworkConnectionCallback getCompletionCallback() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + return this.m_completionCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + this.m_completionCallback = networkConnectionCallback; + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public void waitOn() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + synchronized (this) { + while (!this.m_response.isCompleted) { + try { + wait(); + } catch (InterruptedException unused) { + } + } + } + } + + @Override // com.ea.nimble.NetworkConnectionHandle + public void cancel() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + synchronized (this) { + if (this.m_thread != null) { + this.m_thread.interrupt(); + } else { + finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Network connection " + toString() + " is cancelled")); + } + } + } + + void cancelForAppSuspend() { + cancel(); + } + + public void run() { + Log.Helper.LOGPUBLICFUNCS("NetworkConnection"); + try { + try { + try { + try { + try { + try { + if (this.m_response.isCompleted) { + synchronized (this) { + this.m_thread = null; + } + return; + } + if (Thread.interrupted()) { + throw new InterruptedIOException(); + } + synchronized (this) { + this.m_thread = Thread.currentThread(); + } + HttpURLConnection httpURLConnection = (HttpURLConnection) this.m_request.getUrl().openConnection(); + httpURLConnection.setRequestMethod(this.m_request.method.toString()); + httpURLConnection.setConnectTimeout((int) (this.m_request.timeout * 1000.0d)); + httpURLConnection.setReadTimeout((int) (this.m_request.timeout * 1000.0d)); + httpURLConnection.setRequestProperty("Connection", "close"); + this.m_requestDataForLog = null; + this.m_responseDataForLog = null; + if (Thread.interrupted()) { + throw new InterruptedIOException(); + } + httpSend(httpURLConnection); + if (Thread.interrupted()) { + throw new InterruptedIOException(); + } + httpRecv(httpURLConnection); + finish(); + synchronized (this) { + this.m_thread = null; + } + } catch (SocketTimeoutException e) { + finishWithError(new Error(Error.Code.NETWORK_TIMEOUT, "Connection " + toString() + " timed out", e)); + synchronized (this) { + this.m_thread = null; + } + } catch (Exception e2) { + finishWithError(new Error(Error.Code.SYSTEM_UNEXPECTED, "Unexpected error.", e2)); + synchronized (this) { + this.m_thread = null; + } + } + } catch (IOException e3) { + finishWithError(new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Connection " + toString() + " failed with I/O exception", e3)); + synchronized (this) { + this.m_thread = null; + } + } catch (ClassCastException e4) { + finishWithError(new Error(Error.Code.NETWORK_UNSUPPORTED_CONNECTION_TYPE, "Request " + toString() + " failed for unsupported connection type" + this.m_request.getUrl().getProtocol(), e4)); + synchronized (this) { + this.m_thread = null; + } + } + } catch (UnknownHostException e5) { + Network.Status status = this.m_manager.getStatus(); + if (status != Network.Status.OK) { + finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + status.toString(), e5)); + } else { + finishWithError(new Error(Error.Code.NETWORK_UNREACHABLE, "Request " + toString() + " failed for unreachable host", e5)); + } + synchronized (this) { + this.m_thread = null; + } + } + } catch (InterruptedIOException e6) { + finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Connection " + toString() + " is cancelled", e6)); + synchronized (this) { + this.m_thread = null; + } + } + } catch (Error e7) { + finishWithError(e7); + synchronized (this) { + this.m_thread = null; + } + } + } catch (Throwable th) { + synchronized (this) { + this.m_thread = null; + throw th; + } + } + } + + private void httpSend(HttpURLConnection httpURLConnection) throws IOException { + Log.Helper.LOGFUNCS("NetworkConnection"); + this.m_connectionStartTimestamp = new Date(); + if (this.m_request.headers != null) { + for (String str : this.m_request.headers.keySet()) { + httpURLConnection.setRequestProperty(str, this.m_request.headers.get(str)); + } + } + logRequest(); + byte[] byteArray = this.m_request.data.toByteArray(); + if (byteArray == null || byteArray.length <= 0) { + return; + } + httpURLConnection.setDoOutput(true); + httpURLConnection.setFixedLengthStreamingMode(byteArray.length); + OutputStream outputStream = null; + try { + try { + OutputStream outputStream2 = httpURLConnection.getOutputStream(); + try { + outputStream2.write(byteArray); + if (outputStream2 != null) { + outputStream2.close(); + } + } catch (Exception e) { + e = e; + outputStream = outputStream2; + StringWriter stringWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(stringWriter)); + Log.Helper.LOGE(this, "Exception in network connection:" + stringWriter.toString(), new Object[0]); + if (outputStream != null) { + outputStream.close(); + } + } catch (Throwable th) { + th = th; + outputStream = outputStream2; + if (outputStream != null) { + outputStream.close(); + } + throw th; + } + } catch (Exception e2) { + e = e2; + } + } catch (Throwable th2) { + th = th2; + } + } + + /* JADX WARN: Removed duplicated region for block: B:30:0x00a8 */ + /* JADX WARN: Removed duplicated region for block: B:35:0x00b5 A[Catch: all -> 0x01b5, TryCatch #2 {all -> 0x01b5, blocks: (B:6:0x0012, B:7:0x003f, B:9:0x0045, B:11:0x0063, B:14:0x0071, B:17:0x0086, B:19:0x008e, B:32:0x00ab, B:33:0x00b4, B:35:0x00b5, B:36:0x00d2, B:37:0x00d3, B:39:0x00dd, B:49:0x00ea, B:50:0x00ef, B:52:0x00f7, B:54:0x00fd, B:56:0x0115, B:57:0x011a, B:58:0x0137, B:59:0x010c, B:62:0x0145, B:63:0x0172, B:65:0x0175, B:66:0x0194, B:67:0x0195, B:68:0x01b4), top: B:5:0x0012 }] */ + /* JADX WARN: Removed duplicated region for block: B:39:0x00dd A[Catch: all -> 0x01b5, TryCatch #2 {all -> 0x01b5, blocks: (B:6:0x0012, B:7:0x003f, B:9:0x0045, B:11:0x0063, B:14:0x0071, B:17:0x0086, B:19:0x008e, B:32:0x00ab, B:33:0x00b4, B:35:0x00b5, B:36:0x00d2, B:37:0x00d3, B:39:0x00dd, B:49:0x00ea, B:50:0x00ef, B:52:0x00f7, B:54:0x00fd, B:56:0x0115, B:57:0x011a, B:58:0x0137, B:59:0x010c, B:62:0x0145, B:63:0x0172, B:65:0x0175, B:66:0x0194, B:67:0x0195, B:68:0x01b4), top: B:5:0x0012 }] */ + /* JADX WARN: Removed duplicated region for block: B:42:0x00e5 */ + /* JADX WARN: Removed duplicated region for block: B:44:0x013e A[DONT_GENERATE] */ + /* JADX WARN: Removed duplicated region for block: B:47:0x00e6 */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private void httpRecv(java.net.HttpURLConnection r10) throws java.io.IOException, com.ea.nimble.Error { + /* + Method dump skipped, instructions count: 458 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.httpRecv(java.net.HttpURLConnection):void"); + } + + /* JADX WARN: Removed duplicated region for block: B:75:0x01ab */ + /* JADX WARN: Removed duplicated region for block: B:77:0x01b0 */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private void downloadToFile(java.io.InputStream r14) throws java.io.IOException { + /* + Method dump skipped, instructions count: 483 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.downloadToFile(java.io.InputStream):void"); + } + + private void downloadToBuffer(InputStream inputStream) throws IOException { + int read; + Log.Helper.LOGFUNCS("NetworkConnection"); + prepareResponseLog(); + int i = 0; + while (true) { + if (i < 0) { + break; + } + try { + byte[] prepareSegment = this.m_response.data.prepareSegment(); + if (prepareSegment == null) { + Log.Helper.LOGE(this, "Error preparing segment", new Object[0]); + break; + } + int i2 = 0; + do { + read = inputStream.read(prepareSegment, i2, prepareSegment.length - i2); + if (!Thread.interrupted()) { + if (read < 0) { + break; + } + if (read == 0) { + Thread.yield(); + } else { + prepareResponseLog(prepareSegment, i2, read); + i2 += read; + this.m_response.downloadedContentLength += read; + } + } else { + throw new InterruptedIOException(); + } + } while (i2 < prepareSegment.length); + this.m_response.data.appendSegmentToBuffer(prepareSegment, i2); + if (this.m_progressCallback != null) { + this.m_progressCallback.callback(this); + } + i = read; + } finally { + inputStream.close(); + } + } + } + + private void finish() { + Log.Helper.LOGFUNCS("NetworkConnection"); + this.m_response.isCompleted = true; + logOperationalTelemetryResponse(); + if (this.m_completionCallback != null) { + this.m_completionCallback.callback(this); + } + synchronized (this) { + notifyAll(); + } + this.m_manager.removeConnection(this); + } + + void finishWithError(Exception exc) { + Log.Helper.LOGFUNCS("NetworkConnection"); + if (this.m_response.isCompleted) { + Log.Helper.LOGI(this, "Finished connection %s skipped an error %s", toString(), exc.toString()); + return; + } + Log.Helper.LOGW(this, "Running connection number %s with name %s failed for error %s", this.m_loggingId, toString(), exc.toString()); + this.m_response.error = exc; + finish(); + } + + private String prepareRequestLog() { + String str; + Log.Helper.LOGFUNCS("NetworkConnection"); + int i = 2048; + if (this.m_request.data != null && this.m_request.data.size() > 0) { + i = 2048 + this.m_request.data.size(); + try { + str = this.m_request.data.toString(HTTP.UTF_8); + } catch (UnsupportedEncodingException unused) { + str = "<-- UNREADABLE -->"; + } + } else { + str = (this.m_request.getMethod() == IHttpRequest.Method.POST || this.m_request.getMethod() == IHttpRequest.Method.PUT) ? "<-- EMPTY -->" : null; + } + StringBuilder sb = new StringBuilder(i); + sb.append("REQUEST: "); + sb.append(this.m_request.method.toString()); + sb.append(TokenParser.SP); + sb.append(this.m_request.url.toString()); + sb.append('\n'); + generateHttpHeaderAndBodyLogString(sb, false, this.m_request.headers, str); + return sb.toString(); + } + + private void prepareResponseLog() { + Log.Helper.LOGFUNCS("NetworkConnection"); + if (Log.getComponent().getThresholdLevel() > 100) { + return; + } + this.m_responseDataForLog = new StringBuilder(this.m_response.expectedContentLength > 0 ? (int) this.m_response.expectedContentLength : 4096); + } + + private void prepareResponseLog(byte[] bArr, int i, int i2) { + Log.Helper.LOGFUNCS("NetworkConnection"); + if (Log.getComponent().getThresholdLevel() > 100 || this.m_responseDataForLog == null) { + return; + } + try { + this.m_responseDataForLog.append(new String(bArr, i, i2, HTTP.UTF_8)); + } catch (UnsupportedEncodingException unused) { + this.m_responseDataForLog = null; + } + } + + private String multiplyStringNTimes(String str, int i) { + Log.Helper.LOGFUNCS("NetworkConnection"); + StringBuilder sb = new StringBuilder(str.length() * i); + for (int i2 = 0; i2 < i; i2++) { + sb.append(str); + } + return sb.toString(); + } + + private String beautifyJSONString(String str) { + Log.Helper.LOGFUNCS("NetworkConnection"); + if (str == null) { + return str; + } + String str2 = null; + try { + Object nextValue = new JSONTokener(str).nextValue(); + if (nextValue instanceof JSONObject) { + str2 = ((JSONObject) nextValue).toString(4); + } else if (nextValue instanceof JSONArray) { + str2 = ((JSONArray) nextValue).toString(4); + } + return str2 != null ? str2 : str; + } catch (JSONException unused) { + return str; + } + } + + private void logRequest() { + Log.Helper.LOGFUNCS("NetworkConnection"); + if (Log.getComponent().getThresholdLevel() > 100) { + return; + } + this.m_requestDataForLog = prepareRequestLog(); + Log.Helper.LOGD(this, "\n>>>> CONNECTION ID %s BEGIN >>>>>>>>>>>>>>>>>>\n%s<<<< CONNECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<<\n", this.m_loggingId, this.m_requestDataForLog); + } + + private void logCommunication() { + String str; + Log.Helper.LOGFUNCS("NetworkConnection"); + if (Log.getComponent().getThresholdLevel() > 100) { + return; + } + if (this.m_requestDataForLog == null) { + this.m_requestDataForLog = prepareRequestLog(); + } + int length = this.m_requestDataForLog.length() + 4096; + boolean z = this.m_request.targetFilePath != null; + if (this.m_responseDataForLog == null || this.m_responseDataForLog.length() <= 0) { + str = z ? "<-- FILE -->" : "<-- EMPTY -->"; + } else { + try { + str = this.m_responseDataForLog.toString(); + } catch (Exception unused) { + str = "<-- UNREADABLE -->"; + } + } + StringBuilder sb = new StringBuilder(length + str.length()); + sb.append(String.format("%n>>>> CONNECTION ID %s FINISH >>>> REQUEST >>>>%n", this.m_loggingId)); + sb.append(this.m_requestDataForLog); + sb.append("<<<< REQUEST <<<<<<<< -- >>>>>>>> RESPONSE >>>>\n"); + sb.append("RESP URL: "); + sb.append(this.m_response.url.toString()); + sb.append('\n'); + sb.append("RESP STATUS: "); + sb.append(this.m_response.statusCode); + sb.append('\n'); + if (this.m_response.getError() != null) { + sb.append("RESP ERROR: "); + if (this.m_response.getError().getMessage() != null) { + sb.append(this.m_response.getError().getMessage()); + sb.append("\n"); + } else { + sb.append("<-- UNKNOWN -->\n"); + } + } + if (z) { + sb.append("RESP FILE: "); + sb.append(this.m_request.targetFilePath); + sb.append("\n"); + } + generateHttpHeaderAndBodyLogString(sb, true, this.m_response.headers, str); + sb.append("<<<< RESPONSE <<<< CONNECTION FINISH <<<<<<<<<<"); + Log.Helper.LOGD(this, sb.toString(), new Object[0]); + } + + private void generateHttpHeaderAndBodyLogString(StringBuilder sb, boolean z, Map map, String str) { + Log.Helper.LOGFUNCS("NetworkConnection"); + String str2 = z ? "RESP" : "REQ"; + boolean z2 = false; + if (map != null && map.size() > 0) { + boolean z3 = false; + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + if (key != null || z) { + if (key == null) { + key = "(null)"; + } + sb.append(str2); + sb.append(" HEADER: "); + sb.append(key); + String value = entry.getValue(); + if (value == null) { + value = "(null)"; + } + sb.append(" VALUE: "); + sb.append(value); + sb.append('\n'); + if (key.equals("Content-Type") && (value.contains("application/json") || value.contains("text/json"))) { + z3 = true; + } + } else { + String str3 = map.get(key); + if (str3 == null) { + str3 = "(null)"; + } + Log.Helper.LOGW("Network request contains a null key with value %s", str3, new Object[0]); + } + } + z2 = z3; + } + if (str != null) { + sb.append(str2); + sb.append(" BODY:\n"); + if (z2) { + str = beautifyJSONString(str); + } + sb.append(str); + sb.append('\n'); + } + } + + /* JADX WARN: Can't wrap try/catch for region: R(24:14|(2:16|(2:18|19))|20|(1:22)|23|(2:25|(8:27|28|29|30|32|33|34|(18:38|39|40|41|42|44|45|46|47|48|49|50|51|52|53|54|55|56))(2:69|70))|73|39|40|41|42|44|45|46|47|48|49|50|51|52|53|54|55|56) */ + /* JADX WARN: Code restructure failed: missing block: B:59:0x013a, code lost: + + r10 = r2; + */ + /* JADX WARN: Code restructure failed: missing block: B:60:0x013f, code lost: + + com.ea.nimble.Log.Helper.LOGE(r14, "Failed to add " + r10 + " to eventDict.", new java.lang.Object[0]); + */ + /* JADX WARN: Code restructure failed: missing block: B:62:0x013c, code lost: + + r10 = "URL_PROTOCOL"; + */ + /* JADX WARN: Code restructure failed: missing block: B:64:0x013e, code lost: + + r10 = "CONNECTIONID"; + */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + void logOperationalTelemetryResponse() { + /* + Method dump skipped, instructions count: 362 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.logOperationalTelemetryResponse():void"); + } +} diff --git a/app/src/main/java/com/ea/nimble/NetworkConnectionCallback.java b/app/src/main/java/com/ea/nimble/NetworkConnectionCallback.java new file mode 100644 index 0000000..b22e655 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NetworkConnectionCallback.java @@ -0,0 +1,6 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface NetworkConnectionCallback { + void callback(NetworkConnectionHandle networkConnectionHandle); +} diff --git a/app/src/main/java/com/ea/nimble/NetworkConnectionHandle.java b/app/src/main/java/com/ea/nimble/NetworkConnectionHandle.java new file mode 100644 index 0000000..f0af791 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NetworkConnectionHandle.java @@ -0,0 +1,24 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface NetworkConnectionHandle { + void cancel(); + + NetworkConnectionCallback getCompletionCallback(); + + NetworkConnectionCallback getHeaderCallback(); + + NetworkConnectionCallback getProgressCallback(); + + IHttpRequest getRequest(); + + IHttpResponse getResponse(); + + void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback); + + void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback); + + void setProgressCallback(NetworkConnectionCallback networkConnectionCallback); + + void waitOn(); +} diff --git a/app/src/main/java/com/ea/nimble/NetworkImpl.java b/app/src/main/java/com/ea/nimble/NetworkImpl.java new file mode 100644 index 0000000..dd787dd --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NetworkImpl.java @@ -0,0 +1,442 @@ +package com.ea.nimble; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import com.ea.nimble.Error; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import com.ea.nimble.Network; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/* loaded from: classes.dex */ +public class NetworkImpl extends Component implements INetwork, LogSource { + private static final String BACKUP_NETWORK_REACHABILITY_CHECK_URL = "https://www.google.com"; + private static final int DETECTION_TIMEOUT = 30; + private static final String MAIN_NETWORK_REACHABILITY_CHECK_URL = "https://ping1.tnt-ea.com"; + private static final int MAX_CONCURRENT_THREADS = 4; + private static final int[] PING_INTERVAL = {5, 10, 30, 60}; + private static final int QUICK_DETECTION_TIMEOUT = 5; + private ExecutorService m_asyncTaskManager; + private ConnectivityReceiver m_connectivityReceiver; + private NetworkConnection m_detectionConnection; + private boolean m_isWifi; + private DetectionState m_networkDetectionState; + private int m_pingIndex; + private List m_queue; + private Network.Status m_status; + private Timer m_timer; + private LinkedList m_waitingToExecuteQueue; + + private enum DetectionState { + NONE, + VERIFY_REACHABLE_MAIN, + VERIFY_UNREACHABLE_MAIN, + VERIFY_REACHABLE_BACKUP, + PING + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.network"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Network"; + } + + private class ConnectivityReceiver extends BroadcastReceiver { + private ConnectivityReceiver() { + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGD(this, "Network reachability changed!", new Object[0]); + synchronized (NetworkImpl.this) { + NetworkImpl.this.detect(true); + } + } + } + + public NetworkImpl() { + Log.Helper.LOGFUNC(this); + this.m_connectivityReceiver = null; + this.m_status = Network.Status.UNKNOWN; + this.m_detectionConnection = null; + this.m_networkDetectionState = DetectionState.NONE; + this.m_pingIndex = 0; + this.m_queue = new ArrayList(); + } + + @Override // com.ea.nimble.Component + public void setup() { + Log.Helper.LOGV(this, "setup", new Object[0]); + startWork(); + } + + @Override // com.ea.nimble.Component + public void suspend() { + synchronized (this) { + stopPing(); + unregisterNetworkListener(); + synchronized (this) { + Iterator it = new ArrayList(this.m_queue).iterator(); + while (it.hasNext()) { + ((NetworkConnection) it.next()).cancelForAppSuspend(); + } + } + Log.Helper.LOGV(this, "suspend", new Object[0]); + } + Log.Helper.LOGV(this, "suspend", new Object[0]); + } + + @Override // com.ea.nimble.Component + public void resume() { + Log.Helper.LOGV(this, "resume", new Object[0]); + synchronized (this) { + detect(true); + registerNetworkListener(); + } + } + + @Override // com.ea.nimble.Component + public void cleanup() { + stopWork(); + Log.Helper.LOGV(this, "cleanup", new Object[0]); + } + + private void registerNetworkListener() { + Log.Helper.LOGFUNC(this); + if (this.m_connectivityReceiver == null) { + Log.Helper.LOGD(this, "Register network reachability listener.", new Object[0]); + this.m_connectivityReceiver = new ConnectivityReceiver(); + ApplicationEnvironment.getComponent().getApplicationContext().registerReceiver(this.m_connectivityReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE")); + } + } + + private void unregisterNetworkListener() { + Log.Helper.LOGFUNC(this); + if (this.m_connectivityReceiver != null) { + try { + ApplicationEnvironment.getComponent().getApplicationContext().unregisterReceiver(this.m_connectivityReceiver); + } catch (IllegalArgumentException unused) { + Log.Helper.LOGE(this, "Unable to unregister network reachability listener even it does exists", new Object[0]); + } + this.m_connectivityReceiver = null; + } + } + + @Override // com.ea.nimble.INetwork + public NetworkConnectionHandle sendGetRequest(URL url, HashMap hashMap, NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.GET; + httpRequest.headers = hashMap; + return sendRequest(httpRequest, networkConnectionCallback); + } + + @Override // com.ea.nimble.INetwork + public NetworkConnectionHandle sendPostRequest(URL url, HashMap hashMap, byte[] bArr, NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.POST; + httpRequest.headers = hashMap; + try { + httpRequest.data.write(bArr); + } catch (Exception e) { + e.printStackTrace(); + } + return sendRequest(httpRequest, networkConnectionCallback); + } + + @Override // com.ea.nimble.INetwork + public NetworkConnectionHandle sendDeleteRequest(URL url, HashMap hashMap, NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.DELETE; + httpRequest.headers = hashMap; + return sendRequest(httpRequest, networkConnectionCallback); + } + + @Override // com.ea.nimble.INetwork + public NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + return sendRequest(httpRequest, networkConnectionCallback, null); + } + + @Override // com.ea.nimble.INetwork + public NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) { + NetworkConnection networkConnection; + Log.Helper.LOGPUBLICFUNC(this); + if (httpRequest.runInBackground) { + networkConnection = new BackgroundNetworkConnection(this, httpRequest, iOperationalTelemetryDispatch); + } else { + networkConnection = new NetworkConnection(this, httpRequest, iOperationalTelemetryDispatch); + } + networkConnection.setCompletionCallback(networkConnectionCallback); + if (httpRequest.url == null || !Utility.validString(httpRequest.url.toString())) { + networkConnection.finishWithError(new Error(Error.Code.INVALID_ARGUMENT, "Sending request without valid url")); + return networkConnection; + } + if (this.m_status != Network.Status.OK) { + networkConnection.finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + this.m_status.toString())); + return networkConnection; + } + synchronized (this) { + this.m_queue.add(networkConnection); + } + if (this.m_asyncTaskManager == null || this.m_asyncTaskManager.isShutdown()) { + if (this.m_asyncTaskManager != null) { + Log.Helper.LOGW(this, "AsyncTaskManager shutdown. Queueing networkconnection until AsyncTaskManager is started.", new Object[0]); + } else { + Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection until AsyncTaskManager is started.", new Object[0]); + } + if (this.m_waitingToExecuteQueue == null) { + this.m_waitingToExecuteQueue = new LinkedList<>(); + } + this.m_waitingToExecuteQueue.add(networkConnection); + } else { + this.m_asyncTaskManager.execute(networkConnection); + } + return networkConnection; + } + + @Override // com.ea.nimble.INetwork + public synchronized void forceRedetectNetworkStatus() { + Log.Helper.LOGPUBLICFUNC(this); + detect(true); + } + + @Override // com.ea.nimble.INetwork + public Network.Status getStatus() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_status; + } + + @Override // com.ea.nimble.INetwork + public boolean isNetworkWifi() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_isWifi; + } + + synchronized void removeConnection(NetworkConnection networkConnection) { + Log.Helper.LOGFUNC(this); + this.m_queue.remove(networkConnection); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void detect(boolean z) { + Log.Helper.LOGFUNC(this); + if (this.m_detectionConnection != null) { + if (!z) { + return; + } + NetworkConnection networkConnection = this.m_detectionConnection; + this.m_detectionConnection = null; + networkConnection.cancel(); + } + stopPing(); + if (reachabilityCheck()) { + if (this.m_status != Network.Status.DEAD) { + setStatus(Network.Status.OK); + } + this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_MAIN; + } else { + if (this.m_status == Network.Status.UNKNOWN) { + setStatus(Network.Status.NONE); + } + this.m_networkDetectionState = DetectionState.VERIFY_UNREACHABLE_MAIN; + } + verifyReachability(MAIN_NETWORK_REACHABILITY_CHECK_URL, 5.0d); + } + + private boolean reachabilityCheck() { + ConnectivityManager connectivityManager; + NetworkInfo activeNetworkInfo; + Log.Helper.LOGFUNC(this); + this.m_isWifi = false; + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + if (applicationContext == null || (connectivityManager = (ConnectivityManager) applicationContext.getSystemService("connectivity")) == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnectedOrConnecting()) { + return false; + } + if (activeNetworkInfo.getType() == 1 || activeNetworkInfo.getType() == 9) { + this.m_isWifi = true; + } + if (BaseCore.getInstance().isActive()) { + return true; + } + Log.Helper.LOGD(this, "BaseCore not active yet. Postpone reachability check.", new Object[0]); + return false; + } + + private void startPing() { + Log.Helper.LOGFUNC(this); + if (this.m_pingIndex >= PING_INTERVAL.length) { + this.m_pingIndex = PING_INTERVAL.length - 1; + } + this.m_timer = new Timer(new TimerTask()); + this.m_timer.schedule(PING_INTERVAL[this.m_pingIndex], false); + } + + private void stopPing() { + Log.Helper.LOGFUNC(this); + if (this.m_timer != null) { + this.m_timer.cancel(); + this.m_timer = null; + } + } + + private class TimerTask implements Runnable { + private TimerTask() { + } + + @Override // java.lang.Runnable + public void run() { + synchronized (NetworkImpl.this) { + NetworkImpl.this.m_timer = null; + NetworkImpl.this.verifyReachability(NetworkImpl.MAIN_NETWORK_REACHABILITY_CHECK_URL, 30.0d); + } + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void verifyReachability(String str, double d) { + Log.Helper.LOGFUNC(this); + try { + HttpRequest httpRequest = new HttpRequest(new URL(str)); + httpRequest.timeout = d; + httpRequest.method = IHttpRequest.Method.GET; + this.m_detectionConnection = new NetworkConnection(this, httpRequest); + this.m_detectionConnection.setCompletionCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.NetworkImpl.1 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + NetworkImpl.this.onReachabilityVerification(networkConnectionHandle); + } + }); + if (this.m_asyncTaskManager == null || this.m_asyncTaskManager.isShutdown()) { + Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection until AsyncTaskManager is started.", new Object[0]); + if (this.m_waitingToExecuteQueue == null) { + this.m_waitingToExecuteQueue = new LinkedList<>(); + } + this.m_waitingToExecuteQueue.addFirst(this.m_detectionConnection); + return; + } + this.m_asyncTaskManager.execute(this.m_detectionConnection); + } catch (MalformedURLException unused) { + Log.Helper.LOGE(this, "Invalid url: " + str, new Object[0]); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public synchronized void onReachabilityVerification(NetworkConnectionHandle networkConnectionHandle) { + Log.Helper.LOGFUNC(this); + Exception error = networkConnectionHandle.getResponse().getError(); + if (error == null) { + Log.Helper.LOGD(this, "network verified reachable.", new Object[0]); + setStatus(Network.Status.OK); + this.m_detectionConnection = null; + return; + } + if (networkConnectionHandle != this.m_detectionConnection) { + return; + } + this.m_detectionConnection = null; + Log.Helper.LOGD(this, "network verified unreachable, ERROR %s for detection state %s", networkConnectionHandle.getResponse().getError(), this.m_networkDetectionState); + if (error instanceof Error) { + Error error2 = (Error) error; + if (error2.getDomain().equals(Error.ERROR_DOMAIN) && error2.isError(Error.Code.NETWORK_OPERATION_CANCELLED)) { + Log.Helper.LOGW(this, "Network detection verification connection get cancelled for unknown reason (maybe reasonable for Android)", new Object[0]); + } + } + switch (this.m_networkDetectionState) { + case VERIFY_REACHABLE_MAIN: + this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_BACKUP; + verifyReachability(BACKUP_NETWORK_REACHABILITY_CHECK_URL, 30.0d); + break; + case VERIFY_UNREACHABLE_MAIN: + setStatus(Network.Status.NONE); + break; + case VERIFY_REACHABLE_BACKUP: + this.m_networkDetectionState = DetectionState.PING; + if (this.m_status == Network.Status.DEAD) { + startPing(); + break; + } else { + setStatus(Network.Status.DEAD); + this.m_pingIndex = 0; + startPing(); + break; + } + case PING: + this.m_pingIndex++; + startPing(); + break; + } + } + + private void setStatus(Network.Status status) { + Log.Helper.LOGI(this, "Status change %s -> %s", this.m_status, status); + if (status != this.m_status) { + this.m_status = status; + Utility.sendBroadcast(Global.NOTIFICATION_NETWORK_STATUS_CHANGE); + } + } + + private synchronized void startWork() { + Log.Helper.LOGFUNC(this); + if (this.m_asyncTaskManager != null) { + return; + } + detect(true); + registerNetworkListener(); + this.m_asyncTaskManager = Executors.newFixedThreadPool(4); + if (this.m_waitingToExecuteQueue != null && !this.m_waitingToExecuteQueue.isEmpty()) { + Log.Helper.LOGW(this, "NetworkConnections waiting to execute on new AsyncTaskManager. Executing.", new Object[0]); + while (!this.m_waitingToExecuteQueue.isEmpty()) { + NetworkConnection poll = this.m_waitingToExecuteQueue.poll(); + if (poll != null) { + Log.Helper.LOGW(this, "Executing request URL: " + poll.getRequest().url.toString(), new Object[0]); + this.m_asyncTaskManager.execute(poll); + } else { + Log.Helper.LOGE(this, "Could not get queued connection", new Object[0]); + } + } + } + } + + private void stopWork() { + Log.Helper.LOGFUNC(this); + synchronized (this) { + this.m_detectionConnection = null; + stopPing(); + unregisterNetworkListener(); + } + if (this.m_asyncTaskManager == null) { + return; + } + try { + Iterator it = this.m_asyncTaskManager.shutdownNow().iterator(); + while (it.hasNext()) { + ((NetworkConnection) it.next()).cancelForAppSuspend(); + } + this.m_asyncTaskManager.awaitTermination(60L, TimeUnit.SECONDS); + } catch (InterruptedException unused) { + this.m_asyncTaskManager.shutdownNow(); + Thread.currentThread().interrupt(); + } + this.m_asyncTaskManager = null; + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleApplicationConfiguration.java b/app/src/main/java/com/ea/nimble/NimbleApplicationConfiguration.java new file mode 100644 index 0000000..b5a551c --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleApplicationConfiguration.java @@ -0,0 +1,95 @@ +package com.ea.nimble; + +import android.app.Activity; +import android.content.pm.PackageManager; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class NimbleApplicationConfiguration { + private static final String LOG_TITLE = "AppConfig"; + + public static boolean configValueExists(String str) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + try { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + if (currentActivity != null) { + return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.containsKey(str); + } + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str); + } + return false; + } + + public static String getConfigValueAsString(String str) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + return getConfigValueAsString(str, ""); + } + + public static String getConfigValueAsString(String str, String str2) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + try { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + if (currentActivity != null) { + return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getString(str); + } + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str); + } + return str2; + } + + public static int getConfigValueAsInt(String str) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + return getConfigValueAsInt(str, 0); + } + + public static int getConfigValueAsInt(String str, int i) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + try { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + if (currentActivity != null) { + return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getInt(str); + } + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str); + } + return i; + } + + public static double getConfigValueAsDouble(String str) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + return getConfigValueAsDouble(str, 0.0d); + } + + public static double getConfigValueAsDouble(String str, double d) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + try { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + if (currentActivity != null) { + return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getDouble(str); + } + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str); + } + return d; + } + + public static boolean getConfigValueAsBoolean(String str) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + return getConfigValueAsBoolean(str, false); + } + + public static boolean getConfigValueAsBoolean(String str, boolean z) { + Log.Helper.LOGPUBLICFUNCS(LOG_TITLE); + try { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + if (currentActivity != null) { + return currentActivity.getPackageManager().getApplicationInfo(currentActivity.getPackageName(), 128).metaData.getBoolean(str); + } + } catch (PackageManager.NameNotFoundException unused) { + Log.Helper.LOGES(LOG_TITLE, "Config value of key '%s' cannot be retrieved.", str); + } + return z; + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleConfiguration.java b/app/src/main/java/com/ea/nimble/NimbleConfiguration.java new file mode 100644 index 0000000..9855b88 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleConfiguration.java @@ -0,0 +1,51 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public enum NimbleConfiguration { + UNKNOWN, + INTEGRATION, + STAGE, + LIVE, + CUSTOMIZED, + MANUAL; + + public static NimbleConfiguration fromName(String str) { + Log.Helper.LOGPUBLICFUNCS("AppConfig"); + if (str.equals("int")) { + return INTEGRATION; + } + if (str.equals("stage")) { + return STAGE; + } + if (str.equals("live")) { + return LIVE; + } + if (str.equals(com.ea.games.nfs13.BuildConfig.FLAVOR)) { + return CUSTOMIZED; + } + if (str.equals("manual")) { + return MANUAL; + } + return UNKNOWN; + } + + @Override // java.lang.Enum + public String toString() { + switch (this) { + case INTEGRATION: + return "int"; + case STAGE: + return "stage"; + case LIVE: + return "live"; + case CUSTOMIZED: + return com.ea.games.nfs13.BuildConfig.FLAVOR; + case MANUAL: + return "manual"; + default: + return "unknown"; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleFacebookError.java b/app/src/main/java/com/ea/nimble/NimbleFacebookError.java new file mode 100644 index 0000000..3a9b36b --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleFacebookError.java @@ -0,0 +1,34 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class NimbleFacebookError extends Error { + public static final String NIMBLE_FACEBOOK_ERROR_DOMAIN = "NimbleFacebookError"; + private static final long serialVersionUID = 1; + + public enum Code { + FBSERVER_ERROR(90000), + RESPONSE_PARSE_ERROR(90001); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public NimbleFacebookError(Code code, String str, Throwable th) { + super(NIMBLE_FACEBOOK_ERROR_DOMAIN, code.intValue(), str, th); + } + + public NimbleFacebookError(Code code, String str) { + super(NIMBLE_FACEBOOK_ERROR_DOMAIN, code.intValue(), str); + } + + public boolean isError(int i) { + return getCode() == i; + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleLocalNotificationReceiver.java b/app/src/main/java/com/ea/nimble/NimbleLocalNotificationReceiver.java new file mode 100644 index 0000000..dff7b4f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleLocalNotificationReceiver.java @@ -0,0 +1,67 @@ +package com.ea.nimble; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.support.v4.app.NotificationCompat; +import android.support.v4.content.LocalBroadcastManager; +import com.ea.eadp.pushnotification.forwarding.GcmIntentService; +import com.ea.nimble.Log; +import com.facebook.internal.ServerProtocol; +import com.facebook.share.internal.ShareConstants; +import java.util.HashMap; + +/* loaded from: classes.dex */ +public class NimbleLocalNotificationReceiver extends BroadcastReceiver { + public static final String NIMBLE_LOCAL_NOTIFICATION_RECEIVED = "nimble.notification.localNotificationReceived"; + private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent"; + + @Override // android.content.BroadcastReceiver + public final void onReceive(Context context, Intent intent) { + handleNewLocalNotification(context, intent.getExtras()); + } + + protected void handleNewLocalNotification(Context context, Bundle bundle) { + String string = bundle.getString(GcmIntentService.PushIntentExtraKeys.PUSH_ID, ""); + String pushTargetActivity = getPushTargetActivity(context); + Log.Helper.LOGD(this, "[handleNewLocalNotification]: Local notification received with target activity: " + pushTargetActivity, new Object[0]); + try { + Intent intent = new Intent(context, Class.forName(pushTargetActivity)); + intent.putExtras(bundle); + intent.putExtra("PushNotification", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE); + intent.setFlags(603979776); + PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1073741824); + if (ApplicationEnvironment.isMainApplicationActive()) { + HashMap hashMap = new HashMap(); + hashMap.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE); + Bundle bundle2 = new Bundle(); + bundle2.putSerializable("core", hashMap); + bundle2.putString("msg_id", string); + bundle2.putString("type", "pn"); + bundle2.putString(NotificationCompat.CATEGORY_SERVICE, "local"); + bundle2.putString("status", "received"); + bundle2.putString("format", "pn"); + Intent intent2 = new Intent(); + intent2.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent2.putExtras(bundle2); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent2); + Utility.sendBroadcast(NIMBLE_LOCAL_NOTIFICATION_RECEIVED, bundle); + return; + } + Notification notification = (Notification) bundle.getParcelable("notification"); + notification.contentIntent = activity; + ((NotificationManager) context.getSystemService("notification")).notify(string.hashCode(), notification); + } catch (ClassNotFoundException e) { + Log.Helper.LOGD(this, String.format("[handleNewLocalNotification]: Could not launch target activity: %s, exception: %s", pushTargetActivity, e.toString()), new Object[0]); + } + } + + protected String getPushTargetActivity(Context context) { + Context applicationContext = context.getApplicationContext(); + return applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName()).resolveActivity(applicationContext.getPackageManager()).getClassName(); + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleLocalNotifications.java b/app/src/main/java/com/ea/nimble/NimbleLocalNotifications.java new file mode 100644 index 0000000..0ed95ec --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleLocalNotifications.java @@ -0,0 +1,20 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class NimbleLocalNotifications { + public static final String COMPONENT_ID = "com.ea.nimble.base.localNotifications"; + static final String KEY_NOTIFICATION_ID = "pushId"; + static final String KEY_NOTIFICATION_PN_TYPE = "pnType"; + static final String NOTIFICATION_TYPE_LOCAL = "local"; + + private static void initialize() { + Log.Helper.LOGFUNCS("LocalNotification"); + Base.registerComponent(new NimbleLocalNotificationsImpl(), COMPONENT_ID); + } + + public static INimbleLocalNotifications getComponent() { + return (INimbleLocalNotifications) Base.getComponent(COMPONENT_ID); + } +} diff --git a/app/src/main/java/com/ea/nimble/NimbleLocalNotificationsImpl.java b/app/src/main/java/com/ea/nimble/NimbleLocalNotificationsImpl.java new file mode 100644 index 0000000..c4ef5b2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/NimbleLocalNotificationsImpl.java @@ -0,0 +1,295 @@ +package com.ea.nimble; + +import android.app.AlarmManager; +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.content.res.Resources; +import android.os.Build; +import android.os.Bundle; +import android.service.notification.StatusBarNotification; +import android.support.v4.app.NotificationCompat; +import android.support.v4.content.LocalBroadcastManager; +import com.ea.eadp.pushnotification.forwarding.GcmIntentService; +import com.ea.nimble.Error; +import com.ea.nimble.Log; +import com.ea.nimble.Persistence; +import com.facebook.share.internal.ShareConstants; +import com.google.android.gms.drive.DriveFile; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; + +/* loaded from: classes.dex */ +public class NimbleLocalNotificationsImpl extends Component implements INimbleLocalNotifications { + private static String BADGE_ID = "Nimble_BadgeNotification"; + private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent"; + private static final String PERSISTENCE_ENABLED_KEY = "enabled"; + private static final String PERSISTENCE_NOTIFICATION_MAP_KEY = "map"; + private static INimbleBadgeProvider m_badgeProvider; + private boolean m_enabled = true; + private HashMap m_notificationMap; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return NimbleLocalNotifications.COMPONENT_ID; + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + if (persistenceForNimbleComponent.hasKey(PERSISTENCE_ENABLED_KEY)) { + this.m_enabled = persistenceForNimbleComponent.getBoolValue(PERSISTENCE_ENABLED_KEY); + } else { + this.m_enabled = true; + } + if (persistenceForNimbleComponent.hasKey(PERSISTENCE_NOTIFICATION_MAP_KEY)) { + this.m_notificationMap = (HashMap) persistenceForNimbleComponent.getValue(PERSISTENCE_NOTIFICATION_MAP_KEY); + Iterator it = this.m_notificationMap.keySet().iterator(); + Date date = new Date(); + while (it.hasNext()) { + String next = it.next(); + Date date2 = this.m_notificationMap.get(next); + if (date2.before(date)) { + Log.Helper.LOGV(this, "restore(): Removed notification list key " + next + " from map because its date (" + date2.toString() + ") is in the past!", new Object[0]); + it.remove(); + } + } + saveNotificationMap(); + } else { + this.m_notificationMap = new HashMap<>(); + } + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + if (Build.VERSION.SDK_INT >= 26) { + NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification"); + if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY)) { + return; + } + String str = Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_VALUE; + if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY)) { + str = applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_NAME_KEY)); + } + NotificationChannel notificationChannel = new NotificationChannel(Global.NOTIFICATION_CHANNEL_DEFAULT_ID, str, 3); + if (NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY)) { + notificationChannel.setDescription(applicationContext.getResources().getString(NimbleApplicationConfiguration.getConfigValueAsInt(Global.NOTIFICATION_CHANNEL_DEFAULT_DESCRIPTION_KEY))); + } + notificationManager.createNotificationChannel(notificationChannel); + } + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public Error scheduleNotification(String str, String str2, String str3, Date date) { + Notification build; + Log.Helper.LOGPUBLICFUNC(this); + Date date2 = new Date(); + if (!this.m_enabled) { + Log.Helper.LOGD(this, "scheduleNotification(): Local Notifications are not enabled!", new Object[0]); + return null; + } + Log.Helper.LOGD(this, "[scheduleNotification] Notification requested with: \n - Title : %s\n - Message : %s\n - ID : %s\n - Date : %s", str, str2, str3, date.toString()); + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "scheduleNotification(): Invalid title", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Invalid title"); + } + if (!Utility.validString(str2)) { + Log.Helper.LOGE(this, "scheduleNotification(): Invalid message", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Invalid message"); + } + if (date.before(date2)) { + Log.Helper.LOGE(this, "scheduleNotification(): Expired date", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Expired date"); + } + if (!Utility.validString(str3)) { + str3 = "auto_" + date2.getTime(); + } + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + Resources resources = ApplicationEnvironment.getComponent().getApplicationContext().getResources(); + String packageName = ApplicationEnvironment.getComponent().getApplicationContext().getPackageName(); + if (Build.VERSION.SDK_INT >= 26) { + Notification.Builder autoCancel = new Notification.Builder(applicationContext, NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) ? NimbleApplicationConfiguration.getConfigValueAsString(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) : Global.NOTIFICATION_CHANNEL_DEFAULT_ID).setContentTitle(str).setContentText(str2).setAutoCancel(true); + try { + autoCancel.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName)); + build = autoCancel.build(); + } catch (Exception e) { + Log.Helper.LOGE(this, "scheduleNotification(): Not scheduled. Unable to set application icon due to exception: " + e.toString(), new Object[0]); + return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon"); + } + } else { + NotificationCompat.Builder autoCancel2 = new NotificationCompat.Builder(applicationContext).setContentTitle(str).setContentText(str2).setAutoCancel(true); + try { + autoCancel2.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName)); + build = autoCancel2.build(); + } catch (Exception e2) { + Log.Helper.LOGE(this, "scheduleNotification(): Not scheduled. Unable to set application icon due to exception: " + e2.toString(), new Object[0]); + return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon"); + } + } + this.m_notificationMap.put(str3, date); + saveNotificationMap(); + Intent intent = new Intent(applicationContext, (Class) NimbleLocalNotificationReceiver.class); + intent.putExtra("notification", build); + intent.putExtra(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str3); + intent.putExtra(GcmIntentService.PushIntentExtraKeys.PN_TYPE, "local"); + ((AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(0, System.currentTimeMillis() + (date.getTime() - date2.getTime()), PendingIntent.getBroadcast(applicationContext, str3 != null ? str3.hashCode() : 0, intent, 134217728)); + HashMap hashMap = new HashMap(); + hashMap.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE); + Bundle bundle = new Bundle(); + bundle.putSerializable("core", hashMap); + bundle.putString("msg_id", str3); + bundle.putString("type", "pn"); + bundle.putString(NotificationCompat.CATEGORY_SERVICE, "local"); + bundle.putString("status", "started"); + bundle.putString("format", "pn"); + Intent intent2 = new Intent(); + intent2.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent2.putExtras(bundle); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent2); + return null; + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public void cancelAllNotifications() { + Iterator it = ((HashMap) this.m_notificationMap.clone()).keySet().iterator(); + while (it.hasNext()) { + cancelNotification((String) it.next()); + } + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public void cancelNotification(String str) { + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + PendingIntent broadcast = PendingIntent.getBroadcast(applicationContext, str.hashCode(), new Intent(applicationContext, (Class) NimbleLocalNotificationReceiver.class), DriveFile.MODE_WRITE_ONLY); + if (broadcast != null) { + broadcast.cancel(); + ((AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM)).cancel(broadcast); + this.m_notificationMap.remove(str); + saveNotificationMap(); + Log.Helper.LOGD(this, "cancelNotification(%s): Successfully canceled", str); + HashMap hashMap = new HashMap(); + hashMap.put("en", ShareConstants.WEB_DIALOG_PARAM_MESSAGE); + Bundle bundle = new Bundle(); + bundle.putSerializable("core", hashMap); + bundle.putString("msg_id", str); + bundle.putString("type", "pn"); + bundle.putString(NotificationCompat.CATEGORY_SERVICE, "local"); + bundle.putString("status", "canceled"); + bundle.putString("format", "pn"); + Intent intent = new Intent(); + intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent.putExtras(bundle); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent); + return; + } + Log.Helper.LOGD(this, "cancelNotification(%s): Not found", str); + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public void setEnabled(boolean z) { + if (this.m_enabled != z) { + this.m_enabled = z; + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + persistenceForNimbleComponent.setValue(PERSISTENCE_ENABLED_KEY, Boolean.valueOf(this.m_enabled)); + persistenceForNimbleComponent.synchronize(); + cancelAllNotifications(); + } + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public boolean isEnabled() { + return this.m_enabled; + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public void setBadgeProvider(INimbleBadgeProvider iNimbleBadgeProvider) { + Log.Helper.LOGPUBLICFUNC(this); + m_badgeProvider = iNimbleBadgeProvider; + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public Error setBadgeCount(int i, String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_enabled) { + if (m_badgeProvider != null) { + return m_badgeProvider.setBadgeCount(i, str, str2); + } + if (Build.VERSION.SDK_INT >= 26) { + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification"); + Resources resources = ApplicationEnvironment.getComponent().getApplicationContext().getResources(); + String packageName = ApplicationEnvironment.getComponent().getApplicationContext().getPackageName(); + if (i == 0) { + notificationManager.cancel(BADGE_ID.hashCode()); + return null; + } + if (i < 0 || i > 999999) { + String str3 = "setBadgeCount(): Badge count " + String.valueOf(i) + "outside [0-999999] range"; + Log.Helper.LOGE(this, str3, new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, str3); + } + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "setBadgeCount(): Invalid title", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Invalid title"); + } + if (!Utility.validString(str2)) { + Log.Helper.LOGE(this, "setBadgeCount(): Invalid message", new Object[0]); + return new Error(Error.Code.INVALID_ARGUMENT, "Invalid message"); + } + Notification.Builder visibility = new Notification.Builder(applicationContext, NimbleApplicationConfiguration.configValueExists(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) ? NimbleApplicationConfiguration.getConfigValueAsString(Global.NOTIFICATION_CHANNEL_LOCAL_NOTIFICATION_ID_KEY) : Global.NOTIFICATION_CHANNEL_DEFAULT_ID).setContentTitle(str).setContentText(str2).setAutoCancel(true).setNumber(i).setVisibility(-1); + try { + visibility.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName)); + Notification build = visibility.build(); + Context applicationContext2 = applicationContext.getApplicationContext(); + String className = applicationContext2.getPackageManager().getLaunchIntentForPackage(applicationContext2.getPackageName()).resolveActivity(applicationContext2.getPackageManager()).getClassName(); + try { + Intent intent = new Intent(applicationContext, Class.forName(className)); + intent.putExtra(GcmIntentService.PushIntentExtraKeys.PUSH_ID, BADGE_ID); + intent.putExtra(GcmIntentService.PushIntentExtraKeys.PN_TYPE, "local"); + intent.setFlags(603979776); + build.contentIntent = PendingIntent.getActivity(applicationContext, 0, intent, 1073741824); + notificationManager.notify(BADGE_ID.hashCode(), build); + return null; + } catch (ClassNotFoundException e) { + String format = String.format("setBadgeCount(): Could not launch target activity: %s, exception: %s", className, e.toString()); + Log.Helper.LOGE(this, format, new Object[0]); + return new Error(Error.Code.SYSTEM_UNEXPECTED, format); + } + } catch (Exception e2) { + Log.Helper.LOGE(this, "setBadgeCount(): Unable to set application icon due to exception: " + e2.toString(), new Object[0]); + return new Error(Error.Code.SYSTEM_UNEXPECTED, "Unable to get pn_icon"); + } + } + Log.Helper.LOGE(this, "setBadgeCount(): Unsupported Android version, unable to set badge count", new Object[0]); + return new Error(Error.Code.UNSUPPORTED, "setBadgeCount(): Unsupported Android version, unable to set badge count"); + } + Log.Helper.LOGE(this, "setBadgeCount(): Local notifications are disabled, unable to set badge count", new Object[0]); + return new Error(Error.Code.NOT_AVAILABLE, "setBadgeCount(): Local notifications are disabled, unable to set badge count"); + } + + @Override // com.ea.nimble.INimbleLocalNotifications + public int getBadgeCount() { + Log.Helper.LOGPUBLICFUNC(this); + if (m_badgeProvider != null) { + return m_badgeProvider.getBadgeCount(); + } + if (Build.VERSION.SDK_INT >= 26) { + for (StatusBarNotification statusBarNotification : ((NotificationManager) ApplicationEnvironment.getComponent().getApplicationContext().getSystemService("notification")).getActiveNotifications()) { + if (statusBarNotification.getId() == BADGE_ID.hashCode()) { + return statusBarNotification.getNotification().number; + } + } + } else { + Log.Helper.LOGE(this, "getBadgeCount(): Unsupported Android version, unable to get badge count", new Object[0]); + } + return 0; + } + + private void saveNotificationMap() { + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + persistenceForNimbleComponent.setValue(PERSISTENCE_NOTIFICATION_MAP_KEY, this.m_notificationMap); + persistenceForNimbleComponent.synchronize(); + } +} diff --git a/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatch.java b/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatch.java new file mode 100644 index 0000000..3f458e6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatch.java @@ -0,0 +1,11 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class OperationalTelemetryDispatch { + public static final String COMPONENT_ID = "com.ea.nimble.operationaltelemetrydispatch"; + public static final String LOG_TAG = "OTDispatch"; + + public static IOperationalTelemetryDispatch getComponent() { + return (IOperationalTelemetryDispatch) Base.getComponent(COMPONENT_ID); + } +} diff --git a/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatchImpl.java b/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatchImpl.java new file mode 100644 index 0000000..3f182f1 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/OperationalTelemetryDispatchImpl.java @@ -0,0 +1,227 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class OperationalTelemetryDispatchImpl extends Component implements IOperationalTelemetryDispatch, LogSource { + private List m_networkMetricsArray = new ArrayList(); + private List m_networkPayloadsArray = new ArrayList(); + private Map m_maxEventQueueSizeDict = new HashMap(); + + @Override // com.ea.nimble.Component + protected void cleanup() { + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return OperationalTelemetryDispatch.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return OperationalTelemetryDispatch.LOG_TAG; + } + + @Override // com.ea.nimble.Component + protected void restore() { + } + + @Override // com.ea.nimble.Component + protected void resume() { + } + + @Override // com.ea.nimble.Component + protected void suspend() { + } + + public OperationalTelemetryDispatchImpl() { + this.m_maxEventQueueSizeDict.put("com.ea.nimble.network", 100); + this.m_maxEventQueueSizeDict.put(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS, 100); + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public void logEvent(String str, JSONObject jSONObject) { + boolean z; + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "logEvent called with null or empty eventType.", new Object[0]); + return; + } + if (jSONObject == null || jSONObject.length() == 0) { + Log.Helper.LOGE(this, "logEvent called with null or empty eventDictionary.", new Object[0]); + return; + } + OperationalTelemetryEventImpl operationalTelemetryEventImpl = new OperationalTelemetryEventImpl(str, jSONObject, new Date()); + synchronized (this) { + z = true; + if (str.equals("com.ea.nimble.network")) { + if (!canLogEvent(str)) { + trimEventQueue(str); + } + if (canLogEvent(str)) { + this.m_networkMetricsArray.add(operationalTelemetryEventImpl); + } + } else if (str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) { + if (!canLogEvent(str)) { + trimEventQueue(str); + } + if (canLogEvent(str)) { + this.m_networkPayloadsArray.add(operationalTelemetryEventImpl); + } + } else { + z = false; + } + } + if (!z) { + Log.Helper.LOGE(this, "logEvent, unsupported OT eventType, " + str + ".", new Object[0]); + } + updateEventThresholdListeners(); + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public List getEvents(String str) { + Log.Helper.LOGPUBLICFUNC(this); + List list = null; + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "getEvents called with null or empty eventType.", new Object[0]); + return null; + } + synchronized (this) { + if (str.equals("com.ea.nimble.network")) { + list = this.m_networkMetricsArray; + this.m_networkMetricsArray = new ArrayList(); + } else if (str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) { + list = this.m_networkPayloadsArray; + this.m_networkPayloadsArray = new ArrayList(); + } + } + if (list == null) { + Log.Helper.LOGE(this, "getEvents, unsupported OT eventType, " + str + ".", new Object[0]); + } + return Collections.unmodifiableList(list); + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public void setMaxEventCount(String str, int i) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "setMaxEventCount called with null or empty eventType.", new Object[0]); + } else { + this.m_maxEventQueueSizeDict.put(str, Integer.valueOf(i)); + trimEventQueue(str); + } + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public int getMaxEventCount(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGE(this, "getMaxEventCount called with null or empty eventType.", new Object[0]); + return 100; + } + Integer num = this.m_maxEventQueueSizeDict.get(str); + if (num == null) { + return 100; + } + return num.intValue(); + } + + private boolean canLogEvent(String str) { + List list; + Log.Helper.LOGFUNC(this); + int maxEventCount = getMaxEventCount(str); + if (str.equals("com.ea.nimble.network")) { + list = this.m_networkMetricsArray; + } else if (str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) { + list = this.m_networkPayloadsArray; + } else { + Log.Helper.LOGE(this, "canLogEvent, unsupported OT eventType, " + str + ".", new Object[0]); + return false; + } + return ((list.size() < maxEventCount) || (maxEventCount < 0)) && !(maxEventCount == 0); + } + + private void updateEventThresholdListeners() { + Log.Helper.LOGFUNC(this); + int maxEventCount = getMaxEventCount("com.ea.nimble.network"); + if (maxEventCount > 0) { + double d = maxEventCount; + Double.isNaN(d); + if (this.m_networkMetricsArray.size() >= ((int) (d * 0.75d))) { + HashMap hashMap = new HashMap(); + hashMap.put("eventType", "com.ea.nimble.network"); + Utility.sendBroadcast(IOperationalTelemetryDispatch.NOTIFICATION_OT_EVENT_THRESHOLD_WARNING, hashMap); + Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.", new Object[0]); + } + } + int maxEventCount2 = getMaxEventCount(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS); + if (maxEventCount2 > 0) { + double d2 = maxEventCount2; + Double.isNaN(d2); + if (this.m_networkPayloadsArray.size() >= ((int) (d2 * 0.75d))) { + HashMap hashMap2 = new HashMap(); + hashMap2.put("eventType", IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS); + Utility.sendBroadcast(IOperationalTelemetryDispatch.NOTIFICATION_OT_EVENT_THRESHOLD_WARNING, hashMap2); + Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.", new Object[0]); + } + } + } + + private void trimEventQueue(String str) { + List list; + Log.Helper.LOGFUNC(this); + int maxEventCount = getMaxEventCount(str); + if (str.equals("com.ea.nimble.network")) { + list = this.m_networkMetricsArray; + } else { + if (!str.equals(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS)) { + Log.Helper.LOGE(this, "trimEventQueue, unsupported OT eventType, " + str + ".", new Object[0]); + return; + } + list = this.m_networkPayloadsArray; + } + if (maxEventCount >= 0 && list.size() != 0 && list.size() - maxEventCount >= 0) { + synchronized (this) { + try { + if (maxEventCount == 0) { + list.clear(); + } else { + int i = maxEventCount / 2; + Log.Helper.LOGI(this, "trimEventQueues, queue threshold surprassed, purging " + i + " older events ", new Object[0]); + for (int i2 = 0; i2 < i; i2++) { + purgeOldestEvent(list); + } + } + } catch (Throwable th) { + throw th; + } + } + } + } + + private void purgeOldestEvent(List list) { + Log.Helper.LOGFUNC(this); + synchronized (this) { + if (list.size() == 0) { + Log.Helper.LOGD(this, "purgeOldestEvent called with empty event array.", new Object[0]); + return; + } + OperationalTelemetryEvent operationalTelemetryEvent = null; + for (OperationalTelemetryEvent operationalTelemetryEvent2 : list) { + if (operationalTelemetryEvent == null || operationalTelemetryEvent2.getLoggedTime().before(operationalTelemetryEvent.getLoggedTime())) { + operationalTelemetryEvent = operationalTelemetryEvent2; + } + } + if (operationalTelemetryEvent != null) { + list.remove(operationalTelemetryEvent); + } + } + } +} diff --git a/app/src/main/java/com/ea/nimble/OperationalTelemetryEvent.java b/app/src/main/java/com/ea/nimble/OperationalTelemetryEvent.java new file mode 100644 index 0000000..27b66d6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/OperationalTelemetryEvent.java @@ -0,0 +1,15 @@ +package com.ea.nimble; + +import java.util.Date; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public interface OperationalTelemetryEvent { + JSONObject getEventDictionary(); + + String getEventDictionaryString(); + + String getEventType(); + + Date getLoggedTime(); +} diff --git a/app/src/main/java/com/ea/nimble/OperationalTelemetryEventImpl.java b/app/src/main/java/com/ea/nimble/OperationalTelemetryEventImpl.java new file mode 100644 index 0000000..809fe4e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/OperationalTelemetryEventImpl.java @@ -0,0 +1,41 @@ +package com.ea.nimble; + +import java.util.Date; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class OperationalTelemetryEventImpl implements OperationalTelemetryEvent { + private JSONObject m_eventDictionary; + private String m_eventType; + private Date m_loggedTime; + + public OperationalTelemetryEventImpl(String str, JSONObject jSONObject, Date date) { + this.m_eventType = str; + this.m_eventDictionary = jSONObject; + this.m_loggedTime = date; + } + + @Override // com.ea.nimble.OperationalTelemetryEvent + public String getEventType() { + return this.m_eventType; + } + + @Override // com.ea.nimble.OperationalTelemetryEvent + public JSONObject getEventDictionary() { + return this.m_eventDictionary; + } + + @Override // com.ea.nimble.OperationalTelemetryEvent + public String getEventDictionaryString() { + return this.m_eventDictionary.toString(); + } + + @Override // com.ea.nimble.OperationalTelemetryEvent + public Date getLoggedTime() { + return this.m_loggedTime; + } + + public String toString() { + return String.format("OperationalTelemetryEvent(%s)-(%s) > %s", getEventType(), getLoggedTime(), getEventDictionary()); + } +} diff --git a/app/src/main/java/com/ea/nimble/Persistence.java b/app/src/main/java/com/ea/nimble/Persistence.java new file mode 100644 index 0000000..ea80a40 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Persistence.java @@ -0,0 +1,556 @@ +package com.ea.nimble; + +import android.app.backup.BackupManager; +import android.content.Context; +import com.ea.nimble.Log; +import com.ea.nimble.PersistenceService; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InvalidClassException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class Persistence implements LogSource { + private static int PERSISTENCE_VERSION = 101; + static final Object s_dataLock = new Object(); + private boolean m_backUp; + private boolean m_changed; + private Map m_content; + private boolean m_encryption; + private Encryptor m_encryptor; + private String m_identifier; + private Storage m_storage; + private Timer m_synchronizeTimer; + + public enum Storage { + DOCUMENT, + CACHE, + TEMP + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Persistence"; + } + + Persistence(String str, Storage storage, Encryptor encryptor) { + this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1 + @Override // java.lang.Runnable + public void run() { + Persistence.this.synchronize(); + } + }); + this.m_content = new HashMap(); + this.m_identifier = str; + this.m_storage = storage; + this.m_encryptor = encryptor; + this.m_encryption = false; + this.m_backUp = false; + this.m_changed = false; + } + + Persistence(Persistence persistence, String str) { + this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1 + @Override // java.lang.Runnable + public void run() { + Persistence.this.synchronize(); + } + }); + this.m_content = new HashMap(persistence.m_content); + this.m_identifier = str; + this.m_storage = persistence.m_storage; + this.m_encryptor = persistence.m_encryptor; + this.m_encryption = persistence.m_encryption; + this.m_backUp = persistence.m_backUp; + flagChange(); + } + + public String getIdentifier() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_identifier; + } + + public Storage getStorage() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_storage; + } + + public boolean getEncryption() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_encryption; + } + + public void setEncryption(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + if (z != this.m_encryption) { + this.m_encryption = z; + flagChange(); + } + } + + public boolean getBackUp() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_backUp; + } + + public void setBackUp(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_storage != Storage.DOCUMENT) { + Log.Helper.LOGF(this, "Error: Backup flag not supported for storage: " + this.m_storage, new Object[0]); + return; + } + this.m_backUp = z; + } + + void merge(Persistence persistence, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) { + Log.Helper.LOGFUNC(this); + switch (persistenceMergePolicy) { + case OVERWRITE: + this.m_content = new HashMap(persistence.m_content); + break; + case SOURCE_FIRST: + this.m_content.putAll(persistence.m_content); + break; + case TARGET_FIRST: + for (String str : persistence.m_content.keySet()) { + if (this.m_content.get(str) == null) { + this.m_content.put(str, persistence.m_content.get(str)); + } + } + break; + } + } + + void restore(boolean z, Context context) { + Log.Helper.LOGFUNC(this); + synchronized (s_dataLock) { + loadPersistenceData(z, context); + } + } + + public boolean hasKey(String str) { + boolean z; + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + z = this.m_content.get(str) != null; + } + return z; + } + + public void setValue(String str, Serializable serializable) { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + if (!Utility.validString(str)) { + Log.Helper.LOGD(this, "Key " + str + " is an invalid string", new Object[0]); + Log.Helper.LOGF(this, "NimblePersistence cannot accept an invalid string as key", new Object[0]); + return; + } + if (serializable == null) { + if (this.m_content.get(str) != null) { + this.m_content.remove(str); + flagChange(); + } + return; + } + try { + putValue(str, serializable); + } catch (IOException unused) { + Log.Helper.LOGD(this, "Value " + serializable.toString() + " was unable to be archived", new Object[0]); + Log.Helper.LOGF(this, "NimblePersistence cannot archive value", new Object[0]); + } + } + } + + public Serializable getValue(String str) { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + byte[] bArr = this.m_content.get(str); + if (bArr == null) { + return null; + } + try { + return (Serializable) new ObjectInputStream(new ByteArrayInputStream(bArr)).readObject(); + } catch (Exception e) { + Log.Helper.LOGD(this, "PERSIST: Exception getting value, " + str + ":" + e, new Object[0]); + return null; + } + } + } + + public String getStringValue(String str) { + Log.Helper.LOGPUBLICFUNC(this); + Serializable value = getValue(str); + try { + return (String) value; + } catch (ClassCastException unused) { + Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]); + Log.Helper.LOGF(this, "Invalid value type for getStringValueCall", new Object[0]); + return null; + } + } + + public boolean getBoolValue(String str) { + Log.Helper.LOGPUBLICFUNC(this); + Serializable value = getValue(str); + try { + if (value != null) { + return ((Boolean) value).booleanValue(); + } + throw new ClassCastException(); + } catch (ClassCastException unused) { + Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]); + Log.Helper.LOGF(this, "Invalid value type for getBoolValue", new Object[0]); + return false; + } + } + + public void addEntries(Object... objArr) { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + String str = null; + for (int i = 0; i < objArr.length; i++) { + if (i % 2 == 0) { + try { + str = (String) objArr[i]; + if (!Utility.validString(str)) { + throw new RuntimeException("Invalid key"); + } + } catch (Exception unused) { + Log.Helper.LOGF(this, "Invalid key in NimblePersistence.addEntries at index %d, not a string", Integer.valueOf(i)); + return; + } + } else { + try { + putValue(str, (Serializable) objArr[i]); + } catch (Exception unused2) { + Log.Helper.LOGD(this, "Invalid value for key %s", str); + Log.Helper.LOGF(this, "Invalid value in NimblePersistence.addEntries at index %d", Integer.valueOf(i)); + return; + } + } + } + } + } + + public void addEntriesFromMap(Map map) { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + if (!Utility.validString(key)) { + Log.Helper.LOGD(this, "Invalid key %s", key); + Log.Helper.LOGE(this, "Invalid key in NimblePersistence.addEntriesInDictionary, not a string, skip it", new Object[0]); + } else { + Serializable value = entry.getValue(); + if (value != null) { + try { + putValue(key, value); + } catch (IOException unused) { + } + } + Log.Helper.LOGD(this, "Invalid key %s", key); + Log.Helper.LOGE(this, "Invalid value in NimblePersistence.addEntries for key", new Object[0]); + } + } + } + } + + public void clean() { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + this.m_content.clear(); + clearSynchronizeTimer(); + String persistencePath = getPersistencePath(this.m_identifier, this.m_storage); + if (persistencePath != null) { + File file = new File(persistencePath); + if (file.exists() && !file.delete()) { + Log.Helper.LOGE(this, "Fail to clean persistence file for id[%s] in storage %s", this.m_identifier, this.m_storage.toString()); + } + } else { + Log.Helper.LOGE(this, "Could not get path to persistence for id[%s] in storage %s", this.m_identifier, this.m_storage.toString()); + } + } + } + + public void synchronize() { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (s_dataLock) { + if (!this.m_changed) { + Log.Helper.LOGD(this, "Not synchronizing to persistence for id[%s] since there is no change", this.m_identifier); + return; + } + clearSynchronizeTimer(); + savePersistenceData(); + if (this.m_backUp) { + new BackupManager(ApplicationEnvironment.getComponent().getApplicationContext()).dataChanged(); + } + } + } + + private void clearSynchronizeTimer() { + Log.Helper.LOGFUNC(this); + synchronized (s_dataLock) { + this.m_synchronizeTimer.cancel(); + } + } + + private void flagChange() { + Log.Helper.LOGFUNC(this); + this.m_changed = true; + synchronized (s_dataLock) { + clearSynchronizeTimer(); + this.m_synchronizeTimer.schedule(0.5d, false); + } + } + + private void putValue(String str, Serializable serializable) throws IOException { + Log.Helper.LOGFUNC(this); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); + objectOutputStream.writeObject(serializable); + objectOutputStream.close(); + byte[] byteArray = byteArrayOutputStream.toByteArray(); + if (Arrays.equals(byteArray, this.m_content.get(str))) { + return; + } + this.m_content.put(str, byteArray); + flagChange(); + } + + private void loadPersistenceData(boolean z, Context context) { + String persistencePath; + FileInputStream fileInputStream; + ObjectInputStream objectInputStream; + ObjectInputStream objectInputStream2; + Log.Helper.LOGFUNC(this); + if (context == null) { + persistencePath = getPersistencePath(this.m_identifier, this.m_storage); + } else { + persistencePath = getPersistencePath(this.m_identifier, this.m_storage, context); + } + if (persistencePath == null) { + return; + } + File file = new File(persistencePath); + if (!file.exists() || file.length() == 0) { + Log.Helper.LOGD(this, "No persistence file for id[%s] to restore from storage %s", this.m_identifier, this.m_storage.toString()); + return; + } + Log.Helper.LOGD(this, "Loading persistence file size %d", Long.valueOf(file.length())); + FileInputStream fileInputStream2 = null; + try { + try { + try { + fileInputStream = new FileInputStream(file); + try { + objectInputStream = new ObjectInputStream(fileInputStream); + } catch (Exception e) { + e = e; + fileInputStream2 = fileInputStream; + Log.Helper.LOGE(this, "Can't read persistence (%s) file, %s: %s", this.m_identifier, persistencePath, e.toString()); + e.printStackTrace(); + if (fileInputStream2 != null) { + fileInputStream2.close(); + } + return; + } catch (Throwable th) { + th = th; + if (fileInputStream != null) { + try { + fileInputStream.close(); + } catch (IOException unused) { + } + } + throw th; + } + } catch (Throwable th2) { + th = th2; + fileInputStream = fileInputStream2; + } + } catch (Exception e2) { + e = e2; + } + if (objectInputStream.readInt() != PERSISTENCE_VERSION) { + throw new InvalidClassException("com.ea.nimble.Persistence", "Persistence version doesn't match"); + } + this.m_encryption = objectInputStream.readBoolean(); + this.m_backUp = objectInputStream.readBoolean(); + if (!z) { + BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream); + if (this.m_encryption) { + objectInputStream2 = this.m_encryptor.encryptInputStream(bufferedInputStream); + } else { + objectInputStream2 = new ObjectInputStream(bufferedInputStream); + } + this.m_content = (Map) objectInputStream2.readObject(); + Log.Helper.LOGD(this, "Persistence file for id[%s] restored from storage %s", this.m_identifier, this.m_storage.toString()); + objectInputStream2.close(); + } + objectInputStream.close(); + fileInputStream.close(); + } catch (IOException unused2) { + } + } + + /* JADX WARN: Code restructure failed: missing block: B:24:0x00b7, code lost: + + if (r6 == null) goto L30; + */ + /* JADX WARN: Removed duplicated region for block: B:32:0x00cf A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private void savePersistenceData() { + /* + Method dump skipped, instructions count: 211 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.savePersistenceData():void"); + } + + static File getPersistenceDirectory(Storage storage) { + String documentPath; + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + switch (storage) { + case DOCUMENT: + documentPath = component.getDocumentPath(); + break; + case CACHE: + documentPath = component.getCachePath(); + break; + case TEMP: + documentPath = component.getTempPath(); + break; + default: + Log.Helper.LOGES("Persistence", "Unknown storage type", new Object[0]); + return null; + } + File file = new File(documentPath + File.separator + "persistence"); + if (file.isDirectory() || file.mkdirs()) { + return file; + } + Log.Helper.LOGE("Persistence", "Cannot create persistence folder in storage(%s) %s", storage, file.toString()); + return null; + } + + /* JADX WARN: Removed duplicated region for block: B:11:0x002f */ + /* JADX WARN: Removed duplicated region for block: B:13:0x003b */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + static java.io.File getPersistenceDirectory(com.ea.nimble.Persistence.Storage r6, android.content.Context r7) { + /* + int[] r0 = com.ea.nimble.Persistence.AnonymousClass2.$SwitchMap$com$ea$nimble$Persistence$Storage + int r1 = r6.ordinal() + r0 = r0[r1] + r1 = 0 + switch(r0) { + case 1: goto L1f; + case 2: goto L14; + case 3: goto L14; + default: goto Lc; + } + Lc: + java.lang.String r6 = "Nimble" + java.lang.String r7 = "Persistence : Unknown storage type" + android.util.Log.e(r6, r7) + return r1 + L14: + java.io.File r7 = r7.getCacheDir() + if (r7 == 0) goto L2a + java.lang.String r7 = r7.getPath() + goto L2b + L1f: + java.io.File r7 = r7.getFilesDir() + if (r7 == 0) goto L2a + java.lang.String r7 = r7.getPath() + goto L2b + L2a: + r7 = r1 + L2b: + r0 = 0 + r2 = 1 + if (r7 != 0) goto L3b + java.lang.String r7 = "Nimble" + java.lang.String r3 = "Persistence : Could not build base path for storage(%s)" + java.lang.Object[] r2 = new java.lang.Object[r2] + r2[r0] = r6 + com.ea.nimble.Log.Helper.LOGE(r7, r3, r2) + return r1 + L3b: + java.lang.String r3 = "com.ea.nimble.configuration" + java.lang.String r3 = com.ea.nimble.NimbleApplicationConfiguration.getConfigValueAsString(r3) + java.lang.StringBuilder r4 = new java.lang.StringBuilder + r4.() + r4.append(r7) + java.lang.String r7 = java.io.File.separator + r4.append(r7) + java.lang.String r7 = "Nimble" + r4.append(r7) + java.lang.String r7 = java.io.File.separator + r4.append(r7) + r4.append(r3) + java.lang.String r7 = java.io.File.separator + r4.append(r7) + java.lang.String r7 = "persistence" + r4.append(r7) + java.lang.String r7 = r4.toString() + com.ea.nimble.Persistence$Storage r3 = com.ea.nimble.Persistence.Storage.TEMP + if (r6 != r3) goto L83 + java.lang.StringBuilder r3 = new java.lang.StringBuilder + r3.() + r3.append(r7) + java.lang.String r7 = java.io.File.separator + r3.append(r7) + java.lang.String r7 = "temp" + r3.append(r7) + java.lang.String r7 = r3.toString() + L83: + java.io.File r3 = new java.io.File + r3.(r7) + boolean r4 = r3.isDirectory() + if (r4 != 0) goto La7 + boolean r4 = r3.mkdirs() + if (r4 != 0) goto La7 + java.lang.String r3 = "Nimble" + java.lang.String r4 = "Persistence : Cannot create persistence folder in storage(%s) %s" + r5 = 2 + java.lang.Object[] r5 = new java.lang.Object[r5] + r5[r0] = r6 + r5[r2] = r7 + java.lang.String r6 = java.lang.String.format(r4, r5) + android.util.Log.e(r3, r6) + return r1 + La7: + return r3 + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.getPersistenceDirectory(com.ea.nimble.Persistence$Storage, android.content.Context):java.io.File"); + } + + static String getPersistencePath(String str, Storage storage) { + File persistenceDirectory = getPersistenceDirectory(storage); + if (persistenceDirectory == null) { + return null; + } + return persistenceDirectory + File.separator + str + ".dat"; + } + + static String getPersistencePath(String str, Storage storage, Context context) { + File persistenceDirectory = getPersistenceDirectory(storage, context); + if (persistenceDirectory == null) { + return null; + } + return persistenceDirectory + File.separator + str + ".dat"; + } +} diff --git a/app/src/main/java/com/ea/nimble/PersistenceService.java b/app/src/main/java/com/ea/nimble/PersistenceService.java new file mode 100644 index 0000000..5e83c89 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/PersistenceService.java @@ -0,0 +1,123 @@ +package com.ea.nimble; + +import android.app.backup.BackupAgent; +import android.app.backup.BackupDataInput; +import android.app.backup.BackupDataOutput; +import android.content.Context; +import android.os.ParcelFileDescriptor; +import com.ea.nimble.Log; +import com.ea.nimble.Persistence; +import java.io.FileOutputStream; +import java.io.IOException; + +/* loaded from: classes.dex */ +public class PersistenceService { + private static final String APPLICATION_PERSISTENCE_ID = "[APPLICATION]"; + public static final String COMPONENT_ID = "com.ea.nimble.persistence"; + private static final String NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE = "[COMPONENT]%s"; + + public enum PersistenceMergePolicy { + OVERWRITE, + SOURCE_FIRST, + TARGET_FIRST + } + + public static class PersistenceBackupAgent extends BackupAgent { + @Override // android.app.backup.BackupAgent + public void onBackup(ParcelFileDescriptor parcelFileDescriptor, BackupDataOutput backupDataOutput, ParcelFileDescriptor parcelFileDescriptor2) throws IOException { + synchronized (Persistence.s_dataLock) { + PersistenceService.writeBackup(parcelFileDescriptor, backupDataOutput, parcelFileDescriptor2, this); + } + } + + @Override // android.app.backup.BackupAgent + public void onRestore(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor) throws IOException { + synchronized (Persistence.s_dataLock) { + PersistenceService.readBackup(backupDataInput, i, parcelFileDescriptor, this); + } + } + } + + public static IPersistenceService getComponent() { + return BaseCore.getInstance().getPersistenceService(); + } + + public static Persistence getAppPersistence(Persistence.Storage storage) { + return getComponent().getPersistence(APPLICATION_PERSISTENCE_ID, storage); + } + + public static Persistence getPersistenceForNimbleComponent(String str, Persistence.Storage storage) { + if (!Utility.validString(str)) { + Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]); + return null; + } + return getComponent().getPersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage); + } + + public static void removePersistenceForNimbleComponent(String str, Persistence.Storage storage) { + if (!Utility.validString(str)) { + Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]); + return; + } + getComponent().removePersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage); + } + + public static void cleanReferenceToPersistence(String str, Persistence.Storage storage) { + if (!Utility.validString(str)) { + Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]); + return; + } + getComponent().cleanPersistenceReference(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage); + } + + /* JADX WARN: Removed duplicated region for block: B:6:0x003e */ + /* JADX WARN: Removed duplicated region for block: B:9:0x0048 */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + static void writeBackup(android.os.ParcelFileDescriptor r18, android.app.backup.BackupDataOutput r19, android.os.ParcelFileDescriptor r20, android.content.Context r21) throws java.io.IOException { + /* + Method dump skipped, instructions count: 268 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.PersistenceService.writeBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor, android.content.Context):void"); + } + + static void readBackup(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor, Context context) throws IOException { + FileOutputStream fileOutputStream; + while (true) { + FileOutputStream fileOutputStream2 = null; + if (!backupDataInput.readNextHeader()) { + break; + } + String key = backupDataInput.getKey(); + int dataSize = backupDataInput.getDataSize(); + byte[] bArr = new byte[dataSize]; + backupDataInput.readEntityData(bArr, 0, dataSize); + try { + fileOutputStream = new FileOutputStream(Persistence.getPersistencePath(key, Persistence.Storage.DOCUMENT, context)); + } catch (Throwable th) { + th = th; + } + try { + fileOutputStream.write(bArr); + fileOutputStream.close(); + } catch (Throwable th2) { + th = th2; + fileOutputStream2 = fileOutputStream; + if (fileOutputStream2 != null) { + fileOutputStream2.close(); + } + throw th; + } + } + if (ApplicationEnvironment.isMainApplicationRunning()) { + for (Persistence persistence : ((PersistenceServiceImpl) getComponent()).m_persistences.values()) { + if (persistence.getBackUp()) { + persistence.restore(false, null); + } + } + } + } +} diff --git a/app/src/main/java/com/ea/nimble/PersistenceServiceImpl.java b/app/src/main/java/com/ea/nimble/PersistenceServiceImpl.java new file mode 100644 index 0000000..5d03a42 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/PersistenceServiceImpl.java @@ -0,0 +1,190 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.google.android.vending.expansion.downloader.Constants; +import java.io.File; +import java.util.Iterator; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/* loaded from: classes.dex */ +public class PersistenceServiceImpl extends Component implements IPersistenceService, LogSource { + private Encryptor m_encryptor; + protected ConcurrentMap m_persistences; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return PersistenceService.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Persistence"; + } + + @Override // com.ea.nimble.Component + public void setup() { + this.m_persistences = new ConcurrentHashMap(); + this.m_encryptor = new Encryptor(); + } + + @Override // com.ea.nimble.Component + public void suspend() { + synchronize(); + } + + @Override // com.ea.nimble.Component + public void teardown() { + synchronize(); + synchronized (Persistence.s_dataLock) { + this.m_persistences = null; + this.m_encryptor = null; + } + } + + @Override // com.ea.nimble.IPersistenceService + public Persistence getPersistence(String str, Persistence.Storage storage) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]); + return null; + } + synchronized (Persistence.s_dataLock) { + Persistence loadPersistenceById = loadPersistenceById(str, storage); + if (loadPersistenceById != null) { + return loadPersistenceById; + } + Persistence persistence = new Persistence(str, storage, this.m_encryptor); + this.m_persistences.put(str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString(), persistence); + return persistence; + } + } + + @Override // com.ea.nimble.IPersistenceService + public void removePersistence(String str, Persistence.Storage storage) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]); + return; + } + cleanPersistenceReference(str, storage); + } + + @Override // com.ea.nimble.IPersistenceService + public void cleanPersistenceReference(String str, Persistence.Storage storage) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str)) { + Log.Helper.LOGF(this, "Invalid identifier " + str + " for persistence", new Object[0]); + return; + } + synchronized (Persistence.s_dataLock) { + this.m_persistences.remove(str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString()); + } + } + + @Override // com.ea.nimble.IPersistenceService + public void wipeAllDataAndForceTerminate() { + Log.Helper.LOGPUBLICFUNC(this); + String documentPath = ApplicationEnvironment.getComponent().getDocumentPath(); + String tempPath = ApplicationEnvironment.getComponent().getTempPath(); + String cachePath = ApplicationEnvironment.getComponent().getCachePath(); + BaseCore.getInstance().onApplicationQuit(); + try { + Log.Helper.LOGW(this, "!!! Wipe begin !!!", new Object[0]); + Log.Helper.LOGD(this, "Clearing DOC folder", new Object[0]); + if (deletePath(documentPath)) { + Log.Helper.LOGD(this, "Successfully deleted doc directory", new Object[0]); + } else { + Log.Helper.LOGE(this, "Failed to delete doc directory", new Object[0]); + } + Log.Helper.LOGD(this, "Clearing TEMP folder", new Object[0]); + if (deletePath(tempPath)) { + Log.Helper.LOGD(this, "Successfully deleted temp directory", new Object[0]); + } else { + Log.Helper.LOGE(this, "Failed to delete temp directory", new Object[0]); + } + Log.Helper.LOGD(this, "Clearing CACHE folder", new Object[0]); + if (deletePath(cachePath)) { + Log.Helper.LOGD(this, "Successfully deleted cache directory", new Object[0]); + } else { + Log.Helper.LOGE(this, "Failed to delete cache directory", new Object[0]); + } + Log.Helper.LOGW(this, "!!! Wipe complete. Force terminating the application !!!", new Object[0]); + } catch (Exception e) { + Log.Helper.LOGE(this, "!!! Wipe exception !!!\n" + e.toString(), new Object[0]); + } + System.exit(0); + } + + @Override // com.ea.nimble.IPersistenceService + public void migratePersistence(String str, Persistence.Storage storage, String str2, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) { + Log.Helper.LOGPUBLICFUNC(this); + if (!Utility.validString(str) || !Utility.validString(str2)) { + Log.Helper.LOGF(this, "Invalid identifiers " + str + " or " + str2 + " for component persistence", new Object[0]); + return; + } + synchronized (Persistence.s_dataLock) { + String str3 = str2 + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString(); + Persistence loadPersistenceById = loadPersistenceById(str, storage); + if (loadPersistenceById == null) { + if (persistenceMergePolicy == PersistenceService.PersistenceMergePolicy.OVERWRITE) { + this.m_persistences.remove(str3); + String persistencePath = Persistence.getPersistencePath(str2, storage); + File file = persistencePath != null ? new File(persistencePath) : null; + if (file == null || !file.delete()) { + Log.Helper.LOGE(this, "Could not delete file: " + persistencePath, new Object[0]); + } + } + return; + } + Persistence loadPersistenceById2 = loadPersistenceById(str2, storage); + if (loadPersistenceById2 == null) { + Persistence persistence = new Persistence(loadPersistenceById, str2); + this.m_persistences.put(str3, persistence); + persistence.synchronize(); + } else { + loadPersistenceById2.merge(loadPersistenceById, persistenceMergePolicy); + } + } + } + + private void synchronize() { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_persistences.values().iterator(); + while (it.hasNext()) { + it.next().synchronize(); + } + } + + private Persistence loadPersistenceById(String str, Persistence.Storage storage) { + Log.Helper.LOGFUNC(this); + synchronized (Persistence.s_dataLock) { + String str2 = str + Constants.FILENAME_SEQUENCE_SEPARATOR + storage.toString(); + Persistence persistence = this.m_persistences.get(str2); + if (persistence != null) { + return persistence; + } + String persistencePath = Persistence.getPersistencePath(str, storage); + File file = persistencePath != null ? new File(persistencePath) : null; + if (file != null && file.exists()) { + Persistence persistence2 = new Persistence(str, storage, this.m_encryptor); + persistence2.restore(false, null); + this.m_persistences.put(str2, persistence2); + return persistence2; + } + return null; + } + } + + private boolean deletePath(String str) { + File file = new File(str); + if (file.isDirectory()) { + for (String str2 : file.list()) { + deletePath(new File(file, str2).getPath()); + } + } + return file.delete(); + } +} diff --git a/app/src/main/java/com/ea/nimble/QA.java b/app/src/main/java/com/ea/nimble/QA.java new file mode 100644 index 0000000..f4741f0 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/QA.java @@ -0,0 +1,10 @@ +package com.ea.nimble; + +import com.ea.nimble.Persistence; + +/* loaded from: classes.dex */ +public class QA { + static String getPersistencePath(String str, Persistence.Storage storage) { + return Persistence.getPersistencePath(str, storage); + } +} diff --git a/app/src/main/java/com/ea/nimble/ReferrerReceiver.java b/app/src/main/java/com/ea/nimble/ReferrerReceiver.java new file mode 100644 index 0000000..c7f4b7d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/ReferrerReceiver.java @@ -0,0 +1,14 @@ +package com.ea.nimble; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class ReferrerReceiver extends BroadcastReceiver { + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGES("ReferrerReceiver", "ReferrerReceiver has been deprecated. Please remove \"com.ea.nimble.ReferrerReceiver\" receiver block from your AndroidManifest.xml file.", new Object[0]); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyEnvironment.java b/app/src/main/java/com/ea/nimble/SynergyEnvironment.java new file mode 100644 index 0000000..5674492 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyEnvironment.java @@ -0,0 +1,40 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class SynergyEnvironment { + public static final String COMPONENT_ID = "com.ea.nimble.synergyEnvironment"; + public static final int INVALID_INT_VALUE = -1; + public static final String NOTIFICATION_APP_VERSION_CHECK_FINISHED = "nimble.environment.notification.app_version_check_finished"; + public static final String NOTIFICATION_RESTORED_FROM_PERSISTENT = "nimble.environment.notification.restored_from_persistent"; + public static final String NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED = "nimble.environment.notification.startup_environment_data_changed"; + public static final String NOTIFICATION_STARTUP_REQUESTS_FINISHED = "nimble.environment.notification.startup_requests_finished"; + public static final String NOTIFICATION_STARTUP_REQUESTS_STARTED = "nimble.environment.notification.startup_requests_started"; + public static final String SERVER_URL_KEY_AKAMAI = "akamai.url"; + public static final String SERVER_URL_KEY_ANTELOPE_GROUPS = "antelope.groups.url"; + public static final String SERVER_URL_KEY_ANTELOPE_REAL_TIME_MESSAGING = "antelope.rtm.host"; + public static final String SERVER_URL_KEY_ANTELOPE_REST_MESSAGING = "antelope.rtm.url"; + public static final String SERVER_URL_KEY_ARUBA = "aruba.url"; + public static final String SERVER_URL_KEY_DYNAMIC_MORE_GAMES = "dmg.url"; + public static final String SERVER_URL_KEY_EADP_FRIENDS_HOST = "eadp.friends.host"; + public static final String SERVER_URL_KEY_ENS = "ens.url"; + public static final String SERVER_URL_KEY_IDENTITY_CONNECT = "nexus.connect"; + public static final String SERVER_URL_KEY_IDENTITY_PORTAL = "nexus.portal"; + public static final String SERVER_URL_KEY_IDENTITY_PROXY = "nexus.proxy"; + public static final String SERVER_URL_KEY_MAYHEM = "mayhem.url"; + public static final String SERVER_URL_KEY_ORIGIN_AVATAR = "avatars.url"; + public static final String SERVER_URL_KEY_ORIGIN_CASUAL_APP = "origincasualapp.url"; + public static final String SERVER_URL_KEY_ORIGIN_CASUAL_SERVER = "origincasualserver.url"; + public static final String SERVER_URL_KEY_ORIGIN_FRIENDS = "friends.url"; + public static final String SERVER_URL_KEY_SYNERGY_CENTRAL_IP_GEOLOCATION = "geoip.url"; + public static final String SERVER_URL_KEY_SYNERGY_DIRECTOR = "synergy.director"; + public static final String SERVER_URL_KEY_SYNERGY_DRM = "synergy.drm"; + public static final String SERVER_URL_KEY_SYNERGY_MESSAGE_TO_USER = "synergy.m2u"; + public static final String SERVER_URL_KEY_SYNERGY_PRODUCT = "synergy.product"; + public static final String SERVER_URL_KEY_SYNERGY_S2S = "synergy.s2s"; + public static final String SERVER_URL_KEY_SYNERGY_TRACKING = "synergy.tracking"; + public static final String SERVER_URL_KEY_SYNERGY_USER = "synergy.user"; + + public static ISynergyEnvironment getComponent() { + return (ISynergyEnvironment) Base.getComponent(COMPONENT_ID); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyEnvironmentImpl.java b/app/src/main/java/com/ea/nimble/SynergyEnvironmentImpl.java new file mode 100644 index 0000000..2796637 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyEnvironmentImpl.java @@ -0,0 +1,448 @@ +package com.ea.nimble; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.preference.PreferenceManager; +import com.ea.nimble.Error; +import com.ea.nimble.Log; +import com.ea.nimble.Network; +import com.ea.nimble.Persistence; +import com.ea.nimble.SynergyEnvironmentUpdater; +import java.io.Serializable; +import java.util.HashMap; + +/* loaded from: classes.dex */ +public class SynergyEnvironmentImpl extends Component implements ISynergyEnvironment, LogSource { + private static final String PERSISTENCE_DATA_ID = "environmentData"; + public static final int SYNERGY_APP_VERSION_OK = 0; + public static final int SYNERGY_APP_VERSION_UPDATE_RECOMMENDED = 1; + public static final int SYNERGY_APP_VERSION_UPDATE_REQUIRED = 2; + private static final String SYNERGY_INT_SERVER_URL = "https://director-int.sn.eamobile.com"; + private static final String SYNERGY_LIVE_SERVER_URL = "https://syn-dir.sn.eamobile.com"; + private static final String SYNERGY_STAGE_SERVER_URL = "https://director-stage.sn.eamobile.com"; + public static final double SYNERGY_UPDATE_RATE_LIMIT_PERIOD_IN_SECONDS = 60.0d; + public static final double SYNERGY_UPDATE_REFRESH_PERIOD_IN_SECONDS = 300.0d; + private BaseCore m_core; + private EnvironmentDataContainer m_environmentDataContainer; + private EnvironmentDataContainer m_previousValidEnvironmentDataContainer; + private Long m_synergyEnvironmentUpdateRateLimitTriggerTimestamp; + private SynergyEnvironmentUpdater m_synergyStartupObject; + private BroadcastReceiver m_networkStatusChangeReceiver = null; + private boolean m_dataLoadedOnComponentSetup = false; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return SynergyEnvironment.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "SynergyEnv"; + } + + SynergyEnvironmentImpl(BaseCore baseCore) { + this.m_core = baseCore; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getEADeviceId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getEADeviceId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSynergyId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getSynergyId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSellId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getSellId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getProductId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getProductId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getEAHardwareId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getEAHardwareId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public Error setServerUrl(String str, String str2) { + return this.m_environmentDataContainer.setServerUrl(str, str2); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getServerUrlWithKey(String str) { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getServerUrlWithKey(str); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public int getLatestAppVersionCheckResult() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_environmentDataContainer == null) { + return 0; + } + return this.m_environmentDataContainer.getLatestAppVersionCheckResult(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public int getTrackingPostInterval() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_environmentDataContainer == null) { + return -1; + } + return this.m_environmentDataContainer.getTrackingPostInterval(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) { + Log.Helper.LOGPUBLICFUNC(this); + switch (nimbleConfiguration) { + case INTEGRATION: + return SYNERGY_INT_SERVER_URL; + case STAGE: + return SYNERGY_STAGE_SERVER_URL; + case LIVE: + return SYNERGY_LIVE_SERVER_URL; + case CUSTOMIZED: + return PreferenceManager.getDefaultSharedPreferences(ApplicationEnvironment.getComponent().getApplicationContext()).getString("NimbleCustomizedSynergyServerEndpointUrl", SYNERGY_LIVE_SERVER_URL); + default: + Log.Helper.LOGF(this, "Request for Synergy Director server URL with unknown NimbleConfiguration, %d.", nimbleConfiguration); + return SYNERGY_LIVE_SERVER_URL; + } + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isDataAvailable() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_environmentDataContainer != null; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isUpdateInProgress() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_synergyStartupObject != null; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public Error checkAndInitiateSynergyEnvironmentUpdate() { + Log.Helper.LOGPUBLICFUNC(this); + if (isUpdateInProgress()) { + return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Update in progress."); + } + if (this.m_environmentDataContainer != null && this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp() != null) { + return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Environment data already cached."); + } + if (isInSynergyEnvironmentUpdateRateLimitingPeriod()) { + double currentTimeMillis = System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue(); + Double.isNaN(currentTimeMillis); + Log.Helper.LOGD(this, "Attempt to re-initiate Synergy environment update blocked by rate limiting. %.2f seconds of rate limiting left", Double.valueOf(60.0d - (currentTimeMillis / 1000.0d))); + return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Synergy environment update rate limit in effect."); + } + startSynergyEnvironmentUpdate(); + return null; + } + + @Override // com.ea.nimble.ISynergyEnvironment + public boolean isFeatureDisabled(String str) { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + return this.m_environmentDataContainer != null && this.m_environmentDataContainer.isFeatureDisabled(str); + } + + @Override // com.ea.nimble.Component + public void setup() { + Log.Helper.LOGFUNC(this); + this.m_dataLoadedOnComponentSetup = restoreEnvironmentDataFromPersistent(true); + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGFUNC(this); + if (this.m_dataLoadedOnComponentSetup) { + this.m_dataLoadedOnComponentSetup = false; + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT); + } else { + restoreEnvironmentDataFromPersistent(false); + } + if (this.m_environmentDataContainer != null && this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp() != null) { + double currentTimeMillis = System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue(); + Double.isNaN(currentTimeMillis); + if (currentTimeMillis / 1000.0d <= 300.0d) { + checkAndInitiateSynergyEnvironmentUpdate(); + return; + } + } + startSynergyEnvironmentUpdate(); + } + + @Override // com.ea.nimble.Component + public void suspend() { + Log.Helper.LOGFUNC(this); + SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject; + if (synergyEnvironmentUpdater != null) { + synergyEnvironmentUpdater.cancel(); + this.m_synergyStartupObject = null; + } + if (this.m_networkStatusChangeReceiver != null) { + Utility.unregisterReceiver(this.m_networkStatusChangeReceiver); + this.m_networkStatusChangeReceiver = null; + } + saveEnvironmentDataToPersistent(); + } + + @Override // com.ea.nimble.Component + public void resume() { + Log.Helper.LOGFUNC(this); + clearSynergyEnvironmentUpdateRateLimiting(); + if (this.m_environmentDataContainer != null && this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp() != null) { + double currentTimeMillis = System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue(); + Double.isNaN(currentTimeMillis); + if (currentTimeMillis / 1000.0d <= 300.0d) { + return; + } + } + startSynergyEnvironmentUpdate(); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGFUNC(this); + SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject; + if (synergyEnvironmentUpdater != null) { + synergyEnvironmentUpdater.cancel(); + this.m_synergyStartupObject = null; + } + if (this.m_networkStatusChangeReceiver != null) { + Utility.unregisterReceiver(this.m_networkStatusChangeReceiver); + this.m_networkStatusChangeReceiver = null; + } + saveEnvironmentDataToPersistent(); + this.m_environmentDataContainer = null; + } + + @Override // com.ea.nimble.Component + public void teardown() { + Log.Helper.LOGFUNC(this); + this.m_environmentDataContainer = null; + } + + private void startSynergyEnvironmentUpdate() { + SynergyEnvironmentUpdater synergyEnvironmentUpdater; + Log.Helper.LOGFUNC(this); + synchronized (this) { + if (this.m_synergyStartupObject == null) { + this.m_synergyStartupObject = new SynergyEnvironmentUpdater(this.m_core); + synergyEnvironmentUpdater = this.m_synergyStartupObject; + } else { + synergyEnvironmentUpdater = null; + } + } + if (synergyEnvironmentUpdater == null) { + Log.Helper.LOGD(this, "Attempt made to start Synergy environment update while a previous one is active. Exiting.", new Object[0]); + return; + } + if (Network.getComponent().getStatus() != Network.Status.OK) { + if (this.m_networkStatusChangeReceiver == null) { + this.m_networkStatusChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.SynergyEnvironmentImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(Global.NOTIFICATION_NETWORK_STATUS_CHANGE) && Network.getComponent().getStatus() == Network.Status.OK) { + Log.Helper.LOGD(this, "Network restored. Starting Synergy environment update.", new Object[0]); + Utility.unregisterReceiver(SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver); + SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver = null; + SynergyEnvironmentImpl.this.startSynergyEnvironmentUpdateImpl(SynergyEnvironmentImpl.this.m_synergyStartupObject); + } + } + }; + Log.Helper.LOGD(this, "Network not available to perform environment update. Setting receiver to listen for network status change.", new Object[0]); + Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkStatusChangeReceiver); + return; + } + return; + } + startSynergyEnvironmentUpdateImpl(synergyEnvironmentUpdater); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void startSynergyEnvironmentUpdateImpl(final SynergyEnvironmentUpdater synergyEnvironmentUpdater) { + Log.Helper.LOGFUNC(this); + if (synergyEnvironmentUpdater == null) { + Log.Helper.LOGD(this, "Synergy Environment Update canceled before it could start", new Object[0]); + return; + } + this.m_previousValidEnvironmentDataContainer = this.m_environmentDataContainer; + HashMap hashMap = new HashMap(); + hashMap.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "1"); + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_STARTED, hashMap); + synergyEnvironmentUpdater.startSynergyStartupSequence(this.m_previousValidEnvironmentDataContainer, new SynergyEnvironmentUpdater.CompletionCallback() { // from class: com.ea.nimble.SynergyEnvironmentImpl.2 + @Override // com.ea.nimble.SynergyEnvironmentUpdater.CompletionCallback + public void callback(Exception exc) { + if (exc == null) { + if (SynergyEnvironmentImpl.this.m_synergyStartupObject != null && synergyEnvironmentUpdater.getEnvironmentDataContainer() != null) { + SynergyEnvironmentImpl.this.m_environmentDataContainer = synergyEnvironmentUpdater.getEnvironmentDataContainer(); + SynergyEnvironmentImpl.this.saveEnvironmentDataToPersistent(); + if (SynergyEnvironmentImpl.this.m_environmentDataContainer.getKeysOfDifferences(SynergyEnvironmentImpl.this.m_previousValidEnvironmentDataContainer) != null) { + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED); + } + HashMap hashMap2 = new HashMap(); + hashMap2.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "1"); + if (ApplicationEnvironment.isMainApplicationActive()) { + Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]); + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap2); + } else { + Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]); + } + } else { + Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. Update was canceled", new Object[0]); + } + } else { + Log.Helper.LOGE(this, "StartupError(%s)", exc); + if (!(exc instanceof Error)) { + if (SynergyEnvironmentImpl.this.m_synergyStartupObject == null || synergyEnvironmentUpdater.getEnvironmentDataContainer() == null) { + Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. More than one update was being peroformed", new Object[0]); + } + } else { + Error error = (Error) exc; + if (error.isError(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT) || error.isError(Error.Code.SYNERGY_SERVER_FULL)) { + Log.Helper.LOGD(this, "GetDirection request timed out or ServerUnavailable signal received. Start rate limiting of /getDirection call.", new Object[0]); + SynergyEnvironmentImpl.this.startSynergyEnvironmentUpdateRateLimiting(); + } + } + HashMap hashMap3 = new HashMap(); + hashMap3.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "0"); + hashMap3.put("error", exc.toString()); + if (ApplicationEnvironment.isMainApplicationActive()) { + Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]); + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap3); + } else { + Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]); + } + } + SynergyEnvironmentImpl.this.m_synergyStartupObject = null; + } + }); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void startSynergyEnvironmentUpdateRateLimiting() { + Log.Helper.LOGFUNC(this); + this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = Long.valueOf(System.currentTimeMillis()); + } + + private boolean isInSynergyEnvironmentUpdateRateLimitingPeriod() { + Log.Helper.LOGFUNC(this); + return this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp != null && ((double) (System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue())) <= 60000.0d; + } + + private void clearSynergyEnvironmentUpdateRateLimiting() { + Log.Helper.LOGFUNC(this); + this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = null; + } + + private boolean restoreEnvironmentDataFromPersistent(boolean z) { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE); + if (persistenceForNimbleComponent != null) { + Serializable value = persistenceForNimbleComponent.getValue(PERSISTENCE_DATA_ID); + if (value == null) { + Log.Helper.LOGD(this, "Environment persistence data value not found in persistence object. Probably first install.", new Object[0]); + } else { + try { + this.m_environmentDataContainer = (EnvironmentDataContainer) value; + Log.Helper.LOGD(this, "Restored environment data from persistent. Restored data timestamp, %s", this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp()); + if (this.m_environmentDataContainer.getEADeviceId() == null) { + this.m_environmentDataContainer.setEADeviceId(EASPDataLoader.loadEADeviceId()); + } + if (!z) { + Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT); + } + return true; + } catch (ClassCastException unused) { + Log.Helper.LOGE(this, "Environment persistence data value is not the expected type.", new Object[0]); + } + } + } else { + Log.Helper.LOGE(this, "Could not get environment persistence object to restore from", new Object[0]); + } + this.m_environmentDataContainer = null; + return false; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void saveEnvironmentDataToPersistent() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE); + if (persistenceForNimbleComponent != null) { + Log.Helper.LOGD(this, "Saving environment data to persistent.", new Object[0]); + persistenceForNimbleComponent.setValue(PERSISTENCE_DATA_ID, this.m_environmentDataContainer); + persistenceForNimbleComponent.synchronize(); + return; + } + Log.Helper.LOGE(this, "Could not get environment persistence object to save to.", new Object[0]); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getNexusClientId() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getNexusClientId(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getNexusClientSecret() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getNexusClientSecret(); + } + + @Override // com.ea.nimble.ISynergyEnvironment + public String getGosMdmAppKey() { + Log.Helper.LOGPUBLICFUNC(this); + checkAndInitiateSynergyEnvironmentUpdate(); + if (this.m_environmentDataContainer == null) { + return null; + } + return this.m_environmentDataContainer.getGosMdmAppKey(); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyEnvironmentUpdater.java b/app/src/main/java/com/ea/nimble/SynergyEnvironmentUpdater.java new file mode 100644 index 0000000..82c37f4 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyEnvironmentUpdater.java @@ -0,0 +1,405 @@ +package com.ea.nimble; + +import android.content.Context; +import android.content.pm.PackageManager; +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; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class SynergyEnvironmentUpdater implements LogSource { + private static final int GET_ANONUID_MAX_RETRY_ATTEMPTS = 3; + private static final int GET_DIRECTION_MAX_RETRY_ATTEMPTS = 3; + private static final int GET_EADEVICEID_MAX_RETRY_ATTEMPTS = 3; + private static final int SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL = -70002; + private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID = -20094; + private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED = -20093; + private static final int VALIDATE_EADEVICEID_MAX_RETRY_ATTEMPTS = 3; + private BaseCore m_core; + private long m_getAnonUIDRetryCount; + private long m_getDirectionRetryCount; + private EnvironmentDataContainer m_environmentForSynergyStartUp = new EnvironmentDataContainer(); + private CompletionCallback m_completionCallback = null; + private EnvironmentDataContainer m_previousValidEnvironmentData = null; + private SynergyNetworkConnectionHandle m_synergyNetworkConnectionHandle = null; + private long m_validateEADeviceIDRetryCount = 0; + private long m_getEADeviceIDRetryCount = 0; + + interface CompletionCallback { + void callback(Exception exc); + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "SynergyEnv"; + } + + static /* synthetic */ long access$1108(SynergyEnvironmentUpdater synergyEnvironmentUpdater) { + long j = synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount; + synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount = 1 + j; + return j; + } + + static /* synthetic */ long access$1308(SynergyEnvironmentUpdater synergyEnvironmentUpdater) { + long j = synergyEnvironmentUpdater.m_getAnonUIDRetryCount; + synergyEnvironmentUpdater.m_getAnonUIDRetryCount = 1 + j; + return j; + } + + static /* synthetic */ long access$408(SynergyEnvironmentUpdater synergyEnvironmentUpdater) { + long j = synergyEnvironmentUpdater.m_getDirectionRetryCount; + synergyEnvironmentUpdater.m_getDirectionRetryCount = 1 + j; + return j; + } + + static /* synthetic */ long access$808(SynergyEnvironmentUpdater synergyEnvironmentUpdater) { + long j = synergyEnvironmentUpdater.m_getEADeviceIDRetryCount; + synergyEnvironmentUpdater.m_getEADeviceIDRetryCount = 1 + j; + return j; + } + + SynergyEnvironmentUpdater(BaseCore baseCore) { + this.m_core = baseCore; + } + + EnvironmentDataContainer getEnvironmentDataContainer() { + return this.m_environmentForSynergyStartUp; + } + + public void startSynergyStartupSequence(EnvironmentDataContainer environmentDataContainer, CompletionCallback completionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_completionCallback = completionCallback; + this.m_previousValidEnvironmentData = environmentDataContainer; + if (Network.getComponent().getStatus() != Network.Status.OK) { + onStartUpSequenceFinished(new Error(Error.Code.NETWORK_NO_CONNECTION, "Device is not connected to Wifi or wireless.")); + } else { + callSynergyGetDirection(); + } + } + + public void cancel() { + Log.Helper.LOGPUBLICFUNC(this); + SynergyNetworkConnectionHandle synergyNetworkConnectionHandle = this.m_synergyNetworkConnectionHandle; + if (synergyNetworkConnectionHandle != null) { + Log.Helper.LOGD(this, "Canceling network connection.", new Object[0]); + synergyNetworkConnectionHandle.cancel(); + this.m_synergyNetworkConnectionHandle = null; + } + onStartUpSequenceFinished(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Synergy startup sequence canceled.")); + } + + /* JADX INFO: Access modifiers changed from: private */ + /* JADX WARN: Multi-variable type inference failed */ + public void loadConfig(Map map) { + this.m_environmentForSynergyStartUp.setMostRecentDirectorResponseTimestamp(Long.valueOf(System.currentTimeMillis())); + this.m_environmentForSynergyStartUp.setGetDirectionResponseDictionary(map); + List list = (List) this.m_environmentForSynergyStartUp.getGetDirectionResponseDictionary().get("serverData"); + this.m_environmentForSynergyStartUp.setServerUrls(new HashMap()); + if (list != null) { + for (Map map2 : list) { + this.m_environmentForSynergyStartUp.getServerUrls().put(map2.get("key"), map2.get("value")); + } + } + if (this.m_environmentForSynergyStartUp.getServerUrls().size() == 0) { + onStartUpSequenceFinished(new Error(Error.Code.NOT_AVAILABLE, "No Synergy server URLs available.")); + 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 */ + public void callSynergyGetDirection() { + Log.Helper.LOGPUBLICFUNC(this); + String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId(); + String deviceString = ApplicationEnvironment.getComponent().getDeviceString(); + String deviceCodename = ApplicationEnvironment.getComponent().getDeviceCodename(); + String deviceManufacturer = ApplicationEnvironment.getComponent().getDeviceManufacturer(); + String deviceModel = ApplicationEnvironment.getComponent().getDeviceModel(); + String deviceBrand = ApplicationEnvironment.getComponent().getDeviceBrand(); + String deviceFingerprint = ApplicationEnvironment.getComponent().getDeviceFingerprint(); + if (!Utility.validString(applicationBundleId)) { + Log.Helper.LOGE(this, "GETDIRECTION bundleId is invalid", new Object[0]); + onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "bundleId is invalid")); + return; + } + if (!Utility.validString(deviceString)) { + Log.Helper.LOGE(this, "GETDIRECTION deviceString is invalid", new Object[0]); + onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "deviceString is invalid")); + return; + } + try { + if (this.m_core.getConfiguration() == NimbleConfiguration.MANUAL) { + try { + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + Resources resources = applicationContext.getResources(); + loadConfig(Utility.convertJSONObjectToMap(new JSONObject(Utility.readStringFromStream(resources.openRawResource(resources.getIdentifier("synergy_direction", "raw", applicationContext.getPackageName())))))); + return; + } catch (Exception e) { + Log.Helper.LOGF(this, "Error loading synergy_direction.json: " + e.toString(), new Object[0]); + return; + } + } + HashMap hashMap = new HashMap(); + hashMap.put("packageId", applicationBundleId); + hashMap.put("deviceString", deviceString); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_CODENAME, deviceCodename); + hashMap.put("manufacturer", deviceManufacturer); + hashMap.put("model", deviceModel); + hashMap.put("brand", deviceBrand); + hashMap.put("fingerprint", deviceFingerprint); + hashMap.put("serverEnvironment", getSynergyServerEnvironmentName()); + hashMap.put("sdkVersion", Global.NIMBLE_RELEASE_VERSION); + hashMap.put("apiVer", "1.0.0"); + this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getSynergyDirectorServerUrl(Base.getConfiguration()), "/director/api/android/getDirectionByPackage", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.1 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + Log.Helper.LOGD(this, "GETDIRECTION FINISHED", new Object[0]); + SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null; + Exception error = synergyNetworkConnectionHandle.getResponse().getError(); + if (error == null) { + SynergyEnvironmentUpdater.this.loadConfig(synergyNetworkConnectionHandle.getResponse().getJsonData()); + return; + } + if (!(error instanceof SynergyServerError)) { + boolean isTimeoutError = SynergyEnvironmentUpdater.this.isTimeoutError(error); + if (isTimeoutError || SynergyEnvironmentUpdater.this.m_getDirectionRetryCount >= 3) { + SynergyEnvironmentUpdater.this.m_getDirectionRetryCount = 0L; + if (isTimeoutError) { + SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT, "Synergy /getDirectionByPackage request timed out.", error)); + return; + } else { + SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(error); + return; + } + } + SynergyEnvironmentUpdater.access$408(SynergyEnvironmentUpdater.this); + Log.Helper.LOGD(this, "GetDirection, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getDirectionRetryCount)); + SynergyEnvironmentUpdater.this.callSynergyGetDirection(); + return; + } + if (((SynergyServerError) error).isError(SynergyEnvironmentUpdater.SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL)) { + SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_SERVER_FULL, "Synergy ServerUnavailable signal received.", error)); + } + } + }); + } catch (Throwable unused) { + } + } + + private String getSynergyServerEnvironmentName() { + Log.Helper.LOGFUNC(this); + switch (this.m_core.getConfiguration()) { + case INTEGRATION: + case STAGE: + case LIVE: + case MANUAL: + return this.m_core.getConfiguration().toString(); + case CUSTOMIZED: + return PreferenceManager.getDefaultSharedPreferences(ApplicationEnvironment.getComponent().getApplicationContext()).getString("NimbleCustomizedSynergyServerEnvironmentName", "live"); + default: + Log.Helper.LOGF(this, "Request for Synergy server environment name with unknown NimbleConfiguration %s", this.m_core.getConfiguration().toString()); + return "live"; + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void callSynergyGetEADeviceId() { + 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); + String anonymousSynergyId = SynergyIdManager.getComponent().getAnonymousSynergyId(); + if (anonymousSynergyId != null) { + Log.Helper.LOGD(this, "Not getting anonymous ID from Synergy since it was loaded from persistence", new Object[0]); + this.m_environmentForSynergyStartUp.setSynergyAnonymousId(anonymousSynergyId); + onStartUpSequenceFinished(null); + return; + } + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("updatePriority", "false"); + hashMap.put("hwId", this.m_environmentForSynergyStartUp.getEAHardwareId()); + if (Utility.validString(this.m_environmentForSynergyStartUp.getEADeviceId())) { + hashMap.put("eadeviceid", this.m_environmentForSynergyStartUp.getEADeviceId()); + this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getAnonUid", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.4 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null; + Exception error = synergyNetworkConnectionHandle.getResponse().getError(); + if (error != null) { + if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount >= 3) { + SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount = 0L; + Log.Helper.LOGD(this, "GETANON Error, (%s)", synergyNetworkConnectionHandle.getResponse().getError().toString()); + SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_ANONYMOUS_ID_FAILURE, "Synergy \"get anonymous id\" call failed.", error)); + return; + } else { + SynergyEnvironmentUpdater.access$1308(SynergyEnvironmentUpdater.this); + Log.Helper.LOGD(this, "GetAnonUid, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount)); + SynergyEnvironmentUpdater.this.callSynergyGetAnonUid(); + return; + } + } + Log.Helper.LOGD(this, "GETANON Success", new Object[0]); + SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setSynergyAnonymousId(synergyNetworkConnectionHandle.getResponse().getJsonData().get("uid").toString()); + SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(null); + } + }); + } else { + Log.Helper.LOGE(this, "getAnonUid got an invalid EA Device ID.", new Object[0]); + onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "EA Device ID is invalid")); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onStartUpSequenceFinished(Exception exc) { + Log.Helper.LOGFUNC(this); + if (this.m_completionCallback != null) { + this.m_completionCallback.callback(exc); + } else { + Log.Helper.LOGW(this, "Startup sequence finished, but no completion callback set.", new Object[0]); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public boolean isTimeoutError(Exception exc) { + Log.Helper.LOGFUNC(this); + return (exc instanceof Error) && ((Error) exc).isError(Error.Code.NETWORK_TIMEOUT); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyIdManager.java b/app/src/main/java/com/ea/nimble/SynergyIdManager.java new file mode 100644 index 0000000..43622b2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyIdManager.java @@ -0,0 +1,13 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class SynergyIdManager { + public static final String COMPONENT_ID = "com.ea.nimble.synergyidmanager"; + public static final String LOG_TAG = "SynergyID"; + public static final String NOTIFICATION_ANONYMOUS_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.anonymous_synergy_id_changed"; + public static final String NOTIFICATION_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.synergy_id_changed"; + + public static ISynergyIdManager getComponent() { + return SynergyIdManagerImpl.getComponent(); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyIdManagerError.java b/app/src/main/java/com/ea/nimble/SynergyIdManagerError.java new file mode 100644 index 0000000..9c7f781 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyIdManagerError.java @@ -0,0 +1,34 @@ +package com.ea.nimble; + +import com.eamobile.DownloadActivityInternal; + +/* loaded from: classes.dex */ +public class SynergyIdManagerError extends Error { + public static final String ERROR_DOMAIN = "NimbleSynergyIdManager"; + private static final long serialVersionUID = 1; + + public enum Code { + AUTHENTICATOR_CONFLICT(5000), + UNEXPECTED_LOGIN_STATE(DownloadActivityInternal.ERROR_UNSUPPORTED_DEVICE), + INVALID_ID(DownloadActivityInternal.ERROR_ASSETS_NOT_FOUND), + MISSING_AUTHENTICATOR(5003); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public SynergyIdManagerError(Code code, String str, Throwable th) { + super(ERROR_DOMAIN, code.intValue(), str, th); + } + + public SynergyIdManagerError(Code code, String str) { + super(ERROR_DOMAIN, code.intValue(), str); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyIdManagerImpl.java b/app/src/main/java/com/ea/nimble/SynergyIdManagerImpl.java new file mode 100644 index 0000000..c138733 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyIdManagerImpl.java @@ -0,0 +1,239 @@ +package com.ea.nimble; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.Log; +import com.ea.nimble.Persistence; +import com.ea.nimble.SynergyIdManagerError; +import java.util.HashMap; + +/* loaded from: classes.dex */ +class SynergyIdManagerImpl extends Component implements ISynergyIdManager, LogSource { + private static final String ANONYMOUS_ID_PERSISTENCE_DATA_ID = "anonymousId"; + private static final String AUTHENTICATOR_PERSISTENCE_DATA_ID = "authenticator"; + private static final String CURRENT_ID_PERSISTENCE_DATA_ID = "currentId"; + private static final String SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID = "com.ea.nimble.synergyidmanager.anonymousId"; + private static final String VERSION_PERSISTENCE_DATA_ID = "dataVersion"; + private String m_anonymousSynergyId; + private String m_authenticatorIdentifier; + private String m_currentSynergyId; + private BroadcastReceiver m_receiver = new SynergyIdManagerReceiver(); + + @Override // com.ea.nimble.Component + public String getComponentId() { + return SynergyIdManager.COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "SynergyId"; + } + + SynergyIdManagerImpl() { + } + + private class SynergyIdManagerReceiver extends BroadcastReceiver { + private SynergyIdManagerReceiver() { + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + if (ApplicationEnvironment.isMainApplicationActive()) { + SynergyIdManagerImpl.this.onSynergyEnvironmentStartupRequestsFinished(); + } + } + } + + public static ISynergyIdManager getComponent() { + return (ISynergyIdManager) Base.getComponent(SynergyIdManager.COMPONENT_ID); + } + + private void wakeup() { + restoreFromPersistent(); + if (!Utility.validString(this.m_anonymousSynergyId)) { + setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId()); + } + if (!Utility.validString(this.m_currentSynergyId)) { + setCurrentSynergyId(this.m_anonymousSynergyId); + } + Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, this.m_receiver); + } + + private void sleep() { + Utility.unregisterReceiver(this.m_receiver); + saveDataToPersistent(); + } + + @Override // com.ea.nimble.Component + protected void restore() { + wakeup(); + } + + @Override // com.ea.nimble.Component + protected void suspend() { + sleep(); + } + + @Override // com.ea.nimble.Component + protected void resume() { + wakeup(); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onSynergyEnvironmentStartupRequestsFinished() { + Log.Helper.LOGFUNC(this); + if (SynergyEnvironment.getComponent() != null) { + Log.Helper.LOGD(this, "onSynergyEnvironmentStartupRequestsFinished - Process the notification, everything looks okay", new Object[0]); + setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId()); + if (Utility.validString(this.m_currentSynergyId)) { + return; + } + setCurrentSynergyId(this.m_anonymousSynergyId); + return; + } + Log.Helper.LOGI(this, "onSynergyEnvironmentStartupRequestsFinished - Aborted because we were unable to get SynergyEnvironment", new Object[0]); + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + sleep(); + } + + private void restoreFromPersistent() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyIdManager.COMPONENT_ID, Persistence.Storage.CACHE); + if (persistenceForNimbleComponent != null) { + Log.Helper.LOGD("Loaded persistence data version, %s.", persistenceForNimbleComponent.getStringValue(VERSION_PERSISTENCE_DATA_ID), new Object[0]); + this.m_currentSynergyId = persistenceForNimbleComponent.getStringValue(CURRENT_ID_PERSISTENCE_DATA_ID); + this.m_authenticatorIdentifier = persistenceForNimbleComponent.getStringValue(AUTHENTICATOR_PERSISTENCE_DATA_ID); + Log.Helper.LOGD(this, "Loaded Synergy ID, %s, with authenticator, %s.", this.m_currentSynergyId, this.m_authenticatorIdentifier); + } else { + Log.Helper.LOGE(this, "Could not get persistence object to load from.", new Object[0]); + } + Persistence persistenceForNimbleComponent2 = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent2 != null) { + Log.Helper.LOGD(this, "Loaded persistence data version, %s.", Utility.safeString(persistenceForNimbleComponent2.getStringValue(VERSION_PERSISTENCE_DATA_ID))); + this.m_anonymousSynergyId = persistenceForNimbleComponent2.getStringValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID); + Log.Helper.LOGD(this, "Loaded anonymous Synergy ID, %s.", Utility.safeString(this.m_anonymousSynergyId)); + return; + } + Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to load from.", new Object[0]); + } + + private void saveDataToPersistent() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + Log.Helper.LOGD("Saving anonymous Synergy ID, %s, to persistent.", this.m_anonymousSynergyId, new Object[0]); + persistenceForNimbleComponent.setValue(VERSION_PERSISTENCE_DATA_ID, "1.0.0"); + persistenceForNimbleComponent.setValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID, this.m_anonymousSynergyId); + persistenceForNimbleComponent.setBackUp(true); + persistenceForNimbleComponent.synchronize(); + } else { + Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to save to.", new Object[0]); + } + Persistence persistenceForNimbleComponent2 = PersistenceService.getPersistenceForNimbleComponent(SynergyIdManager.COMPONENT_ID, Persistence.Storage.CACHE); + if (persistenceForNimbleComponent2 != null) { + Log.Helper.LOGD(this, "Saving current Synergy ID, %s, and authenticator, %s, to persistent.", this.m_currentSynergyId, this.m_authenticatorIdentifier); + persistenceForNimbleComponent2.setValue(VERSION_PERSISTENCE_DATA_ID, "1.0.0"); + persistenceForNimbleComponent2.setValue(CURRENT_ID_PERSISTENCE_DATA_ID, this.m_currentSynergyId); + persistenceForNimbleComponent2.setValue(AUTHENTICATOR_PERSISTENCE_DATA_ID, this.m_authenticatorIdentifier); + persistenceForNimbleComponent2.synchronize(); + return; + } + Log.Helper.LOGE(this, "Could not get persistence object to save to.", new Object[0]); + } + + private void setAnonymousSynergyId(String str) { + Log.Helper.LOGFUNC(this); + if (Utility.validString(this.m_anonymousSynergyId) && !Utility.validString(str)) { + Log.Helper.LOGE(this, "Attempt to set invalid anonymous Synergy ID over existing ID, %s. Ignoring attempt.", this.m_anonymousSynergyId); + return; + } + String str2 = this.m_anonymousSynergyId; + this.m_anonymousSynergyId = str; + saveDataToPersistent(); + if (Utility.validString(str2) && ((Utility.validString(str2) && !str2.equals(this.m_anonymousSynergyId)) || (Utility.validString(this.m_anonymousSynergyId) && !this.m_anonymousSynergyId.equals(str2)))) { + HashMap hashMap = new HashMap(); + hashMap.put("previousSynergyId", Utility.safeString(str2)); + hashMap.put("currentSynergyId", Utility.safeString(this.m_anonymousSynergyId)); + Utility.sendBroadcast(SynergyIdManager.NOTIFICATION_ANONYMOUS_SYNERGY_ID_CHANGED, hashMap); + } + if (this.m_authenticatorIdentifier == null) { + setCurrentSynergyId(this.m_anonymousSynergyId); + } + } + + private void setCurrentSynergyId(String str) { + Log.Helper.LOGFUNC(this); + if (Utility.validString(this.m_currentSynergyId) && !Utility.validString(str)) { + Log.Helper.LOGE(this, "Attempt to set invalid current Synergy ID over existing ID, %s. Ignoring attempt.", this.m_currentSynergyId); + return; + } + String str2 = this.m_currentSynergyId; + this.m_currentSynergyId = str; + saveDataToPersistent(); + if (Utility.validString(str2)) { + if ((!Utility.validString(str2) || str2.equals(this.m_currentSynergyId)) && (!Utility.validString(this.m_currentSynergyId) || this.m_currentSynergyId.equals(str2))) { + return; + } + HashMap hashMap = new HashMap(); + hashMap.put("previousSynergyId", Utility.safeString(str2)); + hashMap.put("currentSynergyId", Utility.safeString(this.m_currentSynergyId)); + Utility.sendBroadcast(SynergyIdManager.NOTIFICATION_SYNERGY_ID_CHANGED, hashMap); + } + } + + @Override // com.ea.nimble.ISynergyIdManager + public String getSynergyId() { + Log.Helper.LOGPUBLICFUNC(this); + if (Utility.validString(this.m_currentSynergyId)) { + return this.m_currentSynergyId; + } + return getAnonymousSynergyId(); + } + + @Override // com.ea.nimble.ISynergyIdManager + public String getAnonymousSynergyId() { + Log.Helper.LOGPUBLICFUNC(this); + if (Utility.validString(this.m_anonymousSynergyId)) { + return this.m_anonymousSynergyId; + } + return SynergyEnvironment.getComponent().getSynergyId(); + } + + @Override // com.ea.nimble.ISynergyIdManager + public SynergyIdManagerError login(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticatorIdentifier != null) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE, "Already logged in with authenticator, " + this.m_authenticatorIdentifier); + } + if (!Utility.validString(str) || !Utility.isOnlyDecimalCharacters(str)) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.INVALID_ID, "Synergy ID must be numeric digits."); + } + if (!Utility.validString(str2)) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR, "Authenticator string required for login API."); + } + this.m_authenticatorIdentifier = str2; + setCurrentSynergyId(str); + return null; + } + + @Override // com.ea.nimble.ISynergyIdManager + public SynergyIdManagerError logout(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticatorIdentifier == null) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE, "Already logged out."); + } + if (!Utility.validString(str)) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR, "Authenticator string required for logout API."); + } + if (!this.m_authenticatorIdentifier.equals(str)) { + return new SynergyIdManagerError(SynergyIdManagerError.Code.AUTHENTICATOR_CONFLICT, "Logout must be performed by the same authenticator that logged in, " + this.m_authenticatorIdentifier); + } + setCurrentSynergyId(this.m_anonymousSynergyId); + this.m_authenticatorIdentifier = null; + return null; + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyNetwork.java b/app/src/main/java/com/ea/nimble/SynergyNetwork.java new file mode 100644 index 0000000..88258df --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyNetwork.java @@ -0,0 +1,10 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public class SynergyNetwork { + public static final String COMPONENT_ID = "com.ea.nimble.synergynetwork"; + + public static ISynergyNetwork getComponent() { + return SynergyNetworkImpl.getComponent(); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyNetworkConnection.java b/app/src/main/java/com/ea/nimble/SynergyNetworkConnection.java new file mode 100644 index 0000000..dd7ee5e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyNetworkConnection.java @@ -0,0 +1,251 @@ +package com.ea.nimble; + +import com.ea.nimble.Log; +import java.util.List; +import java.util.Map; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class SynergyNetworkConnection implements SynergyNetworkConnectionHandle { + private SynergyNetworkConnectionCallback m_completionCallback; + private SynergyRequest m_request; + private NetworkConnectionHandle m_networkHandle = null; + private SynergyResponse m_response = new SynergyResponse(); + private SynergyOperationalTelemetryDispatch m_otDispatch = new SynergyOperationalTelemetryDispatch(); + private SynergyNetworkConnectionCallback m_headerCallback = null; + private SynergyNetworkConnectionCallback m_progressCallback = null; + + public SynergyNetworkConnection(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + this.m_request = synergyRequest; + this.m_completionCallback = synergyNetworkConnectionCallback; + } + + public void start() { + this.m_request.prepare(this); + } + + void send() { + Log.Helper.LOGFUNC(this); + try { + this.m_request.build(); + this.m_networkHandle = Network.getComponent().sendRequest(this.m_request.httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.1 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + if (SynergyNetworkConnection.this.m_networkHandle == null) { + SynergyNetworkConnection.this.m_networkHandle = networkConnectionHandle; + } + SynergyNetworkConnection.this.parseDataFromNetworkHandle(); + networkConnectionHandle.setHeaderCallback(null); + networkConnectionHandle.setProgressCallback(null); + networkConnectionHandle.setCompletionCallback(null); + if (SynergyNetworkConnection.this.m_completionCallback != null) { + SynergyNetworkConnection.this.m_completionCallback.callback(SynergyNetworkConnection.this); + } + } + }, this.m_otDispatch); + this.m_response.httpResponse = this.m_networkHandle.getResponse(); + updateNetworkHeaderHandler(); + updateNetworkProgressHandler(); + } catch (Exception e) { + errorPriorToSend(e); + } + } + + public void errorPriorToSend(Exception exc) { + Log.Helper.LOGPUBLICFUNC(this); + HttpResponse httpResponse = new HttpResponse(); + httpResponse.error = exc; + httpResponse.isCompleted = true; + this.m_response.httpResponse = httpResponse; + if (this.m_completionCallback != null) { + this.m_completionCallback.callback(this); + } + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public ISynergyRequest getRequest() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_request; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public ISynergyResponse getResponse() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_response; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public SynergyNetworkConnectionCallback getHeaderCallback() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_headerCallback; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public void setHeaderCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_headerCallback = synergyNetworkConnectionCallback; + if (this.m_networkHandle != null) { + updateNetworkHeaderHandler(); + } + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public SynergyNetworkConnectionCallback getProgressCallback() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_progressCallback; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public void setProgressCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_progressCallback = synergyNetworkConnectionCallback; + if (this.m_networkHandle != null) { + updateNetworkProgressHandler(); + } + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public SynergyNetworkConnectionCallback getCompletionCallback() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_completionCallback; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public void setCompletionCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_completionCallback = synergyNetworkConnectionCallback; + } + + public NetworkConnectionHandle getNetworkConnectionHandle() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_networkHandle; + } + + public void setNetworkConnectionHandle(NetworkConnectionHandle networkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_networkHandle = networkConnectionHandle; + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public void waitOn() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_networkHandle != null) { + this.m_networkHandle.waitOn(); + } + } + + @Override // com.ea.nimble.SynergyNetworkConnectionHandle + public void cancel() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_networkHandle != null) { + this.m_networkHandle.cancel(); + } + } + + private void updateNetworkHeaderHandler() { + Log.Helper.LOGFUNC(this); + if (this.m_headerCallback == null) { + this.m_networkHandle.setHeaderCallback(null); + } else { + this.m_networkHandle.setHeaderCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.2 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + SynergyNetworkConnection.this.m_headerCallback.callback(SynergyNetworkConnection.this); + } + }); + } + } + + private void updateNetworkProgressHandler() { + Log.Helper.LOGFUNC(this); + if (this.m_progressCallback == null) { + this.m_networkHandle.setProgressCallback(null); + } else { + this.m_networkHandle.setProgressCallback(new NetworkConnectionCallback() { // from class: com.ea.nimble.SynergyNetworkConnection.3 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + SynergyNetworkConnection.this.m_progressCallback.callback(SynergyNetworkConnection.this); + } + }); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void parseDataFromNetworkHandle() { + Log.Helper.LOGFUNC(this); + if (this.m_networkHandle != null) { + this.m_response.httpResponse = this.m_networkHandle.getResponse(); + this.m_response.parseData(); + } + } + + private class SynergyOperationalTelemetryDispatch implements IOperationalTelemetryDispatch { + private SynergyOperationalTelemetryDispatch() { + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public void logEvent(String str, JSONObject jSONObject) { + Log.Helper.LOGFUNC(this); + if (!BaseCore.getInstance().isActive()) { + Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]); + return; + } + IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent(); + if (component != null) { + SynergyNetworkConnection.this.parseDataFromNetworkHandle(); + Map jsonData = SynergyNetworkConnection.this.m_response.getJsonData(); + if (jsonData != null && jsonData.containsKey("resultCode")) { + try { + jSONObject.put("SYNERGY_RESULT_CODE", ((Integer) jsonData.get("resultCode")).intValue()); + } catch (JSONException unused) { + Log.Helper.LOGE(this, "Failed to add SYNERGY_RESULT_CODE to eventDict.", new Object[0]); + } + } + component.logEvent(str, jSONObject); + } + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public List getEvents(String str) { + Log.Helper.LOGFUNC(this); + if (!BaseCore.getInstance().isActive()) { + Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]); + return null; + } + IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent(); + if (component == null) { + return null; + } + return component.getEvents(str); + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public void setMaxEventCount(String str, int i) { + Log.Helper.LOGFUNC(this); + if (!BaseCore.getInstance().isActive()) { + Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]); + return; + } + IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent(); + if (component == null) { + return; + } + component.setMaxEventCount(str, i); + } + + @Override // com.ea.nimble.IOperationalTelemetryDispatch + public int getMaxEventCount(String str) { + Log.Helper.LOGFUNC(this); + if (!BaseCore.getInstance().isActive()) { + Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]); + return -1; + } + IOperationalTelemetryDispatch component = OperationalTelemetryDispatch.getComponent(); + if (component == null) { + return -1; + } + return component.getMaxEventCount(str); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionCallback.java b/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionCallback.java new file mode 100644 index 0000000..f1bcbe8 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionCallback.java @@ -0,0 +1,6 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface SynergyNetworkConnectionCallback { + void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle); +} diff --git a/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionHandle.java b/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionHandle.java new file mode 100644 index 0000000..75811f2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyNetworkConnectionHandle.java @@ -0,0 +1,24 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface SynergyNetworkConnectionHandle { + void cancel(); + + SynergyNetworkConnectionCallback getCompletionCallback(); + + SynergyNetworkConnectionCallback getHeaderCallback(); + + SynergyNetworkConnectionCallback getProgressCallback(); + + ISynergyRequest getRequest(); + + ISynergyResponse getResponse(); + + void setCompletionCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); + + void setHeaderCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); + + void setProgressCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback); + + void waitOn(); +} diff --git a/app/src/main/java/com/ea/nimble/SynergyNetworkImpl.java b/app/src/main/java/com/ea/nimble/SynergyNetworkImpl.java new file mode 100644 index 0000000..7f469db --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyNetworkImpl.java @@ -0,0 +1,160 @@ +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; +import java.util.Map; +import java.util.UUID; + +/* loaded from: classes.dex */ +public class SynergyNetworkImpl extends Component implements ISynergyNetwork { + private String m_sessionId; + private ArrayList m_pendingRequests = null; + private BroadcastReceiver m_synergyEnvironmentNotifyReceiver = null; + private boolean m_sessionIdNeedsRefresh = false; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return SynergyNetwork.COMPONENT_ID; + } + + SynergyNetworkImpl() { + } + + String getSessionId() { + if (this.m_sessionId == null || (this.m_sessionIdNeedsRefresh && BaseCore.getInstance().getComponentManager().getStage() == ComponentManager.Stage.READY)) { + this.m_sessionId = generateSessionId(); + this.m_sessionIdNeedsRefresh = false; + } + return this.m_sessionId; + } + + public static ISynergyNetwork getComponent() { + return (ISynergyNetwork) Base.getComponent(SynergyNetwork.COMPONENT_ID); + } + + @Override // com.ea.nimble.Component + public void setup() { + this.m_pendingRequests = new ArrayList<>(); + getSessionId(); + } + + @Override // com.ea.nimble.Component + public void restore() { + if (SynergyEnvironment.getComponent().isDataAvailable()) { + return; + } + this.m_synergyEnvironmentNotifyReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.SynergyNetworkImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + String stringExtra = intent.getStringExtra(Global.NOTIFICATION_DICTIONARY_KEY_RESULT); + if (stringExtra == null || !stringExtra.equals("0")) { + Iterator it = SynergyNetworkImpl.this.m_pendingRequests.iterator(); + while (it.hasNext()) { + ((SynergyNetworkConnection) it.next()).start(); + } + } else { + Iterator it2 = SynergyNetworkImpl.this.m_pendingRequests.iterator(); + while (it2.hasNext()) { + ((SynergyNetworkConnection) it2.next()).errorPriorToSend(new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Failed to retrieve Environment data from Synergy")); + } + } + SynergyNetworkImpl.this.m_pendingRequests.clear(); + } + }; + Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, this.m_synergyEnvironmentNotifyReceiver); + } + + @Override // com.ea.nimble.Component + protected void suspend() { + this.m_sessionIdNeedsRefresh = true; + } + + @Override // com.ea.nimble.Component + protected void resume() { + getSessionId(); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + if (this.m_synergyEnvironmentNotifyReceiver != null) { + Utility.unregisterReceiver(this.m_synergyEnvironmentNotifyReceiver); + this.m_synergyEnvironmentNotifyReceiver = null; + } + this.m_pendingRequests.clear(); + } + + @Override // com.ea.nimble.ISynergyNetwork + public SynergyNetworkConnectionHandle sendGetRequest(String str, String str2, Map map, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.GET, null); + synergyRequest.baseUrl = str; + synergyRequest.urlParameters = map; + return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback); + } + + @Override // com.ea.nimble.ISynergyNetwork + public SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.POST, null); + synergyRequest.baseUrl = str; + synergyRequest.urlParameters = map; + synergyRequest.jsonData = iJsonData; + return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback); + } + + @Override // com.ea.nimble.ISynergyNetwork + public SynergyNetworkConnectionHandle sendPostRequest(String str, String str2, Map map, ISynergyRequest.IJsonData iJsonData, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback, Map map2) { + Log.Helper.LOGPUBLICFUNC(this); + SynergyRequest synergyRequest = new SynergyRequest(str2, IHttpRequest.Method.POST, null); + synergyRequest.baseUrl = str; + synergyRequest.urlParameters = map; + synergyRequest.jsonData = iJsonData; + if (map2 != null) { + synergyRequest.httpRequest.headers.putAll(map2); + } + return sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback); + } + + @Override // com.ea.nimble.ISynergyNetwork + public void sendRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGPUBLICFUNC(this); + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component.isDataAvailable()) { + sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback); + return; + } + SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(synergyRequest, synergyNetworkConnectionCallback); + if (component.isUpdateInProgress()) { + this.m_pendingRequests.add(synergyNetworkConnection); + return; + } + Error checkAndInitiateSynergyEnvironmentUpdate = component.checkAndInitiateSynergyEnvironmentUpdate(); + if (checkAndInitiateSynergyEnvironmentUpdate == null) { + this.m_pendingRequests.add(synergyNetworkConnection); + } else { + synergyNetworkConnection.errorPriorToSend(checkAndInitiateSynergyEnvironmentUpdate); + } + } + + private SynergyNetworkConnectionHandle sendSynergyRequest(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) { + Log.Helper.LOGFUNC(this); + SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(synergyRequest, synergyNetworkConnectionCallback); + synergyNetworkConnection.start(); + return synergyNetworkConnection; + } + + private String generateSessionId() { + Log.Helper.LOGFUNC(this); + return UUID.randomUUID().toString().replace(Constants.FILENAME_SEQUENCE_SEPARATOR, "").toLowerCase(Locale.US); + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyRequest.java b/app/src/main/java/com/ea/nimble/SynergyRequest.java new file mode 100644 index 0000000..204cb5a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyRequest.java @@ -0,0 +1,135 @@ +package com.ea.nimble; + +import com.ea.nimble.Error; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.ISynergyRequest; +import com.ea.nimble.Log; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/* loaded from: classes.dex */ +public class SynergyRequest implements ISynergyRequest { + public String api; + public String baseUrl; + public SynergyRequestPreparingCallback prepareRequestCallback; + private SynergyNetworkConnection m_connection = null; + public HttpRequest httpRequest = new HttpRequest(); + public Map urlParameters = null; + public ISynergyRequest.IJsonData jsonData = null; + + public interface SynergyRequestPreparingCallback { + void prepareRequest(SynergyRequest synergyRequest); + } + + public SynergyRequest(String str, IHttpRequest.Method method, SynergyRequestPreparingCallback synergyRequestPreparingCallback) { + this.api = str; + this.prepareRequestCallback = synergyRequestPreparingCallback; + this.httpRequest.method = method; + this.httpRequest.headers.put("Content-Type", "application/json"); + this.httpRequest.headers.put("SDK-VERSION", Global.NIMBLE_RELEASE_VERSION); + this.httpRequest.headers.put("SDK-TYPE", Global.NIMBLE_ID); + String sessionId = ((SynergyNetworkImpl) SynergyNetwork.getComponent()).getSessionId(); + if (Utility.validString(sessionId)) { + this.httpRequest.headers.put("EAM-SESSION", sessionId); + } else { + Log.Helper.LOGES("SynergyRequest", "Synergy Network session ID is null", new Object[0]); + } + String synergyId = SynergyIdManager.getComponent().getSynergyId(); + if (Utility.validString(synergyId)) { + this.httpRequest.headers.put("EAM-USER-ID", synergyId); + } + String sellId = SynergyEnvironment.getComponent().getSellId(); + if (Utility.validString(sellId)) { + this.httpRequest.headers.put("EA-SELL-ID", sellId); + } + } + + @Override // com.ea.nimble.ISynergyRequest + public HttpRequest getHttpRequest() { + Log.Helper.LOGPUBLICFUNC(this); + return this.httpRequest; + } + + @Override // com.ea.nimble.ISynergyRequest + public String getBaseUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.baseUrl; + } + + @Override // com.ea.nimble.ISynergyRequest + public String getApi() { + Log.Helper.LOGPUBLICFUNC(this); + return this.api; + } + + public IHttpRequest.Method getMethod() { + Log.Helper.LOGPUBLICFUNC(this); + return this.httpRequest.getMethod(); + } + + public void setMethod(IHttpRequest.Method method) { + Log.Helper.LOGPUBLICFUNC(this); + this.httpRequest.method = method; + } + + @Override // com.ea.nimble.ISynergyRequest + public Map getUrlParameters() { + Log.Helper.LOGPUBLICFUNC(this); + return this.urlParameters; + } + + @Override // com.ea.nimble.ISynergyRequest + public ISynergyRequest.IJsonData getJsonData() { + Log.Helper.LOGPUBLICFUNC(this); + return this.jsonData; + } + + public void send() { + Log.Helper.LOGPUBLICFUNC(this); + this.m_connection.send(); + } + + void prepare(SynergyNetworkConnection synergyNetworkConnection) { + Log.Helper.LOGFUNC(this); + this.m_connection = synergyNetworkConnection; + if (this.prepareRequestCallback != null) { + this.prepareRequestCallback.prepareRequest(this); + } else { + send(); + } + } + + void build() throws Error { + Log.Helper.LOGFUNC(this); + if (!Utility.validString(this.baseUrl) || !Utility.validString(this.api)) { + throw new Error(Error.Code.INVALID_ARGUMENT, String.format("Invalid synergy request parameter (%s, %s) to build http request url", this.baseUrl, this.api)); + } + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + HashMap hashMap = new HashMap(); + hashMap.put("appVer", component.getApplicationVersion()); + hashMap.put("appLang", component.getShortApplicationLanguageCode()); + hashMap.put("localization", component.getApplicationLanguageCode()); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LANGUAGE, Locale.getDefault().getLanguage()); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Locale.getDefault().toString()); + String eAHardwareId = SynergyEnvironment.getComponent().getEAHardwareId(); + if (Utility.validString(eAHardwareId)) { + hashMap.put("hwId", eAHardwareId); + } + if (this.urlParameters != null) { + hashMap.putAll(this.urlParameters); + } + this.httpRequest.url = Network.generateURL(this.baseUrl + this.api, hashMap); + if ((this.httpRequest.method == IHttpRequest.Method.POST || this.httpRequest.method == IHttpRequest.Method.PUT) && this.jsonData != null && this.jsonData.size() > 0) { + String convertObjectToJSONString = Utility.convertObjectToJSONString(this.jsonData.getData()); + this.httpRequest.data = new ByteArrayOutputStream(); + try { + this.httpRequest.data.write(convertObjectToJSONString.getBytes()); + } catch (IOException e) { + throw new Error(Error.Code.INVALID_ARGUMENT, "Error converting jsonData in SynergyRequest to a data stream", e); + } + } + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyResponse.java b/app/src/main/java/com/ea/nimble/SynergyResponse.java new file mode 100644 index 0000000..0b60e69 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyResponse.java @@ -0,0 +1,72 @@ +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; + +/* loaded from: classes.dex */ +public class SynergyResponse implements ISynergyResponse { + public IHttpResponse httpResponse = null; + public Error error = null; + public Map jsonData = null; + + public void parseData() { + String str; + Exception e; + int intValue; + Log.Helper.LOGPUBLICFUNC(this); + if (this.jsonData != null) { + return; + } + if (this.httpResponse != null && this.httpResponse.getError() == null) { + try { + str = Utility.readStringFromStream(this.httpResponse.getDataStream()); + try { + this.jsonData = Utility.convertJSONObjectToMap(new JSONObject(str)); + 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)); + } catch (Exception e2) { + e = e2; + this.jsonData = null; + this.error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Unparseable synergy json response " + str, e); + } + } catch (Exception e3) { + str = ""; + e = e3; + } + } else { + this.jsonData = null; + this.error = null; + } + } + + @Override // com.ea.nimble.ISynergyResponse + public IHttpResponse getHttpResponse() { + Log.Helper.LOGPUBLICFUNC(this); + return this.httpResponse; + } + + @Override // com.ea.nimble.ISynergyResponse + public boolean isCompleted() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.httpResponse == null) { + return false; + } + return this.httpResponse.isCompleted(); + } + + @Override // com.ea.nimble.ISynergyResponse + public Exception getError() { + return (this.error != null || this.httpResponse == null) ? this.error : this.httpResponse.getError(); + } + + @Override // com.ea.nimble.ISynergyResponse + public Map getJsonData() { + Log.Helper.LOGPUBLICFUNC(this); + return this.jsonData; + } +} diff --git a/app/src/main/java/com/ea/nimble/SynergyServerError.java b/app/src/main/java/com/ea/nimble/SynergyServerError.java new file mode 100644 index 0000000..0214081 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/SynergyServerError.java @@ -0,0 +1,42 @@ +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"; + private static final long serialVersionUID = 1; + + public enum Code { + ERROR_NONCE_VERIFICATION(-30013), + ERROR_SIGNATURE_VERIFICATION(-30014), + ERROR_NOT_SUPPORTED_RECEIPT_TYPE(-30015), + AMAZON_SERVER_CONNECTION_ERROR(-30016), + APPLE_SERVER_CONNECTION_ERROR(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public SynergyServerError() { + } + + public SynergyServerError(int i, String str, Throwable th) { + super(ERROR_DOMAIN, i, str, th); + } + + public SynergyServerError(int i, String str) { + super(ERROR_DOMAIN, i, str, null); + } + + public boolean isError(int i) { + return getCode() == i; + } +} diff --git a/app/src/main/java/com/ea/nimble/Timer.java b/app/src/main/java/com/ea/nimble/Timer.java new file mode 100644 index 0000000..e8276e0 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Timer.java @@ -0,0 +1,124 @@ +package com.ea.nimble; + +import android.os.Handler; +import android.os.Looper; +import android.os.SystemClock; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class Timer { + private static Handler s_handler = new Handler(Looper.getMainLooper()); + private long m_fireTime; + private long m_pauseTime; + private Runnable m_task; + private Runnable m_taskToRun; + private long m_timeInterval; + private boolean m_running = false; + private boolean m_paused = false; + + private class RepeatingTask implements Runnable { + private RepeatingTask() { + } + + @Override // java.lang.Runnable + public void run() { + if (Timer.this.m_paused || !Timer.this.m_running) { + return; + } + Timer.this.m_task.run(); + Timer.this.m_fireTime = SystemClock.uptimeMillis() + Timer.this.m_fireTime; + Timer.s_handler.postDelayed(this, Timer.this.m_timeInterval); + } + } + + private class SingleRunTask implements Runnable { + private SingleRunTask() { + } + + @Override // java.lang.Runnable + public void run() { + if (Timer.this.m_paused || !Timer.this.m_running) { + return; + } + Timer.this.m_running = false; + Timer.this.m_task.run(); + } + } + + public Timer(Runnable runnable) { + this.m_task = runnable; + } + + public boolean isRunning() { + return this.m_running; + } + + public boolean isPaused() { + return this.m_paused; + } + + public void schedule(double d, boolean z) { + cancel(); + if (d < 0.1d) { + if (z) { + Log.Helper.LOGES(null, "Timer scheduled to repeat for %.2f seconds, running only once", Double.valueOf(d)); + } + if (Looper.myLooper() == Looper.getMainLooper()) { + this.m_task.run(); + return; + } else { + s_handler.post(this.m_task); + return; + } + } + this.m_timeInterval = (long) (d * 1000.0d); + this.m_fireTime = SystemClock.uptimeMillis() + this.m_timeInterval; + if (z) { + this.m_taskToRun = new RepeatingTask(); + } else { + this.m_taskToRun = new SingleRunTask(); + } + s_handler.postDelayed(this.m_taskToRun, this.m_timeInterval); + this.m_running = true; + } + + public void fire() { + cancel(); + this.m_task.run(); + if (this.m_taskToRun instanceof RepeatingTask) { + if (this.m_paused) { + this.m_fireTime = this.m_pauseTime + this.m_timeInterval; + return; + } + this.m_fireTime = SystemClock.uptimeMillis() + this.m_timeInterval; + s_handler.postDelayed(this.m_taskToRun, this.m_timeInterval); + this.m_running = true; + } + } + + public void pause() { + if (this.m_paused || !this.m_running) { + return; + } + this.m_pauseTime = SystemClock.uptimeMillis(); + s_handler.removeCallbacks(this.m_taskToRun); + this.m_paused = true; + } + + public void resume() { + if (this.m_paused && this.m_running) { + this.m_fireTime += SystemClock.uptimeMillis() - this.m_pauseTime; + s_handler.postAtTime(this.m_taskToRun, this.m_fireTime); + this.m_paused = false; + } + } + + public void cancel() { + if (this.m_running) { + if (!this.m_paused) { + s_handler.removeCallbacks(this.m_taskToRun); + } + this.m_running = false; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/Utility.java b/app/src/main/java/com/ea/nimble/Utility.java new file mode 100644 index 0000000..6ed3dd6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/Utility.java @@ -0,0 +1,387 @@ +package com.ea.nimble; + +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.ResolveInfo; +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Looper; +import android.support.v4.content.LocalBroadcastManager; +import com.ea.nimble.Log; +import com.google.gson.GsonBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Serializable; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; +import org.apache.http.protocol.HTTP; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public final class Utility { + public static boolean getTestResult() { + return true; + } + + public static String safeString(String str) { + return str == null ? "" : str; + } + + private Utility() { + } + + public static void loadLibrary(String str) { + String unsatisfiedLinkError; + if (str == null) { + Log.Helper.LOGDS("Utility", "loadLibrary(): libName is null", new Object[0]); + return; + } + try { + System.loadLibrary(str); + unsatisfiedLinkError = "Success"; + } catch (NullPointerException e) { + unsatisfiedLinkError = e.toString(); + } catch (SecurityException e2) { + unsatisfiedLinkError = e2.toString(); + } catch (Exception e3) { + unsatisfiedLinkError = e3.toString(); + } catch (UnsatisfiedLinkError e4) { + unsatisfiedLinkError = e4.toString(); + } + Log.Helper.LOGDS("Utility", "loadLibrary(" + str + "): " + unsatisfiedLinkError, new Object[0]); + } + + /* JADX WARN: Multi-variable type inference failed */ + /* JADX WARN: Removed duplicated region for block: B:35:0x0076 */ + /* JADX WARN: Type inference failed for: r6v2 */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public static java.util.Map parseXmlFile(int r6) { + /* + r0 = 0 + com.ea.nimble.IApplicationEnvironment r1 = com.ea.nimble.ApplicationEnvironment.getComponent() // Catch: java.lang.Throwable -> L49 java.lang.Exception -> L4e + android.content.Context r1 = r1.getApplicationContext() // Catch: java.lang.Throwable -> L49 java.lang.Exception -> L4e + android.content.res.Resources r1 = r1.getResources() // Catch: java.lang.Throwable -> L49 java.lang.Exception -> L4e + android.content.res.XmlResourceParser r6 = r1.getXml(r6) // Catch: java.lang.Throwable -> L49 java.lang.Exception -> L4e + if (r6 == 0) goto L41 + java.util.LinkedHashMap r1 = new java.util.LinkedHashMap // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + r1.() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + int r2 = r6.getEventType() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + r3 = r0 + L1d: + r4 = 1 + if (r2 == r4) goto L38 + r4 = 2 + if (r2 != r4) goto L29 + java.lang.String r2 = r6.getName() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + r3 = r2 + goto L33 + L29: + r4 = 4 + if (r2 != r4) goto L33 + java.lang.String r2 = r6.getText() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + r1.put(r3, r2) // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + L33: + int r2 = r6.next() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + goto L1d + L38: + r6.close() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + if (r6 == 0) goto L40 + r6.close() + L40: + return r1 + L41: + java.lang.Exception r1 = new java.lang.Exception // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + r1.() // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + throw r1 // Catch: java.lang.Exception -> L47 java.lang.Throwable -> L73 + L47: + r1 = move-exception + goto L50 + L49: + r6 = move-exception + r5 = r0 + r0 = r6 + r6 = r5 + goto L74 + L4e: + r1 = move-exception + r6 = r0 + L50: + java.lang.String r2 = "Utility" + java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L73 + r3.() // Catch: java.lang.Throwable -> L73 + java.lang.String r4 = "Error reading xml file: " + r3.append(r4) // Catch: java.lang.Throwable -> L73 + java.lang.String r1 = r1.toString() // Catch: java.lang.Throwable -> L73 + r3.append(r1) // Catch: java.lang.Throwable -> L73 + java.lang.String r1 = r3.toString() // Catch: java.lang.Throwable -> L73 + r3 = 0 + java.lang.Object[] r3 = new java.lang.Object[r3] // Catch: java.lang.Throwable -> L73 + com.ea.nimble.Log.Helper.LOGES(r2, r1, r3) // Catch: java.lang.Throwable -> L73 + if (r6 == 0) goto L72 + r6.close() + L72: + return r0 + L73: + r0 = move-exception + L74: + if (r6 == 0) goto L79 + r6.close() + L79: + throw r0 + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Utility.parseXmlFile(int):java.util.Map"); + } + + public static String readStringFromStream(InputStream inputStream) throws IOException { + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.defaultCharset()); + char[] cArr = new char[4096]; + StringWriter stringWriter = new StringWriter(); + while (true) { + int read = inputStreamReader.read(cArr, 0, 4096); + if (read > 0) { + stringWriter.write(cArr, 0, read); + } else { + return stringWriter.toString(); + } + } + } + + public static String getUTCDateStringFormat(Date date) { + if (date == null) { + return ""; + } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return simpleDateFormat.format(date); + } + + public static boolean validString(String str) { + return str != null && str.length() > 0; + } + + public static boolean validStringObject(Object obj) { + return obj != null && (obj instanceof String) && ((String) obj).length() > 0; + } + + public static String convertObjectToJSONString(Object obj) { + return new GsonBuilder().disableHtmlEscaping().create().toJson(obj); + } + + public static Map convertJSONObjectToMap(JSONObject jSONObject) { + HashMap hashMap = new HashMap(); + Iterator keys = jSONObject.keys(); + while (keys.hasNext()) { + String next = keys.next(); + if (jSONObject.isNull(next)) { + hashMap.put(next, null); + } else { + JSONObject optJSONObject = jSONObject.optJSONObject(next); + if (optJSONObject != null) { + hashMap.put(next, convertJSONObjectToMap(optJSONObject)); + } else { + JSONArray optJSONArray = jSONObject.optJSONArray(next); + if (optJSONArray != null) { + hashMap.put(next, convertJSONArrayToList(optJSONArray)); + } else { + try { + hashMap.put(next, jSONObject.get(next)); + } catch (JSONException e) { + e.printStackTrace(); + hashMap.put(next, null); + } + } + } + } + } + return hashMap; + } + + public static Map convertJSONObjectStringToMap(String str) { + try { + return convertJSONObjectToMap(new JSONObject(str)); + } catch (JSONException e) { + e.printStackTrace(); + return new HashMap(); + } + } + + public static List convertJSONArrayToList(JSONArray jSONArray) { + ArrayList arrayList = new ArrayList(); + for (int i = 0; i < jSONArray.length(); i++) { + if (jSONArray.isNull(i)) { + arrayList.add(null); + } else { + JSONObject optJSONObject = jSONArray.optJSONObject(i); + if (optJSONObject != null) { + arrayList.add(convertJSONObjectToMap(optJSONObject)); + } else { + JSONArray optJSONArray = jSONArray.optJSONArray(i); + if (optJSONArray != null) { + arrayList.add(convertJSONArrayToList(optJSONArray)); + } else { + try { + arrayList.add(jSONArray.get(i)); + } catch (JSONException e) { + e.printStackTrace(); + arrayList.add(null); + } + } + } + } + } + return arrayList; + } + + public static String readFile(String str) { + try { + InputStream open = ApplicationEnvironment.getCurrentActivity().getAssets().open(str); + byte[] bArr = new byte[open.available()]; + open.read(bArr); + open.close(); + return new String(bArr, HTTP.UTF_8); + } catch (IOException e) { + Log.Helper.LOGV("Utility", "readFile(): %s", e.toString()); + return null; + } + } + + public static void sendBroadcast(String str) { + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str)); + } + + public static void sendBroadcast(String str, Map map) { + LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()); + Intent intent = new Intent(str); + if (map != null) { + for (Map.Entry entry : map.entrySet()) { + intent.putExtra(entry.getKey(), entry.getValue()); + } + } + localBroadcastManager.sendBroadcast(intent); + } + + public static void sendBroadcast(String str, Bundle bundle) { + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(new Intent(str).replaceExtras(bundle)); + } + + public static void sendBroadcastSerializable(String str, Map map) { + LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()); + Intent intent = new Intent(str); + if (map != null) { + for (Map.Entry entry : map.entrySet()) { + intent.putExtra(entry.getKey(), entry.getValue()); + } + } + localBroadcastManager.sendBroadcast(intent); + } + + public static void sendExplicitBroadcast(Intent intent) { + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + for (ResolveInfo resolveInfo : applicationContext.getPackageManager().queryBroadcastReceivers(intent, 0)) { + Intent intent2 = new Intent(intent); + intent2.setComponent(new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name)); + applicationContext.sendBroadcast(intent2); + } + } + + public static void registerReceiver(String str, BroadcastReceiver broadcastReceiver) { + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).registerReceiver(broadcastReceiver, new IntentFilter(str)); + } + + public static void unregisterReceiver(BroadcastReceiver broadcastReceiver) { + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).unregisterReceiver(broadcastReceiver); + } + + public static String SHA256HashString(String str) { + if (str == null) { + return null; + } + try { + MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.reset(); + byte[] digest = messageDigest.digest(str.getBytes()); + StringBuffer stringBuffer = new StringBuffer(); + for (byte b : digest) { + stringBuffer.append(Integer.toString((b & 255) + 256, 16).substring(1)); + } + return stringBuffer.toString(); + } catch (NoSuchAlgorithmException unused) { + Log.Helper.LOGES("Utility", "Can't find SHA-256 algorithm", new Object[0]); + return null; + } + } + + public static boolean stringsAreEquivalent(String str, String str2) { + return (str == null || str2 == null) ? str == str2 : str.compareTo(str2) == 0; + } + + public static String bytesToHexString(byte[] bArr) { + char[] charArray = "0123456789ABCDEF".toCharArray(); + char[] cArr = new char[bArr.length * 2]; + for (int i = 0; i < bArr.length; i++) { + int i2 = bArr[i] & 255; + int i3 = i * 2; + cArr[i3] = charArray[i2 >> 4]; + cArr[i3 + 1] = charArray[i2 & 15]; + } + return new String(cArr); + } + + public static boolean isOnlyDecimalCharacters(String str) { + if (str == null) { + return false; + } + for (int i = 0; i < str.length(); i++) { + if (!Character.isDigit(str.charAt(i))) { + return false; + } + } + return true; + } + + public static String convertLiteralMapToString(Map map) { + if (map == null) { + return "NULL"; + } + StringBuilder sb = new StringBuilder(); + sb.append("{\n"); + for (Map.Entry entry : map.entrySet()) { + sb.append("\t\""); + sb.append(entry.getKey()); + sb.append("\" = \""); + sb.append(entry.getValue()); + sb.append("\",\n"); + } + sb.deleteCharAt(sb.length() - 2); + sb.append("}"); + return sb.toString(); + } + + public static void runOnWorkerThread(Runnable runnable) { + if (Looper.getMainLooper() == Looper.myLooper()) { + AsyncTask.SERIAL_EXECUTOR.execute(runnable); + } else { + runnable.run(); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/WebView.java b/app/src/main/java/com/ea/nimble/WebView.java new file mode 100644 index 0000000..8bf5912 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/WebView.java @@ -0,0 +1,81 @@ +package com.ea.nimble; + +import android.app.Activity; +import android.content.Intent; +import android.content.res.Configuration; +import android.graphics.Bitmap; +import android.os.Bundle; +import android.webkit.WebViewClient; +import android.widget.RelativeLayout; + +/* loaded from: classes.dex */ +public class WebView extends Activity { + private static WebViewCallback s_callback; + + @Override // android.app.Activity, android.content.ComponentCallbacks + public void onConfigurationChanged(Configuration configuration) { + super.onConfigurationChanged(configuration); + if (configuration.orientation == 2) { + setRequestedOrientation(0); + } else if (configuration.orientation == 1) { + setRequestedOrientation(1); + } + } + + @Override // android.app.Activity + public void onBackPressed() { + if (s_callback != null) { + s_callback.callback(""); + s_callback = null; + } + super.onBackPressed(); + } + + @Override // android.app.Activity + protected void onCreate(Bundle bundle) { + super.onCreate(bundle); + RelativeLayout relativeLayout = new RelativeLayout(this); + relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); + android.webkit.WebView webView = new android.webkit.WebView(this); + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1); + layoutParams.addRule(14); + layoutParams.addRule(15); + webView.setLayoutParams(layoutParams); + webView.getSettings().setJavaScriptEnabled(true); + setRequestedOrientation(ApplicationEnvironment.getCurrentActivity().getResources().getConfiguration().orientation != 1 ? 0 : 1); + Bundle extras = getIntent().getExtras(); + 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) { + if (str.contains(string)) { + WebView.this.finish(); + if (WebView.s_callback != null) { + WebView.s_callback.callback(str); + WebViewCallback unused = WebView.s_callback = null; + return; + } + return; + } + super.onPageStarted(webView2, str, bitmap); + } + }); + } + relativeLayout.addView(webView); + setContentView(relativeLayout); + } + + public static void showAuthView(String str, String str2, WebViewCallback webViewCallback) { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + Intent intent = new Intent(currentActivity, (Class) WebView.class); + intent.putExtra("Oauth_URL", str); + intent.putExtra("Redirect_URL", str2); + s_callback = webViewCallback; + currentActivity.startActivity(intent); + } +} diff --git a/app/src/main/java/com/ea/nimble/WebViewCallback.java b/app/src/main/java/com/ea/nimble/WebViewCallback.java new file mode 100644 index 0000000..0ceabc8 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/WebViewCallback.java @@ -0,0 +1,6 @@ +package com.ea.nimble; + +/* loaded from: classes.dex */ +public interface WebViewCallback { + void callback(String str); +} diff --git a/app/src/main/java/com/ea/nimble/bridge/BaseNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/BaseNativeCallback.java new file mode 100644 index 0000000..e34332a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/BaseNativeCallback.java @@ -0,0 +1,79 @@ +package com.ea.nimble.bridge; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import com.ea.nimble.Error; +import com.ea.nimble.IApplicationEnvironment; +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.SynergyNetworkConnectionCallback; +import com.ea.nimble.SynergyNetworkConnectionHandle; +import com.ea.nimble.SynergyRequest; +import com.ea.nimble.Utility; +import java.util.HashMap; + +/* loaded from: classes.dex */ +public class BaseNativeCallback extends BroadcastReceiver implements NetworkConnectionCallback, SynergyNetworkConnectionCallback, SynergyRequest.SynergyRequestPreparingCallback, IApplicationEnvironment.SafetyNetAttestationCallback { + private int m_id; + + public static native void nativeCallback(int i, Object... objArr); + + public static native void nativeFinalize(int i); + + public static void sendNativeCallback(final int i, final Object... objArr) { + Utility.runOnWorkerThread(new Runnable() { // from class: com.ea.nimble.bridge.BaseNativeCallback.1 + @Override // java.lang.Runnable + public void run() { + BaseNativeCallback.nativeCallback(i, objArr); + } + }); + } + + public BaseNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + sendNativeCallback(this.m_id, networkConnectionHandle); + } + + public void finalize() throws Throwable { + super.finalize(); + Utility.runOnWorkerThread(new Runnable() { // from class: com.ea.nimble.bridge.BaseNativeCallback.2 + @Override // java.lang.Runnable + public void run() { + BaseNativeCallback.nativeFinalize(BaseNativeCallback.this.m_id); + } + }); + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + HashMap hashMap = new HashMap(); + Bundle extras = intent.getExtras(); + if (extras != null) { + for (String str : extras.keySet()) { + hashMap.put(str, extras.get(str)); + } + } + sendNativeCallback(this.m_id, intent.getAction(), hashMap); + } + + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + sendNativeCallback(this.m_id, synergyRequest); + } + + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + sendNativeCallback(this.m_id, synergyNetworkConnectionHandle); + } + + @Override // com.ea.nimble.IApplicationEnvironment.SafetyNetAttestationCallback + public void onCallback(String str, Error error) { + sendNativeCallback(this.m_id, str, error); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/FacebookNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/FacebookNativeCallback.java new file mode 100644 index 0000000..af19136 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/FacebookNativeCallback.java @@ -0,0 +1,22 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.Error; +import com.ea.nimble.IFacebook; + +/* loaded from: classes.dex */ +public class FacebookNativeCallback implements IFacebook.RequestCallback { + private int m_id; + + public FacebookNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.IFacebook.RequestCallback + public void callback(String str, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, str, error); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/FriendsNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/FriendsNativeCallback.java new file mode 100644 index 0000000..d4764e5 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/FriendsNativeCallback.java @@ -0,0 +1,38 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.Error; +import com.ea.nimble.friends.INimbleOriginFriendsService; +import com.ea.nimble.friends.NimbleFriendsList; +import com.ea.nimble.friends.NimbleFriendsRefreshCallback; +import com.ea.nimble.friends.NimbleFriendsRefreshResult; +import com.ea.nimble.friends.NimbleFriendsRefreshScope; +import com.ea.nimble.friends.NimbleUser; +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public class FriendsNativeCallback implements NimbleFriendsRefreshCallback, INimbleOriginFriendsService.NimbleUserSearchCallback, INimbleOriginFriendsService.NimbleFriendInvitationCallback { + private int m_id; + + public FriendsNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.friends.NimbleFriendsRefreshCallback + public void onCallback(NimbleFriendsList nimbleFriendsList, NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshResult nimbleFriendsRefreshResult) { + BaseNativeCallback.sendNativeCallback(this.m_id, nimbleFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService.NimbleUserSearchCallback + public void onCallback(ArrayList arrayList, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, arrayList, error); + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService.NimbleFriendInvitationCallback + public void onCallback(boolean z, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, Boolean.valueOf(z), error); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/GoogleServiceRequestCallback.java b/app/src/main/java/com/ea/nimble/bridge/GoogleServiceRequestCallback.java new file mode 100644 index 0000000..150d8c2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/GoogleServiceRequestCallback.java @@ -0,0 +1,22 @@ +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 map, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, map, error); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/IdentityGenericAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/bridge/IdentityGenericAuthenticationConductor.java new file mode 100644 index 0000000..d17c3f3 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/IdentityGenericAuthenticationConductor.java @@ -0,0 +1,28 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.identity.INimbleIdentityGenericAuthenticationConductor; +import com.ea.nimble.identity.INimbleIdentityGenericLoginResolver; +import com.ea.nimble.identity.INimbleIdentityGenericLogoutResolver; + +/* loaded from: classes.dex */ +public class IdentityGenericAuthenticationConductor implements INimbleIdentityGenericAuthenticationConductor { + private int m_id; + + public IdentityGenericAuthenticationConductor(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericAuthenticationConductor + public void handleLogin(INimbleIdentityGenericLoginResolver iNimbleIdentityGenericLoginResolver) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityGenericLoginResolver); + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericAuthenticationConductor + public void handleLogout(INimbleIdentityGenericLogoutResolver iNimbleIdentityGenericLogoutResolver) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityGenericLogoutResolver, null); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/IdentityMigrationAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/bridge/IdentityMigrationAuthenticationConductor.java new file mode 100644 index 0000000..395ef4f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/IdentityMigrationAuthenticationConductor.java @@ -0,0 +1,33 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.identity.INimbleIdentityMigrationAuthenticationConductor; +import com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver; +import com.ea.nimble.identity.INimbleIdentityPendingMigrationResolver; + +/* loaded from: classes.dex */ +public class IdentityMigrationAuthenticationConductor implements INimbleIdentityMigrationAuthenticationConductor { + private int m_id; + + public IdentityMigrationAuthenticationConductor(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationAuthenticationConductor + public void handleLogin(INimbleIdentityMigrationLoginResolver iNimbleIdentityMigrationLoginResolver) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityMigrationLoginResolver); + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationAuthenticationConductor + public void handleLogout() { + BaseNativeCallback.sendNativeCallback(this.m_id, new Object[0]); + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationAuthenticationConductor + public void handlePendingMigration(INimbleIdentityPendingMigrationResolver iNimbleIdentityPendingMigrationResolver) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityPendingMigrationResolver, null); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/IdentityNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/IdentityNativeCallback.java new file mode 100644 index 0000000..f2fb929 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/IdentityNativeCallback.java @@ -0,0 +1,38 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.Error; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class IdentityNativeCallback implements INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback, INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback, INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback { + private int m_id; + + public IdentityNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, JSONObject jSONObject, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityAuthenticator, jSONObject, error); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str, String str2, String str3, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityAuthenticator, str, str2, str3, error); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityAuthenticator, error); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleAuthenticatorAccessTokenCallback + public void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str, String str2, Error error) { + BaseNativeCallback.sendNativeCallback(this.m_id, iNimbleIdentityAuthenticator, str, str2, error); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/IdentityPlainAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/bridge/IdentityPlainAuthenticationConductor.java new file mode 100644 index 0000000..3465b3e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/IdentityPlainAuthenticationConductor.java @@ -0,0 +1,26 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.identity.INimbleIdentityPlainAuthenticationConductor; + +/* loaded from: classes.dex */ +public class IdentityPlainAuthenticationConductor implements INimbleIdentityPlainAuthenticationConductor { + private int m_id; + + public IdentityPlainAuthenticationConductor(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.identity.INimbleIdentityPlainAuthenticationConductor + public void handleLogin() { + BaseNativeCallback.sendNativeCallback(this.m_id, new Object[0]); + } + + @Override // com.ea.nimble.identity.INimbleIdentityPlainAuthenticationConductor + public void handleLogout() { + BaseNativeCallback.sendNativeCallback(this.m_id, null); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/LogNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/LogNativeCallback.java new file mode 100644 index 0000000..80eb073 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/LogNativeCallback.java @@ -0,0 +1,21 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.ILog; + +/* loaded from: classes.dex */ +public class LogNativeCallback implements ILog.LogCallback { + private int m_id; + + public LogNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.ILog.LogCallback + public void callback(int i, String str, String str2) { + BaseNativeCallback.sendNativeCallback(this.m_id, Integer.valueOf(i), str, str2); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/MTXNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/MTXNativeCallback.java new file mode 100644 index 0000000..2da1830 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/MTXNativeCallback.java @@ -0,0 +1,37 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.mtx.INimbleMTX; +import com.ea.nimble.mtx.NimbleMTXTransaction; + +/* loaded from: classes.dex */ +public class MTXNativeCallback implements INimbleMTX.PurchaseTransactionCallback, INimbleMTX.ItemGrantedCallback, INimbleMTX.FinalizeTransactionCallback { + private int m_id; + + public MTXNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.mtx.INimbleMTX.FinalizeTransactionCallback + public void finalizeComplete(NimbleMTXTransaction nimbleMTXTransaction) { + BaseNativeCallback.sendNativeCallback(this.m_id, nimbleMTXTransaction); + } + + @Override // com.ea.nimble.mtx.INimbleMTX.ItemGrantedCallback + public void itemGrantedComplete(NimbleMTXTransaction nimbleMTXTransaction) { + BaseNativeCallback.sendNativeCallback(this.m_id, nimbleMTXTransaction); + } + + @Override // com.ea.nimble.mtx.INimbleMTX.PurchaseTransactionCallback + public void purchaseComplete(NimbleMTXTransaction nimbleMTXTransaction) { + BaseNativeCallback.sendNativeCallback(this.m_id, nimbleMTXTransaction, true); + } + + @Override // com.ea.nimble.mtx.INimbleMTX.PurchaseTransactionCallback + public void unverifiedReceiptReceived(NimbleMTXTransaction nimbleMTXTransaction) { + BaseNativeCallback.sendNativeCallback(this.m_id, nimbleMTXTransaction, false); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/NimbleCppApplicationLifeCycle.java b/app/src/main/java/com/ea/nimble/bridge/NimbleCppApplicationLifeCycle.java new file mode 100644 index 0000000..7a6f11d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/NimbleCppApplicationLifeCycle.java @@ -0,0 +1,160 @@ +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; +import com.ea.nimble.Component; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.SynergyEnvironment; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class NimbleCppApplicationLifeCycle extends Component implements IApplicationLifecycle.ApplicationLifecycleCallbacks, IApplicationLifecycle.ActivityEventCallbacks, IApplicationLifecycle.ActivityLifecycleCallbacks { + public static final String COMPONENT_ID = "com.ea.nimble.bridge.NimbleCppApplicationLifeCycle"; + private Intent m_newIntent = null; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return COMPONENT_ID; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityCreated(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityDestroyed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityPaused(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onActivityResult(Activity activity, int i, int i2, Intent intent) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStarted(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityStopped(Activity activity) { + } + + public native void onApplicationLaunch(Map map); + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public native void onApplicationQuit(); + + public native void onApplicationResume(Map map); + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public native void onApplicationSuspend(); + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public boolean onBackPressed() { + return true; + } + + public native void onUpdateLaunchMethod(Map map); + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onWindowFocusChanged(boolean z) { + } + + private static void initialize() { + Base.registerComponent(new NimbleCppApplicationLifeCycle(), COMPONENT_ID); + } + + @Override // com.ea.nimble.Component + public void setup() { + ApplicationLifecycle.getComponent().registerApplicationLifecycleCallbacks(this); + ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this); + ApplicationLifecycle.getComponent().registerActivityLifecycleCallbacks(this); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationLaunch(Intent intent) { + onApplicationLaunch(parseIntentInformation(intent, null)); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationResume() { + onApplicationResume(parseIntentInformation(ApplicationEnvironment.getCurrentActivity().getIntent(), this.m_newIntent)); + this.m_newIntent = null; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onNewIntent(Activity activity, Intent intent) { + this.m_newIntent = intent; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityResumed(Activity activity) { + if (this.m_newIntent != null) { + onUpdateLaunchMethod(parseIntentInformation(null, this.m_newIntent)); + this.m_newIntent = null; + } + } + + private Map parseIntentInformation(Intent intent, Intent intent2) { + HashMap hashMap = new HashMap(); + if (intent2 != null) { + if (intent2.getData() != null) { + hashMap.put("mode", "url"); + hashMap.put("url", intent2.getDataString()); + String stringExtra = intent2.getStringExtra("key"); + if (stringExtra != null) { + hashMap.put("key", stringExtra); + } + return hashMap; + } + if (intent2.getStringExtra("PushNotification") != null) { + parsePushNotificationDetails(hashMap, intent2.getExtras()); + return hashMap; + } + } + if (intent != null) { + if (intent.getData() != null) { + hashMap.put("mode", "url"); + hashMap.put("url", intent.getDataString()); + String stringExtra2 = intent.getStringExtra("key"); + if (stringExtra2 != null) { + hashMap.put("key", stringExtra2); + } + return hashMap; + } + if (intent.getStringExtra("PushNotification") != null) { + parsePushNotificationDetails(hashMap, intent.getExtras()); + return hashMap; + } + } + return hashMap; + } + + private void parsePushNotificationDetails(Map 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()); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/NimbleCppComponentRegistrar.java b/app/src/main/java/com/ea/nimble/bridge/NimbleCppComponentRegistrar.java new file mode 100644 index 0000000..1747e91 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/NimbleCppComponentRegistrar.java @@ -0,0 +1,71 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class NimbleCppComponentRegistrar extends Component { + public static final String COMPONENT_ID = "com.ea.nimble.bridge.NimbleCppComponentRegistrar"; + static boolean m_baseComponentSetupComplete; + static HashMap m_components = new HashMap<>(); + + @Override // com.ea.nimble.Component + public String getComponentId() { + return COMPONENT_ID; + } + + static class NimbleCppComponent extends Component { + private String m_componentId; + + @Override // com.ea.nimble.Component + protected native void cleanup(); + + @Override // com.ea.nimble.Component + protected native void restore(); + + @Override // com.ea.nimble.Component + protected native void resume(); + + @Override // com.ea.nimble.Component + protected native void setup(); + + @Override // com.ea.nimble.Component + protected native void suspend(); + + @Override // com.ea.nimble.Component + protected native void teardown(); + + NimbleCppComponent(String str) { + this.m_componentId = str; + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return this.m_componentId; + } + } + + private static void initialize() { + Base.registerComponent(new NimbleCppComponentRegistrar(), COMPONENT_ID); + m_baseComponentSetupComplete = true; + for (Map.Entry entry : m_components.entrySet()) { + Base.registerComponent(entry.getValue(), entry.getKey()); + } + m_components.clear(); + } + + public static void register(String str) { + NimbleCppComponent nimbleCppComponent = new NimbleCppComponent(str); + if (m_baseComponentSetupComplete) { + Base.registerComponent(nimbleCppComponent, str); + } else { + m_components.put(str, nimbleCppComponent); + } + } + + public static String getComponentId(Component component) { + return component.getComponentId(); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/PushTNGNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/PushTNGNativeCallback.java new file mode 100644 index 0000000..59cda7e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/PushTNGNativeCallback.java @@ -0,0 +1,36 @@ +package com.ea.nimble.bridge; + +import com.ea.eadp.pushnotification.listeners.IPushListener; + +/* loaded from: classes.dex */ +public class PushTNGNativeCallback implements IPushListener { + private int m_id; + + public PushTNGNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.eadp.pushnotification.listeners.IPushListener + public void onConnectionError(int i, String str) { + BaseNativeCallback.sendNativeCallback(this.m_id, 0, Integer.valueOf(i), str); + } + + @Override // com.ea.eadp.pushnotification.listeners.IPushListener + public void onGetInAppSuccess(int i, String str) { + BaseNativeCallback.sendNativeCallback(this.m_id, 1, Integer.valueOf(i), str); + } + + @Override // com.ea.eadp.pushnotification.listeners.IPushListener + public void onRegistrationSuccess(int i, String str) { + BaseNativeCallback.sendNativeCallback(this.m_id, 2, Integer.valueOf(i), str); + } + + @Override // com.ea.eadp.pushnotification.listeners.IPushListener + public void onTrackingSuccess(int i, String str) { + BaseNativeCallback.sendNativeCallback(this.m_id, 3, Integer.valueOf(i), str); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/bridge/WebViewNativeCallback.java b/app/src/main/java/com/ea/nimble/bridge/WebViewNativeCallback.java new file mode 100644 index 0000000..673939f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/bridge/WebViewNativeCallback.java @@ -0,0 +1,21 @@ +package com.ea.nimble.bridge; + +import com.ea.nimble.WebViewCallback; + +/* loaded from: classes.dex */ +public class WebViewNativeCallback implements WebViewCallback { + private int m_id; + + public WebViewNativeCallback(int i) { + this.m_id = i; + } + + @Override // com.ea.nimble.WebViewCallback + public void callback(String str) { + BaseNativeCallback.sendNativeCallback(this.m_id, str); + } + + public void finalize() { + BaseNativeCallback.nativeFinalize(this.m_id); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/INimbleFriends.java b/app/src/main/java/com/ea/nimble/friends/INimbleFriends.java new file mode 100644 index 0000000..9f9493a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/INimbleFriends.java @@ -0,0 +1,9 @@ +package com.ea.nimble.friends; + +/* loaded from: classes.dex */ +public interface INimbleFriends { + public static final int IDENTITY_FRIEND_INFO_REQUEST_LIMIT = 20; + public static final String NIMBLE_NOTIFICATION_FRIENDS_LIST_UPDATE = "nimble.notification.friends.update"; + + NimbleFriendsList getFriendsList(String str, boolean z); +} diff --git a/app/src/main/java/com/ea/nimble/friends/INimbleOriginFriendsService.java b/app/src/main/java/com/ea/nimble/friends/INimbleOriginFriendsService.java new file mode 100644 index 0000000..6525791 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/INimbleOriginFriendsService.java @@ -0,0 +1,34 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Error; +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public interface INimbleOriginFriendsService { + + public interface NimbleFriendInvitationCallback { + void onCallback(boolean z, Error error); + } + + public interface NimbleUserSearchCallback { + void onCallback(ArrayList arrayList, Error error); + } + + void acceptFriendInvitation(String str, NimbleFriendInvitationCallback nimbleFriendInvitationCallback); + + void declineFriendInvitation(String str, NimbleFriendInvitationCallback nimbleFriendInvitationCallback); + + void listFriendInvitationsReceived(NimbleUserSearchCallback nimbleUserSearchCallback); + + void listFriendInvitationsSent(NimbleUserSearchCallback nimbleUserSearchCallback); + + void searchUserByDisplayName(String str, NimbleUserSearchCallback nimbleUserSearchCallback); + + void searchUserByEmail(String str, NimbleUserSearchCallback nimbleUserSearchCallback); + + void sendFriendInvitation(String str, String str2, NimbleFriendInvitationCallback nimbleFriendInvitationCallback); + + void sendInvitationOverEmail(ArrayList arrayList, String str, String str2, NimbleFriendInvitationCallback nimbleFriendInvitationCallback); + + void sendInvitationOverSMS(ArrayList arrayList, String str, NimbleFriendInvitationCallback nimbleFriendInvitationCallback); +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java b/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java new file mode 100644 index 0000000..f0e0675 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java @@ -0,0 +1,19 @@ +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; + +/* loaded from: classes.dex */ +class NimbleFacebookUser extends NimbleUser { + NimbleFacebookUser(JSONObject jSONObject) { + 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.refreshTimestamp = new Date(); + setPlayedCurrentGame(NimbleUser.PlayedCurrentGameFlag.PLAYED); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriends.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriends.java new file mode 100644 index 0000000..f5d2861 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriends.java @@ -0,0 +1,12 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Base; + +/* loaded from: classes.dex */ +public class NimbleFriends { + public static final String NIMBLE_COMPONENT_ID_FRIENDS = "com.ea.nimble.friends"; + + public static INimbleFriends getComponent() { + return (INimbleFriends) Base.getComponent(NIMBLE_COMPONENT_ID_FRIENDS); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java new file mode 100644 index 0000000..9322775 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java @@ -0,0 +1,66 @@ +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 { + public static final String NIMBLE_FRIENDS_ERROR_DOMAIN = "NimbleFriendsError"; + private static final long serialVersionUID = 1; + + public enum Code { + NIMBLE_FRIENDS_FACEBOOK_NOT_AVAILABLE(90000), + NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE(90001), + NIMBLE_FRIENDS_FACEBOOK_USER_NOT_LOGGED_IN(90002), + NIMBLE_FRIENDS_EMAIL_NOT_AVAILABLE(90003), + NIMBLE_FRIENDS_SMS_NOT_AVAILABLE(90004), + NIMBLE_FRIENDS_EMAIL_LAST_REQUEST_NOT_FINISHED(90005), + NIMBLE_FRIENDS_SMS_LAST_REQUEST_NOT_FINISHED(90006), + NIMBLE_FRIENDS_SMS_NOT_SENT_OUT(90007), + NIMBLE_FRIENDS_NO_TARGETS_PROVIDED(90008), + NIMBLE_FRIENDS_FAILED_TO_CREATE_GOS_REQUEST(80000), + NIMBLE_FRIENDS_NETWORK_UNEXPECT_ERROR(80001), + 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_IDENTITY_SERVER_EMPTY_RESPONSE(10007), + NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY(10008), + NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_NOT_UPDATED(10009), + NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_SUPPORTED(10010), + NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_LOGGED_IN(10011), + NIMBLE_FRIENDS_REFRESH_SCOPE_ERROR_PARSING_HTTP_RESPONSE(10013), + NIMBLE_FRIENDS_REFRESH_SCOPE_EMPTY_HTTP_RESPONSE(10014), + 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_SERVER_RETURNED_ERROR(90009), + NIMBLE_FRIENDS_ORIGIN_SERVICES_SERVER_RESPONSE_ERROR(10018), + NIMBLE_FRIENDS_REFRESH_SCOPE_FAILED_TO_CREATE_GOS_REQUEST(10012); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public NimbleFriendsError(Code code, String str, Throwable th) { + super(NIMBLE_FRIENDS_ERROR_DOMAIN, code.intValue(), str, th); + } + + public NimbleFriendsError(Code code, String str) { + super(NIMBLE_FRIENDS_ERROR_DOMAIN, code.intValue(), str); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsImpl.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsImpl.java new file mode 100644 index 0000000..f54e55a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsImpl.java @@ -0,0 +1,112 @@ +package com.ea.nimble.friends; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Utility; +import com.ea.nimble.identity.INimbleIdentity; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.Hashtable; + +/* loaded from: classes.dex */ +public class NimbleFriendsImpl extends Component implements INimbleFriends, LogSource { + private Hashtable m_friends = new Hashtable<>(); + private BroadcastReceiver m_authenticatorLoginChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.friends.NimbleFriendsImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + INimbleIdentityAuthenticator authenticatorById; + if (intent == null || intent.getExtras() == null || intent.getAction() == null || !intent.getAction().equalsIgnoreCase(Global.NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE)) { + return; + } + String string = intent.getExtras().getString(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID); + if (!Utility.validString(string) || (authenticatorById = ((INimbleIdentity) Base.getComponent("com.ea.nimble.identity")).getAuthenticatorById(string)) == null) { + return; + } + if (authenticatorById.getState() == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + if (NimbleFriendsImpl.this.m_friends.get(string) == null) { + if (Global.NIMBLE_AUTHENTICATOR_FACEBOOK == string) { + NimbleFriendsImpl.this.m_friends.put(string, new NimbleFriendsListFacebook()); + return; + } else { + if (Global.NIMBLE_AUTHENTICATOR_ORIGIN == string) { + NimbleFriendsImpl.this.m_friends.put(string, new NimbleFriendsListOrigin()); + return; + } + return; + } + } + return; + } + if (NimbleFriendsImpl.this.m_friends.get(string) != null) { + ((NimbleFriendsListImpl) NimbleFriendsImpl.this.m_friends.get(string)).clear(); + NimbleFriendsImpl.this.m_friends.remove(string); + } + } + }; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return NimbleFriends.NIMBLE_COMPONENT_ID_FRIENDS; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "NimbleFriendsService"; + } + + private static void initialize() { + Base.registerComponent(new NimbleFriendsImpl(), NimbleFriends.NIMBLE_COMPONENT_ID_FRIENDS); + } + + @Override // com.ea.nimble.Component + public void setup() { + Log.Helper.LOGPUBLICFUNC(this); + try { + Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE, this.m_authenticatorLoginChangeReceiver); + } catch (Exception unused) { + } + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void suspend() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void resume() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGPUBLICFUNC(this); + try { + Utility.unregisterReceiver(this.m_authenticatorLoginChangeReceiver); + } catch (Exception unused) { + } + } + + @Override // com.ea.nimble.friends.INimbleFriends + public synchronized NimbleFriendsList getFriendsList(String str, boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_friends.get(str) == null) { + return null; + } + return this.m_friends.get(str).getFriendsList(z); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsList.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsList.java new file mode 100644 index 0000000..2c080f1 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsList.java @@ -0,0 +1,74 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Log; +import com.ea.nimble.friends.NimbleFriendsError; +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public class NimbleFriendsList { + private NimbleFriendsListImpl m_friendsListImpl; + private FriendsListType m_type; + + protected enum FriendsListType { + ALL_FRIENDS, + CURRENT_GAME_FRIENDS + } + + NimbleFriendsList(NimbleFriendsListImpl nimbleFriendsListImpl, FriendsListType friendsListType) { + this.m_friendsListImpl = nimbleFriendsListImpl; + this.m_type = friendsListType; + } + + public ArrayList getFriends() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_friendsListImpl == null) { + return null; + } + if (this.m_type == FriendsListType.CURRENT_GAME_FRIENDS) { + return this.m_friendsListImpl.m_playedFriendsList; + } + return this.m_friendsListImpl.m_friendsList; + } + + public NimbleUser getFriendProfile(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_friendsListImpl != null) { + return this.m_friendsListImpl.m_friends.get(str); + } + return null; + } + + public int getTotalFriendCount() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_type == FriendsListType.CURRENT_GAME_FRIENDS) { + return this.m_friendsListImpl.m_totalPlayedFriends; + } + return this.m_friendsListImpl.m_totalFriends; + } + + public synchronized void refreshFriendsList(NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_friendsListImpl != null) { + this.m_friendsListImpl.refreshFriendsList(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, this.m_type); + } else if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsError nimbleFriendsError = new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE, "Specified Friends provider is not available. Failed to refresh Friends list."); + NimbleFriendsRefreshResult nimbleFriendsRefreshResult = new NimbleFriendsRefreshResult(); + nimbleFriendsRefreshResult.m_error = nimbleFriendsError; + nimbleFriendsRefreshResult.m_success = false; + nimbleFriendsRefreshResult.m_userList = null; + nimbleFriendsRefreshCallback.onCallback(null, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } + } + + public int getRefreshPageSize() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_friendsListImpl != null) { + return this.m_friendsListImpl.getPageSize(); + } + return -1; + } + + FriendsListType getType() { + return this.m_type; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListFacebook.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListFacebook.java new file mode 100644 index 0000000..0f2fbf3 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListFacebook.java @@ -0,0 +1,103 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.IFacebook; +import com.ea.nimble.Log; +import com.ea.nimble.friends.NimbleFriendsError; +import com.ea.nimble.friends.NimbleFriendsList; +import java.util.List; +import org.json.JSONArray; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class NimbleFriendsListFacebook extends NimbleFriendsListImpl { + private static final String FACEBOOK_COMPONENT_ID = "com.ea.nimble.facebook"; + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl, com.ea.nimble.LogSource + public /* bridge */ /* synthetic */ String getLogSourceTitle() { + return super.getLogSourceTitle(); + } + + NimbleFriendsListFacebook() { + this.LOG_SOURCE_TITLE = "NimbleFriendsListFacebook"; + this.m_authenticatorId = Global.NIMBLE_AUTHENTICATOR_FACEBOOK; + Log.Helper.LOGV(this, "Constructed", new Object[0]); + this.m_pageSize = 1000; + this.m_nimbleFriendsList = new NimbleFriendsList(this, NimbleFriendsList.FriendsListType.ALL_FRIENDS); + this.m_nimblePlayedFriendsList = new NimbleFriendsList(this, NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS); + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected void refreshFriendsListBasicInfo(final int i, final int i2, String str, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, final NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo) { + Log.Helper.LOGFUNC(this); + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + Log.Helper.LOGE(this, "Facebook no longer supports getting friends with ALL_FRIENDS flag", new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_FRIENDS_LIST_TYPE_UNSUPPORTED, "Facebook no longer supports getting friends with ALL_FRIENDS flag", friendsListType); + } else if (!isNimbleComponentAvailable("com.ea.nimble.facebook") || !((IFacebook) Base.getComponent("com.ea.nimble.facebook")).hasOpenSession()) { + Log.Helper.LOGE(this, "Unable to refresh friends from Facebook because NimbleFacebook is either unavailable or the session is not open", new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_FACEBOOK_USER_NOT_LOGGED_IN, "Unable to refresh friends from Facebook because NimbleFacebook is either unavailable or the session is not open", friendsListType); + } else { + ((IFacebook) Base.getComponent("com.ea.nimble.facebook")).retrieveFriends(i, i2, new IFacebook.FacebookFriendsCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListFacebook.1 + @Override // com.ea.nimble.IFacebook.FacebookFriendsCallback + public void callback(IFacebook iFacebook, JSONArray jSONArray, Error error) { + if (error != null) { + Log.Helper.LOGE(this, String.format("Error in retrieving friends list from Facebook. Error :%s", error.toString()), new Object[0]); + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult.m_success = false; + nimbleFriendsRangeRefreshResult.m_error = error; + nimbleFriendsRangeRefreshResult.m_userList = null; + nimbleFriendsRangeRefreshResult.m_startIndex = i; + nimbleFriendsRangeRefreshResult.m_size = i2; + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS) { + nimbleFriendsRefreshCallback.onCallback(NimbleFriendsListFacebook.this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + return; + } else { + nimbleFriendsRefreshCallback.onCallback(NimbleFriendsListFacebook.this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + return; + } + } + return; + } + if (jSONArray == null || jSONArray.length() <= 0) { + Log.Helper.LOGD(NimbleFriendsListFacebook.this, "No friends retrieved from Facebook even though the operation was successful", new Object[0]); + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult2 = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult2.m_success = true; + nimbleFriendsRangeRefreshResult2.m_error = null; + nimbleFriendsRangeRefreshResult2.m_userList = null; + nimbleFriendsRangeRefreshResult2.m_startIndex = i; + nimbleFriendsRangeRefreshResult2.m_size = i2; + nimbleFriendsRangeRefreshResult2.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS) { + nimbleFriendsRefreshCallback.onCallback(NimbleFriendsListFacebook.this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + return; + } else { + nimbleFriendsRefreshCallback.onCallback(NimbleFriendsListFacebook.this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + return; + } + } + } + Log.Helper.LOGD(this, "Successfully retrieved friends for specified scope from Facebook. Proceeding with NimbleFriendList update", new Object[0]); + NimbleFriendsListFacebook.this.updateFriendsListBasicInfo(jSONArray, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + } + }); + } + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected void refreshFriendsListImageUrl(List list, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshScope nimbleFriendsRefreshScope) { + Log.Helper.LOGFUNC(this); + Log.Helper.LOGI(this, "Facebook Friends Service does not support ImageUri refresh because Facebook friends already have Image URI information", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_TYPE_UNSUPPORTED, "Facebook Friends Service does not support ImageUri refresh because Facebook friends already have Image URI information", friendsListType); + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected NimbleUser createNimbleUser(JSONObject jSONObject) { + Log.Helper.LOGFUNC(this); + return new NimbleFacebookUser(jSONObject); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListImpl.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListImpl.java new file mode 100644 index 0000000..7da4d88 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListImpl.java @@ -0,0 +1,578 @@ +package com.ea.nimble.friends; + +import android.annotation.SuppressLint; +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +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.friends.NimbleUser; +import com.ea.nimble.identity.INimbleIdentity; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import org.json.JSONArray; +import org.json.JSONObject; + +@SuppressLint({"DefaultLocale"}) +/* loaded from: classes.dex */ +abstract class NimbleFriendsListImpl implements LogSource { + protected NimbleFriendsList m_nimbleFriendsList; + protected NimbleFriendsList m_nimblePlayedFriendsList; + protected Hashtable m_friends = new Hashtable<>(); + protected ArrayList m_friendsList = new ArrayList<>(); + protected ArrayList m_playedFriendsList = new ArrayList<>(); + protected int m_totalFriends = -1; + protected int m_totalPlayedFriends = -1; + protected String LOG_SOURCE_TITLE = "NimbleFriendsListImpl"; + protected int m_pageSize = 100; + protected String m_authenticatorId = ""; + + protected abstract NimbleUser createNimbleUser(JSONObject jSONObject); + + protected abstract void refreshFriendsListBasicInfo(int i, int i2, String str, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo); + + protected abstract void refreshFriendsListImageUrl(List list, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshScope nimbleFriendsRefreshScope); + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return this.LOG_SOURCE_TITLE; + } + + NimbleFriendsListImpl() { + Log.Helper.LOGV(this, "No default implementation for NimbleFriendsListImpl - Must construct a typed-NimbleFriendsListImpl", new Object[0]); + } + + NimbleFriendsList getFriendsList(boolean z) { + synchronized (this) { + try { + if (z) { + Log.Helper.LOGV(this, "Returning NimbleFriendsList with playedCurrentGameOnly flag returned", new Object[0]); + return this.m_nimblePlayedFriendsList; + } + Log.Helper.LOGV(this, "Returning NimbleFriendsList with all friends", new Object[0]); + return this.m_nimbleFriendsList; + } catch (Throwable th) { + throw th; + } + } + } + + protected int getPageSize() { + return this.m_pageSize; + } + + @SuppressLint({"DefaultLocale"}) + protected void refreshFriendsList(NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsList.FriendsListType friendsListType) { + String str; + int size; + String str2; + int i; + String str3; + Log.Helper.LOGV(this, "refreshFriendsList API called", new Object[0]); + Error environmentCheck = environmentCheck(); + if (environmentCheck != null) { + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRefreshResult nimbleFriendsRefreshResult = new NimbleFriendsRefreshResult(); + nimbleFriendsRefreshResult.m_error = environmentCheck; + nimbleFriendsRefreshResult.m_success = false; + nimbleFriendsRefreshResult.m_userList = null; + nimbleFriendsRefreshCallback.onCallback(null, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + return; + } + return; + } + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + str = "ALL_FRIENDS"; + Log.Helper.LOGV(this, "Refresh API called for All Friends List", new Object[0]); + if (this.m_friendsList != null && this.m_friendsList.size() > 0) { + size = this.m_friendsList.size() - 1; + } + size = 0; + } else { + str = "CURRENT_GAME_FRIENDS"; + Log.Helper.LOGV(this, "Refresh API called for Played Current Game Friends List", new Object[0]); + if (this.m_playedFriendsList != null && this.m_playedFriendsList.size() > 0) { + size = this.m_playedFriendsList.size() - 1; + } + size = 0; + } + if (nimbleFriendsRefreshScope == null) { + Log.Helper.LOGW(this, "NimbleFriendsRefreshScope is null. Unable to process the request", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID, "NimbleFriendsRefreshScope is null. Unable to process the request", friendsListType); + return; + } + if (nimbleFriendsRefreshScope instanceof NimbleFriendsRefreshBasicInfo) { + NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo = (NimbleFriendsRefreshBasicInfo) nimbleFriendsRefreshScope; + int startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + int range = nimbleFriendsRefreshBasicInfo.getRange(); + if (nimbleFriendsRefreshBasicInfo.getNextPage()) { + Log.Helper.LOGV(this, "Refresh API is called to get the next page of friends", new Object[0]); + int i2 = this.m_pageSize; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS && this.m_friendsList != null && this.m_friendsList.size() > 0) { + str3 = this.m_friendsList.get(size); + } else if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS && this.m_playedFriendsList != null && this.m_playedFriendsList.size() > 0) { + str3 = this.m_playedFriendsList.get(size); + } else { + str2 = ""; + i = 0; + Log.Helper.LOGD(this, String.format("Refreshing next page for Type = %s, Start Index = %d, Range = %d, Last UID: %s", str, Integer.valueOf(i), Integer.valueOf(i2), str2), new Object[0]); + refreshFriendsListBasicInfo(i, i2, str2, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + return; + } + i = size; + str2 = str3; + Log.Helper.LOGD(this, String.format("Refreshing next page for Type = %s, Start Index = %d, Range = %d, Last UID: %s", str, Integer.valueOf(i), Integer.valueOf(i2), str2), new Object[0]); + refreshFriendsListBasicInfo(i, i2, str2, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + return; + } + if (startIndex <= 0) { + Log.Helper.LOGD(this, String.format("Start Index is less than or equal to 0 - get friends from 0 to page size for Type = %s", str), new Object[0]); + refreshFriendsListBasicInfo(0, this.m_pageSize, "", friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + return; + } + if (range > this.m_pageSize || range <= 0) { + String format = String.format("Range (%d) either exceeds Page Size (%d) or is less than 1. Unable to process this request.", Integer.valueOf(range), Integer.valueOf(this.m_pageSize)); + Log.Helper.LOGW(this, format, new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT, format, friendsListType); + return; + } + if (startIndex - size >= 1) { + String format2 = String.format("Start Index (%d) higher than currentsize (%d). Unable to process this request.", Integer.valueOf(startIndex), Integer.valueOf(size)); + Log.Helper.LOGW(this, format2, new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX, format2, friendsListType); + return; + } + if (startIndex + range > size + 1) { + String format3 = String.format("Range (%d) exceeds Available Size (%d). Unable to process this request.", Integer.valueOf(range), Integer.valueOf(size)); + Log.Helper.LOGW(this, format3, new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT, format3, friendsListType); + return; + } + if (startIndex > 0) { + String str4 = ""; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS && this.m_friendsList != null && this.m_friendsList.size() > 0 && startIndex < this.m_friendsList.size()) { + str4 = this.m_friendsList.get(startIndex - 1); + } else if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS && this.m_playedFriendsList != null && this.m_playedFriendsList.size() > 0 && startIndex < this.m_playedFriendsList.size()) { + str4 = this.m_playedFriendsList.get(startIndex - 1); + } + String str5 = str4; + if (str5.length() > 0) { + Log.Helper.LOGD(this, String.format("Refreshing friends by range for Type = %s, Start Index = %d, Range = %d, Last UID = %s", str, Integer.valueOf(startIndex), Integer.valueOf(range), str5), new Object[0]); + refreshFriendsListBasicInfo(startIndex, range, str5, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + return; + } else { + String format4 = String.format("Unable to process refresh request because we are unable to retrieve the last UID before start index %d.", Integer.valueOf(startIndex)); + Log.Helper.LOGW(this, format4, new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID, format4, friendsListType); + return; + } + } + Log.Helper.LOGD(this, String.format("Refreshing friends by range for Type = %s, Range = %d with starting index at 0 and no last UID", str, Integer.valueOf(range)), new Object[0]); + refreshFriendsListBasicInfo(0, range, "", friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshBasicInfo); + return; + } + if (nimbleFriendsRefreshScope instanceof NimbleFriendsRefreshIdentityInfo) { + ArrayList targetedFriendIds = ((NimbleFriendsRefreshIdentityInfo) nimbleFriendsRefreshScope).getTargetedFriendIds(); + if (targetedFriendIds == null || targetedFriendIds.size() <= 0) { + Log.Helper.LOGW(this, "No user IDs provided for NimbleFriendsRefreshIdentityInfo scope. Unable to process request", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST, "No user IDs provided for NimbleFriendsRefreshIdentityInfo scope. Unable to process request", friendsListType); + return; + } else if (targetedFriendIds.size() > 20 || targetedFriendIds.size() > size + 1) { + Log.Helper.LOGW(this, "Number of user IDs provided for NimbleFriendsRefreshIdentityInfo exceeds allowed limits. Unable to process request", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT, "Number of user IDs provided for NimbleFriendsRefreshIdentityInfo exceeds allowed limits. Unable to process request", friendsListType); + return; + } else { + Log.Helper.LOGD(this, "Refreshing identity info of %d friends of type %s", Integer.valueOf(targetedFriendIds.size()), str); + refreshFriendsListIdentityInfo(targetedFriendIds, friendsListType, nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback); + return; + } + } + if (nimbleFriendsRefreshScope instanceof NimbleFriendsRefreshImageUrl) { + ArrayList targetedFriendIds2 = ((NimbleFriendsRefreshImageUrl) nimbleFriendsRefreshScope).getTargetedFriendIds(); + if (targetedFriendIds2 == null || targetedFriendIds2.size() <= 0) { + Log.Helper.LOGW(this, "No user IDs provided for NimbleFriendsRefreshImageUrl scope. Unable to process request", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST, "No user IDs provided for NimbleFriendsRefreshImageUrl scope. Unable to process request", friendsListType); + } else if (targetedFriendIds2.size() > size + 1 || targetedFriendIds2.size() > 20) { + Log.Helper.LOGW(this, "Number of user IDs provided for NimbleFriendsRefreshImageUrl is more than the page size. Unable to process request", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT, "Number of user IDs provided for NimbleFriendsRefreshImageUrl is more than the page size. Unable to process request", friendsListType); + } else { + Log.Helper.LOGD(this, "Refreshing image url of %d friends of type %s", Integer.valueOf(targetedFriendIds2.size()), str); + refreshFriendsListImageUrl(targetedFriendIds2, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshScope); + } + } + } + + void invokeCallbackWithScopeError(NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsError.Code code, String str, NimbleFriendsList.FriendsListType friendsListType) { + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsError nimbleFriendsError = new NimbleFriendsError(code, str); + NimbleFriendsRefreshResult nimbleFriendsRefreshResult = new NimbleFriendsRefreshResult(); + nimbleFriendsRefreshResult.m_success = false; + nimbleFriendsRefreshResult.m_error = nimbleFriendsError; + nimbleFriendsRefreshResult.m_userList = null; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } else { + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } + } + } + + void invokeCallbackWithScopeError(NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, Error error, NimbleFriendsList.FriendsListType friendsListType) { + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRefreshResult nimbleFriendsRefreshResult = new NimbleFriendsRefreshResult(); + nimbleFriendsRefreshResult.m_success = false; + nimbleFriendsRefreshResult.m_error = error; + nimbleFriendsRefreshResult.m_userList = null; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } else { + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } + } + } + + void invokeCallbackWithBasicScopeError(NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsError.Code code, String str, NimbleFriendsList.FriendsListType friendsListType) { + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsError nimbleFriendsError = new NimbleFriendsError(code, str); + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult.m_success = false; + nimbleFriendsRangeRefreshResult.m_error = nimbleFriendsError; + nimbleFriendsRangeRefreshResult.m_userList = null; + nimbleFriendsRangeRefreshResult.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } else { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } + } + } + + void invokeCallbackWithBasicScopeError(NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, Error error, NimbleFriendsList.FriendsListType friendsListType) { + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult.m_success = false; + nimbleFriendsRangeRefreshResult.m_error = error; + nimbleFriendsRangeRefreshResult.m_userList = null; + nimbleFriendsRangeRefreshResult.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } else { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } + } + } + + protected void refreshFriendsListIdentityInfo(ArrayList arrayList, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshScope nimbleFriendsRefreshScope, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback) { + Log.Helper.LOGD(this, "Preparing to make the call to C&I to get the pid info", new Object[0]); + if (!isNimbleComponentAvailable("com.ea.nimble.identity")) { + Log.Helper.LOGE(this, "Unable to refresh friends Identity information because NimbleIdentity is not available", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to refresh friends Identity information because NimbleIdentity is not available", friendsListType); + return; + } + try { + INimbleIdentity iNimbleIdentity = (INimbleIdentity) Base.getComponent("com.ea.nimble.identity"); + if (iNimbleIdentity.getAuthenticatorById(this.m_authenticatorId).getState() != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + String format = String.format("Authenticator (%s) is not logged in or is unavailable", this.m_authenticatorId); + Log.Helper.LOGE(this, format, new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_LOGGED_IN, format, friendsListType); + return; + } + iNimbleIdentity.getAuthenticatorById(this.m_authenticatorId).requestIdentityForFriends(arrayList, new INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback() { // from class: com.ea.nimble.friends.NimbleFriendsListImpl.1 + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, JSONObject jSONObject, Error error) { + if (error != null) { + Log.Helper.LOGE(this, "Server error when retrieving Pid Info. Error: " + error.toString(), new Object[0]); + NimbleFriendsListImpl.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR, error.toString(), friendsListType); + return; + } + Log.Helper.LOGD(this, "No errors when retrieving Pid Info response from C&I server", new Object[0]); + ArrayList parseJSONObjectToArrayOfUserInfo = NimbleFriendsUtility.parseJSONObjectToArrayOfUserInfo(jSONObject); + if (parseJSONObjectToArrayOfUserInfo == null || parseJSONObjectToArrayOfUserInfo.size() == 0) { + Log.Helper.LOGW(this, "Response for Pid Info request is empty. No Pids were updated for this request. It is probably because the selected friends do not have any Pids associated with them", new Object[0]); + NimbleFriendsListImpl.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE, "Response for Pid Info request is empty. No Pids were updated for this request. It is probably because the selected friends do not have any Pids associated with them", friendsListType); + } else { + Log.Helper.LOGD(this, "Successfully retrieved non-empty updated pid info from Identity server.", new Object[0]); + NimbleFriendsListImpl.this.updateFriendsListIdentityInfo(parseJSONObjectToArrayOfUserInfo, friendsListType, nimbleFriendsRefreshCallback, nimbleFriendsRefreshScope); + } + } + }); + } catch (Exception unused) { + String format2 = String.format("Authenticator (%s) does not support Identity Refresh for Friends List", this.m_authenticatorId); + Log.Helper.LOGE(this, format2, new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_SUPPORTED, format2, friendsListType); + } + } + + protected boolean isNimbleComponentAvailable(String str) { + return Base.getComponent(str) != null; + } + + /* JADX WARN: Code restructure failed: missing block: B:23:0x0079, code lost: + + r4 = new com.ea.nimble.friends.NimbleUser(r3); + r4.setImageUrl(r5); + r11.m_friends.put(r4.getUserId(), r4); + r0.add(r4); + */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + protected synchronized void updateFriendsListAvatarInfo(java.util.ArrayList r12, com.ea.nimble.friends.NimbleFriendsList.FriendsListType r13, com.ea.nimble.friends.NimbleFriendsRefreshCallback r14, com.ea.nimble.friends.NimbleFriendsRefreshScope r15) { + /* + Method dump skipped, instructions count: 271 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.friends.NimbleFriendsListImpl.updateFriendsListAvatarInfo(java.util.ArrayList, com.ea.nimble.friends.NimbleFriendsList$FriendsListType, com.ea.nimble.friends.NimbleFriendsRefreshCallback, com.ea.nimble.friends.NimbleFriendsRefreshScope):void"); + } + + protected synchronized void updateFriendsListIdentityInfo(ArrayList arrayList, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshScope nimbleFriendsRefreshScope) { + ArrayList arrayList2 = new ArrayList<>(); + if (this.m_friends != null && this.m_friends.size() > 0) { + if (arrayList != null && arrayList.size() > 0) { + for (int i = 0; i < arrayList.size(); i++) { + NimbleUser nimbleUser = this.m_friends.get(arrayList.get(i).getExternalRefValue()); + if (nimbleUser != null && nimbleUser.getPid() == null) { + NimbleUser nimbleUser2 = new NimbleUser(nimbleUser); + nimbleUser2.setPid(arrayList.get(i).getPidId()); + nimbleUser2.setPersonaId(arrayList.get(i).getPersonaId()); + this.m_friends.put(arrayList.get(i).getExternalRefValue(), nimbleUser2); + arrayList2.add(nimbleUser2); + } + } + if (arrayList2.size() == 0) { + Log.Helper.LOGD(this, "No Pid Info updates were made to the Friends List", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_NOT_UPDATED, "No Pid Info updates were made to the Friends List", friendsListType); + return; + } + Log.Helper.LOGD(this, String.format("%d Friends were updated for Identity Scope", Integer.valueOf(arrayList2.size())), new Object[0]); + sendUpdateNotification(); + if (nimbleFriendsRefreshCallback != null) { + Log.Helper.LOGD(this, "Friends list was updated. Invoking the callback", new Object[0]); + NimbleFriendsRefreshResult nimbleFriendsRefreshResult = new NimbleFriendsRefreshResult(); + nimbleFriendsRefreshResult.m_success = true; + nimbleFriendsRefreshResult.m_error = null; + nimbleFriendsRefreshResult.m_userList = arrayList2; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } else { + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult); + } + } + return; + } + Log.Helper.LOGE(this, "Updated friends array is empty", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE, "Updated friends array is empty", friendsListType); + return; + } + Log.Helper.LOGE(this, "Current Friends list is empty. Unable to process the PID update", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY, "Current Friends list is empty. Unable to process the PID update", friendsListType); + } + + protected synchronized void updateFriendsListBasicInfo(JSONArray jSONArray, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo) { + ArrayList arrayList = new ArrayList<>(); + if (jSONArray != null && jSONArray.length() > 0) { + Log.Helper.LOGV(this, "Retrieved " + jSONArray.length() + "friends.", new Object[0]); + for (int i = 0; i < jSONArray.length(); i++) { + if (jSONArray.optJSONObject(i) != null) { + updateInternalCache(createNimbleUser(jSONArray.optJSONObject(i)), friendsListType, arrayList); + } + } + if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS) { + this.m_totalPlayedFriends = this.m_playedFriendsList.size(); + } else { + this.m_totalFriends = this.m_friendsList.size(); + } + if (nimbleFriendsRefreshCallback != null) { + Log.Helper.LOGD(this, "Friends list was updated. Invoking the callback", new Object[0]); + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult.m_success = true; + nimbleFriendsRangeRefreshResult.m_error = null; + nimbleFriendsRangeRefreshResult.m_userList = arrayList; + nimbleFriendsRangeRefreshResult.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + if (arrayList.size() > 0) { + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = true; + } else { + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = false; + } + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } else { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } + } + Log.Helper.LOGD(this, "Friends list was upodated, send the update notification", new Object[0]); + sendUpdateNotification(); + return; + } + Log.Helper.LOGD(this, "Even though the retrieval of Friends list was successful, the retrieved Friend list is empty", new Object[0]); + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult2 = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult2.m_success = true; + nimbleFriendsRangeRefreshResult2.m_error = null; + nimbleFriendsRangeRefreshResult2.m_userList = null; + nimbleFriendsRangeRefreshResult2.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult2.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + nimbleFriendsRangeRefreshResult2.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult2.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + } else { + nimbleFriendsRangeRefreshResult2.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + } + } + } + + protected synchronized void updateFriendsListBasicInfo(ArrayList arrayList, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo) { + ArrayList arrayList2 = new ArrayList<>(); + if (arrayList != null && arrayList.size() > 0) { + Log.Helper.LOGV(this, "Retrieved " + arrayList.size() + "friends.", new Object[0]); + for (int i = 0; i < arrayList.size(); i++) { + if (arrayList.get(i) != null) { + updateInternalCache(arrayList.get(i), friendsListType, arrayList2); + } + } + if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS) { + this.m_totalPlayedFriends = this.m_playedFriendsList.size(); + } else { + this.m_totalFriends = this.m_friendsList.size(); + } + if (nimbleFriendsRefreshCallback != null) { + Log.Helper.LOGD(this, "Friends list was updated. Invoking the callback", new Object[0]); + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult.m_success = true; + nimbleFriendsRangeRefreshResult.m_error = null; + nimbleFriendsRangeRefreshResult.m_userList = arrayList2; + nimbleFriendsRangeRefreshResult.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + if (arrayList2.size() > 0) { + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = true; + } else { + nimbleFriendsRangeRefreshResult.m_friendListEndInRefresh = false; + } + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } else { + nimbleFriendsRangeRefreshResult.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult); + } + } + Log.Helper.LOGD(this, "Friends list was upodated, send the update notification", new Object[0]); + sendUpdateNotification(); + return; + } + Log.Helper.LOGD(this, "Even though the retrieval of Friends list was successful, the retrieved Friend list is empty", new Object[0]); + if (nimbleFriendsRefreshCallback != null) { + NimbleFriendsRangeRefreshResult nimbleFriendsRangeRefreshResult2 = new NimbleFriendsRangeRefreshResult(); + nimbleFriendsRangeRefreshResult2.m_success = true; + nimbleFriendsRangeRefreshResult2.m_error = null; + nimbleFriendsRangeRefreshResult2.m_userList = null; + nimbleFriendsRangeRefreshResult2.m_startIndex = nimbleFriendsRefreshBasicInfo.getStartIndex(); + nimbleFriendsRangeRefreshResult2.m_size = nimbleFriendsRefreshBasicInfo.getRange(); + nimbleFriendsRangeRefreshResult2.m_friendListEndInRefresh = false; + if (friendsListType == NimbleFriendsList.FriendsListType.ALL_FRIENDS) { + nimbleFriendsRangeRefreshResult2.m_totalFriendCount = this.m_totalFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimbleFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + } else { + nimbleFriendsRangeRefreshResult2.m_totalFriendCount = this.m_totalPlayedFriends; + nimbleFriendsRefreshCallback.onCallback(this.m_nimblePlayedFriendsList, nimbleFriendsRefreshBasicInfo, nimbleFriendsRangeRefreshResult2); + } + } + } + + protected void sendUpdateNotification() { + HashMap hashMap = new HashMap(); + if (Base.getComponent("com.ea.nimble.identity") != null) { + hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, this.m_authenticatorId); + } else { + hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, this.m_authenticatorId); + } + Utility.sendBroadcast(INimbleFriends.NIMBLE_NOTIFICATION_FRIENDS_LIST_UPDATE, hashMap); + } + + protected synchronized void clear() { + if (this.m_friends != null) { + this.m_friends.clear(); + } + if (this.m_friendsList != null) { + this.m_friendsList.clear(); + } + if (this.m_playedFriendsList != null) { + this.m_playedFriendsList.clear(); + } + this.m_totalFriends = -1; + this.m_totalPlayedFriends = -1; + } + + protected void updateInternalCache(NimbleUser nimbleUser, NimbleFriendsList.FriendsListType friendsListType, ArrayList arrayList) { + if (this.m_friends == null || nimbleUser == null || nimbleUser.getUserId() == null) { + Log.Helper.LOGI(this, "updateInternalCache - Cannot update internal cache because the friend map or the new friend is null", new Object[0]); + return; + } + boolean z = friendsListType != NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS; + if (this.m_friends.get(nimbleUser.getUserId()) == null) { + if (z) { + nimbleUser.addedToAllFriends = true; + this.m_friendsList.add(nimbleUser.getUserId()); + if (nimbleUser.getPlayedCurrentGame() == NimbleUser.PlayedCurrentGameFlag.PLAYED) { + this.m_playedFriendsList.add(nimbleUser.getUserId()); + } + } else { + nimbleUser.addedToAllFriends = false; + this.m_playedFriendsList.add(nimbleUser.getUserId()); + } + this.m_friends.put(nimbleUser.getUserId(), nimbleUser); + arrayList.add(nimbleUser); + return; + } + NimbleUser nimbleUser2 = this.m_friends.get(nimbleUser.getUserId()); + if (z && !nimbleUser2.addedToAllFriends) { + nimbleUser.addedToAllFriends = true; + this.m_friends.put(nimbleUser.getUserId(), nimbleUser); + this.m_friendsList.add(nimbleUser.getUserId()); + } + if (nimbleUser2.isUserUpdated(nimbleUser)) { + nimbleUser.setPersonaId(nimbleUser2.getPersonaId()); + nimbleUser.setPid(nimbleUser2.getPid()); + nimbleUser.addedToAllFriends = nimbleUser2.addedToAllFriends; + nimbleUser.setRefreshTimestamp(new Date()); + this.m_friends.put(nimbleUser.getUserId(), nimbleUser); + arrayList.add(nimbleUser); + } + } + + private Error environmentCheck() { + Log.Helper.LOGV(this, "Environment Check -->", new Object[0]); + if (Network.getComponent().getStatus() != Network.Status.OK) { + Log.Helper.LOGD(this, "Environment Check - Network unavailable", new Object[0]); + return new Error(Error.Code.NETWORK_NO_CONNECTION, "Friends component cannot do updates without network"); + } + if (SynergyEnvironment.getComponent().isDataAvailable()) { + return null; + } + Log.Helper.LOGD(this, "Environment Check - Synergy Environment Not Ready", new Object[0]); + return new Error(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT, "Friends component is still in initialization and not ready for operation"); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListOrigin.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListOrigin.java new file mode 100644 index 0000000..5930561 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsListOrigin.java @@ -0,0 +1,473 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.HttpError; +import com.ea.nimble.HttpRequest; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import com.ea.nimble.Network; +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; +import java.util.ArrayList; +import java.util.Date; +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; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserFactory; + +/* loaded from: classes.dex */ +public class NimbleFriendsListOrigin extends NimbleFriendsListImpl { + private static String GET_FRIENDS_AVATAR_URI = "/avatar/user/%s/avatars"; + private static String GET_FRIENDS_URI_PARAMS = "/friends/2/users/%s/friends?start=%d&size=%d&names=%s"; + private NimbleFriendsError lastError = null; + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl, com.ea.nimble.LogSource + public /* bridge */ /* synthetic */ String getLogSourceTitle() { + return super.getLogSourceTitle(); + } + + NimbleFriendsListOrigin() { + this.LOG_SOURCE_TITLE = "NimbleFriendsListOrigin"; + this.m_authenticatorId = Global.NIMBLE_AUTHENTICATOR_ORIGIN; + Log.Helper.LOGV(this, "Constructed", new Object[0]); + this.m_pageSize = 20; + this.m_nimbleFriendsList = new NimbleFriendsList(this, NimbleFriendsList.FriendsListType.ALL_FRIENDS); + this.m_nimblePlayedFriendsList = new NimbleFriendsList(this, NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS); + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected void refreshFriendsListBasicInfo(final int i, final int i2, String str, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, final NimbleFriendsRefreshBasicInfo nimbleFriendsRefreshBasicInfo) { + Log.Helper.LOGFUNC(this); + if (friendsListType == NimbleFriendsList.FriendsListType.CURRENT_GAME_FRIENDS) { + Log.Helper.LOGE(this, "Origin Friends Service does not support getting friends with PlayedCurrentGame flag", new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_SCOPE_FRIENDS_LIST_TYPE_UNSUPPORTED, "Origin Friends Service does not support getting friends with PlayedCurrentGame flag", friendsListType); + return; + } + if (!isNimbleComponentAvailable("com.ea.nimble.identity")) { + Log.Helper.LOGE(this, "Unable to refresh friends Identity information because NimbleIdentity is not available", new Object[0]); + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to refresh friends Identity information because NimbleIdentity is not available", friendsListType); + return; + } + INimbleIdentity iNimbleIdentity = (INimbleIdentity) Base.getComponent("com.ea.nimble.identity"); + NimbleIdentityPidInfo pidInfo = iNimbleIdentity.getAuthenticatorById(this.m_authenticatorId).getPidInfo(); + final String pid = pidInfo != null ? pidInfo.getPid() : null; + if (!Utility.validString(pid)) { + invokeCallbackWithBasicScopeError(nimbleFriendsRefreshBasicInfo, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_AUTHENTICATOR_NOT_LOGGED_IN, "Origin PID for the current user is not available.", friendsListType); + } else { + 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 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 arrayList, NimbleFriendsList.FriendsListType friendsListType, NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback) { + Log.Helper.LOGFUNC(this); + Log.Helper.LOGI(this, "Origin Friends Service does not support IdentityInfo refresh because Origin friends already have Identity information", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_REFRESH_TYPE_UNSUPPORTED, "Origin Friends Service does not support IdentityInfo refresh because Origin friends already have Identity information", friendsListType); + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected void refreshFriendsListImageUrl(final List list, final NimbleFriendsList.FriendsListType friendsListType, final NimbleFriendsRefreshCallback nimbleFriendsRefreshCallback, final NimbleFriendsRefreshScope nimbleFriendsRefreshScope) { + if (!isNimbleComponentAvailable("com.ea.nimble.identity")) { + Log.Helper.LOGE(this, "Unable to refresh friends Avatar information because NimbleIdentity is not available", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to refresh friends Avatar information because NimbleIdentity is not available", friendsListType); + return; + } + INimbleIdentity iNimbleIdentity = (INimbleIdentity) Base.getComponent("com.ea.nimble.identity"); + if (iNimbleIdentity == null) { + Log.Helper.LOGE(this, "Identity Component not found. Not able to get friends Avatars.", new Object[0]); + invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Identity Component not found. Not able to get friends Avatars.", friendsListType); + } else { + 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 { + NimbleFriendsListOrigin.this.invokeCallbackWithScopeError(nimbleFriendsRefreshScope, nimbleFriendsRefreshCallback, error, friendsListType); + } + } + }); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void sendGosRefreshAvatarsRequest(String str, String str2, List 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 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 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 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 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 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 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 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 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 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; + } + + @Override // com.ea.nimble.friends.NimbleFriendsListImpl + protected NimbleUser createNimbleUser(JSONObject jSONObject) { + Log.Helper.LOGFUNC(this); + NimbleUser nimbleUser = new NimbleUser(); + try { + nimbleUser.setAuthenticatorId(this.m_authenticatorId); + nimbleUser.setDisplayName(jSONObject.optString("displayName", "")); + nimbleUser.setFriendType(jSONObject.optString("friendType", "")); + nimbleUser.setUserId(String.valueOf(jSONObject.optLong("userId"))); + nimbleUser.setPersonaId(String.valueOf(jSONObject.optLong("personaId"))); + nimbleUser.setPid(String.valueOf(jSONObject.optLong("userId"))); + if (jSONObject.optLong("timestamp", 0L) != 0) { + nimbleUser.setRefreshTimestamp(new Date(jSONObject.optLong("timestamp") * 1000)); + } + } catch (Exception e) { + Log.Helper.LOGW(this, String.format("Exception when parsing JSON for Friends. Message: %s", e.getMessage()), new Object[0]); + } + return nimbleUser; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRangeRefreshResult.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRangeRefreshResult.java new file mode 100644 index 0000000..94b16d2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRangeRefreshResult.java @@ -0,0 +1,25 @@ +package com.ea.nimble.friends; + +/* loaded from: classes.dex */ +public class NimbleFriendsRangeRefreshResult extends NimbleFriendsRefreshResult { + protected boolean m_friendListEndInRefresh; + protected int m_size; + protected int m_startIndex; + protected int m_totalFriendCount; + + public int getRefreshStartIndex() { + return this.m_startIndex; + } + + public int getRefreshSize() { + return this.m_size; + } + + public int getTotalFriendCount() { + return this.m_totalFriendCount; + } + + public boolean isFriendListEndInRefresh() { + return this.m_friendListEndInRefresh; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshBasicInfo.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshBasicInfo.java new file mode 100644 index 0000000..2cc92ec --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshBasicInfo.java @@ -0,0 +1,36 @@ +package com.ea.nimble.friends; + +/* loaded from: classes.dex */ +public class NimbleFriendsRefreshBasicInfo extends NimbleFriendsRefreshScope { + private boolean m_nextPage; + private int m_range; + private int m_startIndex; + + public NimbleFriendsRefreshBasicInfo() { + this.m_startIndex = -1; + this.m_range = -1; + this.m_nextPage = false; + this.m_nextPage = true; + } + + public NimbleFriendsRefreshBasicInfo(int i, int i2) { + this.m_startIndex = -1; + this.m_range = -1; + this.m_nextPage = false; + this.m_startIndex = i; + this.m_range = i2; + this.m_nextPage = false; + } + + int getStartIndex() { + return this.m_startIndex; + } + + int getRange() { + return this.m_range; + } + + boolean getNextPage() { + return this.m_nextPage; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshCallback.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshCallback.java new file mode 100644 index 0000000..9a792ec --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshCallback.java @@ -0,0 +1,6 @@ +package com.ea.nimble.friends; + +/* loaded from: classes.dex */ +public interface NimbleFriendsRefreshCallback { + void onCallback(NimbleFriendsList nimbleFriendsList, NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshResult nimbleFriendsRefreshResult); +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshIdentityInfo.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshIdentityInfo.java new file mode 100644 index 0000000..561c246 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshIdentityInfo.java @@ -0,0 +1,16 @@ +package com.ea.nimble.friends; + +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public class NimbleFriendsRefreshIdentityInfo extends NimbleFriendsRefreshScope { + private ArrayList userIds; + + public ArrayList getTargetedFriendIds() { + return this.userIds; + } + + public NimbleFriendsRefreshIdentityInfo(ArrayList arrayList) { + this.userIds = arrayList; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshImageUrl.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshImageUrl.java new file mode 100644 index 0000000..47caf60 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshImageUrl.java @@ -0,0 +1,16 @@ +package com.ea.nimble.friends; + +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public class NimbleFriendsRefreshImageUrl extends NimbleFriendsRefreshScope { + private ArrayList userIds; + + public ArrayList getTargetedFriendIds() { + return this.userIds; + } + + public NimbleFriendsRefreshImageUrl(ArrayList arrayList) { + this.userIds = arrayList; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshResult.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshResult.java new file mode 100644 index 0000000..d9cce44 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshResult.java @@ -0,0 +1,24 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Error; +import java.util.ArrayList; +import java.util.List; + +/* loaded from: classes.dex */ +public class NimbleFriendsRefreshResult { + protected Error m_error; + protected boolean m_success; + protected ArrayList m_userList = new ArrayList<>(); + + public boolean isSuccess() { + return this.m_success; + } + + public Error getError() { + return this.m_error; + } + + public List getUpdatedFriends() { + return this.m_userList; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshScope.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshScope.java new file mode 100644 index 0000000..3bb6675 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsRefreshScope.java @@ -0,0 +1,5 @@ +package com.ea.nimble.friends; + +/* loaded from: classes.dex */ +public abstract class NimbleFriendsRefreshScope { +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsServerCodeError.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsServerCodeError.java new file mode 100644 index 0000000..56b8992 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsServerCodeError.java @@ -0,0 +1,17 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Error; + +/* loaded from: classes.dex */ +public class NimbleFriendsServerCodeError extends Error { + public static final String NIMBLE_FRIENDS_SERVER_CODE_ERROR_DOMAIN = "NimbleFriendsServerCodeError"; + private static final long serialVersionUID = 1; + + public NimbleFriendsServerCodeError(int i, String str, Throwable th) { + super(NIMBLE_FRIENDS_SERVER_CODE_ERROR_DOMAIN, i, str, th); + } + + public NimbleFriendsServerCodeError(int i, String str) { + super(NIMBLE_FRIENDS_SERVER_CODE_ERROR_DOMAIN, i, str); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java new file mode 100644 index 0000000..153cc5b --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java @@ -0,0 +1,65 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.HttpError; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.friends.NimbleFriendsError; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Scanner; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class NimbleFriendsUtility { + protected static JSONArray cutJSONArray(JSONArray jSONArray, int i) { + return null; + } + + NimbleFriendsUtility() { + } + + protected static ArrayList parseJSONObjectToArrayOfUserInfo(JSONObject jSONObject) { + JSONArray optJSONArray; + if (jSONObject == null || jSONObject.optJSONObject("pidInfos") == null || (optJSONArray = jSONObject.optJSONObject("pidInfos").optJSONArray("pidInfo")) == null) { + return null; + } + ArrayList arrayList = new ArrayList<>(); + for (int i = 0; i < optJSONArray.length(); i++) { + try { + UserInfoFromIdentity userInfoFromIdentity = new UserInfoFromIdentity(optJSONArray.getJSONObject(i)); + if (userInfoFromIdentity.getPidId() != null && userInfoFromIdentity.getPidId() != "" && userInfoFromIdentity.getExternalRefValue() != null && userInfoFromIdentity.getExternalRefValue() != "") { + arrayList.add(userInfoFromIdentity); + } + } catch (JSONException unused) { + } + } + return arrayList; + } + + protected static boolean isNimbleComponentAvailable(String str) { + return Base.getComponent(str) != null; + } + + public static HashMap parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error { + 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", 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(); + if (next == null || next.length() <= 0) { + return null; + } + return (HashMap) new GsonBuilder().serializeNulls().create().fromJson(next, new TypeToken>() { // from class: com.ea.nimble.friends.NimbleFriendsUtility.1 + }.getType()); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsService.java b/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsService.java new file mode 100644 index 0000000..a3ff4e3 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsService.java @@ -0,0 +1,12 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Base; + +/* loaded from: classes.dex */ +public class NimbleOriginFriendsService { + public static final String NIMBLE_COMPONENT_ID_FRIENDS_ORIGIN = "com.ea.nimble.friends.originfriendsservice"; + + public static INimbleOriginFriendsService getComponent() { + return (INimbleOriginFriendsService) Base.getComponent(NIMBLE_COMPONENT_ID_FRIENDS_ORIGIN); + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsServiceImpl.java b/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsServiceImpl.java new file mode 100644 index 0000000..c81b293 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleOriginFriendsServiceImpl.java @@ -0,0 +1,1016 @@ +package com.ea.nimble.friends; + +import android.content.Intent; +import android.net.Uri; +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.HttpError; +import com.ea.nimble.HttpRequest; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +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; +import java.net.URL; +import java.util.ArrayList; +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; + +/* loaded from: classes.dex */ +public class NimbleOriginFriendsServiceImpl extends Component implements INimbleOriginFriendsService, LogSource { + private static int EMAIL_REQUEST_CODE = 6698; + private static final String GET_RECEIVED_INVITATION_LIST_URI = "/friends/2/users/%s/invitations/inbound"; + private static final String GET_SENT_INVITATION_LIST_URI = "/friends/2/users/%s/invitations/outbound"; + private static final String POST_SEND_FRIEND_INVITATION_URI = "/friends/2/users/%s/invitations/outbound/%s"; + private static final String RESPOND_TO_FRIEND_INVITATION_URI = "/friends/2/users/%s/invitations/inbound/%s"; + private static final String SEARCH_USER_BY_DISPLAY_NAME_URI = "/proxy/identity/personas?displayName=%s*"; + private static final String SEARCH_USER_BY_EMAIL_URI = "/proxy/identity/pids?email=%s"; + private static int SMS_REQUEST_CODE = 6697; + + enum UserSearchCriteria { + EMAIL, + DISPLAY_NAME + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return NimbleOriginFriendsService.NIMBLE_COMPONENT_ID_FRIENDS_ORIGIN; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "NimbleOriginFriendsService"; + } + + private static void initialize() { + Base.registerComponent(new NimbleOriginFriendsServiceImpl(), NimbleOriginFriendsService.NIMBLE_COMPONENT_ID_FRIENDS_ORIGIN); + } + + @Override // com.ea.nimble.Component + public void setup() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void suspend() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void resume() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void searchUserByEmail(String str, INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleUserSearchCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void searchUserByDisplayName(String str, INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleUserSearchCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void listFriendInvitationsSent(INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleUserSearchCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void listFriendInvitationsReceived(INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleUserSearchCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void sendFriendInvitation(String str, String str2, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleFriendInvitationCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void acceptFriendInvitation(String str, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleFriendInvitationCallback == null) { + 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); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void declineFriendInvitation(String str, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleFriendInvitationCallback == null) { + Log.Helper.LOGE(this, "Cannot process declineFriendInvitation request because callback is null", new Object[0]); + } else { + Log.Helper.LOGD(this, "Request: declineFriendInvitation", new Object[0]); + processRespondToFriendInvitationRequest(false, str, nimbleFriendInvitationCallback); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void sendInvitationOverEmail(ArrayList arrayList, String str, String str2, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (arrayList == null || arrayList.size() <= 0) { + Log.Helper.LOGE(this, "Target user emails is null or empty. Cannot send email invite.", new Object[0]); + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(false, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NO_TARGETS_PROVIDED, "Target user emails is null or empty. Cannot send email invite.")); + return; + } + return; + } + String[] strArr = arrayList != null ? (String[]) arrayList.toArray(new String[arrayList.size()]) : null; + if (str == null || str.length() <= 0) { + str = "Please accept my friend invitation"; + } + if (str2 == null || str2.length() <= 0) { + str2 = "Hi, I'll appreciate if you can accept my friend invitation."; + } + Intent intent = new Intent("android.intent.action.SEND"); + intent.setType("message/rfc822"); + intent.putExtra("android.intent.extra.EMAIL", strArr); + intent.putExtra("android.intent.extra.SUBJECT", str); + intent.putExtra("android.intent.extra.TEXT", str2); + try { + ApplicationEnvironment.getCurrentActivity().startActivityForResult(Intent.createChooser(intent, "Send mail using:"), EMAIL_REQUEST_CODE); + } catch (Exception unused) { + Log.Helper.LOGE(this, "Can not send email on this device", new Object[0]); + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(false, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_EMAIL_NOT_AVAILABLE, "Email is not available on this device")); + return; + } + } + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(true, null); + } + } + + @Override // com.ea.nimble.friends.INimbleOriginFriendsService + public void sendInvitationOverSMS(ArrayList arrayList, String str, INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (arrayList == null || arrayList.size() <= 0) { + Log.Helper.LOGE(this, "Target phone numbers is null or empty. Cannot send SMS invite.", new Object[0]); + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(false, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_NO_TARGETS_PROVIDED, "Target phone numbers is null or empty. Cannot send SMS invite.")); + return; + } + return; + } + StringBuilder sb = new StringBuilder(); + sb.append("smsto:"); + Iterator it = arrayList.iterator(); + while (it.hasNext()) { + sb.append(it.next()); + sb.append(";"); + } + sb.deleteCharAt(sb.length() - 1); + if (str == null || str.length() <= 0) { + str = "Hi, I'll appreciate if you can accept my friend invitation."; + } + Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse(sb.toString())); + intent.putExtra("sms_body", str); + try { + ApplicationEnvironment.getCurrentActivity().startActivityForResult(Intent.createChooser(intent, "Send sms using:"), SMS_REQUEST_CODE); + } catch (Exception unused) { + Log.Helper.LOGE(this, "Can not send sms on this device", new Object[0]); + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(false, new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SMS_NOT_AVAILABLE, "Sms is not available on this device")); + return; + } + } + if (nimbleFriendInvitationCallback != null) { + nimbleFriendInvitationCallback.onCallback(true, null); + } + } + + private void processSendFriendInvitationRequest(final String str, final String str2, final INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGFUNC(this); + if (!isNimbleComponentAvailable("com.ea.nimble.identity")) { + Log.Helper.LOGE(this, "Unable to send friend request because NimbleIdentity is not available", new Object[0]); + invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to send friend 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) { + invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, 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.1 + @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); + } else { + Log.Helper.LOGE(this, "Failed to refresh AccessToken - cannot send friend invitation request.", new Object[0]); + NimbleOriginFriendsServiceImpl.this.invokeFriendInvitationCallbackWithError(nimbleFriendInvitationCallback, error); + } + } + }); + } + } + + private void processRespondToFriendInvitationRequest(final boolean z, final String str, final INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGFUNC(this); + if (!isNimbleComponentAvailable("com.ea.nimble.identity")) { + Log.Helper.LOGE(this, "Unable to process request for responding to friend invitation because NimbleIdentity is not available", new Object[0]); + invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, NimbleFriendsError.Code.NIMBLE_FRIENDS_IDENTITY_NOT_AVAILABLE, "Unable to process request for responding to friend invitation 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) { + invokeFriendInvitationCallbackWithCode(nimbleFriendInvitationCallback, 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.2 + @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); + } 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); + } + } + }); + } + } + + 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"); + String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_IDENTITY_PROXY); + if (serverUrlWithKey == null || serverUrlWithKey.length() <= 0) { + return null; + } + 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 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 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 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 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; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void invokeUserSearchCallbackWithCode(INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback, NimbleFriendsError.Code code, String str) { + Log.Helper.LOGFUNC(this); + if (nimbleUserSearchCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke an error callback for Friends services because callback is null", new Object[0]); + } else { + nimbleUserSearchCallback.onCallback(null, new NimbleFriendsError(code, str)); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void invokeUserSearchCallbackWithError(INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback, Error error) { + Log.Helper.LOGFUNC(this); + if (nimbleUserSearchCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke an error callback for Friends services because callback is null", new Object[0]); + } else { + nimbleUserSearchCallback.onCallback(null, error); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void invokeUserSearchCallbackWithSuccess(INimbleOriginFriendsService.NimbleUserSearchCallback nimbleUserSearchCallback, ArrayList arrayList) { + Log.Helper.LOGFUNC(this); + if (nimbleUserSearchCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke a success callback for Friends services because callback is null", new Object[0]); + } else { + nimbleUserSearchCallback.onCallback(arrayList, null); + } + } + + private void invokeFriendInvitationCallbackWithCode(INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback, NimbleFriendsError.Code code, String str) { + Log.Helper.LOGFUNC(this); + if (nimbleFriendInvitationCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke an error callback for Friends services because callback is null", new Object[0]); + } else { + nimbleFriendInvitationCallback.onCallback(false, new NimbleFriendsError(code, str)); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void invokeFriendInvitationCallbackWithError(INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback, Error error) { + Log.Helper.LOGFUNC(this); + if (nimbleFriendInvitationCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke an error callback for Friends services because callback is null", new Object[0]); + } else { + nimbleFriendInvitationCallback.onCallback(false, error); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void invokeFriendInvitationCallbackWithSuccess(INimbleOriginFriendsService.NimbleFriendInvitationCallback nimbleFriendInvitationCallback) { + Log.Helper.LOGFUNC(this); + if (nimbleFriendInvitationCallback == null) { + Log.Helper.LOGW(this, "Unable to invoke a success callback for Friends services because callback is null", new Object[0]); + } else { + nimbleFriendInvitationCallback.onCallback(true, null); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public ArrayList parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error { + Log.Helper.LOGFUNC(this); + 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 friend invitation list 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 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 friend invitation list request. Code = %d, Message = %s", Integer.valueOf(optInt), optString), new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for friend invitation list request", new NimbleFriendsServerCodeError(optInt, optString)); + } + return null; + } + JSONArray optJSONArray = jSONObject.optJSONArray("entries"); + if (optJSONArray == null) { + JSONObject jSONObject2 = jSONObject.getJSONObject("error"); + if (jSONObject2 != null) { + int optInt2 = jSONObject2.optInt("code", -1); + String optString2 = jSONObject2.optString("type", ""); + Log.Helper.LOGE(this, String.format("Server error for friend invitation list request. Code = %d, Message = %s", Integer.valueOf(optInt2), optString2), new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for friend invitation list request", new NimbleFriendsServerCodeError(optInt2, optString2)); + } + Log.Helper.LOGE(this, "Unknown server error when retrieving GOS Friends.", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Unknown server error when retrieving GOS Friends."); + } + if (optJSONArray.length() <= 0) { + Log.Helper.LOGD(this, "No invitations found for your selected criteria", new Object[0]); + return arrayList; + } + if (optJSONArray != null && optJSONArray.length() > 0) { + for (int i = 0; i < optJSONArray.length(); i++) { + JSONObject jSONObject3 = optJSONArray.getJSONObject(i); + if (jSONObject3 != null) { + NimbleUser createNimbleUserFromGosJson = createNimbleUserFromGosJson(jSONObject3); + if (createNimbleUserFromGosJson.getUserId() != null && createNimbleUserFromGosJson.getUserId().length() > 0) { + arrayList.add(createNimbleUserFromGosJson); + } + } + } + } + return arrayList; + } catch (JSONException e) { + Log.Helper.LOGE(this, String.format("%s Error: %s", "Exception when parsing JSON response for friend invitation list request.", e.getMessage()), new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Exception when parsing JSON response for friend invitation list request.", e); + } + } + Log.Helper.LOGE(this, "Empty response data for friend invitation list request.", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Empty response data for friend invitation list request."); + } + + /* JADX INFO: Access modifiers changed from: private */ + public ArrayList parseUserSearchByEmailResponse(NetworkConnectionHandle networkConnectionHandle) throws Error { + NimbleUser createNimbleUserFromNexusJson; + Log.Helper.LOGFUNC(this); + 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 user search by email", 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 arrayList = new ArrayList<>(); + if (next != null && next.length() > 0) { + try { + JSONObject jSONObject = new JSONObject(next); + if (jSONObject.optJSONObject("error") != null) { + String jSONObject2 = jSONObject.optJSONObject("error").toString(); + if (jSONObject2 != null && jSONObject2.length() > 0) { + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for user search by email", new NimbleFriendsServerCodeError(-1, jSONObject2)); + } + return null; + } + JSONObject optJSONObject = jSONObject.optJSONObject("pids"); + if (optJSONObject != null) { + JSONArray optJSONArray = optJSONObject.optJSONArray("pid"); + if (optJSONArray != null && optJSONArray.length() > 0) { + for (int i = 0; i < optJSONArray.length(); i++) { + JSONObject optJSONObject2 = optJSONArray.optJSONObject(i); + if (optJSONObject2 != null && (createNimbleUserFromNexusJson = createNimbleUserFromNexusJson(optJSONObject2)) != null) { + arrayList.add(createNimbleUserFromNexusJson); + } + } + return arrayList; + } + Log.Helper.LOGD(this, "Search response indicates that no user was found with the email address that you searched for.", new Object[0]); + return arrayList; + } + Log.Helper.LOGE(this, "Unable to parse response from server for user search by email - no pids object found", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Unable to parse response from server for user search by email - no pids object found"); + } catch (JSONException e) { + Log.Helper.LOGE(this, String.format("%s Error: %s", "Exception when parsing JSON response for user search by email.", e.getMessage()), new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Exception when parsing JSON response for user search by email.", e); + } + } + Log.Helper.LOGE(this, "Empty response data for user search by email.", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Empty response data for user search by email."); + } + + /* JADX INFO: Access modifiers changed from: private */ + public ArrayList parseUserSearchByDisplayNameResponse(NetworkConnectionHandle networkConnectionHandle) throws Error { + NimbleUser createNimbleUserFromNexusJson; + Log.Helper.LOGFUNC(this); + 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 user search by display name", 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 arrayList = new ArrayList<>(); + if (next != null && next.length() > 0) { + try { + JSONObject jSONObject = new JSONObject(next); + if (jSONObject.optJSONObject("error") != null) { + String jSONObject2 = jSONObject.optJSONObject("error").toString(); + if (jSONObject2 != null && jSONObject2.length() > 0) { + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_CODE_ERROR, "Error response from server for user search by display name", new NimbleFriendsServerCodeError(-1, jSONObject2)); + } + return null; + } + JSONObject optJSONObject = jSONObject.optJSONObject("personas"); + if (optJSONObject != null) { + JSONArray optJSONArray = optJSONObject.optJSONArray("persona"); + if (optJSONArray != null && optJSONArray.length() > 0) { + for (int i = 0; i < optJSONArray.length(); i++) { + JSONObject optJSONObject2 = optJSONArray.optJSONObject(i); + if (optJSONObject2 != null && (createNimbleUserFromNexusJson = createNimbleUserFromNexusJson(optJSONObject2)) != null) { + arrayList.add(createNimbleUserFromNexusJson); + } + } + return arrayList; + } + Log.Helper.LOGD(this, "Search response indicates that no user was found with the display name prefix that you searched for.", new Object[0]); + return arrayList; + } + Log.Helper.LOGE(this, "Unable to parse response from server for user search by display name - no personas object found", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Unable to parse response from server for user search by display name - no personas object found"); + } catch (JSONException e) { + Log.Helper.LOGE(this, String.format("%s Error: %s", "Exception when parsing JSON response for user search by display name .", e.getMessage()), new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Exception when parsing JSON response for user search by display name .", e); + } + } + Log.Helper.LOGE(this, "Empty response data for user search by display name .", new Object[0]); + throw new NimbleFriendsError(NimbleFriendsError.Code.NIMBLE_FRIENDS_SERVER_INVALID_RESPONSE_ERROR, "Empty response data for user search by display name ."); + } + + private NimbleUser createNimbleUserFromGosJson(JSONObject jSONObject) { + Log.Helper.LOGFUNC(this); + NimbleUser nimbleUser = new NimbleUser(); + try { + nimbleUser.setAuthenticatorId(Global.NIMBLE_AUTHENTICATOR_ORIGIN); + nimbleUser.setDisplayName(jSONObject.optString("displayName", "")); + nimbleUser.setFriendType(jSONObject.optString("friendType", "")); + nimbleUser.setUserId(String.valueOf(jSONObject.optLong("userId", 0L))); + nimbleUser.setPersonaId(String.valueOf(jSONObject.optLong("personaId", 0L))); + nimbleUser.setPid(String.valueOf(jSONObject.optLong("userId", 0L))); + if (jSONObject.optLong("timestamp", 0L) == 0) { + return nimbleUser; + } + nimbleUser.setRefreshTimestamp(new Date(jSONObject.optLong("timestamp") * 1000)); + return nimbleUser; + } catch (Exception e) { + Log.Helper.LOGW(this, String.format("Exception when parsing JSON response. Message: %s", e.getMessage()), new Object[0]); + return null; + } + } + + private NimbleUser createNimbleUserFromNexusJson(JSONObject jSONObject) { + Log.Helper.LOGFUNC(this); + NimbleUser nimbleUser = new NimbleUser(); + try { + nimbleUser.setAuthenticatorId(Global.NIMBLE_AUTHENTICATOR_ORIGIN); + nimbleUser.setDisplayName(jSONObject.optString("displayName", "")); + nimbleUser.setFriendType(""); + nimbleUser.setUserId(String.valueOf(jSONObject.optLong("pidId", 0L))); + nimbleUser.setPersonaId(String.valueOf(jSONObject.optLong("personaId", 0L))); + nimbleUser.setPid(String.valueOf(jSONObject.optLong("pidId", 0L))); + if (jSONObject.optLong("timestamp", 0L) == 0) { + return nimbleUser; + } + nimbleUser.setRefreshTimestamp(new Date(jSONObject.optLong("timestamp") * 1000)); + return nimbleUser; + } catch (Exception e) { + Log.Helper.LOGW(this, String.format("Exception when parsing JSON response. Message: %s", e.getMessage()), new Object[0]); + return null; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleUser.java b/app/src/main/java/com/ea/nimble/friends/NimbleUser.java new file mode 100644 index 0000000..cc961bf --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/NimbleUser.java @@ -0,0 +1,201 @@ +package com.ea.nimble.friends; + +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; + +/* loaded from: classes.dex */ +public class NimbleUser { + protected boolean addedToAllFriends; + protected String authenticatorId; + protected String displayName; + protected Map extraInfo; + protected String friendType; + protected String imageUrl; + protected String personaId; + protected String pid; + protected PlayedCurrentGameFlag playedCurrentGame; + protected Date refreshTimestamp; + protected String userId; + + public enum PlayedCurrentGameFlag { + NOT_AVAILABLE, + PLAYED, + NOT_PLAYED + } + + public NimbleUser() { + this.playedCurrentGame = PlayedCurrentGameFlag.NOT_AVAILABLE; + this.addedToAllFriends = false; + } + + public NimbleUser(NimbleUser nimbleUser) { + this.playedCurrentGame = PlayedCurrentGameFlag.NOT_AVAILABLE; + this.addedToAllFriends = false; + this.displayName = nimbleUser.getDisplayName(); + this.authenticatorId = nimbleUser.getAuthenticatorId(); + this.userId = nimbleUser.getUserId(); + this.pid = nimbleUser.getPid(); + this.personaId = nimbleUser.getPersonaId(); + this.playedCurrentGame = nimbleUser.getPlayedCurrentGame(); + this.imageUrl = nimbleUser.getImageUrl(); + this.refreshTimestamp = nimbleUser.getRefreshTimestamp(); + this.friendType = nimbleUser.getFriendType(); + this.addedToAllFriends = nimbleUser.addedToAllFriends; + if (nimbleUser.getExtraInfo() == null) { + this.extraInfo = null; + } else { + this.extraInfo = new HashMap(nimbleUser.getExtraInfo()); + } + } + + public String getDisplayName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.displayName; + } + + protected void setDisplayName(String str) { + Log.Helper.LOGFUNC(this); + this.displayName = str; + } + + public String getAuthenticatorId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.authenticatorId; + } + + protected void setAuthenticatorId(String str) { + Log.Helper.LOGFUNC(this); + this.authenticatorId = str; + } + + public String getUserId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.userId; + } + + protected void setUserId(String str) { + Log.Helper.LOGFUNC(this); + this.userId = str; + } + + public String getPid() { + Log.Helper.LOGPUBLICFUNC(this); + return this.pid; + } + + protected void setPid(String str) { + Log.Helper.LOGFUNC(this); + this.pid = str; + } + + public PlayedCurrentGameFlag getPlayedCurrentGame() { + Log.Helper.LOGPUBLICFUNC(this); + return this.playedCurrentGame; + } + + protected void setPlayedCurrentGame(PlayedCurrentGameFlag playedCurrentGameFlag) { + Log.Helper.LOGFUNC(this); + this.playedCurrentGame = playedCurrentGameFlag; + } + + public String getImageUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return (this.authenticatorId == null || !this.authenticatorId.equals(Global.NIMBLE_AUTHENTICATOR_FACEBOOK) || this.userId == null || this.userId.length() <= 0) ? this.imageUrl : String.format("https://graph.facebook.com/%s/picture?type=normal", this.userId); + } + + protected void setImageUrl(String str) { + Log.Helper.LOGFUNC(this); + this.imageUrl = str; + } + + public Map getExtraInfo() { + Log.Helper.LOGPUBLICFUNC(this); + return this.extraInfo; + } + + protected void setExtraInfo(Map map) { + Log.Helper.LOGFUNC(this); + this.extraInfo = map; + } + + public String getPersonaId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.personaId; + } + + protected void setPersonaId(String str) { + Log.Helper.LOGFUNC(this); + this.personaId = str; + } + + public Date getRefreshTimestamp() { + Log.Helper.LOGPUBLICFUNC(this); + return this.refreshTimestamp; + } + + protected void setRefreshTimestamp(Date date) { + Log.Helper.LOGFUNC(this); + this.refreshTimestamp = date; + } + + public String getFriendType() { + Log.Helper.LOGPUBLICFUNC(this); + return this.friendType; + } + + protected void setFriendType(String str) { + Log.Helper.LOGFUNC(this); + this.friendType = str; + } + + boolean isUserUpdated(NimbleUser nimbleUser) { + Log.Helper.LOGFUNC(this); + boolean z = false; + if (nimbleUser == null) { + return false; + } + if (nimbleUser.getDisplayName() != null && nimbleUser.getDisplayName() != "" && (getDisplayName() == null || !nimbleUser.getDisplayName().equals(getDisplayName()))) { + z = true; + } + if (nimbleUser.getPid() != null && nimbleUser.getPid() != "" && (getPid() == null || !nimbleUser.getPid().equals(getPid()))) { + z = true; + } + if (nimbleUser.getPersonaId() != null && nimbleUser.getPersonaId() != "" && (getPersonaId() == null || !nimbleUser.getPersonaId().equals(getPersonaId()))) { + z = true; + } + if (nimbleUser.getImageUrl() != null && nimbleUser.getImageUrl() != "" && (getImageUrl() == null || !nimbleUser.getImageUrl().equals(getImageUrl()))) { + z = true; + } + if (nimbleUser.getPlayedCurrentGame() == null || (getPlayedCurrentGame() != null && nimbleUser.getPlayedCurrentGame().equals(getPlayedCurrentGame()))) { + return z; + } + return true; + } + + public String toString() { + String str; + String str2; + if (this.playedCurrentGame == PlayedCurrentGameFlag.PLAYED) { + str = "YES"; + } else if (this.playedCurrentGame == PlayedCurrentGameFlag.NOT_PLAYED) { + str = "NO"; + } else { + str = this.playedCurrentGame == PlayedCurrentGameFlag.NOT_AVAILABLE ? "NOT AVAILABLE" : "UNKNOWN"; + } + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); + str2 = simpleDateFormat.format(this.refreshTimestamp); + } catch (Exception unused) { + str2 = ""; + } + new String(); + return ("displayName(" + getDisplayName() + ") friendId(" + getUserId() + ") pid(" + this.pid + ") personaId(" + getPersonaId() + ") imageUrl(" + getImageUrl() + ") authenticatorId(" + getAuthenticatorId() + ") playedCurrentGame(" + str + ")refreshTimestamp(" + str2 + ")") + "ExtraInfo(" + (getExtraInfo() == null ? "" : getExtraInfo().toString()) + ") \n"; + } +} diff --git a/app/src/main/java/com/ea/nimble/friends/UserInfoFromIdentity.java b/app/src/main/java/com/ea/nimble/friends/UserInfoFromIdentity.java new file mode 100644 index 0000000..f1f4430 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/friends/UserInfoFromIdentity.java @@ -0,0 +1,28 @@ +package com.ea.nimble.friends; + +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class UserInfoFromIdentity { + private String externalRefValue; + private String personaId; + private String pidId; + + public UserInfoFromIdentity(JSONObject jSONObject) { + this.pidId = jSONObject.optString("pidId"); + this.personaId = jSONObject.optString("personaId"); + this.externalRefValue = jSONObject.optString("externalRefValue"); + } + + public String getPidId() { + return this.pidId; + } + + public String getPersonaId() { + return this.personaId; + } + + public String getExternalRefValue() { + return this.externalRefValue; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/AuthenticatorAnonymous.java b/app/src/main/java/com/ea/nimble/identity/AuthenticatorAnonymous.java new file mode 100644 index 0000000..910c4a7 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/AuthenticatorAnonymous.java @@ -0,0 +1,249 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.Network; +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.Timer; +import com.ea.nimble.Utility; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import com.ea.nimble.identity.NimbleIdentityError; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +class AuthenticatorAnonymous extends AuthenticatorBase { + private static final String ANONYMOUS_USER_NAME = "Guest"; + private static final double INITIAL_RETRY_TIME = 1.0d; + private static final double MAX_RETRY_TIME = 300.0d; + private static final String PID_TYPE = "mobile_upid"; + private static final String URL_TEMPLATE_ANONYMOUS_LOGIN = "%s/connect/auth?mobile_login_type=mobile_game_UPID&mobile_UPIDToken=%s&client_id=%s&response_type=code&redirect_uri=nucleus:rest"; + private static final String URL_TEMPLATE_ANONYMOUS_UPIDTOKEN = "%s/connect/upidtoken?client_id=%s"; + private String m_upidToken = ""; + private double m_currentRetryTime = INITIAL_RETRY_TIME; + private Timer m_retryTimer = new Timer(new Runnable() { // from class: com.ea.nimble.identity.AuthenticatorAnonymous.1 + @Override // java.lang.Runnable + public void run() { + AuthenticatorAnonymous.this.onRetryTimerExpired(); + } + }); + + private static void initialize() { + Log.Helper.LOGFUNCS("AuthenticatorAnonymous"); + AuthenticatorAnonymous authenticatorAnonymous = new AuthenticatorAnonymous(); + Base.registerComponent(authenticatorAnonymous, authenticatorAnonymous.getComponentId()); + } + + private AuthenticatorAnonymous() { + this.TAG = "AuthenticatorAnonymous"; + } + + @Override // com.ea.nimble.identity.AuthenticatorBase, com.ea.nimble.Component + public void suspend() { + super.suspend(); + this.m_retryTimer.cancel(); + this.m_currentRetryTime = INITIAL_RETRY_TIME; + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + public void restoreAuthenticator(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + this.m_userInfo.setUserName(ANONYMOUS_USER_NAME); + this.m_userInfo.setDisplayName(ANONYMOUS_USER_NAME); + loadUpidToken(); + super.restoreAuthenticator(nimbleIdentityAuthenticatorCallback); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public String getAuthenticatorId() { + Log.Helper.LOGPUBLICFUNC(this); + return Global.NIMBLE_AUTHENTICATOR_ANONYMOUS; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void login(NimbleIdentityLoginParams nimbleIdentityLoginParams, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + Log.Helper.LOGWS(this.TAG, "Anonymous authenticator is self-maintained, explicitly calling login on the anonymous authenticator does nothing.", new Object[0]); + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(this, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_UNSUPPORTED_ACTION, "Anonymous authenticator is self-maintained, explicitly calling login on the anonymous authenticator does nothing.")); + } + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void logout(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + Log.Helper.LOGWS(this.TAG, "Anonymous authenticator is self-maintained, explicitly calling logout on the anonymous authenticator does nothing.", new Object[0]); + NimbleIdentityError nimbleIdentityError = new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_UNSUPPORTED_ACTION, "Anonymous authenticator is self-maintained, explicitly calling logout on the anonymous authenticator does nothing."); + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(null, nimbleIdentityError); + } + } + + void logoutInternal(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + if (NimbleIdentityImpl.getComponent().getLoggedInAuthenticators().size() == 1) { + Log.Helper.LOGWS(this.TAG, "Attempting to logout the anonymous authenticator but it is the only one logged in. Aborting", new Object[0]); + } else { + cancelAuthentication(); + cleanAtLogout(nimbleIdentityAuthenticatorCallback); + } + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + void autoLogin() { + Log.Helper.LOGFUNC(this); + this.m_autoLoginAttempt = true; + login(null); + } + + private synchronized void login(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + this.m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING; + if (nimbleIdentityAuthenticatorCallback != null) { + this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + Log.Helper.LOGDS(this.TAG, "Anonymous Login", new Object[0]); + if (Utility.validString(this.m_upidToken)) { + Log.Helper.LOGVS(this.TAG, "Found cached UPID token %s, use it for login", this.m_upidToken); + exchangeUpidTokenForAuthCode(); + } else { + Log.Helper.LOGVS(this.TAG, "Request a new User PID token", new Object[0]); + getUpidToken(); + } + } + + @Override // com.ea.nimble.identity.AuthenticatorBase, com.ea.nimble.identity.INimbleIdentityAuthenticator + public void requestIdentityForFriends(ArrayList arrayList, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) { + Log.Helper.LOGPUBLICFUNC(this); + requestIdentityForFriends(PID_TYPE, arrayList, nimbleIdentityFriendsIdentityInfoCallback); + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + protected boolean isPlatformLoggedIn() { + Log.Helper.LOGFUNC(this); + return Utility.validString(this.m_upidToken); + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + protected void closeAuthentication(Error error) { + Log.Helper.LOGFUNC(this); + if (error != null && this.m_autoLoginAttempt) { + double d = this.m_currentRetryTime; + this.m_currentRetryTime = Math.min(this.m_currentRetryTime * 2.0d, 300.0d); + Log.Helper.LOGDS(this.TAG, "Auto login failed. Retrying in %.1f seconds", Double.valueOf(d)); + this.m_retryTimer.schedule(d, false); + return; + } + this.m_currentRetryTime = INITIAL_RETRY_TIME; + this.m_retryTimer.cancel(); + super.closeAuthentication(error); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onRetryTimerExpired() { + Log.Helper.LOGFUNC(this); + login(null); + } + + private synchronized void getUpidToken() { + Log.Helper.LOGFUNC(this); + try { + NimbleIdentityConfig configuration = getConfiguration(); + this.m_authenticateRequest = Network.getComponent().sendGetRequest(new URL(String.format(URL_TEMPLATE_ANONYMOUS_UPIDTOKEN, configuration.getConnectServerUrl(), configuration.getClientId())), new HashMap<>(), new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorAnonymous.2 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + Error error; + Exception error2 = networkConnectionHandle.getResponse().getError(); + if (error2 != null) { + if (error2 instanceof Error) { + error = (Error) error2; + } else { + error = new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Connection error", error2); + } + AuthenticatorAnonymous.this.closeAuthentication(error); + } + try { + String readStringFromStream = Utility.readStringFromStream(networkConnectionHandle.getResponse().getDataStream()); + synchronized (this) { + AuthenticatorAnonymous.this.m_upidToken = readStringFromStream; + AuthenticatorAnonymous.this.saveUpidToken(); + AuthenticatorAnonymous.this.exchangeUpidTokenForAuthCode(); + } + } catch (IOException unused) { + AuthenticatorAnonymous.this.closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Cannot read UPID token from server response")); + } + } + }); + } catch (MalformedURLException e) { + closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Received a malformed URL with exception e: " + e)); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public synchronized void exchangeUpidTokenForAuthCode() { + Log.Helper.LOGFUNC(this); + try { + NimbleIdentityConfig configuration = getConfiguration(); + this.m_authenticateRequest = Network.getComponent().sendGetRequest(new URL(String.format(URL_TEMPLATE_ANONYMOUS_LOGIN, configuration.getConnectServerUrl(), this.m_upidToken, configuration.getClientId())), new HashMap<>(), new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorAnonymous.3 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + String str = (String) parseBodyJSONData.get("code"); + if (!Utility.validString(str)) { + AuthenticatorAnonymous.this.closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Cannot read login OAuth code data from server response data " + parseBodyJSONData)); + return; + } + synchronized (this) { + AuthenticatorAnonymous.this.exchangeAuthCodeToToken(str); + } + } catch (Error e) { + AuthenticatorAnonymous.this.closeAuthentication(e); + } + } + }); + } catch (MalformedURLException e) { + closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Received a malformed URL with exception e: " + e)); + } + } + + private void loadUpidToken() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + this.m_upidToken = null; + return; + } + this.m_upidToken = persistenceForNimbleComponent.getStringValue("UpidToken"); + if (this.m_upidToken == null) { + this.m_upidToken = persistenceForNimbleComponent.getStringValue("upid_token"); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void saveUpidToken() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + if (!persistenceForNimbleComponent.getBackUp()) { + persistenceForNimbleComponent.setBackUp(true); + } + persistenceForNimbleComponent.setValue("UpidToken", this.m_upidToken); + persistenceForNimbleComponent.synchronize(); + } + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + protected void completeMigration() { + Log.Helper.LOGFUNC(this); + cleanAtLogout(null); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/AuthenticatorBase.java b/app/src/main/java/com/ea/nimble/identity/AuthenticatorBase.java new file mode 100644 index 0000000..b7f2e0f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/AuthenticatorBase.java @@ -0,0 +1,1294 @@ +package com.ea.nimble.identity; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.HttpRequest; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.INetwork; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.Timer; +import com.ea.nimble.Utility; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import com.ea.nimble.identity.NimbleIdentityError; +import com.ea.nimble.tracking.ITracking; +import com.ea.nimble.tracking.Tracking; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +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 { + private static final String AUTHORIZATION_KEY = "Authorization"; + private static final String DATA_CONTENT_TYPE_KEY = "Content-type"; + private static final String DATA_CONTENT_TYPE_VALUE = "application/x-www-form-urlencoded"; + private static final String DATA_TEMPLATE_LOGIN_WITH_OAUTH_CODE = "grant_type=authorization_code&code=%s&client_id=%s&client_secret=%s&redirect_uri=nucleus:rest"; + private static final String DATA_TEMPLATE_LOGIN_WITH_REFRESH_TOKEN = "grant_type=refresh_token&refresh_token=%s&client_id=%s&client_secret=%s&redirect_uri=nucleus:rest"; + private static final double DEFAULT_RETRY_INTERVAL = 60.0d; + private static final double EXPIRY_MARGIN_FOR_TIMER = 5.0d; + public static final String NIMBLE_IDENTITY_PERSISTENCE_TOKEN_SUFFIX = "nimble_identity_access_token"; + private static final String REQUEST_HEADER_PERSONA_INFO_EXTRA_FLAG = "X-Expand-Results"; + private static final String REQUEST_HEADER_PID_INFO_EXTRA_FLAG = "X-Include-Underage"; + private static final String REQUEST_HEADER_REFRESH_TOKEN_EXTRA_FLAG = "X-Include-RT-Time"; + private static final String REQUEST_HEADER_TRUE_VALUE = "true"; + private static final String URL_TEMPALTE_GET_IDENTITY_INFO_FOR_FRIENDS = "/proxy/identity/pids/personaextref/bulk"; + private static final String URL_TEMPLATE_GET_PERSONA_INFO = "%s/proxy/identity/pids/me/personas"; + private static final String URL_TEMPLATE_GET_PID_INFO = "%s/proxy/identity/pids/me"; + private static final String URL_TEMPLATE_LOGIN = "%s/connect/token"; + private static final String URL_TEMPLATE_LOGOUT = "%s/connect/clearsid?client_id=%s&access_token=%s"; + private static final String URL_TEMPLATE_REQUEST_SERVER_AUTHENTICATION_OAUTH_CODE = "%s/connect/auth?client_id=%s&response_type=code&access_token=%s&redirect_uri=nucleus:rest"; + protected NetworkConnectionHandle m_authenticateRequest; + protected boolean m_autoLoginAttempt; + private NetworkConnectionHandle m_personaRequest; + private ArrayList m_personas; + private NimbleIdentityPidInfo m_pidInfo; + private NetworkConnectionHandle m_pidInfoRequest; + private NimbleIdentityToken m_token; + protected INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE; + protected NimbleIdentityUserInfo m_userInfo = new NimbleIdentityUserInfo(); + protected ArrayList m_authenticateCallbacks = new ArrayList<>(); + private ArrayList m_userInfoCallbacks = new ArrayList<>(); + private ArrayList m_pidInfoCallbacks = new ArrayList<>(); + private ArrayList 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() { + AuthenticatorBase.this.onTokenRefreshTimer(); + } + }); + private Timer m_userProfileRefreshTimer = new Timer(new Runnable() { // from class: com.ea.nimble.identity.AuthenticatorBase.2 + @Override // java.lang.Runnable + public void run() { + AuthenticatorBase.this.onUserProfileRefreshTimer(); + } + }); + private Timer m_pidInfoRefreshTimer = new Timer(new Runnable() { // from class: com.ea.nimble.identity.AuthenticatorBase.3 + @Override // java.lang.Runnable + public void run() { + AuthenticatorBase.this.onPidInfoRefreshTimer(); + } + }); + private Timer m_personaRefreshTimer = new Timer(new Runnable() { // from class: com.ea.nimble.identity.AuthenticatorBase.4 + @Override // java.lang.Runnable + public void run() { + AuthenticatorBase.this.onPersonaRefreshTimer(); + } + }); + protected String TAG = "AuthenticatorBase"; + private BroadcastReceiver m_networkChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.identity.AuthenticatorBase.5 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + AuthenticatorBase.this.onNetworkChange(); + } + }; + protected BroadcastReceiver m_identityConfigChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.identity.AuthenticatorBase.6 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + AuthenticatorBase.this.onConfigurationChange(); + } + }; + + interface INimbleIdentityInternalServiceRequestCallback { + void onServiceComplete(Error error); + } + + abstract void autoLogin(); + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState getState() { + return this.m_state; + } + + void setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState nimbleIdentityAuthenticationState) { + if (nimbleIdentityAuthenticationState != this.m_state) { + this.m_state = nimbleIdentityAuthenticationState; + saveState(); + HashMap hashMap = new HashMap(); + hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, getAuthenticatorId()); + Utility.sendBroadcastSerializable(Global.NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE, hashMap); + } + } + + NimbleIdentityToken getAccessToken() { + return this.m_token; + } + + protected NimbleIdentityConfig getConfiguration() { + return NimbleIdentityImpl.getComponent().getConfiguration(); + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return this.TAG; + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return INimbleIdentityAuthenticator.AUTHENTICATOR_COMPONENT_PREFIX + getAuthenticatorId(); + } + + public void restoreAuthenticator(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_UNAVAILABLE) { + loadState(); + if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) { + loadToken(); + loadPidInfo(); + } + Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkChangeReceiver); + Utility.registerReceiver("nimble.notification.identity.configuration.change", this.m_identityConfigChangeReceiver); + resume(nimbleIdentityAuthenticatorCallback); + } + } + + @Override // com.ea.nimble.Component + public void suspend() { + cancelAuthentication(); + } + + @Override // com.ea.nimble.Component + public void resume() { + resume(null); + } + + private synchronized void resume(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) { + Log.Helper.LOGIS(this.TAG, "Skipping autoLogin for state NONE", new Object[0]); + return; + } + if (nimbleIdentityAuthenticatorCallback != null) { + this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + if (environmentCheck() != null) { + Log.Helper.LOGIS(this.TAG, "Authenticator %s resume failing - environment not ready.", getAuthenticatorId()); + return; + } + if (this.m_state == INimbleIdentityAuthenticator.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); + verifyAccessToken(); + return; + } else if (this.m_token.getRefreshTokenExpiryTime().after(new Date())) { + refreshToken(); + return; + } + } + autoLogin(); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void verifyAccessToken() { + Log.Helper.LOGPUBLICFUNC(this); + onVerifiedAccessToken(); + } + + protected void onVerifiedAccessToken() { + Log.Helper.LOGFUNC(this); + closeAuthentication(null); + getPidInfo(); + getPersonas(); + getUserInfo(); + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + Log.Helper.LOGFUNC(this); + Utility.unregisterReceiver(this.m_networkChangeReceiver); + Utility.unregisterReceiver(this.m_identityConfigChangeReceiver); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public NimbleIdentityUserInfo getUserInfo() { + NimbleIdentityUserInfo nimbleIdentityUserInfo; + Log.Helper.LOGPUBLICFUNC(this); + synchronized (this) { + nimbleIdentityUserInfo = this.m_userInfo; + if (this.m_userInfo == null || (this.m_userInfo.getExpiryTime() != null && this.m_userInfo.getExpiryTime().before(new Date()))) { + refreshUserProfile(null); + } + if (this.m_pidInfo == null || this.m_pidInfo.getExpiryTime().before(new Date())) { + refreshPidInfo(null); + } + } + return nimbleIdentityUserInfo; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void refreshUserInfo(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + refreshPidInfo(new INimbleIdentityAuthenticator.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) { + Log.Helper.LOGDS(AuthenticatorBase.this.TAG, "Received null callback in refreshUserInfo", new Object[0]); + } else if (error == null) { + AuthenticatorBase.this.refreshUserProfile(nimbleIdentityAuthenticatorCallback); + } else { + nimbleIdentityAuthenticatorCallback.onCallback(iNimbleIdentityAuthenticator, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_REFRESH_USER_INFO_FROM_PID_INFO, "Fail to refresh user info from pid info", error)); + } + } + }); + } + + /* JADX INFO: Access modifiers changed from: private */ + public synchronized void refreshUserProfile(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + Error environmentCheck = environmentCheck(); + if (environmentCheck != null) { + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(this, environmentCheck); + } + return; + } + Log.Helper.LOGVS(this.TAG, "Ready to refresh user profile", new Object[0]); + if (this.m_userProfileRefreshTimer.isRunning()) { + this.m_userProfileRefreshTimer.cancel(); + } + if (nimbleIdentityAuthenticatorCallback != null) { + this.m_pidInfoCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + updateUserProfile(); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + 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()))) { + 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()))) { + refreshPidInfo(null); + } + } + } + savePidInfo(); + return nimbleIdentityPidInfo; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void refreshPidInfo(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + prepare(new INimbleIdentityAuthenticator.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) { + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Ready to refresh pid info", new Object[0]); + synchronized (AuthenticatorBase.this) { + if (AuthenticatorBase.this.m_pidInfoRefreshTimer.isRunning()) { + AuthenticatorBase.this.m_pidInfoRefreshTimer.cancel(); + } + if (nimbleIdentityAuthenticatorCallback != null) { + AuthenticatorBase.this.m_pidInfoCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + AuthenticatorBase.this.updatePidInfo(); + } + return; + } + synchronized (AuthenticatorBase.this) { + if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + AuthenticatorBase.this.m_pidInfoRefreshTimer.schedule(60.0d, false); + } + if (nimbleIdentityAuthenticatorCallback != null) { + Log.Helper.LOGWS(AuthenticatorBase.this.TAG, "Persona refresh failed early because of error %s", error); + nimbleIdentityAuthenticatorCallback.onCallback(AuthenticatorBase.this, error); + } + } + } + }); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public List getPersonas() { + ArrayList arrayList; + 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())))) { + updatePersonas(); + } + } + return arrayList; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void refreshPersonas(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + prepare(new INimbleIdentityAuthenticator.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) { + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Ready to refresh persona info", new Object[0]); + synchronized (AuthenticatorBase.this) { + if (AuthenticatorBase.this.m_personaRefreshTimer.isRunning()) { + AuthenticatorBase.this.m_personaRefreshTimer.cancel(); + } + if (nimbleIdentityAuthenticatorCallback != null) { + AuthenticatorBase.this.m_personaCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + AuthenticatorBase.this.updatePersonas(); + } + return; + } + synchronized (AuthenticatorBase.this) { + if (AuthenticatorBase.this.getConfiguration().getAutoRefresh() && AuthenticatorBase.this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + AuthenticatorBase.this.m_personaRefreshTimer.schedule(60.0d, false); + } + if (nimbleIdentityAuthenticatorCallback != null) { + Log.Helper.LOGWS(AuthenticatorBase.this.TAG, "Persona refresh failed early because of error %s", error); + nimbleIdentityAuthenticatorCallback.onCallback(AuthenticatorBase.this, error); + } + } + } + }); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public NimbleIdentityPersona getPersonaByNamespace(String str, long j) { + Log.Helper.LOGPUBLICFUNC(this); + List personas = getPersonas(); + if (personas != null) { + for (NimbleIdentityPersona nimbleIdentityPersona : personas) { + if (nimbleIdentityPersona.getPersonaId() == j) { + if (nimbleIdentityPersona.getNamespaceName() != null && nimbleIdentityPersona.getNamespaceName().equals(str)) { + return nimbleIdentityPersona; + } + Log.Helper.LOGWS(this.TAG, "Try to get persona with persona id %d, but namespace %s doesn't match the asked for %s", Long.valueOf(nimbleIdentityPersona.getPersonaId()), nimbleIdentityPersona.getNamespaceName(), str); + return null; + } + } + } + return null; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public NimbleIdentityPersona getPersonaByNamespace(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + List personas = getPersonas(); + if (personas == null) { + return null; + } + for (NimbleIdentityPersona nimbleIdentityPersona : personas) { + if (nimbleIdentityPersona.getNamespaceName() != null && nimbleIdentityPersona.getNamespaceName().equals(str) && nimbleIdentityPersona.getName() != null && nimbleIdentityPersona.getName().equals(str2)) { + return nimbleIdentityPersona; + } + } + return null; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void requestAuthCode(final String str, final String str2, final INimbleIdentityAuthenticator.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 + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) { + URL url; + if (error == null) { + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Ready to request server auth code for serverId %s and scope %s", str, str2); + try { + String format = String.format(AuthenticatorBase.URL_TEMPLATE_REQUEST_SERVER_AUTHENTICATION_OAUTH_CODE, AuthenticatorBase.this.getConfiguration().getConnectServerUrl(), str, AuthenticatorBase.this.m_token.getAccessToken()); + if (Utility.validString(str2)) { + format = String.format("%s&scope=%s", format, str2); + } + url = new URL(format); + } catch (MalformedURLException unused) { + url = null; + } + Network.getComponent().sendGetRequest(url, new HashMap<>(), new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.10.1 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + String str3 = (String) parseBodyJSONData.get("code"); + if (!Utility.validString(str3)) { + Error error2 = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, String.format("Fail to parse oAuth code from server response data %s", parseBodyJSONData)); + Log.Helper.LOGDS(AuthenticatorBase.this.TAG, "Request for server auth code failed for error %s", error2); + nimbleIdentityServerAuthCodeCallback.onCallback(AuthenticatorBase.this, null, str, str2, error2); + } else { + Log.Helper.LOGDS(AuthenticatorBase.this.TAG, "Request for server auth code succeed with auth code: %s", str3); + nimbleIdentityServerAuthCodeCallback.onCallback(AuthenticatorBase.this, str3, str, str2, null); + } + } catch (Error e) { + Log.Helper.LOGDS(AuthenticatorBase.this.TAG, "Request for server auth code failed for error %s", e); + nimbleIdentityServerAuthCodeCallback.onCallback(AuthenticatorBase.this, null, str, str2, e); + } + } + }); + return; + } + Log.Helper.LOGDS(AuthenticatorBase.this.TAG, "Fail to get server authentication oauth code because of error %s", error); + nimbleIdentityServerAuthCodeCallback.onCallback(AuthenticatorBase.this, null, str, str2, error); + } + }); + } + } + + public void requestIdentityForFriends(ArrayList arrayList, INimbleIdentityAuthenticator.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) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleAuthenticatorAccessTokenCallback == null) { + Log.Helper.LOGW(this, "requestAccessToken API called without a callback. Aborting token refresh", new Object[0]); + return; + } + Log.Helper.LOGD(this, "requestAccessToken API called, proceeding with token refresh", new Object[0]); + if (this.m_token != null) { + if (!Utility.validString(this.m_token.getAccessToken())) { + nimbleAuthenticatorAccessTokenCallback.AccessTokenCallback(this, "", "", new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_UNAUTHENTICATED, "No tokens found for your authenticator")); + return; + } else if (this.m_token.getAccessTokenExpiryTime().after(new Date())) { + 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 + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) { + if (error == null) { + nimbleAuthenticatorAccessTokenCallback.AccessTokenCallback(AuthenticatorBase.this, AuthenticatorBase.this.m_token.getAccessToken(), AuthenticatorBase.this.m_token.getType(), null); + } else { + nimbleAuthenticatorAccessTokenCallback.AccessTokenCallback(AuthenticatorBase.this, "", "", error); + } + } + }); + return; + } + } + nimbleAuthenticatorAccessTokenCallback.AccessTokenCallback(this, "", "", new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_UNAUTHENTICATED, "No tokens found for your authenticator")); + } + + protected boolean isPlatformLoggedIn() { + Log.Helper.LOGFUNC(this); + return this.m_token != null && (this.m_token.getAccessTokenExpiryTime().after(new Date()) || this.m_token.getRefreshTokenExpiryTime().after(new Date())); + } + + 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); + } + return new Error(Error.Code.NETWORK_NO_CONNECTION, "Idenitity cannot work without network."); + } + NimbleIdentityConfig configuration = getConfiguration(); + if (configuration != null && configuration.isReady()) { + if (NimbleIdentityImpl.getComponent().getAuthenticationConductor() != null) { + return null; + } + return new Error(Error.Code.NOT_READY, "No authentication conductor has been set yet."); + } + return new Error(Error.Code.NOT_READY, "Identity is still in initialization and not ready for operation."); + } + + /* JADX WARN: Code restructure failed: missing block: B:29:0x0054, code lost: + + r2.m_authenticateCallbacks.add(r3); + */ + /* + 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) { + /* + r2 = this; + monitor-enter(r2) + com.ea.nimble.Log.Helper.LOGFUNC(r2) // Catch: java.lang.Throwable -> L64 + com.ea.nimble.Error r0 = r2.environmentCheck() // Catch: java.lang.Throwable -> L64 + if (r0 == 0) goto L11 + if (r3 == 0) goto Lf + r3.onCallback(r2, r0) // Catch: java.lang.Throwable -> L64 + Lf: + monitor-exit(r2) + return + L11: + com.ea.nimble.identity.INimbleIdentityAuthenticator$NimbleIdentityAuthenticationState r0 = r2.m_state // Catch: java.lang.Throwable -> L64 + com.ea.nimble.identity.INimbleIdentityAuthenticator$NimbleIdentityAuthenticationState r1 = com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING // Catch: java.lang.Throwable -> L64 + if (r0 == r1) goto L52 + com.ea.nimble.identity.NimbleIdentityToken r0 = r2.m_token // Catch: java.lang.Throwable -> L64 + if (r0 == 0) goto L52 + com.ea.nimble.identity.NimbleIdentityToken r0 = r2.m_token // Catch: java.lang.Throwable -> L64 + java.util.Date r0 = r0.getRefreshTokenExpiryTime() // Catch: java.lang.Throwable -> L64 + java.util.Date r1 = new java.util.Date // Catch: java.lang.Throwable -> L64 + r1.() // Catch: java.lang.Throwable -> L64 + boolean r0 = r0.before(r1) // Catch: java.lang.Throwable -> L64 + if (r0 == 0) goto L2d + goto L52 + L2d: + com.ea.nimble.identity.NimbleIdentityToken r0 = r2.m_token // Catch: java.lang.Throwable -> L64 + java.util.Date r0 = r0.getAccessTokenExpiryTime() // Catch: java.lang.Throwable -> L64 + java.util.Date r1 = new java.util.Date // Catch: java.lang.Throwable -> L64 + r1.() // Catch: java.lang.Throwable -> L64 + boolean r0 = r0.after(r1) // Catch: java.lang.Throwable -> L64 + if (r0 == 0) goto L46 + if (r3 == 0) goto L44 + r0 = 0 + r3.onCallback(r2, r0) // Catch: java.lang.Throwable -> L64 + L44: + monitor-exit(r2) + return + L46: + if (r3 == 0) goto L4d + java.util.ArrayList r0 = r2.m_authenticateCallbacks // Catch: java.lang.Throwable -> L64 + r0.add(r3) // Catch: java.lang.Throwable -> L64 + L4d: + r2.refreshToken() // Catch: java.lang.Throwable -> L64 + monitor-exit(r2) + return + L52: + if (r3 == 0) goto L59 + java.util.ArrayList r0 = r2.m_authenticateCallbacks // Catch: java.lang.Throwable -> L64 + r0.add(r3) // Catch: java.lang.Throwable -> L64 + L59: + com.ea.nimble.identity.INimbleIdentityAuthenticator$NimbleIdentityAuthenticationState r3 = r2.m_state // Catch: java.lang.Throwable -> L64 + com.ea.nimble.identity.INimbleIdentityAuthenticator$NimbleIdentityAuthenticationState r0 = com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING // Catch: java.lang.Throwable -> L64 + if (r3 == r0) goto L62 + r2.autoLogin() // Catch: java.lang.Throwable -> L64 + L62: + monitor-exit(r2) + return + L64: + r3 = move-exception + monitor-exit(r2) + throw r3 + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.identity.AuthenticatorBase.prepare(com.ea.nimble.identity.INimbleIdentityAuthenticator$NimbleIdentityAuthenticatorCallback):void"); + } + + protected void exchangeAuthCodeToToken(String str) { + Log.Helper.LOGFUNC(this); + NimbleIdentityConfig configuration = getConfiguration(); + exchangeDataForToken(String.format(DATA_TEMPLATE_LOGIN_WITH_OAUTH_CODE, str, configuration.getClientId(), configuration.getClientSecret())); + } + + protected void exchangeDataForToken(String str) { + URL url; + Log.Helper.LOGFUNC(this); + URL url2 = null; + try { + url = new URL(String.format(URL_TEMPLATE_LOGIN, getConfiguration().getConnectServerUrl())); + } catch (IOException unused) { + } + try { + byte[] bytes = str.getBytes(HTTP.UTF_8); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length); + byteArrayOutputStream.write(bytes); + HashMap hashMap = new HashMap<>(); + hashMap.put(DATA_CONTENT_TYPE_KEY, "application/x-www-form-urlencoded"); + hashMap.put(REQUEST_HEADER_REFRESH_TOKEN_EXTRA_FLAG, "true"); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.POST; + httpRequest.headers = hashMap; + httpRequest.data = byteArrayOutputStream; + synchronized (this) { + this.m_authenticateRequest = Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.12 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + AuthenticatorBase.this.onTokenResponse(networkConnectionHandle); + } + }); + } + } catch (IOException unused2) { + url2 = url; + Log.Helper.LOGFS("Network", "Malformed URL from %s", url2); + } + } + + private synchronized void refreshToken() { + Log.Helper.LOGFUNC(this); + if (this.m_tokenRefreshTimer.isRunning()) { + this.m_tokenRefreshTimer.cancel(); + } + setState(INimbleIdentityAuthenticator.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); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length); + byteArrayOutputStream.write(bytes); + HashMap hashMap = new HashMap<>(); + hashMap.put(DATA_CONTENT_TYPE_KEY, "application/x-www-form-urlencoded"); + hashMap.put(REQUEST_HEADER_REFRESH_TOKEN_EXTRA_FLAG, "true"); + HttpRequest httpRequest = new HttpRequest(url2); + httpRequest.method = IHttpRequest.Method.POST; + httpRequest.headers = hashMap; + httpRequest.data = byteArrayOutputStream; + httpRequest.runInBackground = true; + this.m_authenticateRequest = Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.13 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + if (networkConnectionHandle.getResponse().getError() == null) { + AuthenticatorBase.this.onTokenResponse(networkConnectionHandle); + } else { + AuthenticatorBase.this.autoLogin(); + } + } + }); + } catch (IOException unused) { + url = url2; + Log.Helper.LOGFS("Network", "Malformed URL from %s", url); + } + } catch (IOException unused2) { + } + } + + protected void cancelAuthentication() { + Log.Helper.LOGFUNC(this); + if (this.m_pidInfoRequest != null) { + this.m_pidInfoRequest.cancel(); + this.m_pidInfoRequest = null; + } + if (this.m_personaRequest != null) { + this.m_personaRequest.cancel(); + this.m_personaRequest = null; + } + if (this.m_state == INimbleIdentityAuthenticator.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); + } + } + + protected void closeAuthentication(Error error) { + ArrayList arrayList; + Log.Helper.LOGFUNC(this); + synchronized (this) { + this.m_authenticateRequest = null; + if (error == null) { + Log.Helper.LOGVS(this.TAG, "Authentication succeed!", new Object[0]); + Log.Helper.LOGWS(this.TAG, "\n\n\nAuthentication succeeded for %s\n\n\n", getAuthenticatorId()); + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null) { + ITracking iTracking = (ITracking) component; + HashMap hashMap = new HashMap(); + HashMap hashMap2 = new HashMap(); + HashMap pidMapInternal = NimbleIdentityImpl.getComponent().getPidMapInternal(); + for (String str : pidMapInternal.keySet()) { + if (str != null && !str.equals(getAuthenticatorId())) { + hashMap2.put(str, pidMapInternal.get(str)); + } + } + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGIN, Utility.convertObjectToJSONString(hashMap2)); + HashMap hashMap3 = new HashMap(); + NimbleIdentityPidInfo pidInfo = getPidInfo(); + if (pidInfo != null) { + hashMap3.put(getAuthenticatorId(), Utility.safeString(pidInfo.getPid())); + } else { + hashMap3.put(getAuthenticatorId(), ""); + } + 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); + if (getConfiguration().getAutoRefresh()) { + double time = this.m_token.getAccessTokenExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time); + this.m_tokenRefreshTimer.schedule((time / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } + NimbleIdentityImpl component2 = NimbleIdentityImpl.getComponent(); + if (component2 != null) { + NimbleIdentityAuthenticationConductorHandler authenticationConductor = component2.getAuthenticationConductor(); + if (authenticationConductor != null) { + authenticationConductor.handleLogin(this, this.m_autoLoginAttempt); + } else { + Log.Helper.LOGWS(this.TAG, "\n\n\n@@@@@@@@@@@@@@@@Attempting to login with no conductor registered!~!!!!!@@@@@@@@@@@@@\n\n\n", new Object[0]); + } + } + } 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); + } + arrayList = this.m_authenticateCallbacks; + this.m_authenticateCallbacks = new ArrayList<>(); + } + this.m_autoLoginAttempt = false; + Iterator it = arrayList.iterator(); + while (it.hasNext()) { + it.next().onCallback(this, error); + } + } + + protected void closeUserInfoUpdate(Error error, boolean z) { + ArrayList arrayList; + Log.Helper.LOGFUNC(this); + if (error == null) { + Log.Helper.LOGVS(this.TAG, "Updating user profile succeed!", new Object[0]); + } else { + Log.Helper.LOGES(this.TAG, "Fail to get user profile for error %s", error); + } + synchronized (this) { + if (z) { + try { + if (getConfiguration().getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.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); + this.m_userProfileRefreshTimer.schedule((time / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } else { + this.m_userProfileRefreshTimer.schedule(60.0d, false); + } + } + } catch (Throwable th) { + throw th; + } + } + arrayList = this.m_userInfoCallbacks; + this.m_userInfoCallbacks = new ArrayList<>(); + } + Iterator it = arrayList.iterator(); + while (it.hasNext()) { + it.next().onCallback(this, error); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void closePidInfoUpdate(Error error) { + ArrayList arrayList; + Log.Helper.LOGFUNC(this); + if (error == null) { + Log.Helper.LOGVS(this.TAG, "Updating pid information succeed!", new Object[0]); + } else { + Log.Helper.LOGES(this.TAG, "Fail to get pid information from Identity server for error %s", error); + } + synchronized (this) { + this.m_pidInfoRequest = null; + if (getConfiguration().getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + if (error == null) { + double time = this.m_pidInfo.getExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time); + this.m_pidInfoRefreshTimer.schedule((time / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } else { + this.m_pidInfoRefreshTimer.schedule(60.0d, false); + } + } + arrayList = this.m_pidInfoCallbacks; + this.m_pidInfoCallbacks = new ArrayList<>(); + } + Iterator it = arrayList.iterator(); + while (it.hasNext()) { + it.next().onCallback(this, error); + } + } + + protected void requestIdentityForFriends(String str, ArrayList arrayList, final INimbleIdentityAuthenticator.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]); + return; + } + HashMap hashMap = new HashMap(); + hashMap.put("pidType", str); + hashMap.put("clientId", getConfiguration().getClientId()); + hashMap.put("values", arrayList); + String convertObjectToJSONString = Utility.convertObjectToJSONString(hashMap); + synchronized (this) { + URL url = null; + try { + 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); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length); + byteArrayOutputStream.write(bytes); + String format = String.format("%s %s", this.m_token.getType(), this.m_token.getAccessToken()); + HashMap hashMap2 = new HashMap<>(); + hashMap2.put("Authorization", format); + hashMap2.put("Content-Type", "text/plain;charset=UTF-8"); + HttpRequest httpRequest = new HttpRequest(url2); + httpRequest.method = IHttpRequest.Method.POST; + httpRequest.headers = hashMap2; + httpRequest.data = byteArrayOutputStream; + INetwork component = Network.getComponent(); + if (component != null) { + component.sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.14 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + try { + nimbleIdentityFriendsIdentityInfoCallback.onCallback(AuthenticatorBase.this, NimbleIdentityUtility.parseJsonResponse(networkConnectionHandle), null); + } catch (Error e) { + nimbleIdentityFriendsIdentityInfoCallback.onCallback(AuthenticatorBase.this, null, e); + } + } + }); + } else { + Log.Helper.LOGES("Network", "Network Component was null!", new Object[0]); + } + } catch (IOException unused) { + url = url2; + Log.Helper.LOGFS("Network", "Malformed URL from %s", url); + } + } catch (IOException unused2) { + } + } catch (Throwable th) { + throw th; + } + } + } + + protected void updateUserProfile() { + Log.Helper.LOGFUNC(this); + this.m_userInfo.setExpiryTime(null); + closeUserInfoUpdate(null, false); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void updatePidInfo() { + Log.Helper.LOGFUNC(this); + if (this.m_pidInfoRequest != null) { + Log.Helper.LOGVS(this.TAG, "Pid info update in progress, skipping", new Object[0]); + return; + } + Log.Helper.LOGVS(this.TAG, "Updating pid info", new Object[0]); + try { + URL url = new URL(String.format(URL_TEMPLATE_GET_PID_INFO, getConfiguration().getProxyServerUrl())); + String format = String.format("%s %s", this.m_token.getType(), this.m_token.getAccessToken()); + HashMap hashMap = new HashMap<>(); + hashMap.put("Authorization", format); + hashMap.put(REQUEST_HEADER_PID_INFO_EXTRA_FLAG, "true"); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.GET; + httpRequest.headers = hashMap; + this.m_pidInfoRequest = Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.15 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + NimbleIdentityUserInfo m4clone; + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + Date date = new Date(System.currentTimeMillis() + ((long) (AuthenticatorBase.this.getConfiguration().getExpiryInterval() * 1000.0d))); + NimbleIdentityPidInfo nimbleIdentityPidInfo = new NimbleIdentityPidInfo(parseBodyJSONData, date); + if (Utility.validString(nimbleIdentityPidInfo.getPid())) { + if (nimbleIdentityPidInfo.equals(AuthenticatorBase.this.m_pidInfo)) { + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Update pid info succesfully, but nothing change.", new Object[0]); + AuthenticatorBase.this.m_pidInfo.setExpiryTime(date); + AuthenticatorBase.this.closePidInfoUpdate(null); + return; + } + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Update pid info successfully with new data.", new Object[0]); + if (AuthenticatorBase.this.m_userInfo == null) { + m4clone = new NimbleIdentityUserInfo(); + } else { + m4clone = AuthenticatorBase.this.m_userInfo.m4clone(); + } + m4clone.setPid(nimbleIdentityPidInfo.getPid()); + if (Utility.validString(nimbleIdentityPidInfo.getDob())) { + m4clone.setDateOfBirth(nimbleIdentityPidInfo.getDob()); + } + synchronized (AuthenticatorBase.this) { + AuthenticatorBase.this.m_pidInfo = nimbleIdentityPidInfo; + AuthenticatorBase.this.m_userInfo = m4clone; + } + AuthenticatorBase.this.closePidInfoUpdate(null); + HashMap hashMap2 = new HashMap(); + hashMap2.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, AuthenticatorBase.this.getAuthenticatorId()); + hashMap2.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_PIDMAP_ID, NimbleIdentityImpl.getComponent().getPidMapInternal()); + Utility.sendBroadcastSerializable(Global.NIMBLE_NOTIFICATION_IDENTITY_USER_INFO_UPDATE, hashMap2); + Utility.sendBroadcastSerializable(Global.NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE, hashMap2); + return; + } + AuthenticatorBase.this.closePidInfoUpdate(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Fail to parse valid pid information from server response data " + parseBodyJSONData)); + } catch (Error e) { + AuthenticatorBase.this.closePidInfoUpdate(e); + } + } + }); + } catch (MalformedURLException unused) { + Log.Helper.LOGFS("Network", "Malformed URL from %s", null); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void closePersonaUpdate(Error error) { + ArrayList arrayList; + double expiryInterval; + Log.Helper.LOGFUNC(this); + if (error == null) { + Log.Helper.LOGVS(this.TAG, "Updating persona information succeed!", new Object[0]); + } else { + Log.Helper.LOGES(this.TAG, "Fail to get persona from Identity server for error %s", error); + } + synchronized (this) { + this.m_personaRequest = null; + NimbleIdentityConfig configuration = getConfiguration(); + if (configuration.getAutoRefresh() && this.m_state == INimbleIdentityAuthenticator.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); + expiryInterval = (time / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER; + if (expiryInterval <= 0.0d) { + expiryInterval = 60.0d; + } + } else { + expiryInterval = configuration.getExpiryInterval(); + } + this.m_personaRefreshTimer.schedule(expiryInterval, false); + } + arrayList = this.m_personaCallbacks; + this.m_personaCallbacks = new ArrayList<>(); + } + Iterator it = arrayList.iterator(); + while (it.hasNext()) { + it.next().onCallback(this, error); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void updatePersonas() { + Log.Helper.LOGFUNC(this); + if (this.m_personaRequest != null) { + Log.Helper.LOGVS(this.TAG, "Persona update in progress, skipping", new Object[0]); + return; + } + Log.Helper.LOGVS(this.TAG, "Updating persona info", new Object[0]); + try { + URL url = new URL(String.format(URL_TEMPLATE_GET_PERSONA_INFO, getConfiguration().getProxyServerUrl())); + String format = String.format("%s %s", this.m_token.getType(), this.m_token.getAccessToken()); + HashMap hashMap = new HashMap<>(); + hashMap.put("Authorization", format); + hashMap.put(REQUEST_HEADER_PERSONA_INFO_EXTRA_FLAG, "true"); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.GET; + httpRequest.headers = hashMap; + this.m_personaRequest = Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.16 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + Map map = (Map) parseBodyJSONData.get("personas"); + if (map == null) { + AuthenticatorBase.this.closePersonaUpdate(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Fail to parse persona information from server response data " + parseBodyJSONData)); + return; + } + List list = (List) map.get("persona"); + if (list == null) { + AuthenticatorBase.this.closePersonaUpdate(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Fail to parse persona information from server response data " + parseBodyJSONData)); + return; + } + ArrayList arrayList = new ArrayList(); + Date date = new Date(System.currentTimeMillis() + ((long) (AuthenticatorBase.this.getConfiguration().getExpiryInterval() * 1000.0d))); + Iterator it = list.iterator(); + while (it.hasNext()) { + arrayList.add(new NimbleIdentityPersona((Map) it.next(), date)); + } + Log.Helper.LOGVS(AuthenticatorBase.this.TAG, "Update personas successfully with new data", new Object[0]); + synchronized (this) { + AuthenticatorBase.this.m_personas = arrayList; + } + AuthenticatorBase.this.closePersonaUpdate(null); + HashMap hashMap2 = new HashMap(); + hashMap2.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, AuthenticatorBase.this.getAuthenticatorId()); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_IDENTITY_PERSONA_INFO_UPDATE, hashMap2); + } catch (Error e) { + AuthenticatorBase.this.closePersonaUpdate(e); + } + } + }); + } catch (MalformedURLException unused) { + Log.Helper.LOGFS("Network", "Malformed URL from %s", null); + } + } + + synchronized void enableAutoRefresh(boolean z) { + Log.Helper.LOGFUNC(this); + if (z) { + if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + return; + } + if (!this.m_tokenRefreshTimer.isRunning() && this.m_authenticateRequest == null && this.m_token != null) { + double time = this.m_token.getAccessTokenExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time); + this.m_tokenRefreshTimer.schedule((time / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } + if (!this.m_userProfileRefreshTimer.isRunning() && this.m_userInfo != null && this.m_userInfo.getExpiryTime() != null) { + double time2 = this.m_userInfo.getExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time2); + this.m_userProfileRefreshTimer.schedule((time2 / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } + if (!this.m_pidInfoRefreshTimer.isRunning() && this.m_pidInfoRequest == null && this.m_pidInfo != null) { + double time3 = this.m_pidInfo.getExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time3); + this.m_pidInfoRefreshTimer.schedule((time3 / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } + if (!this.m_personaRefreshTimer.isRunning() && this.m_personaRequest == null && this.m_personas != null && this.m_personas.size() > 0) { + double time4 = this.m_personas.get(0).getExpiryTime().getTime() - System.currentTimeMillis(); + Double.isNaN(time4); + this.m_personaRefreshTimer.schedule((time4 / 1000.0d) - EXPIRY_MARGIN_FOR_TIMER, false); + } + } else { + if (this.m_tokenRefreshTimer.isRunning()) { + this.m_tokenRefreshTimer.cancel(); + } + if (this.m_pidInfoRefreshTimer.isRunning()) { + this.m_pidInfoRefreshTimer.cancel(); + } + if (this.m_personaRefreshTimer.isRunning()) { + this.m_personaRefreshTimer.cancel(); + } + } + } + + protected synchronized void cleanAtLogout(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + boolean z = true; + if (this.m_state == INimbleIdentityAuthenticator.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()))); + httpRequest.method = IHttpRequest.Method.GET; + Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.AuthenticatorBase.17 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + networkConnectionHandle.getResponse().getError(); + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(AuthenticatorBase.this, null); + } + } + }); + if (this.m_tokenRefreshTimer.isRunning()) { + this.m_tokenRefreshTimer.cancel(); + } + if (this.m_pidInfoRefreshTimer.isRunning()) { + this.m_pidInfoRefreshTimer.cancel(); + } + if (this.m_personaRefreshTimer.isRunning()) { + this.m_personaRefreshTimer.cancel(); + } + this.m_token = null; + saveToken(); + String pid = this.m_pidInfo != null ? this.m_pidInfo.getPid() : null; + boolean z2 = this.m_pidInfo != null; + this.m_pidInfo = null; + if (this.m_personas == null) { + z = false; + } + this.m_personas = null; + setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE); + Log.Helper.LOGDS(this.TAG, "Logout of authenticator " + getAuthenticatorId(), new Object[0]); + if (z2) { + HashMap hashMap = new HashMap(); + hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, getAuthenticatorId()); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE, hashMap); + } + if (z) { + HashMap hashMap2 = new HashMap(); + hashMap2.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, getAuthenticatorId()); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_IDENTITY_PERSONA_INFO_UPDATE, hashMap2); + } + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null && pid != null) { + HashMap hashMap3 = new HashMap(); + hashMap3.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGOUT, NimbleIdentityImpl.getComponent().getPidMapInternal().toString()); + HashMap hashMap4 = new HashMap(); + hashMap4.put(getAuthenticatorId(), pid); + hashMap3.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE, Utility.convertObjectToJSONString(hashMap4)); + ((ITracking) component).logEvent(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_LOGOUT, hashMap3); + } + NimbleIdentityAuthenticationConductorHandler authenticationConductor = NimbleIdentityImpl.getComponent().getAuthenticationConductor(); + if (authenticationConductor != null) { + authenticationConductor.handleLogout(this); + } + } 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); + 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); + } + NimbleIdentityAuthenticationConductorHandler authenticationConductor2 = NimbleIdentityImpl.getComponent().getAuthenticationConductor(); + if (authenticationConductor2 != null) { + authenticationConductor2.handleLogout(this); + } + } else { + setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onNetworkChange() { + Log.Helper.LOGFUNC(this); + INetwork component = Network.getComponent(); + if (component != null && component.getStatus() == Network.Status.OK) { + Log.Helper.LOGDS(this.TAG, "Identity resumes after network recovered.", new Object[0]); + resume(); + return; + } + if (this.m_state == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) { + cancelAuthentication(); + } + if (this.m_state != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE) { + setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onConfigurationChange() { + Log.Helper.LOGVS(this.TAG, "Identity resumes after configuration changed.", new Object[0]); + resume(); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onTokenResponse(NetworkConnectionHandle networkConnectionHandle) { + Log.Helper.LOGFUNC(this); + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + NimbleIdentityToken nimbleIdentityToken = new NimbleIdentityToken(parseBodyJSONData); + if (!Utility.validString(nimbleIdentityToken.getAccessToken()) || !Utility.validString(nimbleIdentityToken.getRefreshToken())) { + closeAuthentication(new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Fail to parse token from server response data " + parseBodyJSONData)); + return; + } + synchronized (this) { + this.m_pidInfoCallbacks.add(new INimbleIdentityAuthenticator.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); + } + }); + this.m_token = nimbleIdentityToken; + saveToken(); + updateUserProfile(); + updatePidInfo(); + updatePersonas(); + } + } catch (Error e) { + closeAuthentication(e); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onTokenRefreshTimer() { + Log.Helper.LOGFUNC(this); + synchronized (this) { + this.m_tokenRefreshTimer.cancel(); + } + refreshToken(); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onUserProfileRefreshTimer() { + Log.Helper.LOGFUNC(this); + refreshUserProfile(null); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onPidInfoRefreshTimer() { + Log.Helper.LOGFUNC(this); + refreshPidInfo(null); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onPersonaRefreshTimer() { + Log.Helper.LOGFUNC(this); + refreshPersonas(null); + } + + private void saveToken() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + return; + } + Log.Helper.LOGVS(this.TAG, "Saving token: " + this.m_token, new Object[0]); + persistenceForNimbleComponent.setValue("token", this.m_token); + } + + private void loadToken() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + this.m_token = null; + return; + } + this.m_token = (NimbleIdentityToken) persistenceForNimbleComponent.getValue("token"); + Log.Helper.LOGVS(this.TAG, "Loading token: " + this.m_token, new Object[0]); + } + + private void savePidInfo() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null || this.m_pidInfo == null) { + return; + } + persistenceForNimbleComponent.setValue("pidInfo", this.m_pidInfo); + persistenceForNimbleComponent.synchronize(); + Log.Helper.LOGDS(this.TAG, "Saved current pidInfo (pid = %s) for %s authenticator to persistence.", this.m_pidInfo.getPid(), getAuthenticatorId()); + } + + private void loadPidInfo() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + this.m_pidInfo = (NimbleIdentityPidInfo) persistenceForNimbleComponent.getValue("pidInfo"); + if (this.m_pidInfo != null) { + Log.Helper.LOGDS(this.TAG, "Restored existing pidInfo (pid = %s) for %s authenticator from persistence.", this.m_pidInfo.getPid(), getAuthenticatorId()); + HashMap hashMap = new HashMap(); + hashMap.put(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID, getAuthenticatorId()); + Utility.sendBroadcast(Global.NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE, hashMap); + return; + } + Log.Helper.LOGDS(this.TAG, "The previous Exception in Persistence while getting NimbleIdentityPidInfo can be safely ignored. A cached value for pidInfo does not exist or was stored in an older format. This value will instead be retrieved from the server.", new Object[0]); + } + } + + private void saveState() { + 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; + 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); + } + } + + private void loadState() { + Boolean bool; + 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; + Log.Helper.LOGVS(this.TAG, "Loaded state: OFFLINE", new Object[0]); + } else { + this.m_state = INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_NONE; + Log.Helper.LOGVS(this.TAG, "Loaded state: NONE", new Object[0]); + } + } + + protected void completeMigration() { + Log.Helper.LOGDS(this.TAG, "AuthenticatorBase complete migration called - has no implementation", new Object[0]); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java b/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java new file mode 100644 index 0000000..4251598 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java @@ -0,0 +1,293 @@ +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 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 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 + 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 arrayList, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) throws Exception { + Log.Helper.LOGPUBLICFUNC(this); + requestIdentityForFriends(PID_TYPE, arrayList, nimbleIdentityFriendsIdentityInfoCallback); + } + + @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 // 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 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 // 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")); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/AuthenticatorOrigin.java b/app/src/main/java/com/ea/nimble/identity/AuthenticatorOrigin.java new file mode 100644 index 0000000..9bc5117 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/AuthenticatorOrigin.java @@ -0,0 +1,102 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Base; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +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.util.ArrayList; + +/* loaded from: classes.dex */ +class AuthenticatorOrigin extends AuthenticatorBase { + private static final String DATA_TEMPLATE_LOGIN_WITH_ORIGIN_PASSWORD = "grant_type=password&client_id=%s&client_secret=%s&username=%s&password=%s&redirect_uri=nucleus:rest"; + private static final String PID_TYPE = "mobile_origin"; + + private static void initialize() { + Log.Helper.LOGFUNCS("AuthenticatorOrigin"); + AuthenticatorOrigin authenticatorOrigin = new AuthenticatorOrigin(); + Base.registerComponent(authenticatorOrigin, authenticatorOrigin.getComponentId()); + } + + private AuthenticatorOrigin() { + this.TAG = "AuthenticatorOrigin"; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public String getAuthenticatorId() { + Log.Helper.LOGPUBLICFUNC(this); + return Global.NIMBLE_AUTHENTICATOR_ORIGIN; + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void login(NimbleIdentityLoginParams nimbleIdentityLoginParams, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + if (nimbleIdentityLoginParams instanceof NimbleIdentityLoginParams.OriginCredentialsLoginParams) { + NimbleIdentityLoginParams.OriginCredentialsLoginParams originCredentialsLoginParams = (NimbleIdentityLoginParams.OriginCredentialsLoginParams) nimbleIdentityLoginParams; + if (!Utility.validString(originCredentialsLoginParams.getUsername()) || !Utility.validString(originCredentialsLoginParams.getPassword())) { + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(this, new Error(Error.Code.INVALID_ARGUMENT, "Invalid username/password for Origin login")); + return; + } + return; + } else { + synchronized (this) { + setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING); + if (nimbleIdentityAuthenticatorCallback != null) { + this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + loginOrigin(originCredentialsLoginParams.getUsername(), originCredentialsLoginParams.getPassword(), nimbleIdentityAuthenticatorCallback); + } + return; + } + } + if (!(nimbleIdentityLoginParams instanceof NimbleIdentityLoginParams.OriginOAuthCodeLoginParams)) { + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(this, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_INVALID_LOGINPARAMS, "Unrecognized login parameters")); + return; + } + return; + } + NimbleIdentityLoginParams.OriginOAuthCodeLoginParams originOAuthCodeLoginParams = (NimbleIdentityLoginParams.OriginOAuthCodeLoginParams) nimbleIdentityLoginParams; + if (!Utility.validString(originOAuthCodeLoginParams.getOauthCode())) { + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(this, new Error(Error.Code.INVALID_ARGUMENT, "Invalid auth code for Origin login")); + } + } else { + synchronized (this) { + setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING); + if (nimbleIdentityAuthenticatorCallback != null) { + this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback); + } + exchangeAuthCodeToToken(originOAuthCodeLoginParams.getOauthCode()); + } + } + } + + private void loginOrigin(String str, String str2, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGFUNC(this); + NimbleIdentityConfig configuration = getConfiguration(); + exchangeDataForToken(String.format(DATA_TEMPLATE_LOGIN_WITH_ORIGIN_PASSWORD, configuration.getClientId(), configuration.getClientSecret(), str, str2)); + } + + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator + public void logout(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + cancelAuthentication(); + cleanAtLogout(nimbleIdentityAuthenticatorCallback); + } + + @Override // com.ea.nimble.identity.AuthenticatorBase + void autoLogin() { + closeAuthentication(new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_SESSION_EXPIRED, "Cannot auto login for origin after session expired")); + } + + @Override // com.ea.nimble.identity.AuthenticatorBase, com.ea.nimble.identity.INimbleIdentityAuthenticator + public void requestIdentityForFriends(ArrayList arrayList, INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) { + Log.Helper.LOGPUBLICFUNC(this); + requestIdentityForFriends(PID_TYPE, arrayList, nimbleIdentityFriendsIdentityInfoCallback); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentity.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentity.java new file mode 100644 index 0000000..3684375 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentity.java @@ -0,0 +1,38 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface INimbleIdentity { + public static final String EXTRA_NIMBLE_IDENTITY_AUTOREFRESH_VALUE = "nimble.identity.extra.autorefresh.value"; + public static final String MIGRATION_PERSISTENCE_ID = "nimble.notification.identity.migraiton"; + public static final String NIMBLE_COMPONENT_ID_IDENTITY = "com.ea.nimble.identity"; + public static final String NIMBLE_NOTIFICATION_IDENTITY_UPDATE = "nimble.notification.identity.update"; + public static final String NOTIFICATION_NIMBLE_IDENTITY_AUTOREFRESH_CHANGE = "nimble.identity.notification.autorefresh_changed"; + + public enum NimbleIdentityState { + NIMBLE_IDENTITY_READY, + NIMBLE_IDENTITY_AUTHENTICATING, + NIMBLE_IDENTITY_UNAVAILABLE + } + + INimbleIdentityAuthenticator getAuthenticatorById(String str); + + List getAuthenticators(); + + boolean getAutoRefreshFlag(); + + List getLoggedInAuthenticators(); + + Map getPidMap(); + + NimbleIdentityState getState(); + + void requestServerAuthCodeForLegacyOriginToken(String str, String str2, String str3, INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback nimbleIdentityServerAuthCodeCallback); + + void setAuthenticationConductor(INimbleIdentityAuthenticationConductor iNimbleIdentityAuthenticationConductor); + + void setAutoRefreshFlag(boolean z); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticationConductor.java new file mode 100644 index 0000000..5b9223e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticationConductor.java @@ -0,0 +1,5 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +public interface INimbleIdentityAuthenticationConductor { +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticator.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticator.java new file mode 100644 index 0000000..fbde5fd --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityAuthenticator.java @@ -0,0 +1,67 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Error; +import java.util.ArrayList; +import java.util.List; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public interface INimbleIdentityAuthenticator { + public static final String AUTHENTICATOR_COMPONENT_PREFIX = "com.ea.nimble.identity.authenticator."; + + public interface NimbleAuthenticatorAccessTokenCallback { + void AccessTokenCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str, String str2, Error error); + } + + public enum NimbleIdentityAuthenticationState { + NIMBLE_IDENTITY_AUTHENTICATION_UNAVAILABLE, + NIMBLE_IDENTITY_AUTHENTICATION_NONE, + NIMBLE_IDENTITY_AUTHENTICATION_GOING, + NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS, + NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE + } + + public interface NimbleIdentityAuthenticatorCallback { + void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error); + } + + public interface NimbleIdentityFriendsIdentityInfoCallback { + void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, JSONObject jSONObject, Error error); + } + + public interface NimbleIdentityServerAuthCodeCallback { + void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str, String str2, String str3, Error error); + } + + String getAuthenticatorId(); + + NimbleIdentityPersona getPersonaByNamespace(String str, long j); + + NimbleIdentityPersona getPersonaByNamespace(String str, String str2); + + List getPersonas(); + + NimbleIdentityPidInfo getPidInfo(); + + NimbleIdentityAuthenticationState getState(); + + NimbleIdentityUserInfo getUserInfo(); + + void login(NimbleIdentityLoginParams nimbleIdentityLoginParams, NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void logout(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void refreshPersonas(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void refreshPidInfo(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void refreshUserInfo(NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void requestAccessToken(NimbleAuthenticatorAccessTokenCallback nimbleAuthenticatorAccessTokenCallback); + + void requestAuthCode(String str, String str2, NimbleIdentityServerAuthCodeCallback nimbleIdentityServerAuthCodeCallback); + + void requestIdentityForFriends(ArrayList arrayList, NimbleIdentityFriendsIdentityInfoCallback nimbleIdentityFriendsIdentityInfoCallback) throws Exception; + + void verifyAccessToken(); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericAuthenticationConductor.java new file mode 100644 index 0000000..d6fe53a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericAuthenticationConductor.java @@ -0,0 +1,8 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +public interface INimbleIdentityGenericAuthenticationConductor extends INimbleIdentityAuthenticationConductor { + void handleLogin(INimbleIdentityGenericLoginResolver iNimbleIdentityGenericLoginResolver); + + void handleLogout(INimbleIdentityGenericLogoutResolver iNimbleIdentityGenericLogoutResolver); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLoginResolver.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLoginResolver.java new file mode 100644 index 0000000..0b4b81d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLoginResolver.java @@ -0,0 +1,17 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.List; + +/* loaded from: classes.dex */ +public interface INimbleIdentityGenericLoginResolver { + List getLoggedInAuthenticatorIds(); + + String getLoggingInAuthenticatorId(); + + void highlight(); + + void ignore(); + + void switchAuthenticators(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLogoutResolver.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLogoutResolver.java new file mode 100644 index 0000000..2a2b073 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityGenericLogoutResolver.java @@ -0,0 +1,12 @@ +package com.ea.nimble.identity; + +import java.util.List; + +/* loaded from: classes.dex */ +public interface INimbleIdentityGenericLogoutResolver { + String getLoggingOutAuthenticatorId(); + + List getStillLoggedInAuthenticatorIds(); + + void resolve(String str); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationAuthenticationConductor.java new file mode 100644 index 0000000..a7fc903 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationAuthenticationConductor.java @@ -0,0 +1,10 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +public interface INimbleIdentityMigrationAuthenticationConductor extends INimbleIdentityAuthenticationConductor { + void handleLogin(INimbleIdentityMigrationLoginResolver iNimbleIdentityMigrationLoginResolver); + + void handleLogout(); + + void handlePendingMigration(INimbleIdentityPendingMigrationResolver iNimbleIdentityPendingMigrationResolver); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLoginResolver.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLoginResolver.java new file mode 100644 index 0000000..952263f --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLoginResolver.java @@ -0,0 +1,17 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.List; + +/* loaded from: classes.dex */ +public interface INimbleIdentityMigrationLoginResolver { + List getLoggedInAuthenticatorIds(); + + String getLoggingInAuthenticatorId(); + + void ignore(); + + void migrate(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); + + void switchAuthenticators(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLogoutResolver.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLogoutResolver.java new file mode 100644 index 0000000..fd0b251 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityMigrationLogoutResolver.java @@ -0,0 +1,12 @@ +package com.ea.nimble.identity; + +import java.util.List; + +/* loaded from: classes.dex */ +public interface INimbleIdentityMigrationLogoutResolver { + String getLoggingOutAuthenticatorId(); + + List getStillLoggedInAuthenticatorIds(); + + void resolve(String str); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPendingMigrationResolver.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPendingMigrationResolver.java new file mode 100644 index 0000000..ecde774 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPendingMigrationResolver.java @@ -0,0 +1,12 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.identity.INimbleIdentityAuthenticator; + +/* loaded from: classes.dex */ +public interface INimbleIdentityPendingMigrationResolver { + String getMigrationSourceAuthenticatorId(); + + String getMigrationTargetAuthenticatorId(); + + void resume(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback); +} diff --git a/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPlainAuthenticationConductor.java b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPlainAuthenticationConductor.java new file mode 100644 index 0000000..9188317 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/INimbleIdentityPlainAuthenticationConductor.java @@ -0,0 +1,8 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +public interface INimbleIdentityPlainAuthenticationConductor extends INimbleIdentityAuthenticationConductor { + void handleLogin(); + + void handleLogout(); +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentity.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentity.java new file mode 100644 index 0000000..0eb6f4a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentity.java @@ -0,0 +1,12 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Base; + +/* loaded from: classes.dex */ +public class NimbleIdentity { + public static final String COMPONENT_ID = "com.ea.nimble.identity"; + + public static INimbleIdentity getComponent() { + return (INimbleIdentity) Base.getComponent("com.ea.nimble.identity"); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityAuthenticationConductorHandler.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityAuthenticationConductorHandler.java new file mode 100644 index 0000000..f14a073 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityAuthenticationConductorHandler.java @@ -0,0 +1,8 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +interface NimbleIdentityAuthenticationConductorHandler { + void handleLogin(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, boolean z); + + void handleLogout(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator); +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityConfig.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityConfig.java new file mode 100644 index 0000000..ca3b2b5 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityConfig.java @@ -0,0 +1,141 @@ +package com.ea.nimble.identity; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.NimbleApplicationConfiguration; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.Utility; + +/* loaded from: classes.dex */ +class NimbleIdentityConfig implements LogSource { + private static final double DEFAULT_DATA_EXPIRY_INTERVAL = 3600.0d; + private static final String META_DATA_TAG_CLIENT_ID = "com.ea.nimble.identity.client_id"; + private static final String META_DATA_TAG_CLIENT_SECRET = "com.ea.nimble.identity.client_secret"; + static final String NOTIFICATION_IDENTITY_CONFIGURATION_CHANGE = "nimble.notification.identity.configuration.change"; + private boolean m_autoRefresh; + private String m_clientId; + private String m_clientSecret; + private String m_connectServerUrl; + private String m_portalServerUrl; + private String m_proxyServerUrl; + private boolean m_ready; + private double m_expiryInterval = DEFAULT_DATA_EXPIRY_INTERVAL; + private BroadcastReceiver m_receiver = new BroadcastReceiver() { // from class: com.ea.nimble.identity.NimbleIdentityConfig.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleIdentityConfig.this.onUpdate(); + } + }; + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Identity"; + } + + NimbleIdentityConfig() { + } + + public boolean isReady() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_ready; + } + + public boolean getAutoRefresh() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_autoRefresh; + } + + public void setAutoRefresh(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_autoRefresh = z; + } + + public String getConnectServerUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_connectServerUrl; + } + + public String getProxyServerUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_proxyServerUrl; + } + + public String getPortalServerUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_portalServerUrl; + } + + public String getClientId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_clientId; + } + + public String getClientSecret() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_clientSecret; + } + + public double getExpiryInterval() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_expiryInterval; + } + + void initialize() { + this.m_ready = false; + this.m_autoRefresh = false; + if (SynergyEnvironment.getComponent().isDataAvailable()) { + onUpdate(); + } + Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED, this.m_receiver); + Log.Helper.LOGV(this, "Configuration initiailized", new Object[0]); + } + + void uninitialize() { + Utility.unregisterReceiver(this.m_receiver); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onUpdate() { + String configValueAsString; + String configValueAsString2; + Log.Helper.LOGFUNC(this); + String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_IDENTITY_CONNECT); + String serverUrlWithKey2 = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_IDENTITY_PROXY); + String serverUrlWithKey3 = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_IDENTITY_PORTAL); + if (!Utility.validString(serverUrlWithKey) || !Utility.validString(serverUrlWithKey2) || !Utility.validString(serverUrlWithKey3)) { + Log.Helper.LOGE(this, "Synergy environment update without valid server urls", new Object[0]); + return; + } + if (serverUrlWithKey.endsWith("/")) { + serverUrlWithKey = serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1); + } + if (serverUrlWithKey2.endsWith("/")) { + serverUrlWithKey2 = serverUrlWithKey2.substring(0, serverUrlWithKey2.length() - 1); + } + if (serverUrlWithKey3.endsWith("/")) { + serverUrlWithKey3 = serverUrlWithKey3.substring(0, serverUrlWithKey3.length() - 1); + } + String nexusClientId = SynergyEnvironment.getComponent().getNexusClientId(); + if (!Utility.validString(nexusClientId) && (configValueAsString2 = NimbleApplicationConfiguration.getConfigValueAsString(META_DATA_TAG_CLIENT_ID)) != null && configValueAsString2.length() > 0) { + nexusClientId = configValueAsString2; + } + String nexusClientSecret = SynergyEnvironment.getComponent().getNexusClientSecret(); + if (!Utility.validString(nexusClientSecret) && (configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(META_DATA_TAG_CLIENT_SECRET)) != null && configValueAsString.length() > 0) { + nexusClientSecret = configValueAsString; + } + this.m_ready = true; + if (serverUrlWithKey.equals(this.m_connectServerUrl) && serverUrlWithKey2.equals(this.m_proxyServerUrl) && serverUrlWithKey3.equals(this.m_portalServerUrl) && nexusClientId.equals(this.m_clientId) && nexusClientSecret.equals(this.m_clientSecret)) { + return; + } + this.m_connectServerUrl = serverUrlWithKey; + this.m_proxyServerUrl = serverUrlWithKey2; + this.m_portalServerUrl = serverUrlWithKey3; + this.m_clientId = nexusClientId; + this.m_clientSecret = nexusClientSecret; + Utility.sendBroadcast(NOTIFICATION_IDENTITY_CONFIGURATION_CHANGE); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityError.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityError.java new file mode 100644 index 0000000..0ec98f8 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityError.java @@ -0,0 +1,77 @@ +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 */ +public class NimbleIdentityError extends Error { + public static final String NIMBLE_IDENTITY_ERROR_DOMAIN = "NimbleIdentityError"; + private static final long serialVersionUID = 1; + + public enum NimbleIdentityErrorCode { + NIMBLE_IDENTITY_ERROR_USER_CANCELLED(100), + 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_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_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); + + private int m_value; + + NimbleIdentityErrorCode(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public NimbleIdentityError(NimbleIdentityErrorCode nimbleIdentityErrorCode, String str, Throwable th) { + super(NIMBLE_IDENTITY_ERROR_DOMAIN, nimbleIdentityErrorCode.intValue(), str, th); + } + + public NimbleIdentityError(NimbleIdentityErrorCode nimbleIdentityErrorCode, String str) { + super(NIMBLE_IDENTITY_ERROR_DOMAIN, nimbleIdentityErrorCode.intValue(), str); + } + + public static NimbleIdentityError createWithData(Map 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; + } + return new NimbleIdentityError(parseErrorCode, str2); + } + + public boolean isError(int i) { + return getCode() == i; + } + + private static NimbleIdentityErrorCode parseErrorCode(String str) { + if (str.equals("invalid_request")) { + return NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_INVALID_REQUEST; + } + if (str.equals("invalid_oauth_info")) { + return NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_INVALID_OAUTH_INFO; + } + return NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_UNKNOWN; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericAuthenticationConductorHandler.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericAuthenticationConductorHandler.java new file mode 100644 index 0000000..d0d2e2e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericAuthenticationConductorHandler.java @@ -0,0 +1,24 @@ +package com.ea.nimble.identity; + +/* loaded from: classes.dex */ +class NimbleIdentityGenericAuthenticationConductorHandler implements NimbleIdentityAuthenticationConductorHandler { + private NimbleIdentityGenericLoginResolver loginResolver; + private NimbleIdentityGenericLogoutResolver logoutResolver; + private INimbleIdentityGenericAuthenticationConductor m_conductor; + + NimbleIdentityGenericAuthenticationConductorHandler(INimbleIdentityAuthenticationConductor iNimbleIdentityAuthenticationConductor) { + this.m_conductor = (INimbleIdentityGenericAuthenticationConductor) iNimbleIdentityAuthenticationConductor; + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogin(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, boolean z) { + this.loginResolver = new NimbleIdentityGenericLoginResolver(iNimbleIdentityAuthenticator); + this.m_conductor.handleLogin(this.loginResolver); + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogout(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + this.logoutResolver = new NimbleIdentityGenericLogoutResolver(iNimbleIdentityAuthenticator); + this.m_conductor.handleLogout(this.logoutResolver); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLoginResolver.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLoginResolver.java new file mode 100644 index 0000000..3d930d2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLoginResolver.java @@ -0,0 +1,53 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/* loaded from: classes.dex */ +class NimbleIdentityGenericLoginResolver implements INimbleIdentityGenericLoginResolver { + private INimbleIdentityAuthenticator m_authenticator; + private String m_authenticatorId; + private ArrayList m_loggedInAuthenticatorIds; + + public NimbleIdentityGenericLoginResolver(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + if (iNimbleIdentityAuthenticator != null) { + this.m_authenticator = iNimbleIdentityAuthenticator; + this.m_authenticatorId = iNimbleIdentityAuthenticator.getAuthenticatorId(); + this.m_loggedInAuthenticatorIds = new ArrayList<>(); + Iterator it = NimbleIdentity.getComponent().getLoggedInAuthenticators().iterator(); + while (it.hasNext()) { + this.m_loggedInAuthenticatorIds.add(it.next().getAuthenticatorId()); + } + } + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLoginResolver + public List getLoggedInAuthenticatorIds() { + return this.m_loggedInAuthenticatorIds; + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLoginResolver + public String getLoggingInAuthenticatorId() { + return this.m_authenticatorId; + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLoginResolver + public void ignore() { + Log.Helper.LOGI(this, "Game decided to resolve login of %s by ignoring", this.m_authenticatorId); + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLoginResolver + public void switchAuthenticators(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + component.switchAuthenticators(nimbleIdentityAuthenticatorCallback, this.m_authenticator, component.getAuthenticatorById(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)); + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLoginResolver + public void highlight() { + NimbleIdentityImpl.getComponent().highlight(this.m_authenticator); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLogoutResolver.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLogoutResolver.java new file mode 100644 index 0000000..a845ad6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityGenericLogoutResolver.java @@ -0,0 +1,39 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Utility; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/* loaded from: classes.dex */ +public class NimbleIdentityGenericLogoutResolver implements INimbleIdentityGenericLogoutResolver { + private String m_authenticatorId; + private ArrayList m_stillLoggedInAuthenticatorIds = new ArrayList<>(); + + public NimbleIdentityGenericLogoutResolver(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + this.m_authenticatorId = iNimbleIdentityAuthenticator.getAuthenticatorId(); + Iterator it = NimbleIdentity.getComponent().getLoggedInAuthenticators().iterator(); + while (it.hasNext()) { + this.m_stillLoggedInAuthenticatorIds.add(it.next().getAuthenticatorId()); + } + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLogoutResolver + public List getStillLoggedInAuthenticatorIds() { + return this.m_stillLoggedInAuthenticatorIds; + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLogoutResolver + public String getLoggingOutAuthenticatorId() { + return this.m_authenticatorId; + } + + @Override // com.ea.nimble.identity.INimbleIdentityGenericLogoutResolver + public void resolve(String str) { + INimbleIdentityAuthenticator authenticatorById; + if (!Utility.validString(str) || (authenticatorById = NimbleIdentityImpl.getComponent().getAuthenticatorById(str)) == null) { + return; + } + NimbleIdentityImpl.getComponent().resolveLogout(authenticatorById); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityImpl.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityImpl.java new file mode 100644 index 0000000..1ba0ec6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityImpl.java @@ -0,0 +1,609 @@ +package com.ea.nimble.identity; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.ApplicationEnvironmentImpl; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.HttpRequest; +import com.ea.nimble.IApplicationEnvironment; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.Utility; +import com.ea.nimble.identity.INimbleIdentity; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import com.ea.nimble.identity.NimbleIdentityError; +import com.ea.nimble.tracking.ITracking; +import com.ea.nimble.tracking.Tracking; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.apache.http.protocol.HTTP; + +/* loaded from: classes.dex */ +public class NimbleIdentityImpl extends Component implements INimbleIdentity, LogSource { + private static final String DATA_TEMPLATE_MIGRATE = "?client_id=%s&tuid=%s"; + private static final String REQUEST_HEADER_CONTENT_TYPE_KEY = "Content-type"; + private static final String REQUEST_HEADER_CONTENT_TYPE_VALUE = "application/x-www-form-urlencoded"; + private static final String REQUEST_HEADER_SOURCE_AT_KEY = "X-SOURCE-ACCESS-TOKEN"; + private static final String REQUEST_HEADER_TARGET_AT_KEY = "X-TARGET-ACCESS-TOKEN"; + private static final String URL_TEMPLATE_MIGRATE = "%s/connect/migrate"; + private static final String URL_TEMPLATE_REQUEST_SERVER_AUTHENTICATION_OAUTH_CODE = "%s/connect/auth?client_id=%s&response_type=code&access_token=%s&redirect_uri=nucleus:rest"; + private INimbleIdentityAuthenticationConductor m_authenticationConductor; + private NimbleIdentityAuthenticationConductorHandler m_authenticationConductorHandler; + private INimbleIdentityAuthenticator m_mainAuthenticator; + private INimbleIdentity.NimbleIdentityState m_state = INimbleIdentity.NimbleIdentityState.NIMBLE_IDENTITY_UNAVAILABLE; + private HashMap m_authenticators = new HashMap<>(); + private NimbleIdentityConfig m_configuration = new NimbleIdentityConfig(); + private HashMap m_pidMap = new HashMap<>(); + private final BroadcastReceiver m_authenticationUpdateReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.identity.NimbleIdentityImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleIdentityImpl.this.onAuthenticatorStateChange(); + } + }; + private final BroadcastReceiver m_pidInfoUpdateReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.identity.NimbleIdentityImpl.2 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleIdentityImpl.this.onPidInfoUpdate(); + } + }; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.identity"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Identity"; + } + + static NimbleIdentityImpl getComponent() { + return (NimbleIdentityImpl) Base.getComponent("com.ea.nimble.identity"); + } + + private static void initialize() { + Log.Helper.LOGFUNCS("NimbleIdentityImpl"); + Base.registerComponent(new NimbleIdentityImpl(), "com.ea.nimble.identity"); + } + + NimbleIdentityConfig getConfiguration() { + return this.m_configuration; + } + + /* JADX WARN: Multi-variable type inference failed */ + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + this.m_configuration.initialize(); + this.m_authenticators.clear(); + 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) { + if (!(applicationEnvironmentImpl instanceof INimbleIdentityAuthenticator)) { + Log.Helper.LOGW(this, "Invalid authenticator %s", applicationEnvironmentImpl.getComponentId()); + } else { + INimbleIdentityAuthenticator iNimbleIdentityAuthenticator = (INimbleIdentityAuthenticator) applicationEnvironmentImpl; + this.m_authenticators.put(iNimbleIdentityAuthenticator.getAuthenticatorId(), iNimbleIdentityAuthenticator); + } + } + String loadMainAuthenticator = loadMainAuthenticator(); + if (loadMainAuthenticator == null) { + Log.Helper.LOGD(this, "No existing main authenticator. Will log in anonymous authenticator", new Object[0]); + loadMainAuthenticator = Global.NIMBLE_AUTHENTICATOR_ANONYMOUS; + } + Log.Helper.LOGD(this, "Main authenticator is " + loadMainAuthenticator, new Object[0]); + AuthenticatorBase authenticatorBaseById = getAuthenticatorBaseById(loadMainAuthenticator); + authenticatorBaseById.setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_OFFLINE); + authenticatorBaseById.restoreAuthenticator(new INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback() { // from class: com.ea.nimble.identity.NimbleIdentityImpl.3 + @Override // com.ea.nimble.identity.INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback + public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2, Error error) { + Log.Helper.LOGPUBLICFUNC(this); + Iterator it = NimbleIdentityImpl.this.m_authenticators.values().iterator(); + while (it.hasNext()) { + AuthenticatorBase authenticatorBase = (AuthenticatorBase) ((INimbleIdentityAuthenticator) it.next()); + if (authenticatorBase != iNimbleIdentityAuthenticator2) { + authenticatorBase.restoreAuthenticator(null); + } + } + } + }); + Iterator it = this.m_authenticators.values().iterator(); + while (it.hasNext()) { + if (it.next().getState() == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) { + this.m_state = INimbleIdentity.NimbleIdentityState.NIMBLE_IDENTITY_AUTHENTICATING; + } + } + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGPUBLICFUNC(this); + Utility.unregisterReceiver(this.m_authenticationUpdateReceiver); + Utility.unregisterReceiver(this.m_pidInfoUpdateReceiver); + } + + private NimbleIdentityImpl() { + Log.Helper.LOGFUNC(this); + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public List getAuthenticators() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticationConductor == null) { + return null; + } + return new LinkedList(this.m_authenticators.values()); + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public Map getPidMap() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticationConductor == null) { + return null; + } + return getPidMapInternal(); + } + + HashMap getPidMapInternal() { + return this.m_pidMap; + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public void setAuthenticationConductor(INimbleIdentityAuthenticationConductor iNimbleIdentityAuthenticationConductor) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticationConductor != null) { + Log.Helper.LOGW(this, "Attempting setAuthenticationConductor when we already have one. Unsupported. Ignoring.", new Object[0]); + return; + } + if (iNimbleIdentityAuthenticationConductor == null) { + Log.Helper.LOGW(this, "Attempting to setAuthenticationConductor with a null conductor.", new Object[0]); + return; + } + if (this.m_authenticationConductor != iNimbleIdentityAuthenticationConductor) { + this.m_authenticationConductor = iNimbleIdentityAuthenticationConductor; + if (iNimbleIdentityAuthenticationConductor instanceof INimbleIdentityGenericAuthenticationConductor) { + Log.Helper.LOGD(this, "Setting the generic auth conductor as our conductor.", new Object[0]); + this.m_authenticationConductorHandler = new NimbleIdentityGenericAuthenticationConductorHandler(iNimbleIdentityAuthenticationConductor); + } else if (iNimbleIdentityAuthenticationConductor instanceof INimbleIdentityMigrationAuthenticationConductor) { + Log.Helper.LOGD(this, "Setting the migration auth conductor as our conductor.", new Object[0]); + this.m_authenticationConductorHandler = new NimbleIdentityMigrationAuthenticationConductorHandler(iNimbleIdentityAuthenticationConductor); + } + for (INimbleIdentityAuthenticator iNimbleIdentityAuthenticator : getAuthenticators()) { + if (iNimbleIdentityAuthenticator != null) { + ((AuthenticatorBase) iNimbleIdentityAuthenticator).resume(); + } + } + } + } + + NimbleIdentityAuthenticationConductorHandler getAuthenticationConductor() { + return this.m_authenticationConductorHandler; + } + + INimbleIdentityAuthenticator getMainAuthenticator() { + return this.m_mainAuthenticator; + } + + void setMainAuthenticator(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + if (iNimbleIdentityAuthenticator == null) { + Log.Helper.LOGW(this, "Failed to set mainAuthenticator with new authenticator because given authenticator is null.", new Object[0]); + return; + } + if (iNimbleIdentityAuthenticator == this.m_mainAuthenticator) { + Log.Helper.LOGV(this, "Skipping setMainAuthenticator because the given authenticator is the same as the previous one.", new Object[0]); + return; + } + Log.Helper.LOGD(this, "Setting mainAuthenticator to: " + iNimbleIdentityAuthenticator.getAuthenticatorId(), new Object[0]); + this.m_mainAuthenticator = iNimbleIdentityAuthenticator; + HashMap hashMap = new HashMap(); + String authenticatorId = this.m_mainAuthenticator.getAuthenticatorId(); + saveMainAuthenticator(authenticatorId); + NimbleIdentityPidInfo pidInfo = this.m_mainAuthenticator.getPidInfo(); + if (pidInfo != null) { + hashMap.put(authenticatorId, pidInfo.getPid()); + } else { + hashMap.put(authenticatorId, ""); + } + HashMap hashMap2 = new HashMap(); + hashMap2.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE, hashMap); + Utility.sendBroadcastSerializable(Global.NIMBLE_NOTIFICATION_IDENTITY_MAIN_AUTHENTICATOR_CHANGE, hashMap2); + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public List getLoggedInAuthenticators() { + Log.Helper.LOGPUBLICFUNC(this); + ArrayList arrayList = new ArrayList(); + if (this.m_authenticationConductor != null) { + synchronized (this) { + if (this.m_authenticators != null && this.m_authenticators.size() > 0) { + for (INimbleIdentityAuthenticator iNimbleIdentityAuthenticator : this.m_authenticators.values()) { + if (iNimbleIdentityAuthenticator.getState() == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + arrayList.add(iNimbleIdentityAuthenticator); + } + } + } + } + } + return arrayList; + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public INimbleIdentityAuthenticator getAuthenticatorById(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_authenticationConductor != null) { + return this.m_authenticators.get(str); + } + return null; + } + + AuthenticatorBase getAuthenticatorBaseById(String str) { + INimbleIdentityAuthenticator iNimbleIdentityAuthenticator = this.m_authenticators.get(str); + if (iNimbleIdentityAuthenticator == null || !(iNimbleIdentityAuthenticator instanceof AuthenticatorBase)) { + return null; + } + return (AuthenticatorBase) iNimbleIdentityAuthenticator; + } + + /* JADX INFO: Access modifiers changed from: private */ + public synchronized void onAuthenticatorStateChange() { + Log.Helper.LOGFUNC(this); + Iterator it = this.m_authenticators.values().iterator(); + while (it.hasNext()) { + if (it.next().getState() == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING) { + setState(INimbleIdentity.NimbleIdentityState.NIMBLE_IDENTITY_AUTHENTICATING); + return; + } + } + setState(INimbleIdentity.NimbleIdentityState.NIMBLE_IDENTITY_READY); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onPidInfoUpdate() { + Log.Helper.LOGFUNC(this); + HashMap hashMap = new HashMap<>(); + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + for (INimbleIdentityAuthenticator iNimbleIdentityAuthenticator : this.m_authenticators.values()) { + NimbleIdentityPidInfo pidInfo = iNimbleIdentityAuthenticator.getPidInfo(); + if (pidInfo != null) { + String pid = pidInfo.getPid(); + hashMap.put(iNimbleIdentityAuthenticator.getAuthenticatorId(), pid); + if (component != null) { + component.setPlayerId(iNimbleIdentityAuthenticator.getAuthenticatorId(), pid); + } + } + } + synchronized (this) { + this.m_pidMap = hashMap; + } + } + + public void setState(INimbleIdentity.NimbleIdentityState nimbleIdentityState) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_state != nimbleIdentityState) { + this.m_state = nimbleIdentityState; + Utility.sendBroadcast(INimbleIdentity.NIMBLE_NOTIFICATION_IDENTITY_UPDATE); + } + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public INimbleIdentity.NimbleIdentityState getState() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_state; + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public void setAutoRefreshFlag(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_configuration.setAutoRefresh(z); + Iterator it = this.m_authenticators.values().iterator(); + while (it.hasNext()) { + ((AuthenticatorBase) it.next()).enableAutoRefresh(z); + } + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public boolean getAutoRefreshFlag() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_configuration.getAutoRefresh(); + } + + @Override // com.ea.nimble.identity.INimbleIdentity + public void requestServerAuthCodeForLegacyOriginToken(String str, final String str2, final String str3, final INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback nimbleIdentityServerAuthCodeCallback) { + URL url; + if (nimbleIdentityServerAuthCodeCallback == null) { + Log.Helper.LOGW(this, "Request server authentication oAuth code without callback, no way to get result", new Object[0]); + return; + } + Log.Helper.LOGV(this, "Request server authentication oauth code for legacy origin ocs token", new Object[0]); + try { + String format = String.format(URL_TEMPLATE_REQUEST_SERVER_AUTHENTICATION_OAUTH_CODE, this.m_configuration.getConnectServerUrl(), str2, str); + if (Utility.validString(str3)) { + format = format + String.format("&scope=%s", str3); + } + url = new URL(format); + } catch (MalformedURLException unused) { + url = null; + } + Network.getComponent().sendGetRequest(url, new HashMap<>(), new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.NimbleIdentityImpl.4 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + try { + Map parseBodyJSONData = NimbleIdentityUtility.parseBodyJSONData(networkConnectionHandle); + String str4 = (String) parseBodyJSONData.get("code"); + if (!Utility.validString(str4)) { + Error error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Fail to parse oAuth code from server response data " + parseBodyJSONData); + Log.Helper.LOGD(NimbleIdentityImpl.this, "Request for legacy server auth code failed for error " + error, new Object[0]); + nimbleIdentityServerAuthCodeCallback.onCallback(null, null, str2, str3, error); + return; + } + Log.Helper.LOGD(this, "Request for server auth code succeed with auth code: " + str4, new Object[0]); + nimbleIdentityServerAuthCodeCallback.onCallback(null, str4, str2, str3, null); + } catch (Error e) { + Log.Helper.LOGD(NimbleIdentityImpl.this, "Request for legacy server auth code failed for error " + e, new Object[0]); + nimbleIdentityServerAuthCodeCallback.onCallback(null, null, str2, str3, e); + } + } + }); + } + + private Error validateMigrationIds(String str, String str2) { + Log.Helper.LOGFUNC(this); + if (str == null || str.length() <= 0) { + Log.Helper.LOGE(this, "Source authenticator ID is either null or empty", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_SOURCE_INVALID, "Source authenticator ID is either null or empty"); + } + if (str2 == null || str2.length() <= 0) { + Log.Helper.LOGE(this, "Target authenticator ID is either null or empty", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_TARGET_INVALID, "Target authenticator ID is either null or empty"); + } + if (!str.equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)) { + Log.Helper.LOGE(this, "Source authenticator must be anonymous", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_SOURCE_INVALID, "Source authenticator must be anonymous"); + } + if (str2.equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)) { + Log.Helper.LOGE(this, "Target authenticator cannot be anonymous", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_TARGET_INVALID, "Target authenticator cannot be anonymous"); + } + INimbleIdentityAuthenticator authenticatorById = getAuthenticatorById(str); + if (authenticatorById == null || authenticatorById.getState() != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + Log.Helper.LOGE(this, "Source authenticator is not logged in", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_NOT_AUTHENTICATED, "Source authenticator is not logged in"); + } + INimbleIdentityAuthenticator authenticatorById2 = getAuthenticatorById(str2); + if (authenticatorById2 != null && authenticatorById2.getState() == INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + return null; + } + Log.Helper.LOGE(this, "Target authenticator is not logged in", new Object[0]); + return new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_NOT_AUTHENTICATED, "Target authenticator is not logged in"); + } + + void resolveLogout(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + if (iNimbleIdentityAuthenticator != null) { + setMainAuthenticator(iNimbleIdentityAuthenticator); + } + } + + void highlight(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + Log.Helper.LOGD(this, "Game wants to high light the just logged in authenticator", new Object[0]); + setMainAuthenticator(iNimbleIdentityAuthenticator); + } + + void switchAuthenticators(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2) { + if (nimbleIdentityAuthenticatorCallback == null) { + Log.Helper.LOGW(this, "Requested account switching without callback. No way to notify caller. Aborting...", new Object[0]); + return; + } + if (iNimbleIdentityAuthenticator2 == null) { + nimbleIdentityAuthenticatorCallback.onCallback(null, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_SOURCE_INVALID, "Attempted to switchAuthenticators but source authenticator was null")); + return; + } + if (iNimbleIdentityAuthenticator == null) { + nimbleIdentityAuthenticatorCallback.onCallback(null, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_TARGET_INVALID, "Attempted to switchAuthenticators but target authenticator was null")); + return; + } + if (iNimbleIdentityAuthenticator2.getAuthenticatorId().equals(iNimbleIdentityAuthenticator.getAuthenticatorId())) { + nimbleIdentityAuthenticatorCallback.onCallback(null, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_FAILED, "Attempted to switch from one authenticator to itself. Your from and your to authenticators must be different.")); + return; + } + setMainAuthenticator(iNimbleIdentityAuthenticator); + if (iNimbleIdentityAuthenticator2.getAuthenticatorId().equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)) { + ((AuthenticatorAnonymous) iNimbleIdentityAuthenticator2).logoutInternal(nimbleIdentityAuthenticatorCallback); + } else { + nimbleIdentityAuthenticatorCallback.onCallback(iNimbleIdentityAuthenticator, null); + } + } + + void migrationFailed(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) { + Log.Helper.LOGD(this, "Migration failed for %s.", iNimbleIdentityAuthenticator); + iNimbleIdentityAuthenticator.logout(nimbleIdentityAuthenticatorCallback); + } + + void completeMigration(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGD(this, "Account migration successful", new Object[0]); + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null) { + HashMap hashMap = new HashMap(); + HashMap hashMap2 = new HashMap(); + hashMap2.put(iNimbleIdentityAuthenticator.getAuthenticatorId(), iNimbleIdentityAuthenticator.getPidInfo().getPid()); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE, Utility.convertObjectToJSONString(hashMap2)); + HashMap hashMap3 = new HashMap(); + hashMap3.put(iNimbleIdentityAuthenticator2.getAuthenticatorId(), iNimbleIdentityAuthenticator2.getPidInfo().getPid()); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET, Utility.convertObjectToJSONString(hashMap3)); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_MIGRATION_GAME_TRIGGERED, "0"); + ((ITracking) component).logEvent(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION, hashMap); + } + setMainAuthenticator(iNimbleIdentityAuthenticator2); + getAuthenticatorBaseById(iNimbleIdentityAuthenticator.getAuthenticatorId()).completeMigration(); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.identity", Persistence.Storage.DOCUMENT); + persistenceForNimbleComponent.setValue(INimbleIdentity.MIGRATION_PERSISTENCE_ID, null); + persistenceForNimbleComponent.synchronize(); + if (nimbleIdentityAuthenticatorCallback != null) { + nimbleIdentityAuthenticatorCallback.onCallback(iNimbleIdentityAuthenticator2, null); + } + } + + void migrate(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2) { + if (nimbleIdentityAuthenticatorCallback == null) { + Log.Helper.LOGW(this, "Request account migration without callback, no way to notify caller", new Object[0]); + return; + } + Log.Helper.LOGI(this, "Request account migration", new Object[0]); + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null) { + HashMap hashMap = new HashMap(); + HashMap hashMap2 = new HashMap(); + hashMap2.put(iNimbleIdentityAuthenticator2.getAuthenticatorId(), iNimbleIdentityAuthenticator2.getPidInfo().getPid()); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE, Utility.convertObjectToJSONString(hashMap2)); + HashMap hashMap3 = new HashMap(); + hashMap3.put(iNimbleIdentityAuthenticator.getAuthenticatorId(), iNimbleIdentityAuthenticator.getPidInfo().getPid()); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET, Utility.convertObjectToJSONString(hashMap3)); + hashMap.put(Tracking.NIMBLE_TRACKING_KEY_MIGRATION_GAME_TRIGGERED, "0"); + ((ITracking) component).logEvent(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION_STARTED, hashMap); + } + String authenticatorId = iNimbleIdentityAuthenticator2.getAuthenticatorId(); + String authenticatorId2 = iNimbleIdentityAuthenticator.getAuthenticatorId(); + Error validateMigrationIds = validateMigrationIds(authenticatorId, authenticatorId2); + if (validateMigrationIds != null) { + nimbleIdentityAuthenticatorCallback.onCallback(null, validateMigrationIds); + } + String andValidateTokenForMigration = getAndValidateTokenForMigration(authenticatorId); + String andValidateTokenForMigration2 = getAndValidateTokenForMigration(authenticatorId2); + if (andValidateTokenForMigration == null || andValidateTokenForMigration2 == null) { + NimbleIdentityError nimbleIdentityError = new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_NO_ACCESS_TOKENS, "Access token is empty or invalid"); + Log.Helper.LOGE(this, "Request for account migration failed for error " + nimbleIdentityError, new Object[0]); + nimbleIdentityAuthenticatorCallback.onCallback(null, nimbleIdentityError); + } + if (!Utility.validString(this.m_configuration.getClientId())) { + NimbleIdentityError nimbleIdentityError2 = new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_BAD_CLIENT_ID, "ClientId is empty or invalid"); + Log.Helper.LOGE(this, "Request for account migration failed for error " + nimbleIdentityError2, new Object[0]); + nimbleIdentityAuthenticatorCallback.onCallback(null, nimbleIdentityError2); + } + String uuid = UUID.randomUUID().toString(); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.identity", Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + Log.Helper.LOGW(this, "Attempted to save pending migration data but persistence was not available. Not saving.", new Object[0]); + } else { + persistenceForNimbleComponent.setValue(INimbleIdentity.MIGRATION_PERSISTENCE_ID, new NimbleIdentityMigrationObject(uuid, authenticatorId2, iNimbleIdentityAuthenticator.getPidInfo().getPid(), authenticatorId, iNimbleIdentityAuthenticator2.getPidInfo().getPid())); + persistenceForNimbleComponent.synchronize(); + Log.Helper.LOGV(this, "Migration object saved to persistence", new Object[0]); + } + makeMigrationNetworkCall(nimbleIdentityAuthenticatorCallback, uuid, iNimbleIdentityAuthenticator, andValidateTokenForMigration2, iNimbleIdentityAuthenticator2, andValidateTokenForMigration); + } + + void handlePendingMigration(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback, String str, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2) { + makeMigrationNetworkCall(nimbleIdentityAuthenticatorCallback, str, iNimbleIdentityAuthenticator, getAndValidateTokenForMigration(iNimbleIdentityAuthenticator.getAuthenticatorId()), iNimbleIdentityAuthenticator2, getAndValidateTokenForMigration(iNimbleIdentityAuthenticator2.getAuthenticatorId())); + } + + void makeMigrationNetworkCall(final INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback, String str, final INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String str2, final INimbleIdentityAuthenticator iNimbleIdentityAuthenticator2, String str3) { + ByteArrayOutputStream byteArrayOutputStream; + URL url; + Log.Helper.LOGD(this, "Starting migration network call", new Object[0]); + String format = String.format(DATA_TEMPLATE_MIGRATE, this.m_configuration.getClientId(), str); + try { + String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_IDENTITY_CONNECT); + if (serverUrlWithKey.substring(serverUrlWithKey.length() - 1).equals("/")) { + serverUrlWithKey = serverUrlWithKey.substring(0, serverUrlWithKey.length() - 1); + } + url = new URL(String.format(URL_TEMPLATE_MIGRATE, serverUrlWithKey) + format); + 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; + } + } catch (IOException unused3) { + byteArrayOutputStream = null; + url = null; + } + HashMap hashMap = new HashMap<>(); + hashMap.put(REQUEST_HEADER_CONTENT_TYPE_KEY, "application/x-www-form-urlencoded"); + hashMap.put(REQUEST_HEADER_SOURCE_AT_KEY, str3); + hashMap.put(REQUEST_HEADER_TARGET_AT_KEY, str2); + HttpRequest httpRequest = new HttpRequest(url); + httpRequest.method = IHttpRequest.Method.POST; + httpRequest.headers = hashMap; + httpRequest.data = byteArrayOutputStream; + Network.getComponent().sendRequest(httpRequest, new NetworkConnectionCallback() { // from class: com.ea.nimble.identity.NimbleIdentityImpl.5 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + Exception error = networkConnectionHandle.getResponse().getError(); + if (error != null) { + Log.Helper.LOGE(this, "Request for account migration failed for error " + error, new Object[0]); + AuthenticatorBase authenticatorBaseById = NimbleIdentityImpl.this.getAuthenticatorBaseById(iNimbleIdentityAuthenticator.getAuthenticatorId()); + if (authenticatorBaseById != null) { + authenticatorBaseById.logout(null); + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(NimbleIdentityImpl.this.getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + persistenceForNimbleComponent.setValue(INimbleIdentity.MIGRATION_PERSISTENCE_ID, null); + persistenceForNimbleComponent.synchronize(); + } + nimbleIdentityAuthenticatorCallback.onCallback(null, new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_MIGRATION_FAILED, error.getMessage(), error)); + return; + } + NimbleIdentityImpl.this.completeMigration(iNimbleIdentityAuthenticator2, iNimbleIdentityAuthenticator, nimbleIdentityAuthenticatorCallback); + } + }); + } + + private String getAndValidateTokenForMigration(String str) { + Log.Helper.LOGFUNC(this); + AuthenticatorBase authenticatorBaseById = getAuthenticatorBaseById(str); + if (authenticatorBaseById != null) { + String accessToken = authenticatorBaseById.getAccessToken().getAccessToken(); + if (Utility.validString(accessToken)) { + return accessToken; + } + return null; + } + Log.Helper.LOGE(this, "Authenticator Base was null!", new Object[0]); + return null; + } + + private void saveMainAuthenticator(String str) { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + persistenceForNimbleComponent.setValue("mainAuthenticatorId", str); + } + } + + private String loadMainAuthenticator() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent != null) { + return persistenceForNimbleComponent.getStringValue("mainAuthenticatorId"); + } + return null; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityLoginParams.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityLoginParams.java new file mode 100644 index 0000000..5ee723e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityLoginParams.java @@ -0,0 +1,102 @@ +package com.ea.nimble.identity; + +import android.support.v4.app.NotificationCompat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/* loaded from: classes.dex */ +public abstract class NimbleIdentityLoginParams { + + public static class AnonymousLoginParams extends NimbleIdentityLoginParams { + } + + protected NimbleIdentityLoginParams() { + } + + public static class OriginOAuthCodeLoginParams extends NimbleIdentityLoginParams { + private String oAuthCode; + + OriginOAuthCodeLoginParams() { + this.oAuthCode = ""; + } + + public OriginOAuthCodeLoginParams(String str) { + this.oAuthCode = ""; + this.oAuthCode = str; + } + + String getOauthCode() { + return this.oAuthCode; + } + } + + public static class OriginCredentialsLoginParams extends NimbleIdentityLoginParams { + private String password; + private String username; + + OriginCredentialsLoginParams() { + this.username = ""; + this.password = ""; + } + + public OriginCredentialsLoginParams(String str, String str2) { + this.username = ""; + this.password = ""; + this.username = str; + this.password = str2; + } + + String getUsername() { + return this.username; + } + + String getPassword() { + return this.password; + } + } + + public static class FacebookAccessTokenLoginParams extends NimbleIdentityLoginParams { + private Date expiryDate; + private String facebookAccessToken; + + FacebookAccessTokenLoginParams() { + this.facebookAccessToken = ""; + } + + public FacebookAccessTokenLoginParams(String str, Date date) { + this.facebookAccessToken = ""; + this.facebookAccessToken = str; + this.expiryDate = new Date(date.getTime()); + } + + String getFacebookAccessToken() { + return this.facebookAccessToken; + } + + Date getExpiryDate() { + return this.expiryDate; + } + } + + public static class FacebookClientLoginParams extends NimbleIdentityLoginParams { + private List facebookPermissions; + + public FacebookClientLoginParams(List 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 getFacebookPermissions() { + return this.facebookPermissions; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationAuthenticationConductorHandler.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationAuthenticationConductorHandler.java new file mode 100644 index 0000000..60efd1c --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationAuthenticationConductorHandler.java @@ -0,0 +1,100 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.Iterator; +import java.util.List; + +/* loaded from: classes.dex */ +class NimbleIdentityMigrationAuthenticationConductorHandler implements NimbleIdentityAuthenticationConductorHandler { + private INimbleIdentityMigrationAuthenticationConductor m_conductor; + + public NimbleIdentityMigrationAuthenticationConductorHandler(INimbleIdentityAuthenticationConductor iNimbleIdentityAuthenticationConductor) { + this.m_conductor = (INimbleIdentityMigrationAuthenticationConductor) iNimbleIdentityAuthenticationConductor; + List loggedInAuthenticators = NimbleIdentity.getComponent().getLoggedInAuthenticators(); + if (loggedInAuthenticators.size() > 0) { + if (loggedInAuthenticators.size() == 1) { + NimbleIdentityImpl.getComponent().setMainAuthenticator(loggedInAuthenticators.get(0)); + } else { + Iterator it = loggedInAuthenticators.iterator(); + while (true) { + if (!it.hasNext()) { + break; + } + INimbleIdentityAuthenticator next = it.next(); + if (!next.getAuthenticatorId().equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)) { + NimbleIdentityImpl.getComponent().setMainAuthenticator(next); + break; + } + } + } + } + handlePendingMigration(); + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogin(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + INimbleIdentityAuthenticator mainAuthenticator = component.getMainAuthenticator(); + if (mainAuthenticator == null) { + component.setMainAuthenticator(iNimbleIdentityAuthenticator); + } else if (iNimbleIdentityAuthenticator == mainAuthenticator) { + Log.Helper.LOGI(this, "Authenticator %s, which is already mainAuthenticator, is currently logged in", iNimbleIdentityAuthenticator.getAuthenticatorId()); + } else { + if (handlePendingMigration()) { + return; + } + this.m_conductor.handleLogin(new NimbleIdentityMigrationLoginResolver(iNimbleIdentityAuthenticator)); + } + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogout(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + Log.Helper.LOGPUBLICFUNC(this); + if (iNimbleIdentityAuthenticator == null) { + Log.Helper.LOGF(this, "Given a null authenticator as part of logout proess.", new Object[0]); + return; + } + if (iNimbleIdentityAuthenticator.getAuthenticatorId().equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)) { + return; + } + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + AuthenticatorBase authenticatorBaseById = component.getAuthenticatorBaseById(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS); + if (authenticatorBaseById == null) { + Log.Helper.LOGF(this, "Unable to set Anonymous Authenticator as main authenticator as part of logout process.", new Object[0]); + return; + } + component.setMainAuthenticator(authenticatorBaseById); + if (authenticatorBaseById.getState() != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS) { + authenticatorBaseById.autoLogin(); + } + } + + public boolean handlePendingMigration() { + AuthenticatorBase authenticatorBaseById; + AuthenticatorBase authenticatorBaseById2; + Log.Helper.LOGPUBLICFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.identity", Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null) { + Log.Helper.LOGW(this, "Attempted to check pending migration status but persistence was not available. Failing.", new Object[0]); + return false; + } + NimbleIdentityMigrationObject nimbleIdentityMigrationObject = (NimbleIdentityMigrationObject) persistenceForNimbleComponent.getValue(INimbleIdentity.MIGRATION_PERSISTENCE_ID); + if (nimbleIdentityMigrationObject == null) { + Log.Helper.LOGI(this, "No pending migration object found in persistence!", new Object[0]); + return false; + } + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + if (component != null && ((authenticatorBaseById = component.getAuthenticatorBaseById(nimbleIdentityMigrationObject.m_currentAuthenticatorId)) == null || authenticatorBaseById.getState() != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS || !authenticatorBaseById.getPidInfo().getPid().equals(nimbleIdentityMigrationObject.m_currentAuthenticatorPid) || (authenticatorBaseById2 = component.getAuthenticatorBaseById(nimbleIdentityMigrationObject.m_newAuthenticatorId)) == null || authenticatorBaseById2.getState() != INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_SUCCESS || !authenticatorBaseById2.getPidInfo().getPid().equals(nimbleIdentityMigrationObject.m_newAuthenticatorPid))) { + return false; + } + NimbleIdentityPendingMigrationResolver nimbleIdentityPendingMigrationResolver = new NimbleIdentityPendingMigrationResolver(nimbleIdentityMigrationObject.m_migrationGUID, nimbleIdentityMigrationObject.m_newAuthenticatorId, nimbleIdentityMigrationObject.m_newAuthenticatorPid, nimbleIdentityMigrationObject.m_currentAuthenticatorId, nimbleIdentityMigrationObject.m_currentAuthenticatorPid); + Log.Helper.LOGI(this, "Sending request to game to handle pending migration", new Object[0]); + this.m_conductor.handlePendingMigration(nimbleIdentityPendingMigrationResolver); + return true; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationLoginResolver.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationLoginResolver.java new file mode 100644 index 0000000..e30e742 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationLoginResolver.java @@ -0,0 +1,49 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Global; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/* loaded from: classes.dex */ +class NimbleIdentityMigrationLoginResolver implements INimbleIdentityMigrationLoginResolver { + private INimbleIdentityAuthenticator m_authenticator; + private String m_authenticatorId; + private ArrayList m_loggedInAuthenticatorIds = new ArrayList<>(); + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver + public void ignore() { + } + + NimbleIdentityMigrationLoginResolver(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + this.m_authenticator = iNimbleIdentityAuthenticator; + this.m_authenticatorId = iNimbleIdentityAuthenticator.getAuthenticatorId(); + Iterator it = NimbleIdentity.getComponent().getLoggedInAuthenticators().iterator(); + while (it.hasNext()) { + this.m_loggedInAuthenticatorIds.add(it.next().getAuthenticatorId()); + } + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver + public List getLoggedInAuthenticatorIds() { + return this.m_loggedInAuthenticatorIds; + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver + public String getLoggingInAuthenticatorId() { + return this.m_authenticatorId; + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver + public void switchAuthenticators(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + component.switchAuthenticators(nimbleIdentityAuthenticatorCallback, this.m_authenticator, component.getAuthenticatorById(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS)); + } + + @Override // com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver + public void migrate(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + component.migrate(nimbleIdentityAuthenticatorCallback, this.m_authenticator, component.getMainAuthenticator()); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationObject.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationObject.java new file mode 100644 index 0000000..7d7b2c6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityMigrationObject.java @@ -0,0 +1,24 @@ +package com.ea.nimble.identity; + +import java.io.Serializable; + +/* loaded from: classes.dex */ +class NimbleIdentityMigrationObject implements Serializable { + private static final long serialVersionUID = 1; + String m_currentAuthenticatorId; + String m_currentAuthenticatorPid; + String m_migrationGUID; + String m_newAuthenticatorId; + String m_newAuthenticatorPid; + + NimbleIdentityMigrationObject() { + } + + NimbleIdentityMigrationObject(String str, String str2, String str3, String str4, String str5) { + this.m_migrationGUID = str; + this.m_newAuthenticatorId = str2; + this.m_newAuthenticatorPid = str3; + this.m_currentAuthenticatorId = str4; + this.m_currentAuthenticatorPid = str5; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPendingMigrationResolver.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPendingMigrationResolver.java new file mode 100644 index 0000000..20c6ece --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPendingMigrationResolver.java @@ -0,0 +1,47 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Log; +import com.ea.nimble.identity.INimbleIdentityAuthenticator; + +/* loaded from: classes.dex */ +public class NimbleIdentityPendingMigrationResolver implements INimbleIdentityPendingMigrationResolver { + private String m_GUID; + private String m_currentAuthenticatorId; + private String m_currentAuthenticatorPid; + private String m_newAuthenticatorId; + + NimbleIdentityPendingMigrationResolver(String str, String str2, String str3, String str4, String str5) { + this.m_GUID = str; + this.m_newAuthenticatorId = str2; + this.m_currentAuthenticatorId = str4; + this.m_currentAuthenticatorPid = str5; + } + + @Override // com.ea.nimble.identity.INimbleIdentityPendingMigrationResolver + public String getMigrationSourceAuthenticatorId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_currentAuthenticatorId; + } + + @Override // com.ea.nimble.identity.INimbleIdentityPendingMigrationResolver + public String getMigrationTargetAuthenticatorId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_newAuthenticatorId; + } + + @Override // com.ea.nimble.identity.INimbleIdentityPendingMigrationResolver + public void resume(INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleIdentityImpl component = NimbleIdentityImpl.getComponent(); + INimbleIdentityAuthenticator authenticatorById = component.getAuthenticatorById(this.m_currentAuthenticatorId); + INimbleIdentityAuthenticator authenticatorById2 = component.getAuthenticatorById(this.m_newAuthenticatorId); + if (authenticatorById == null || authenticatorById2 == null) { + return; + } + if (!authenticatorById.getPidInfo().getPid().equals(this.m_currentAuthenticatorPid)) { + component.completeMigration(authenticatorById, authenticatorById2, nimbleIdentityAuthenticatorCallback); + } else { + component.handlePendingMigration(nimbleIdentityAuthenticatorCallback, this.m_GUID, authenticatorById2, authenticatorById); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPersona.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPersona.java new file mode 100644 index 0000000..dfe85af --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPersona.java @@ -0,0 +1,408 @@ +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; + +/* loaded from: classes.dex */ +public class NimbleIdentityPersona { + private String dateCreated; + private String displayName; + private Date expiryTime; + private String isVisible; + private String lastAuthenticated; + private String name; + private String namespaceName; + private long personaId; + private String pidId; + private PersonaPrivacyLevel showPersona; + private PersonaStatus status; + private PersonaStatusReasonCodes statusReasonCode; + + public enum PersonaPrivacyLevel { + PERSONA_PRIVACY_LEVEL_NONE, + PERSONA_PRIVACY_LEVEL_NO_ONE, + PERSONA_PRIVACY_LEVEL_EVERYONE, + PERSONA_PRIVACY_LEVEL_FRIENDS, + PERSONA_PRIVACY_LEVEL_FRIENDS_OF_FRIENDS + } + + public enum PersonaStatus { + PERSONA_STATUS_NONE, + PERSONA_STATUS_PENDING, + PERSONA_STATUS_ACTIVE, + PERSONA_STATUS_DEACTIVATED, + PERSONA_STATUS_DISABLED, + PERSONA_STATUS_DELETED, + PERSONA_STATUS_BANNED + } + + public enum PersonaStatusReasonCodes { + PERSONA_STATUS_REASON_CODES_NONE, + PERSONA_STATUS_REASON_CODES_ONE, + PERSONA_STATUS_REASON_CODES_REACTIVATED_CUSTOMER, + PERSONA_STATUS_REASON_CODES_INVALID_EMAIL, + PERSONA_STATUS_REASON_CODES_PRIVACY_POLICY, + PERSONA_STATUS_REASON_CODES_PARENTS_REQUEST, + PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_GENERAL, + PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_HARASSMENT, + PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_MACROING, + PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_EXPLOITATION, + PERSONA_STATUS_REASON_CODES_SUSPENDED_FRAUD, + PERSONA_STATUS_REASON_CODES_CUSTOMER_OPT_OUT, + PERSONA_STATUS_REASON_CODES_CUSTOMER_UNDER_AGE, + PERSONA_STATUS_REASON_CODES_EMAIL_CONFIRMATION_REQUIRED, + PERSONA_STATUS_REASON_CODES_MISTYPED_ID, + PERSONA_STATUS_REASON_CODES_ABUSED_ID, + PERSONA_STATUS_REASON_CODES_DEACTIVATED_EMAIL_LINK, + PERSONA_STATUS_REASON_CODES_DEACTIVATED_CS, + PERSONA_STATUS_REASON_CODES_CLAIMED_BY_TRUE_OWNER, + PERSONA_STATUS_REASON_CODES_BANNED, + PERSONA_STATUS_REASON_CODES_DEACTIVATED_AFFILIATE + } + + public NimbleIdentityPersona(Map map, Date date) { + Log.Helper.LOGPUBLICFUNC(this); + this.personaId = getLongFromObject(map.get("personaId")); + this.pidId = map.get("pidId").toString(); + this.displayName = (String) map.get("displayName"); + this.name = (String) map.get("name"); + this.namespaceName = (String) map.get("namespaceName"); + this.status = toEnumPersonaStatus((String) map.get("status")); + this.statusReasonCode = toEnumPersonaStatusReasonCodes((String) map.get("statusReasonCode")); + 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()); + } + + NimbleIdentityPersona() { + } + + public long getPersonaId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.personaId; + } + + public String getPidId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.pidId; + } + + public String getDisplayName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.displayName; + } + + public String getName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.name; + } + + public String getNamespaceName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.namespaceName; + } + + public String getVisible() { + Log.Helper.LOGPUBLICFUNC(this); + return this.isVisible; + } + + public PersonaStatus getStauts() { + Log.Helper.LOGPUBLICFUNC(this); + return this.status; + } + + public PersonaStatusReasonCodes getStatusReasonCode() { + Log.Helper.LOGPUBLICFUNC(this); + return this.statusReasonCode; + } + + public PersonaPrivacyLevel getShowPersona() { + Log.Helper.LOGPUBLICFUNC(this); + return this.showPersona; + } + + public String getDateCreated() { + Log.Helper.LOGPUBLICFUNC(this); + return this.dateCreated; + } + + public String getLastAuthenticated() { + Log.Helper.LOGPUBLICFUNC(this); + return this.lastAuthenticated; + } + + public Date getExpiryTime() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.expiryTime != null) { + return new Date(this.expiryTime.getTime()); + } + return null; + } + + public void setPersonaId(long j) { + Log.Helper.LOGPUBLICFUNC(this); + this.personaId = j; + } + + public void setPidId(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.pidId = str; + } + + public void setDisplayName(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.displayName = str; + } + + public void setName(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.name = str; + } + + public void setNamespaceName(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.namespaceName = str; + } + + public void setVisible(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.isVisible = str; + } + + public void setStauts(PersonaStatus personaStatus) { + Log.Helper.LOGPUBLICFUNC(this); + this.status = personaStatus; + } + + public void setStatusReasonCode(PersonaStatusReasonCodes personaStatusReasonCodes) { + Log.Helper.LOGPUBLICFUNC(this); + this.statusReasonCode = personaStatusReasonCodes; + } + + public void setShowPersona(PersonaPrivacyLevel personaPrivacyLevel) { + Log.Helper.LOGPUBLICFUNC(this); + this.showPersona = personaPrivacyLevel; + } + + public void setDateCreated(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.dateCreated = str; + } + + public void setLastAuthenticated(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.lastAuthenticated = str; + } + + private long getLongFromObject(Object obj) { + Log.Helper.LOGFUNC(this); + if (obj instanceof Long) { + return ((Long) obj).longValue(); + } + if (obj instanceof Integer) { + return ((Integer) obj).intValue(); + } + Log.Helper.LOGES("Identity", "Can't convert object of type " + obj.getClass().getName() + " to long", new Object[0]); + return 0L; + } + + public static String toStringPersonaStatus(PersonaStatus personaStatus) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + switch (personaStatus) { + case PERSONA_STATUS_PENDING: + return "PENDING"; + case PERSONA_STATUS_ACTIVE: + return "ACTIVE"; + case PERSONA_STATUS_DEACTIVATED: + return "DEACTIVATED"; + case PERSONA_STATUS_DISABLED: + return "DISABLED"; + case PERSONA_STATUS_DELETED: + return "DELETED"; + case PERSONA_STATUS_BANNED: + return "BANNED"; + default: + return ""; + } + } + + public static String toStringPersonaStatusReasonCodes(PersonaStatusReasonCodes personaStatusReasonCodes) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + switch (personaStatusReasonCodes) { + case PERSONA_STATUS_REASON_CODES_ONE: + return "CODES_ONE"; + case PERSONA_STATUS_REASON_CODES_REACTIVATED_CUSTOMER: + return "REACTIVATED_CUSTOMER"; + case PERSONA_STATUS_REASON_CODES_INVALID_EMAIL: + return "INVALID_EMAIL"; + case PERSONA_STATUS_REASON_CODES_PRIVACY_POLICY: + return "PRIVACY_POLICY"; + case PERSONA_STATUS_REASON_CODES_PARENTS_REQUEST: + return "PARENTS_REQUEST"; + case PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_GENERAL: + return "SUSPENDED_MISCONDUCT_GENERAL"; + case PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_HARASSMENT: + return "SUSPENDED_MISCONDUCT_HARASSMENT"; + case PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_MACROING: + return "SUSPENDED_MISCONDUCT_MACROING"; + case PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_EXPLOITATION: + return "SUSPENDED_MISCONDUCT_EXPLOITATION"; + case PERSONA_STATUS_REASON_CODES_SUSPENDED_FRAUD: + return "SUSPENDED_FRAUD"; + case PERSONA_STATUS_REASON_CODES_CUSTOMER_OPT_OUT: + return "CUSTOMER_OPT_OUT"; + case PERSONA_STATUS_REASON_CODES_CUSTOMER_UNDER_AGE: + return "CUSTOMER_UNDER_AGE"; + case PERSONA_STATUS_REASON_CODES_EMAIL_CONFIRMATION_REQUIRED: + return "EMAIL_CONFIRMATION_REQUIRED"; + case PERSONA_STATUS_REASON_CODES_MISTYPED_ID: + return "MISTYPED_ID"; + case PERSONA_STATUS_REASON_CODES_ABUSED_ID: + return "ABUSED_ID"; + case PERSONA_STATUS_REASON_CODES_DEACTIVATED_EMAIL_LINK: + return "DEACTIVATED_EMAIL_LINK"; + case PERSONA_STATUS_REASON_CODES_DEACTIVATED_CS: + return "DEACTIVATED_CS"; + case PERSONA_STATUS_REASON_CODES_CLAIMED_BY_TRUE_OWNER: + return "CLAIMED_BY_TRUE_OWNER"; + case PERSONA_STATUS_REASON_CODES_BANNED: + return "BANNED"; + case PERSONA_STATUS_REASON_CODES_DEACTIVATED_AFFILIATE: + return "DEACTIVATED_AFFILIATE"; + default: + return ""; + } + } + + public static String toStringPersonaPrivacyLevel(PersonaPrivacyLevel personaPrivacyLevel) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + switch (personaPrivacyLevel) { + case PERSONA_PRIVACY_LEVEL_NO_ONE: + 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: + return ""; + } + } + + public static PersonaStatus toEnumPersonaStatus(String str) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + PersonaStatus personaStatus = PersonaStatus.PERSONA_STATUS_NONE; + if (str.equalsIgnoreCase("PENDING")) { + return PersonaStatus.PERSONA_STATUS_PENDING; + } + if (str.equalsIgnoreCase("ACTIVE")) { + return PersonaStatus.PERSONA_STATUS_ACTIVE; + } + if (str.equalsIgnoreCase("DEACTIVATED")) { + return PersonaStatus.PERSONA_STATUS_DEACTIVATED; + } + if (str.equalsIgnoreCase("DISABLE")) { + return PersonaStatus.PERSONA_STATUS_DISABLED; + } + if (str.equalsIgnoreCase("DELETED")) { + return PersonaStatus.PERSONA_STATUS_DELETED; + } + return str.equalsIgnoreCase("BANNED") ? PersonaStatus.PERSONA_STATUS_BANNED : personaStatus; + } + + public static PersonaStatusReasonCodes toEnumPersonaStatusReasonCodes(String str) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + PersonaStatusReasonCodes personaStatusReasonCodes = PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_NONE; + if (str.equalsIgnoreCase("CODES_ONE")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_ONE; + } + if (str.equalsIgnoreCase("REACTIVATED_CUSTOMER")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_REACTIVATED_CUSTOMER; + } + if (str.equalsIgnoreCase("INVALID_EMAIL")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_INVALID_EMAIL; + } + if (str.equalsIgnoreCase("PRIVACY_POLICY")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_PRIVACY_POLICY; + } + if (str.equalsIgnoreCase("PARENTS_REQUEST")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_PARENTS_REQUEST; + } + if (str.equalsIgnoreCase("SUSPENDED_MISCONDUCT_GENERAL")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_GENERAL; + } + if (str.equalsIgnoreCase("SUSPENDED_MISCONDUCT_HARASSMENT")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_HARASSMENT; + } + if (str.equalsIgnoreCase("SUSPENDED_MISCONDUCT_MACROING")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_MACROING; + } + if (str.equalsIgnoreCase("SUSPENDED_MISCONDUCT_EXPLOITATION")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_SUSPENDED_MISCONDUCT_EXPLOITATION; + } + if (str.equalsIgnoreCase("SUSPENDED_FRAUD")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_SUSPENDED_FRAUD; + } + if (str.equalsIgnoreCase("CUSTOMER_OPT_OUT")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_CUSTOMER_OPT_OUT; + } + if (str.equalsIgnoreCase("CUSTOMER_UNDER_AGE")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_CUSTOMER_UNDER_AGE; + } + if (str.equalsIgnoreCase("EMAIL_CONFIRMATION_REQUIRED")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_EMAIL_CONFIRMATION_REQUIRED; + } + if (str.equalsIgnoreCase("MISTYPED_ID")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_MISTYPED_ID; + } + if (str.equalsIgnoreCase("ABUSED_ID")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_ABUSED_ID; + } + if (str.equalsIgnoreCase("DEACTIVATED_EMAIL_LINK")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_DEACTIVATED_EMAIL_LINK; + } + if (str.equalsIgnoreCase("DEACTIVATED_CS")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_DEACTIVATED_CS; + } + if (str.equalsIgnoreCase("CLAIMED_BY_TRUE_OWNER")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_CLAIMED_BY_TRUE_OWNER; + } + if (str.equalsIgnoreCase("BANNED")) { + return PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_BANNED; + } + return str.equalsIgnoreCase("DEACTIVATED_AFFILIATE") ? PersonaStatusReasonCodes.PERSONA_STATUS_REASON_CODES_DEACTIVATED_AFFILIATE : personaStatusReasonCodes; + } + + public static PersonaPrivacyLevel toEnumPersonaPrivacyLevel(String str) { + Log.Helper.LOGPUBLICFUNCS("NimbleIdentityPersona"); + PersonaPrivacyLevel personaPrivacyLevel = PersonaPrivacyLevel.PERSONA_PRIVACY_LEVEL_NONE; + if (str.equalsIgnoreCase("NO_ONE")) { + return PersonaPrivacyLevel.PERSONA_PRIVACY_LEVEL_NO_ONE; + } + 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; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPidInfo.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPidInfo.java new file mode 100644 index 0000000..dd7b214 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPidInfo.java @@ -0,0 +1,232 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Log; +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +/* loaded from: classes.dex */ +public class NimbleIdentityPidInfo implements Serializable { + private static final long serialVersionUID = 2; + private String anonymousPid; + private String authenticationSource; + private String country; + private String dateCreated; + private String dateModified; + private String dob; + private Date expiryTime; + private String language; + private String lastAuthDate; + private String locale; + private String pid; + private String reasonCode; + private String registrationSource; + private String status; + private String strength; + private String tosVersion; + + public NimbleIdentityPidInfo(Map map, Date date) { + Map map2; + Log.Helper.LOGPUBLICFUNC(this); + if (map == null || (map2 = (Map) map.get("pid")) == null) { + return; + } + this.pid = map2.get("pidId").toString(); + this.anonymousPid = (String) map2.get("anonymousPid"); + this.authenticationSource = (String) map2.get("authenticationSource"); + this.country = (String) map2.get("country"); + this.dateCreated = (String) map2.get("dateCreated"); + this.dateModified = (String) map2.get("dateModified"); + this.dob = (String) map2.get("dob"); + this.language = (String) map2.get("language"); + this.lastAuthDate = (String) map2.get("lastAuthDate"); + this.locale = (String) map2.get("locale"); + this.reasonCode = (String) map2.get("reasonCode"); + this.registrationSource = (String) map2.get("registrationSource"); + this.status = (String) map2.get("status"); + this.strength = (String) map2.get("strength"); + this.tosVersion = (String) map2.get("tosVersion"); + this.expiryTime = new Date(date.getTime()); + } + + NimbleIdentityPidInfo() { + } + + public boolean equals(Object obj) { + Log.Helper.LOGPUBLICFUNC(this); + if (!(obj instanceof NimbleIdentityPidInfo)) { + return false; + } + if (this == obj) { + return true; + } + NimbleIdentityPidInfo nimbleIdentityPidInfo = (NimbleIdentityPidInfo) obj; + return this.pid.equals(nimbleIdentityPidInfo.pid) && this.strength.equals(nimbleIdentityPidInfo.strength) && this.dob.equals(nimbleIdentityPidInfo.dob) && this.country.equals(nimbleIdentityPidInfo.country) && this.language.equals(nimbleIdentityPidInfo.language) && this.locale.equals(nimbleIdentityPidInfo.locale) && this.status.equals(nimbleIdentityPidInfo.status) && this.reasonCode.equals(nimbleIdentityPidInfo.reasonCode) && this.tosVersion.equals(nimbleIdentityPidInfo.tosVersion) && this.dateCreated.equals(nimbleIdentityPidInfo.dateCreated) && this.dateModified.equals(nimbleIdentityPidInfo.dateModified) && this.lastAuthDate.equals(nimbleIdentityPidInfo.lastAuthDate) && this.registrationSource.equals(nimbleIdentityPidInfo.registrationSource) && this.authenticationSource.equals(nimbleIdentityPidInfo.authenticationSource) && this.anonymousPid.equals(nimbleIdentityPidInfo.anonymousPid); + } + + public int hashCode() { + return ((((((((((((((((((((((((((((527 + this.pid.hashCode()) * 31) + this.strength.hashCode()) * 31) + this.dob.hashCode()) * 31) + this.country.hashCode()) * 31) + this.language.hashCode()) * 31) + this.locale.hashCode()) * 31) + this.status.hashCode()) * 31) + this.reasonCode.hashCode()) * 31) + this.tosVersion.hashCode()) * 31) + this.dateCreated.hashCode()) * 31) + this.dateModified.hashCode()) * 31) + this.lastAuthDate.hashCode()) * 31) + this.registrationSource.hashCode()) * 31) + this.authenticationSource.hashCode()) * 31) + this.anonymousPid.hashCode(); + } + + public String getPid() { + Log.Helper.LOGPUBLICFUNC(this); + return this.pid; + } + + public String getAnonymousPid() { + Log.Helper.LOGPUBLICFUNC(this); + return this.anonymousPid; + } + + public String getAuthenticationSource() { + Log.Helper.LOGPUBLICFUNC(this); + return this.authenticationSource; + } + + public String getCountry() { + Log.Helper.LOGPUBLICFUNC(this); + return this.country; + } + + public String getDateCreated() { + Log.Helper.LOGPUBLICFUNC(this); + return this.dateCreated; + } + + public String getDateModified() { + Log.Helper.LOGPUBLICFUNC(this); + return this.dateModified; + } + + public String getDob() { + Log.Helper.LOGPUBLICFUNC(this); + return this.dob; + } + + public String getLanguage() { + Log.Helper.LOGPUBLICFUNC(this); + return this.language; + } + + public String getLastAuthDate() { + Log.Helper.LOGPUBLICFUNC(this); + return this.lastAuthDate; + } + + public String getLocale() { + Log.Helper.LOGPUBLICFUNC(this); + return this.locale; + } + + public String getReasonCode() { + Log.Helper.LOGPUBLICFUNC(this); + return this.reasonCode; + } + + public String getRegistrationSource() { + Log.Helper.LOGPUBLICFUNC(this); + return this.registrationSource; + } + + public String getStatus() { + Log.Helper.LOGPUBLICFUNC(this); + return this.status; + } + + public String getStrength() { + Log.Helper.LOGPUBLICFUNC(this); + return this.strength; + } + + public String getTosVersion() { + Log.Helper.LOGPUBLICFUNC(this); + return this.tosVersion; + } + + public Date getExpiryTime() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.expiryTime != null) { + return new Date(this.expiryTime.getTime()); + } + return null; + } + + public void setPidId(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.pid = str; + } + + public void setAnonymousPid(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.anonymousPid = str; + } + + public void setAuthenticationSource(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.authenticationSource = str; + } + + public void setCountry(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.country = str; + } + + public void setDateCreated(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.dateCreated = str; + } + + public void setDateModified(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.dateModified = str; + } + + public void setDob(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.dob = str; + } + + public void setLanguage(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.language = str; + } + + public void setLastAuthDate(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.lastAuthDate = str; + } + + public void setLocale(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.locale = str; + } + + public void setReasonCode(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.reasonCode = str; + } + + public void setRegistrationSource(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.registrationSource = str; + } + + public void setStatus(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.status = str; + } + + public void setStrength(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.strength = str; + } + + public void setTosVersion(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.tosVersion = str; + } + + void setExpiryTime(Date date) { + this.expiryTime = new Date(date.getTime()); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPlainAuthenticationConductorHandler.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPlainAuthenticationConductorHandler.java new file mode 100644 index 0000000..83467ba --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityPlainAuthenticationConductorHandler.java @@ -0,0 +1,29 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Global; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class NimbleIdentityPlainAuthenticationConductorHandler implements NimbleIdentityAuthenticationConductorHandler { + private INimbleIdentityPlainAuthenticationConductor m_conductor; + + public NimbleIdentityPlainAuthenticationConductorHandler(INimbleIdentityAuthenticationConductor iNimbleIdentityAuthenticationConductor) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_conductor = (INimbleIdentityPlainAuthenticationConductor) iNimbleIdentityAuthenticationConductor; + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogin(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + if (iNimbleIdentityAuthenticator.getAuthenticatorId().equals(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS) && NimbleIdentityImpl.getComponent().getMainAuthenticator() == null) { + NimbleIdentityImpl.getComponent().setMainAuthenticator(iNimbleIdentityAuthenticator); + } + Log.Helper.LOGD(this, "New authenticator %s being LogIn handled by Plain authenticator.", iNimbleIdentityAuthenticator.getAuthenticatorId()); + } + + @Override // com.ea.nimble.identity.NimbleIdentityAuthenticationConductorHandler + public void handleLogout(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator) { + Log.Helper.LOGPUBLICFUNC(this); + Log.Helper.LOGD(this, "New authenticator %s being LogOut handled by Plain authenticator.", iNimbleIdentityAuthenticator.getAuthenticatorId()); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityToken.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityToken.java new file mode 100644 index 0000000..a5479a7 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityToken.java @@ -0,0 +1,83 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Log; +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +/* loaded from: classes.dex */ +class NimbleIdentityToken implements Serializable { + private static final String NIMBLE_IDENTITY_REFRESH_TOKEN_EXPIRES_IN = "refresh_token_expires_in"; + private static final String NIMBLE_IDENTITY_TOKEN_ACCESS_TOKEN = "access_token"; + private static final String NIMBLE_IDENTITY_TOKEN_EXPIRES_IN = "expires_in"; + private static final String NIMBLE_IDENTITY_TOKEN_ID_TOKEN = "id_token"; + private static final String NIMBLE_IDENTITY_TOKEN_REFRESH_TOKEN = "refresh_token"; + private static final String NIMBLE_IDENTITY_TOKEN_TYPE = "token_type"; + private static final long serialVersionUID = 2; + private String accessToken; + private Date accessTokenExpiryTime; + private String idToken; + private String refreshToken; + private Date refreshTokenExpiryTime; + private String type; + + public NimbleIdentityToken(Map map) { + this.accessToken = (String) map.get("access_token"); + this.refreshToken = (String) map.get(NIMBLE_IDENTITY_TOKEN_REFRESH_TOKEN); + this.idToken = (String) map.get(NIMBLE_IDENTITY_TOKEN_ID_TOKEN); + this.type = (String) map.get(NIMBLE_IDENTITY_TOKEN_TYPE); + long currentTimeMillis = System.currentTimeMillis(); + this.accessTokenExpiryTime = new Date(getTimeFromObject(map.get("expires_in")) + currentTimeMillis); + this.refreshTokenExpiryTime = new Date(currentTimeMillis + getTimeFromObject(map.get(NIMBLE_IDENTITY_REFRESH_TOKEN_EXPIRES_IN))); + } + + public NimbleIdentityToken() { + } + + public String getAccessToken() { + Log.Helper.LOGPUBLICFUNC(this); + return this.accessToken; + } + + public String getRefreshToken() { + Log.Helper.LOGPUBLICFUNC(this); + return this.refreshToken; + } + + public Date getAccessTokenExpiryTime() { + Log.Helper.LOGPUBLICFUNC(this); + return this.accessTokenExpiryTime; + } + + public Date getRefreshTokenExpiryTime() { + Log.Helper.LOGPUBLICFUNC(this); + return this.refreshTokenExpiryTime; + } + + public String getIdToken() { + Log.Helper.LOGPUBLICFUNC(this); + return this.idToken; + } + + public String getType() { + Log.Helper.LOGPUBLICFUNC(this); + return this.type; + } + + private long getTimeFromObject(Object obj) { + double d; + Log.Helper.LOGFUNC(this); + if (obj instanceof String) { + d = Double.parseDouble((String) obj); + } else if (obj instanceof Double) { + d = ((Double) obj).doubleValue(); + } else { + if (obj instanceof Integer) { + return ((Integer) obj).intValue() * 1000; + } + Log.Helper.LOGES("Identity", "Couldn't get time from object of type " + obj.getClass().getName(), new Object[0]); + d = 0.0d; + } + return (long) (d * 1000.0d); + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUserInfo.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUserInfo.java new file mode 100644 index 0000000..265fe00 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUserInfo.java @@ -0,0 +1,109 @@ +package com.ea.nimble.identity; + +import com.ea.nimble.Log; +import java.io.Serializable; +import java.util.Date; + +/* loaded from: classes.dex */ +public class NimbleIdentityUserInfo implements Serializable, Cloneable { + private static final long serialVersionUID = 1; + private String avatarUri; + private String dateOfBirth; + private String displayName; + private String email; + private Date expiryTime; + private String pid; + private String userId; + private String userName; + + /* renamed from: clone, reason: merged with bridge method [inline-methods] */ + public NimbleIdentityUserInfo m4clone() { + Log.Helper.LOGPUBLICFUNC(this); + try { + return (NimbleIdentityUserInfo) super.clone(); + } catch (CloneNotSupportedException unused) { + return null; + } + } + + public String getPid() { + Log.Helper.LOGPUBLICFUNC(this); + return this.pid; + } + + public void setPid(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.pid = str; + } + + public String getUserId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.userId; + } + + void setUserId(String str) { + this.userId = str; + } + + public String getDateOfBirth() { + Log.Helper.LOGPUBLICFUNC(this); + return this.dateOfBirth; + } + + public void setDateOfBirth(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.dateOfBirth = str; + } + + public String getEmail() { + Log.Helper.LOGPUBLICFUNC(this); + return this.email; + } + + public void setEmail(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.email = str; + } + + public String getDisplayName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.displayName; + } + + public void setDisplayName(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.displayName = str; + } + + public String getuserName() { + Log.Helper.LOGPUBLICFUNC(this); + return this.userName; + } + + public void setUserName(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.userName = str; + } + + public String getAvatarUri() { + Log.Helper.LOGPUBLICFUNC(this); + return this.avatarUri; + } + + public void setAvatarUri(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.avatarUri = str; + } + + public Date getExpiryTime() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.expiryTime != null) { + return new Date(this.expiryTime.getTime()); + } + return null; + } + + void setExpiryTime(Date date) { + this.expiryTime = date; + } +} diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java new file mode 100644 index 0000000..7eeb206 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java @@ -0,0 +1,101 @@ +package com.ea.nimble.identity; + +import android.annotation.SuppressLint; +import com.ea.nimble.Error; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.Utility; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +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; + +/* loaded from: classes.dex */ +class NimbleIdentityUtility { + public static final String NIMBLE_IDENTITY_DEVICE_UNIQUE_IDENTIFIER = "nimble.identity.device.unique.identifier"; + + NimbleIdentityUtility() { + } + + public static Map parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error { + return Utility.convertJSONObjectToMap(parseJsonResponse(networkConnectionHandle)); + } + + public static HashMap parseRedirectURLParameters(NetworkConnectionHandle networkConnectionHandle) { + String url = networkConnectionHandle.getResponse().getUrl().toString(); + HashMap hashMap = new HashMap<>(); + for (String str : (url.split("\\?").length == 2 ? url.split("\\?")[0] : "").split("&")) { + if (str.split("=").length == 2) { + hashMap.put(str.split("=")[0], str.split("=")[1]); + } + } + return hashMap; + } + + @SuppressLint({"SimpleDateFormat"}) + public static String getTimeString(Date date) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-DD HH:mm:ss"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + return simpleDateFormat.format(date); + } + + @SuppressLint({"SimpleDateFormat"}) + public static String getCurrentTimeString() { + return new SimpleDateFormat("yyyy-MM-DD HH:mm:ss").format(new Date()); + } + + public static ByteArrayOutputStream toJSONString(HashMap hashMap) { + if (hashMap == null) { + return null; + } + try { + byte[] bytes = new GsonBuilder().serializeNulls().create().toJson(hashMap, new TypeToken>() { // from class: com.ea.nimble.identity.NimbleIdentityUtility.1 + }.getType()).getBytes(HTTP.UTF_8); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length); + byteArrayOutputStream.write(bytes); + return byteArrayOutputStream; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } catch (IOException e2) { + e2.printStackTrace(); + return null; + } + } + + public static JSONObject parseJsonResponse(NetworkConnectionHandle networkConnectionHandle) throws Error { + Exception error = networkConnectionHandle.getResponse().getError(); + if (error != null) { + if (error instanceof Error) { + throw ((Error) error); + } + throw new Error(Error.Code.UNKNOWN, "Unknown error while parsing network response", error); + } + InputStream dataStream = networkConnectionHandle.getResponse().getDataStream(); + if (dataStream == null) { + throw new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Cannot understand server response, expecting JSON string but get invalid data"); + } + try { + try { + JSONObject jSONObject = new JSONObject(Utility.readStringFromStream(dataStream)); + if (Utility.validString((String) jSONObject.opt("error"))) { + throw NimbleIdentityError.createWithData(Utility.convertJSONObjectToMap(jSONObject)); + } + return jSONObject; + } catch (JSONException e) { + throw new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Invalid JSON received from server", e); + } + } catch (IOException e2) { + throw new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Error reading server response", e2); + } + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/INimbleMTX.java b/app/src/main/java/com/ea/nimble/mtx/INimbleMTX.java new file mode 100644 index 0000000..c4ac0f2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/INimbleMTX.java @@ -0,0 +1,50 @@ +package com.ea.nimble.mtx; + +import com.ea.nimble.Error; +import com.ea.nimble.mtx.NimbleCatalogItem; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface INimbleMTX { + public static final String NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED = "nimble.notification.mtx.refreshcatalogfinished"; + public static final String NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED = "nimble.notification.mtx.restorepurchasedtransactionsfinished"; + public static final String NIMBLE_NOTIFICATION_MTX_TRANSACTIONS_RECOVERED = "nimble.notification.mtx.transactionsrecovered"; + public static final String NOTIFICATION_DICTIONARY_KEY_TRANSACTIONID = "TRANSACTION_ID"; + + public interface FinalizeTransactionCallback { + void finalizeComplete(NimbleMTXTransaction nimbleMTXTransaction); + } + + public interface ItemGrantedCallback { + void itemGrantedComplete(NimbleMTXTransaction nimbleMTXTransaction); + } + + public interface PurchaseTransactionCallback { + void purchaseComplete(NimbleMTXTransaction nimbleMTXTransaction); + + void unverifiedReceiptReceived(NimbleMTXTransaction nimbleMTXTransaction); + } + + Error finalizeTransaction(String str, FinalizeTransactionCallback finalizeTransactionCallback); + + List getAvailableCatalogItems(); + + List getPendingTransactions(); + + List getPurchasedTransactions(); + + List getRecoveredTransactions(); + + Error itemGranted(String str, NimbleCatalogItem.ItemType itemType, ItemGrantedCallback itemGrantedCallback); + + Error purchaseItem(String str, PurchaseTransactionCallback purchaseTransactionCallback, String str2); + + void refreshAvailableCatalogItems(); + + void restorePurchasedTransactions(); + + Error resumeTransaction(String str, PurchaseTransactionCallback purchaseTransactionCallback, ItemGrantedCallback itemGrantedCallback, FinalizeTransactionCallback finalizeTransactionCallback); + + void setPlatformParameters(Map map); +} diff --git a/app/src/main/java/com/ea/nimble/mtx/NimbleCatalogItem.java b/app/src/main/java/com/ea/nimble/mtx/NimbleCatalogItem.java new file mode 100644 index 0000000..f3004cf --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/NimbleCatalogItem.java @@ -0,0 +1,32 @@ +package com.ea.nimble.mtx; + +import java.util.Map; + +/* loaded from: classes.dex */ +public abstract class NimbleCatalogItem { + + public enum ItemType { + UNKNOWN, + NONCONSUMABLE, + CONSUMABLE, + SUBSCRIPTION + } + + public abstract Map getAdditionalInfo(); + + public abstract String getDescription(); + + public abstract ItemType getItemType(); + + public abstract String getMetaDataUrl(); + + public abstract float getPriceDecimal(); + + public abstract String getPriceWithCurrencyAndFormat(); + + public abstract String getSellId(); + + public abstract String getSku(); + + public abstract String getTitle(); +} diff --git a/app/src/main/java/com/ea/nimble/mtx/NimbleMTX.java b/app/src/main/java/com/ea/nimble/mtx/NimbleMTX.java new file mode 100644 index 0000000..5f31db8 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/NimbleMTX.java @@ -0,0 +1,20 @@ +package com.ea.nimble.mtx; + +import com.ea.nimble.Base; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class NimbleMTX { + public static final String COMPONENT_ID = "com.ea.nimble.mtx"; + + public static INimbleMTX getComponent() { + Object[] componentList = Base.getComponentList("com.ea.nimble.mtx"); + if (componentList == null || componentList.length <= 0) { + return null; + } + if (componentList.length != 1) { + Log.Helper.LOGFS("MTX", "More than one MTX component registered!", new Object[0]); + } + return (INimbleMTX) componentList[0]; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/NimbleMTXError.java b/app/src/main/java/com/ea/nimble/mtx/NimbleMTXError.java new file mode 100644 index 0000000..b53dacf --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/NimbleMTXError.java @@ -0,0 +1,56 @@ +package com.ea.nimble.mtx; + +import com.ea.nimble.Error; + +/* loaded from: classes.dex */ +public class NimbleMTXError extends Error { + public static final String ERROR_DOMAIN = "NimbleMTXError"; + private static final long serialVersionUID = 1; + + public enum Code { + BILLING_NOT_AVAILABLE(20000), + ITEM_ALREADY_OWNED(20001), + ITEM_NOT_OWNED(20002), + USER_CANCELED(20003), + VERIFICATION_ERROR(20004), + GET_NONCE_ERROR(20005), + NON_CRITICAL_INTERRUPTION(20006), + INTERNAL_STATE(20007), + TRANSACTION_PENDING(20008), + TRANSACTION_NOT_RESUMABLE(20009), + UNRECOGNIZED_TRANSACTION_ID(20010), + INVALID_TRANSACTION_STATE(20011), + UNABLE_TO_CONSTRUCT_REQUEST(20012), + PLATFORM_ERROR(20013), + INVALID_SERVER_RESPONSE(20014), + ERROR_GETTING_PREPURCHASE_INFO(20015), + ITEM_UNAVAILABLE(20016), + INVALID_SKU(20017), + TRANSACTION_DEFERRED(20018), + TRANSACTION_SUPERSEDED(20019), + EMPTY_SYNERGY_CATALOG(20020), + EMPTY_BILLING_CATALOG(20021), + ITEM_TYPE_NOT_MATCH(20037); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public NimbleMTXError() { + } + + public NimbleMTXError(Code code, String str, Throwable th) { + super(ERROR_DOMAIN, code.intValue(), str, th); + } + + public NimbleMTXError(Code code, String str) { + super(ERROR_DOMAIN, code.intValue(), str, null); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/NimbleMTXTransaction.java b/app/src/main/java/com/ea/nimble/mtx/NimbleMTXTransaction.java new file mode 100644 index 0000000..0a5d951 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/NimbleMTXTransaction.java @@ -0,0 +1,44 @@ +package com.ea.nimble.mtx; + +import java.util.Date; +import java.util.Map; + +/* loaded from: classes.dex */ +public interface NimbleMTXTransaction { + + public enum TransactionState { + UNDEFINED, + USER_INITIATED, + WAITING_FOR_PREPURCHASE_INFO, + WAITING_FOR_PLATFORM_RESPONSE, + WAITING_FOR_VERIFICATION, + WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT, + WAITING_FOR_PLATFORM_CONSUMPTION, + COMPLETE + } + + public enum TransactionType { + PURCHASE, + RESTORE + } + + Map getAdditionalInfo(); + + Exception getError(); + + String getItemSellId(); + + String getItemSku(); + + float getPriceDecimal(); + + String getReceipt(); + + Date getTimeStamp(); + + String getTransactionId(); + + TransactionState getTransactionState(); + + TransactionType getTransactionType(); +} diff --git a/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/ItemCategory.java b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/ItemCategory.java new file mode 100644 index 0000000..aa214d3 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/ItemCategory.java @@ -0,0 +1,9 @@ +package com.ea.nimble.mtx.catalog.synergy; + +/* loaded from: classes.dex */ +public class ItemCategory { + public int m_id; + public byte[] m_regularImageData; + public byte[] m_selectedImageData; + public String m_title; +} diff --git a/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalog.java b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalog.java new file mode 100644 index 0000000..a91e2d1 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalog.java @@ -0,0 +1,462 @@ +package com.ea.nimble.mtx.catalog.synergy; + +import android.util.Base64; +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.Global; +import com.ea.nimble.IApplicationEnvironment; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.INetwork; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.ISynergyNetwork; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.SynergyIdManager; +import com.ea.nimble.SynergyNetwork; +import com.ea.nimble.SynergyNetworkConnectionCallback; +import com.ea.nimble.SynergyNetworkConnectionHandle; +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; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/* loaded from: classes.dex */ +public class SynergyCatalog implements LogSource { + public static final String MTX_INFO_KEY_CURRENCY = "localCurrency"; + public static final String MTX_INFO_KEY_METADATA = "metadata"; + public static final String MTX_INFO_KEY_SELLID = "sellId"; + private static final String SYNERGY_API_GET_AVAILABLE_ITEMS = "/product/api/core/getAvailableItems"; + private static final String SYNERGY_API_GET_CATEGORIES = "/product/api/core/getMTXGameCategories"; + private static final String SYNERGY_API_GET_DOWNLOAD_URL = "/product/api/core/getDownloadItemUrl"; + private static final String SYNERGY_API_GET_NONCE = "/drm/api/core/getNonce"; + private static final String SYNERGY_API_GET_PURCHASED_ITEMS = "/drm/api/core/getPurchasedItems"; + private String m_itemSkuPrefix; + private int m_itemsLoadingBinaryData = 0; + + public interface CategoryCallback { + void callback(Set set, Exception exc); + } + + public interface CompletionCallback { + void callback(Exception exc); + } + + public interface DataCallback { + void callback(InputStream inputStream, Exception exc); + } + + public interface ItemCallback { + void callback(List list, Exception exc); + } + + public interface ItemSkuCallback { + void callback(List list, Exception exc); + } + + public enum StoreType { + GOOGLE, + AMAZON + } + + public interface StringCallback { + void callback(String str, Exception exc); + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "SynergyCatalog"; + } + + static /* synthetic */ int access$106(SynergyCatalog synergyCatalog) { + int i = synergyCatalog.m_itemsLoadingBinaryData - 1; + synergyCatalog.m_itemsLoadingBinaryData = i; + return i; + } + + public SynergyCatalog(StoreType storeType) { + if (storeType == StoreType.AMAZON) { + this.m_itemSkuPrefix = ApplicationEnvironment.getComponent().getApplicationBundleId() + "."; + return; + } + this.m_itemSkuPrefix = ""; + } + + public String getItemSkuPrefix() { + return this.m_itemSkuPrefix; + } + + public String getSellIdFromSku(String str) { + if (!this.m_itemSkuPrefix.isEmpty() && str != null && str.startsWith(this.m_itemSkuPrefix)) { + str = str.substring(this.m_itemSkuPrefix.length()); + } + if (Utility.isOnlyDecimalCharacters(str)) { + return str; + } + return null; + } + + public void getItemCatalog(final ItemCallback itemCallback) { + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.1 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); + if (component2 != null) { + synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT); + HashMap hashMap = new HashMap(); + hashMap.put("masterSellId", component2.getSellId()); + hashMap.put("typeSubstr", "1"); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("ver", component.getApplicationVersion()); + 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; + } + Log.Helper.LOGE(this, "[getItemCatalog prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.2 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + List list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("productData"); + if (list == null || list.size() == 0) { + itemCallback.callback(null, new NimbleMTXError(NimbleMTXError.Code.EMPTY_SYNERGY_CATALOG, "No items retrieved from Synergy")); + return; + } + ArrayList arrayList = new ArrayList(list.size()); + Iterator it = list.iterator(); + while (it.hasNext()) { + arrayList.add(SynergyCatalog.this.createItemFromMap((Map) it.next())); + } + itemCallback.callback(arrayList, null); + return; + } + itemCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError()); + } + }; + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_AVAILABLE_ITEMS, IHttpRequest.Method.GET, synergyRequestPreparingCallback); + ISynergyNetwork component = SynergyNetwork.getComponent(); + if (component != null) { + component.sendRequest(synergyRequest, synergyNetworkConnectionCallback); + } else { + Log.Helper.LOGE(this, "[getItemCatalog failed] Synergy Network is null, unable to send request", new Object[0]); + } + } + + public void loadBinaryDataForItems(Collection collection, final CompletionCallback completionCallback) { + String metaDataUrl; + if (this.m_itemsLoadingBinaryData != 0) { + Log.Helper.LOGE(this, "Error: items already loading binary data", new Object[0]); + return; + } + for (final SynergyCatalogItem synergyCatalogItem : collection) { + if (synergyCatalogItem.m_additionalInfo.get("binaryData") == null && (metaDataUrl = synergyCatalogItem.getMetaDataUrl()) != null) { + try { + URL url = new URL(metaDataUrl); + this.m_itemsLoadingBinaryData++; + INetwork component = Network.getComponent(); + if (component != null) { + component.sendGetRequest(url, null, new NetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.3 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + InputStream dataStream = networkConnectionHandle.getResponse().getDataStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + try { + byte[] bArr = new byte[4096]; + while (true) { + int read = dataStream.read(bArr, 0, bArr.length); + if (read == -1) { + break; + } else { + byteArrayOutputStream.write(bArr, 0, read); + } + } + byteArrayOutputStream.flush(); + } catch (IOException unused) { + Log.Helper.LOGE(this, "Error reading binary data", new Object[0]); + } + synergyCatalogItem.getAdditionalInfo().put("binaryData", byteArrayOutputStream.toByteArray()); + SynergyCatalog.access$106(SynergyCatalog.this); + if (SynergyCatalog.this.m_itemsLoadingBinaryData == 0) { + completionCallback.callback(null); + } + } + }); + } else { + Log.Helper.LOGE(this, "Synergy loadBinaryDataForItems failed! Network component was null, unable to send get request", new Object[0]); + } + } catch (MalformedURLException unused) { + Log.Helper.LOGE(this, "Error: Malformed item url: " + metaDataUrl, new Object[0]); + } + } + } + } + + public void getNonce(final StringCallback stringCallback) { + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.4 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component != null) { + synergyRequest.baseUrl = component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM); + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId()); + hashMap.put("masterSellId", component.getSellId()); + synergyRequest.urlParameters = hashMap; + synergyRequest.send(); + return; + } + Log.Helper.LOGE(this, "[getNonce failed] Synergy environment is null, unable to send request", new Object[0]); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.5 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + Object obj = synergyNetworkConnectionHandle.getResponse().getJsonData().get("nonce"); + stringCallback.callback(obj != null ? obj.toString() : "", null); + } else { + stringCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError()); + } + } + }; + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_NONCE, IHttpRequest.Method.GET, synergyRequestPreparingCallback); + ISynergyNetwork component = SynergyNetwork.getComponent(); + if (component != null) { + component.sendRequest(synergyRequest, synergyNetworkConnectionCallback); + } else { + Log.Helper.LOGE(this, "[getNonce failed] Synergy network is null, unable to send request", new Object[0]); + } + } + + public void downloadItem(SynergyCatalogItem synergyCatalogItem, final DataCallback dataCallback) { + getDownloadUrlForItem(synergyCatalogItem, new StringCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.6 + @Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.StringCallback + public void callback(String str, Exception exc) { + if (exc == null) { + SynergyCatalog.this.downloadContent(str, dataCallback); + } else { + callback(null, exc); + } + } + }); + } + + public void getPurchasedItems(final ItemSkuCallback itemSkuCallback) { + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.7 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component != null) { + synergyRequest.baseUrl = component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM); + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId()); + hashMap.put("masterSellId", component.getSellId()); + synergyRequest.urlParameters = hashMap; + synergyRequest.send(); + return; + } + Log.Helper.LOGE(this, "[getPurchasedItems prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.8 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + List list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("sellIds"); + ArrayList arrayList = new ArrayList(list.size()); + Iterator it = list.iterator(); + while (it.hasNext()) { + arrayList.add(SynergyCatalog.this.m_itemSkuPrefix + ((Integer) it.next())); + } + itemSkuCallback.callback(arrayList, null); + return; + } + itemSkuCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError()); + } + }; + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_PURCHASED_ITEMS, IHttpRequest.Method.GET, synergyRequestPreparingCallback); + ISynergyNetwork component = SynergyNetwork.getComponent(); + if (component != null) { + component.sendRequest(synergyRequest, synergyNetworkConnectionCallback); + } else { + Log.Helper.LOGE(this, "[getPurchasedItems failed] Synergy network is null, unable to send request", new Object[0]); + } + } + + public void getCategories(final CategoryCallback categoryCallback) { + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.9 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); + if (component2 != null) { + synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT); + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("masterSellId", component2.getSellId()); + hashMap.put("langCode", component.getShortApplicationLanguageCode()); + synergyRequest.urlParameters = hashMap; + synergyRequest.send(); + return; + } + Log.Helper.LOGE(this, "[getCategories prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.10 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + List list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("gameCategoryData"); + HashSet hashSet = new HashSet(); + for (Map map : list) { + ItemCategory itemCategory = new ItemCategory(); + itemCategory.m_id = ((Integer) map.get("categoryId")).intValue(); + itemCategory.m_title = (String) map.get("title"); + itemCategory.m_regularImageData = Base64.decode((String) map.get("imageOff"), 0); + itemCategory.m_selectedImageData = Base64.decode((String) map.get("imageOn"), 0); + hashSet.add(itemCategory); + } + categoryCallback.callback(hashSet, null); + return; + } + categoryCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError()); + } + }; + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_CATEGORIES, IHttpRequest.Method.GET, synergyRequestPreparingCallback); + ISynergyNetwork component = SynergyNetwork.getComponent(); + if (component != null) { + component.sendRequest(synergyRequest, synergyNetworkConnectionCallback); + } else { + Log.Helper.LOGE(this, "[getCategories failed] Synergy network is null, unable to send request", new Object[0]); + } + } + + private void getDownloadUrlForItem(final SynergyCatalogItem synergyCatalogItem, final StringCallback stringCallback) { + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.11 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(SynergyRequest synergyRequest) { + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); + if (component2 != null) { + synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT); + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + hashMap.put("ver", component.getApplicationVersion()); + hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId()); + hashMap.put("langCode", component.getShortApplicationLanguageCode()); + hashMap.put(SynergyCatalog.MTX_INFO_KEY_SELLID, synergyCatalogItem.getSellId()); + synergyRequest.urlParameters = hashMap; + synergyRequest.send(); + return; + } + Log.Helper.LOGE(this, "[getDownloadUrlForItem prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.12 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + if (synergyNetworkConnectionHandle.getResponse().getError() == null) { + List list = (List) ((Map) synergyNetworkConnectionHandle.getResponse().getJsonData().get("infoData")).get("fileURL"); + if (list.size() > 0) { + stringCallback.callback((String) list.get(0), null); + return; + } else { + stringCallback.callback(null, new Exception("No urls for item")); + return; + } + } + stringCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError()); + } + }; + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_DOWNLOAD_URL, IHttpRequest.Method.GET, synergyRequestPreparingCallback); + ISynergyNetwork component = SynergyNetwork.getComponent(); + if (component != null) { + component.sendRequest(synergyRequest, synergyNetworkConnectionCallback); + } else { + Log.Helper.LOGE(this, "[getDownloadUrlForItem failed] Synergy network is null, unable to send request", new Object[0]); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void downloadContent(String str, final DataCallback dataCallback) { + try { + URL url = new URL(str); + INetwork component = Network.getComponent(); + if (component != null) { + component.sendGetRequest(url, null, new NetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.13 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + if (networkConnectionHandle.getResponse().getError() == null) { + dataCallback.callback(networkConnectionHandle.getResponse().getDataStream(), null); + } else { + dataCallback.callback(null, networkConnectionHandle.getResponse().getError()); + } + } + }); + } else { + Log.Helper.LOGE(this, "[downloadContent failed] Network component is null, unable to sendGetRequest to Url", new Object[0]); + } + } catch (MalformedURLException unused) { + Log.Helper.LOGE(this, "Invalid url: " + str, new Object[0]); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public SynergyCatalogItem createItemFromMap(Map map) { + SynergyCatalogItem synergyCatalogItem = new SynergyCatalogItem(); + String str = "" + map.get(MTX_INFO_KEY_SELLID); + String str2 = "skuAlias_" + str + "="; + String str3 = (String) map.get("desc2"); + if (str3 != null && str3.contains(str2)) { + String substring = str3.substring(str3.indexOf(str2) + str2.length()); + int indexOf = substring.indexOf(59); + if (indexOf > 0) { + substring = substring.substring(0, indexOf); + } + synergyCatalogItem.m_sku = substring; + Log.Helper.LOGV(this, "[Sku Mapping] SellID=" + str + " | SKU=" + synergyCatalogItem.m_sku, new Object[0]); + } else { + synergyCatalogItem.m_sku = this.m_itemSkuPrefix + str; + } + synergyCatalogItem.m_title = (String) map.get("title"); + if (Utility.safeString((String) map.get("offerType")).equals("Subscription")) { + synergyCatalogItem.m_type = NimbleCatalogItem.ItemType.SUBSCRIPTION; + } else { + synergyCatalogItem.m_type = ((Boolean) map.get("consumable")).booleanValue() ? NimbleCatalogItem.ItemType.CONSUMABLE : NimbleCatalogItem.ItemType.NONCONSUMABLE; + } + synergyCatalogItem.m_description = (String) map.get("desc"); + synergyCatalogItem.m_metaDataUrl = (String) map.get("packUrl"); + synergyCatalogItem.m_isFree = ((Boolean) map.get("free")).booleanValue(); + synergyCatalogItem.m_additionalInfo.putAll(map); + String str4 = (String) map.get("binaryPack"); + if (Utility.validString(str4)) { + synergyCatalogItem.m_additionalInfo.put("binaryData", Base64.decode(str4, 0)); + } + return synergyCatalogItem; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalogItem.java b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalogItem.java new file mode 100644 index 0000000..004d9ab --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/catalog/synergy/SynergyCatalogItem.java @@ -0,0 +1,97 @@ +package com.ea.nimble.mtx.catalog.synergy; + +import com.ea.nimble.mtx.NimbleCatalogItem; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class SynergyCatalogItem extends NimbleCatalogItem implements Serializable { + private static final long serialVersionUID = 1; + Map m_additionalInfo; + String m_description; + String m_formattedPrice; + boolean m_isFree; + String m_metaDataUrl; + float m_price; + String m_sku; + String m_title; + NimbleCatalogItem.ItemType m_type; + + public SynergyCatalogItem() { + this.m_additionalInfo = new HashMap(); + } + + public SynergyCatalogItem(String str) { + this(); + this.m_sku = str; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getSku() { + return this.m_sku; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getSellId() { + if (this.m_additionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) { + return this.m_additionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString(); + } + return null; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getTitle() { + return this.m_title; + } + + public void setTitle(String str) { + this.m_title = str; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getDescription() { + return this.m_description; + } + + public void setDescription(String str) { + this.m_description = str; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public float getPriceDecimal() { + return this.m_price; + } + + public void setPriceDecimal(float f) { + this.m_price = f; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getPriceWithCurrencyAndFormat() { + return this.m_formattedPrice; + } + + public void setPriceWithCurrencyAndFormat(String str) { + this.m_formattedPrice = str; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public NimbleCatalogItem.ItemType getItemType() { + return this.m_type; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getMetaDataUrl() { + return this.m_metaDataUrl; + } + + public boolean isFree() { + return this.m_isFree; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public Map getAdditionalInfo() { + return this.m_additionalInfo; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java new file mode 100644 index 0000000..320b086 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java @@ -0,0 +1,1957 @@ +package com.ea.nimble.mtx.googleplay; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +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 com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.ApplicationLifecycle; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Error; +import com.ea.nimble.Global; +import com.ea.nimble.IApplicationEnvironment; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.ISynergyIdManager; +import com.ea.nimble.ISynergyRequest; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.NimbleApplicationConfiguration; +import com.ea.nimble.NimbleConfiguration; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.SynergyIdManager; +import com.ea.nimble.SynergyNetwork; +import com.ea.nimble.SynergyNetworkConnectionCallback; +import com.ea.nimble.SynergyNetworkConnectionHandle; +import com.ea.nimble.SynergyRequest; +import com.ea.nimble.SynergyServerError; +import com.ea.nimble.Timer; +import com.ea.nimble.Utility; +import com.ea.nimble.mtx.INimbleMTX; +import com.ea.nimble.mtx.NimbleCatalogItem; +import com.ea.nimble.mtx.NimbleMTXError; +import com.ea.nimble.mtx.NimbleMTXTransaction; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalogItem; +import com.ea.nimble.mtx.googleplay.GooglePlayError; +import com.ea.nimble.mtx.googleplay.GooglePlayTransaction; +import com.ea.nimble.mtx.googleplay.util.IabHelper; +import com.ea.nimble.mtx.googleplay.util.IabResult; +import com.ea.nimble.mtx.googleplay.util.Inventory; +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; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; + +/* loaded from: classes.dex */ +public class GooglePlay extends Component implements INimbleMTX, IabHelper.OnIabPurchaseFinishedListener, IApplicationLifecycle.ActivityEventCallbacks, LogSource { + private static final double CACHE_EXPIRE_TIME = 3600.0d; + private static final String CACHE_TIMESTAMP_KEY = "cacheTimestamp"; + public static final String COMPONENT_ID = "com.ea.nimble.mtx.googleplay"; + private static final double DEFERRED_CALLBACK_DELAY = 0.1d; + public static int GOOGLEPLAY_ACTIVITY_RESULT_REQUEST_CODE = 987654; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID = "orderId"; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA = "purchaseData"; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE = "purchaseState"; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME = "purchaseTime"; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_RECEIPT = "receipt"; + public static String GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN = "token"; + public static String GOOGLEPLAY_PLATFORM_PARAMETER_APPLICATION_PUBLIC_KEY = "GOOGLEPLAY_APPLICATION_PUBLIC_KEY"; + private static final double MAX_REQUEST_RETRY_DELAY = 300.0d; + private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent"; + private static final String PERSISTENCE_CATALOG_ITEMS = "catalogItems"; + private static final String PERSISTENCE_PENDING_TRANSACTIONS = "pendingTransactions"; + private static final String PERSISTENCE_PURCHASED_TRANSACTIONS = "purchasedTransactions"; + private static final String PERSISTENCE_RECOVERED_TRANSACTIONS = "recoveredTransactions"; + private static final String PERSISTENCE_UNRECORDED_TRANSACTIONS = "unrecordedTransactions"; + private static final String SYNERGY_API_VERIFY_AND_RECORD_GOOGLEPLAY_PURCHASE = "/drm/api/android/verifyAndRecordPurchase"; + public static final String TAG = "MTX Google"; + IabHelper mGooglePlayIabHelper; + String m_appPublicKey; + private Long m_cacheTimestamp; + private ItemRestorer m_itemRestorer; + private boolean m_reportingEnabled; + private boolean m_restoreInProgress; + SynergyCatalog m_synergyCatalog; + private TransactionRecorder m_transactionRecorder; + private boolean m_verificationEnabled; + HashMap mPendingTransactions = new HashMap<>(); + HashMap mPurchasedTransactions = new HashMap<>(); + HashMap mRecoveredTransactions = new HashMap<>(); + HashMap mCatalogItems = new HashMap<>(); + ArrayList mUnrecordedTransactions = new ArrayList<>(); + + private interface CatalogItemCallback { + void onCatalogItemsRetrieved(List list, Exception exc); + } + + private interface GetNonceCallback { + void onGetNonceComplete(GooglePlayTransaction googlePlayTransaction, String str, Error error); + } + + private interface VerifyCallback { + void onVerificationComplete(Exception exc); + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.mtx.googleplay"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return TAG; + } + + @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) { + } + + private class JsonData implements ISynergyRequest.IJsonData { + private HashMap data; + + public JsonData(HashMap hashMap) { + this.data = hashMap; + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public int size() { + return this.data.size(); + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public Object getData() { + return this.data; + } + } + + private class ItemRestorer extends BroadcastReceiver implements Runnable { + private double m_requestRetryDelay; + private int m_retryCount; + private Timer m_timer; + + private ItemRestorer() { + this.m_timer = new Timer(this); + this.m_requestRetryDelay = 1.0d; + this.m_retryCount = 0; + } + + public void restoreItems() { + if (GooglePlay.this.m_restoreInProgress) { + return; + } + synchronized (GooglePlay.this) { + if (GooglePlay.this.mCatalogItems != null && !GooglePlay.this.mCatalogItems.isEmpty()) { + GooglePlay.this.restorePurchasedTransactionsImpl(false); + } + GooglePlay.this.m_restoreInProgress = true; + Log.Helper.LOGD(GooglePlay.this, "Restore pending but catalog is unavailable. Initiating refresh now.", new Object[0]); + Utility.registerReceiver(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, this); + this.m_retryCount = 0; + GooglePlay.this.refreshAvailableCatalogItems(); + } + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Bundle extras = intent.getExtras(); + if (extras != null && extras.getString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT).equals("0")) { + Error error = (Error) extras.getParcelable("error"); + this.m_retryCount++; + if (error.getDomain().equals(SynergyServerError.ERROR_DOMAIN) && this.m_retryCount < 5) { + Log.Helper.LOGD(GooglePlay.this, "Catalog refresh failed with restore pending. Retrying in " + this.m_requestRetryDelay + " seconds.", new Object[0]); + if (this.m_timer.isRunning()) { + return; + } + this.m_timer.schedule(this.m_requestRetryDelay, false); + return; + } + Log.Helper.LOGD(GooglePlay.this, "Catalog refresh failed with restore pending. Skip.", new Object[0]); + } + this.m_retryCount = 0; + this.m_timer.cancel(); + Utility.unregisterReceiver(this); + GooglePlay.this.m_restoreInProgress = false; + GooglePlay.this.restorePurchasedTransactionsImpl(false); + } + + @Override // java.lang.Runnable + public void run() { + this.m_requestRetryDelay = Math.min(this.m_requestRetryDelay * 2.0d, 300.0d); + GooglePlay.this.refreshAvailableCatalogItems(); + } + + public void cancel() { + GooglePlay.this.m_restoreInProgress = false; + this.m_timer.cancel(); + this.m_requestRetryDelay = 1.0d; + Utility.unregisterReceiver(this); + } + } + + private GooglePlay() { + this.m_itemRestorer = new ItemRestorer(); + this.m_transactionRecorder = new TransactionRecorder(); + } + + 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() { + return (GooglePlay) Base.getComponent("com.ea.nimble.mtx.googleplay"); + } + + private static void initialize() { + Base.registerComponent(new GooglePlay(), "com.ea.nimble.mtx.googleplay"); + } + + @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 + public void restore() { + Log.Helper.LOGD(this, "Component restore", new Object[0]); + this.m_synergyCatalog = new SynergyCatalog(SynergyCatalog.StoreType.GOOGLE); + loadFromPersistence(); + Utility.registerReceiver(Global.NOTIFICATION_LANGUAGE_CHANGE, new BroadcastReceiver() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.3 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGD(this, "refreshing catalog items after language change", new Object[0]); + GooglePlay.this.refreshAvailableCatalogItems(); + } + }); + ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this); + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGD(this, "Component teardown", new Object[0]); + this.m_transactionRecorder.cancel(); + this.m_itemRestorer.cancel(); + } + + @Override // com.ea.nimble.Component + public void suspend() { + Log.Helper.LOGD(this, "Component suspend", new Object[0]); + this.m_transactionRecorder.cancel(); + this.m_itemRestorer.cancel(); + } + + @Override // com.ea.nimble.Component + public void resume() { + Log.Helper.LOGD(this, "Component resume", new Object[0]); + if (!this.mGooglePlayIabHelper.isServiceAvailable()) { + this.mGooglePlayIabHelper.dispose(); + createIabHelper(); + } + synchronized (this) { + for (GooglePlayTransaction googlePlayTransaction : this.mPendingTransactions.values()) { + if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE) { + new PurchaseTransactionVerifier().verifyTransaction(googlePlayTransaction); + } + } + } + this.m_transactionRecorder.recordTransactions(); + this.m_itemRestorer.restoreItems(); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGD(this, "Component cleanup", new Object[0]); + if (this.mGooglePlayIabHelper != null) { + this.mGooglePlayIabHelper.dispose(); + this.mGooglePlayIabHelper = null; + } + ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onActivityResult(Activity activity, int i, int i2, Intent intent) { + Log.Helper.LOGD(this, "onActivityResult", new Object[0]); + if (this.mGooglePlayIabHelper == null) { + Log.Helper.LOGE(this, "GooglePlayIabHelper is not created or service is not currently available!", new Object[0]); + } else { + this.mGooglePlayIabHelper.handleActivityResult(i, i2, intent); + } + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public Error purchaseItem(final String str, INimbleMTX.PurchaseTransactionCallback purchaseTransactionCallback, String str2) { + GooglePlayCatalogItem googlePlayCatalogItem; + Object obj; + String currencyCode; + Log.Helper.LOGV(this, "purchaseItem() call with sku(%s)", str); + if (this.mGooglePlayIabHelper == null || !this.mGooglePlayIabHelper.isServiceAvailable()) { + Log.Helper.LOGE(this, "IabHelper is not set up. Either the GooglePlay app is not present, or the billing server was not bound", new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.BILLING_NOT_AVAILABLE, "IabHelper is not set up. Either the GooglePlay app is not present, or the billing server was not bound"); + } + if (purchaseTransactionCallback == null) { + Log.Helper.LOGE(this, "Missing purchase callback", new Object[0]); + return new Error(Error.Code.MISSING_CALLBACK, "Missing purchase callback"); + } + if (isTransactionPending()) { + Log.Helper.LOGD(this, "purchaseItem called while transactions still pending.", new Object[0]); + synchronized (this) { + Log.Helper.LOGD(this, "pendingTransactions: " + this.mPendingTransactions, new Object[0]); + Log.Helper.LOGD(this, "recoveredTransactions: " + this.mRecoveredTransactions, new Object[0]); + } + return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Another transaction is still outstanding."); + } + if (this.m_restoreInProgress) { + Log.Helper.LOGD(this, "purchaseItem called while restore is in progress.", new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Can't purchase item while restore is in progress."); + } + if (this.mRecoveredTransactions.size() != 0) { + Log.Helper.LOGE(this, "mRecoveredTransactions.size() != 0. Resuming transaction.", new Object[0]); + for (Map.Entry entry : this.mRecoveredTransactions.entrySet()) { + String key = entry.getKey(); + Log.Helper.LOGE(this, "transactionId: %s", key); + GooglePlayTransaction value = entry.getValue(); + resumeTransaction(key, purchaseTransactionCallback, value.mItemGrantedCallback, value.mFinalizeCallback); + } + } + String generateTransactionId = generateTransactionId(); + final GooglePlayTransaction googlePlayTransaction = new GooglePlayTransaction(); + googlePlayTransaction.mItemSku = str; + googlePlayTransaction.mTransactionId = generateTransactionId; + googlePlayTransaction.mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; + googlePlayTransaction.mPurchaseCallback = purchaseTransactionCallback; + Object[] objArr = new Object[2]; + objArr[0] = Utility.validString(str2) ? str2 : "not set; metadata is null"; + objArr[1] = str; + Log.Helper.LOGV(this, "Setting metadata... %s for sku %s", objArr); + if (Utility.validString(str2)) { + googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_METADATA, str2); + } + String sellIdFromSku = this.m_synergyCatalog.getSellIdFromSku(str); + synchronized (this) { + googlePlayCatalogItem = this.mCatalogItems.get(str); + if (googlePlayCatalogItem != null) { + googlePlayTransaction.mCatalogItem = new GooglePlayCatalogItem(googlePlayCatalogItem); + sellIdFromSku = googlePlayCatalogItem.getSellId(); + } + } + synchronized (this) { + this.mPendingTransactions.put(generateTransactionId, googlePlayTransaction); + } + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_PREPURCHASE_INFO); + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null && sellIdFromSku != null) { + HashMap hashMap = new HashMap(); + hashMap.put(Tracking.KEY_MTX_SELLID, sellIdFromSku); + ((ITracking) component).logEvent(Tracking.EVENT_MTX_ITEM_BEGIN_PURCHASE, hashMap); + } + HashMap hashMap2 = new HashMap(); + 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 { + bundle.putString("skuAlias", str); + } + float f = 0.0f; + if (googlePlayCatalogItem != null) { + f = googlePlayCatalogItem.getPriceDecimal(); + obj = googlePlayCatalogItem.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY); + } else { + obj = null; + } + if (obj != null) { + currencyCode = obj.toString(); + } else { + currencyCode = ApplicationEnvironment.getComponent().getCurrencyCode(); + } + bundle.putString("currency", currencyCode); + bundle.putString("price", String.format(Locale.US, "%.2f", Float.valueOf(f))); + bundle.putString("eatid", generateTransactionId); + Intent intent = new Intent(); + intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent.putExtras(bundle); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent); + GooglePlayCatalogItem googlePlayCatalogItem2 = new GooglePlayCatalogItem(); + googlePlayCatalogItem2.mSku = str; + ArrayList arrayList = new ArrayList(); + arrayList.add(googlePlayCatalogItem2); + getGooglePlayPricingForPendingCatalogItems(arrayList, new CatalogItemCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.4 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.CatalogItemCallback + public void onCatalogItemsRetrieved(List list, Exception exc) { + if (exc == null && (list == null || list.isEmpty())) { + exc = new NimbleMTXError(NimbleMTXError.Code.ERROR_GETTING_PREPURCHASE_INFO, "Failed to get prepurchase info for item " + str); + } + if (exc != null) { + googlePlayTransaction.mError = exc; + googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + if (googlePlayTransaction.mPurchaseCallback != null) { + try { + googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); + return; + } catch (Exception e) { + Log.Helper.LOGE(this, "MTX_GOOGLE: Unhandled exception in mPurchaseCallback: " + e, new Object[0]); + e.printStackTrace(); + return; + } + } + return; + } + googlePlayTransaction.mPriceDecimal = list.get(0).getPriceDecimal(); + Object obj2 = list.get(0).getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY); + if (obj2 != null) { + googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, obj2.toString()); + } else { + Log.Helper.LOGD(this, "Currency information not currently available; using local currency instead.", new Object[0]); + googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, ApplicationEnvironment.getComponent().getCurrencyCode()); + } + GooglePlay.this.googlePlayCallPurchaseItem(googlePlayTransaction); + } + }); + return null; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public Error itemGranted(String str, NimbleCatalogItem.ItemType itemType, INimbleMTX.ItemGrantedCallback itemGrantedCallback) { + GooglePlayTransaction googlePlayTransaction; + Log.Helper.LOGV(this, "itemGranted() call with transactionId(%s) and type (%s)", str, itemType.toString()); + synchronized (this) { + googlePlayTransaction = this.mPendingTransactions.get(str); + } + if (googlePlayTransaction == null) { + Log.Helper.LOGE(this, "Could not find transaction by Id to perform item grant, id: " + str, new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "Could not find transaction to perform item grant."); + } + if (googlePlayTransaction.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT) { + Log.Helper.LOGW(this, "Transaction in unexpected state for item grant. Transaction state: %s", googlePlayTransaction.mGooglePlayTransactionState); + } + if (itemGrantedCallback == null) { + Log.Helper.LOGE(this, "itemGranted called with empty callback parameter.", new Object[0]); + return new Error(Error.Code.MISSING_CALLBACK, "Missing callback in itemGranted call."); + } + googlePlayTransaction.mItemGrantedCallback = itemGrantedCallback; + if (googlePlayTransaction.mCatalogItem != null && googlePlayTransaction.mCatalogItem.getItemType() == NimbleCatalogItem.ItemType.CONSUMABLE && itemType != NimbleCatalogItem.ItemType.CONSUMABLE) { + Log.Helper.LOGW(this, "Game called item grant for SKU, %s, and indicated NOT consumable, though cached catalog data indicates the item is a consumable.", googlePlayTransaction.getItemSku()); + } + if (googlePlayTransaction.getError() != null) { + Log.Helper.LOGW(this, "Transaction for item SKU, %s, granted by game, despite an error. Clearing error from transaction.", googlePlayTransaction.getItemSku()); + googlePlayTransaction.mError = null; + } + if (itemType == NimbleCatalogItem.ItemType.CONSUMABLE) { + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION); + googlePlayConsumeItem(googlePlayTransaction); + } else { + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + deferredConsumeCallback(googlePlayTransaction.mItemGrantedCallback, googlePlayTransaction); + } + return null; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public Error finalizeTransaction(String str, INimbleMTX.FinalizeTransactionCallback finalizeTransactionCallback) { + GooglePlayTransaction googlePlayTransaction; + String currencyCode; + Log.Helper.LOGV(this, "finalizeTransaction() call with transactionId(%s)", str); + synchronized (this) { + googlePlayTransaction = this.mPendingTransactions.get(str); + } + if (googlePlayTransaction == null) { + String str2 = "Could not find transaction by Id to perform finalize, id: " + str; + Log.Helper.LOGE(this, str2, new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, str2); + } + if (googlePlayTransaction.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.COMPLETE) { + Log.Helper.LOGW(this, "Finalize called on unfinished transaction, for sku, %s.", googlePlayTransaction.getItemSku()); + } + googlePlayTransaction.mFinalizeCallback = finalizeTransactionCallback; + if (googlePlayTransaction.getError() == null && googlePlayTransaction.mTransactionType == NimbleMTXTransaction.TransactionType.PURCHASE) { + String itemSku = googlePlayTransaction.getItemSku(); + String format = String.format(Locale.US, "%.2f", Float.valueOf(googlePlayTransaction.getPriceDecimal())); + Object obj = googlePlayTransaction.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY); + if (obj != null) { + currencyCode = obj.toString(); + } else { + Log.Helper.LOGD(this, "Currency information not currently available; using local currency instead.", new Object[0]); + currencyCode = ApplicationEnvironment.getComponent().getCurrencyCode(); + } + String sellIdFromSku = this.m_synergyCatalog.getSellIdFromSku(itemSku); + if (sellIdFromSku == null) { + GooglePlayCatalogItem catalogItem = googlePlayTransaction.getCatalogItem(); + if (catalogItem == null) { + catalogItem = this.mCatalogItems.get(itemSku); + } + if (catalogItem != null) { + sellIdFromSku = catalogItem.getSellId(); + } + } + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null && sellIdFromSku != null) { + HashMap hashMap = new HashMap(); + hashMap.put(Tracking.KEY_MTX_SELLID, sellIdFromSku); + hashMap.put(Tracking.KEY_MTX_PRICE, format); + hashMap.put(Tracking.KEY_MTX_CURRENCY, currencyCode); + ((ITracking) component).logEvent(Tracking.EVENT_MTX_ITEM_PURCHASED, hashMap); + } + HashMap hashMap2 = new HashMap(); + 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 { + bundle.putString("skuAlias", itemSku); + } + bundle.putString("price", format); + bundle.putString("currency", currencyCode); + bundle.putString("eatid", str); + Object obj2 = googlePlayTransaction.getAdditionalInfo().get(GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID); + if (obj2 != null) { + bundle.putString("fptid", obj2.toString()); + } + Intent intent = new Intent(); + intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent.putExtras(bundle); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent); + } + synchronized (this) { + this.mPendingTransactions.remove(str); + } + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + if (googlePlayTransaction.getError() == null) { + synchronized (this) { + this.mPurchasedTransactions.put(str, googlePlayTransaction); + } + savePurchasedTransactionsToPersistence(); + } + boolean z = !googlePlayTransaction.mIsRecorded && googlePlayTransaction.mError == null; + if (z) { + synchronized (this) { + this.mUnrecordedTransactions.add(googlePlayTransaction); + } + saveUnrecordedTransactionsToPersistence(); + } + if (googlePlayTransaction.mFinalizeCallback != null) { + googlePlayTransaction.mFinalizeCallback.finalizeComplete(googlePlayTransaction); + } + if (!z) { + return null; + } + this.m_transactionRecorder.recordTransactions(); + return null; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public void restorePurchasedTransactions() { + Log.Helper.LOGV(this, "restorePurchasedTransactions()", new Object[0]); + restorePurchasedTransactionsImpl(true); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void restorePurchasedTransactionsImpl(boolean z) { + Log.Helper.LOGFUNC(this); + if (this.m_restoreInProgress) { + Log.Helper.LOGD(this, "restorePurchasedTransactions called while restore already in progress. Aborting.", new Object[0]); + return; + } + if (isTransactionPending(z)) { + Log.Helper.LOGD(this, "restorePurchasedTransactions called while transactions still pending.", new Object[0]); + synchronized (this) { + Log.Helper.LOGD(this, "pendingTransactions: " + this.mPendingTransactions, new Object[0]); + Log.Helper.LOGD(this, "recoveredTransactions: " + this.mRecoveredTransactions, new Object[0]); + } + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Can't restore purchases while transaction is pending"), null, null); + return; + } + Log.Helper.LOGD(this, "restorePurchasedTransactions called.", new Object[0]); + this.m_restoreInProgress = true; + try { + this.mGooglePlayIabHelper.queryInventoryAsync(true, true, new IabHelper.QueryInventoryFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.5 + @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.QueryInventoryFinishedListener + public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory) { + GooglePlayError createGooglePlayErrorFromIabResult; + Log.Helper.LOGDS(GooglePlay.TAG, "restorePurchasedTransactions onQueryInventoryFinished", new Object[0]); + if (iabResult == null || iabResult.isFailure()) { + Log.Helper.LOGES(GooglePlay.TAG, "Error with GooglePlay purchased item query. %s", iabResult.getMessage()); + createGooglePlayErrorFromIabResult = GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult); + } else { + createGooglePlayErrorFromIabResult = null; + } + ArrayList arrayList = new ArrayList(); + if (inventory != null && inventory.getAllPurchases() != null) { + List allPurchases = inventory.getAllPurchases(); + HashSet hashSet = new HashSet(); + for (Purchase purchase : allPurchases) { + hashSet.add(Utility.safeString(purchase.getSku())); + GooglePlayTransaction googlePlayTransaction = new GooglePlayTransaction(); + googlePlayTransaction.mTransactionType = NimbleMTXTransaction.TransactionType.RESTORE; + googlePlayTransaction.mTransactionId = GooglePlay.this.generateTransactionId(); + googlePlayTransaction.mItemSku = Utility.safeString(purchase.getSku()); + GooglePlayCatalogItem googlePlayCatalogItem = GooglePlay.this.mCatalogItems.get(googlePlayTransaction.mItemSku); + if (googlePlayCatalogItem != null) { + if (googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.CONSUMABLE) { + Log.Helper.LOGDS("CatalogItem: ", "CONSUMABLE", new Object[0]); + } else if (googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.NONCONSUMABLE) { + Log.Helper.LOGDS("CatalogItem: ", "NONCONSUMABLE", new Object[0]); + } else if (googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.SUBSCRIPTION) { + Log.Helper.LOGDS("CatalogItem: ", "SUBSCRIPTION", new Object[0]); + } else { + Log.Helper.LOGDS("CatalogItem: ", "UNKNOWN", new Object[0]); + } + } else { + Log.Helper.LOGDS("CatalogItem: ", "UNKNOWN", new Object[0]); + } + googlePlayTransaction.mNonce = Utility.safeString(purchase.getDeveloperPayload()); + googlePlayTransaction.mReceipt = Utility.safeString(purchase.getSignature()); + googlePlayTransaction.mGooglePlayTransactionState = GooglePlayTransaction.GooglePlayTransactionState.UNDEFINED; + GooglePlay.this.updateAdditionalInfoBundleFromIabPurchase(googlePlayTransaction, purchase); + SkuDetails skuDetails = inventory.getSkuDetails(purchase.getSku()); + try { + googlePlayTransaction.mPriceDecimal = Float.parseFloat(skuDetails.getPriceMicros()) / 1000000.0f; + } catch (NullPointerException unused) { + Log.Helper.LOGES(GooglePlay.TAG, "Error: got passed a null pointer when trying to parse the catalog prices.", new Object[0]); + googlePlayTransaction.mPriceDecimal = 0.0f; + } catch (NumberFormatException unused2) { + Log.Helper.LOGES(GooglePlay.TAG, "Error: got passed an invalid float string when trying to parse the catalog prices.", new Object[0]); + googlePlayTransaction.mPriceDecimal = 0.0f; + } + if (skuDetails != null) { + googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, skuDetails.getCurrencyCode()); + } + googlePlayTransaction.mTimeStamp = new Date(); + arrayList.add(googlePlayTransaction); + } + HashMap hashMap = new HashMap(); + for (String str : GooglePlay.this.mPurchasedTransactions.keySet()) { + hashMap.put(GooglePlay.this.mPurchasedTransactions.get(str).getItemSku(), str); + } + Set keySet = hashMap.keySet(); + keySet.removeAll(hashSet); + Iterator it = keySet.iterator(); + while (it.hasNext()) { + String str2 = (String) hashMap.get((String) it.next()); + synchronized (GooglePlay.this) { + GooglePlay.this.mPurchasedTransactions.remove(str2); + GooglePlay.this.mPendingTransactions.remove(str2); + } + } + } else { + GooglePlay.this.mPurchasedTransactions.clear(); + } + if (arrayList.size() != 0) { + if (!GooglePlay.this.m_verificationEnabled) { + if (!GooglePlay.this.m_reportingEnabled) { + GooglePlay.this.mUnrecordedTransactions.remove(arrayList); + } + GooglePlay.this.onRestoreComplete(arrayList); + return; + } + new RestoreTransactionVerifier().verifyTransactions(arrayList); + return; + } + Log.Helper.LOGDS(GooglePlay.TAG, "No restored transactions to verify. Raising NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED notification.", new Object[0]); + GooglePlay.this.m_restoreInProgress = false; + GooglePlay.this.broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, createGooglePlayErrorFromIabResult != null ? new Error(Error.Code.UNKNOWN, createGooglePlayErrorFromIabResult.getMessage(), createGooglePlayErrorFromIabResult) : null, null, null); + } + }); + } catch (IllegalStateException e) { + this.m_restoreInProgress = false; + Log.Helper.LOGD(this, "IAB Helper not setup. Check for Google Play account", new Object[0]); + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, new Error(Error.Code.NOT_READY, "ERROR_IAB_NULL", e), null, null); + } + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public List getPurchasedTransactions() { + ArrayList arrayList; + Log.Helper.LOGPUBLICFUNC(this); + synchronized (this) { + arrayList = new ArrayList(this.mPurchasedTransactions.values()); + } + return arrayList; + } + + public NimbleMTXTransaction getTransaction(String str) { + GooglePlayTransaction googlePlayTransaction; + Log.Helper.LOGPUBLICFUNC(this); + if (this.mPendingTransactions == null) { + return null; + } + synchronized (this) { + googlePlayTransaction = this.mPendingTransactions.get(str); + } + return googlePlayTransaction; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public List getPendingTransactions() { + ArrayList arrayList; + Log.Helper.LOGPUBLICFUNC(this); + if (this.mPendingTransactions == null) { + return null; + } + synchronized (this) { + arrayList = new ArrayList(this.mPendingTransactions.values()); + } + return arrayList; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public Error resumeTransaction(String str, INimbleMTX.PurchaseTransactionCallback purchaseTransactionCallback, INimbleMTX.ItemGrantedCallback itemGrantedCallback, INimbleMTX.FinalizeTransactionCallback finalizeTransactionCallback) { + GooglePlayTransaction remove; + Log.Helper.LOGV(this, "Resuming transaction id, %s.", Utility.safeString(str)); + if (str == null) { + return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "Null transaction ID"); + } + if (this.m_restoreInProgress) { + Log.Helper.LOGD(this, "resumeTransaction called while restore is in progress.", new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Can't resume transaction while restore is in progress."); + } + synchronized (this) { + if (this.mPendingTransactions.size() > 0) { + remove = this.mPendingTransactions.get(str); + if (remove == null) { + Log.Helper.LOGD(this, "Resume called while transactions are pending: " + this.mPendingTransactions, new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Another transaction is pending. It needs to finish and finalize first."); + } + if (remove.mError == null) { + return new Error(Error.Code.INVALID_ARGUMENT, "Cannot resume a pending transaction with no error"); + } + } else { + remove = this.mRecoveredTransactions.remove(str); + if (remove == null) { + return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "No transaction for given transaction ID."); + } + this.mPendingTransactions.put(remove.getTransactionId(), remove); + } + if (remove.mError != null && (!(remove.mError instanceof Error) || ((Error) remove.mError).getCode() != NimbleMTXError.Code.TRANSACTION_SUPERSEDED.intValue())) { + Log.Helper.LOGD(this, "Resuming transaction that failed in state " + remove.mFailedState + " with error " + remove.mError, new Object[0]); + remove.mGooglePlayTransactionState = remove.mFailedState; + remove.mFailedState = null; + remove.mError = null; + } + if (remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_PREPURCHASE_INFO || remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE) { + remove.mFailedState = remove.mGooglePlayTransactionState; + remove.mGooglePlayTransactionState = GooglePlayTransaction.GooglePlayTransactionState.COMPLETE; + remove.mError = new NimbleMTXError(NimbleMTXError.Code.NON_CRITICAL_INTERRUPTION, "MTX transaction interrupted before account charged."); + } + remove.mPurchaseCallback = purchaseTransactionCallback; + remove.mFinalizeCallback = finalizeTransactionCallback; + remove.mItemGrantedCallback = itemGrantedCallback; + savePendingTransactionsToPersistence(); + if (remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE || remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION) { + new PurchaseTransactionVerifier().verifyTransaction(remove); + } else if (remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT) { + if (remove.mPurchaseCallback != null) { + remove.mPurchaseCallback.purchaseComplete(remove); + } else { + return new Error(Error.Code.MISSING_CALLBACK, "Resumed transaction not given purchase callback."); + } + } else if (remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION) { + if (remove.mItemGrantedCallback != null) { + googlePlayConsumeItem(remove); + } else { + return new Error(Error.Code.MISSING_CALLBACK, "Resumed transaction not given item granted callback."); + } + } else if (remove.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.COMPLETE) { + finalizeTransaction(str, remove.mFinalizeCallback); + } else { + Log.Helper.LOGE(this, "ResumeTransaction called on a transaction that can't be resumed: " + remove, new Object[0]); + return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_NOT_RESUMABLE, "Transaction not in a resumable state."); + } + return null; + } + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public List getRecoveredTransactions() { + ArrayList arrayList; + Log.Helper.LOGPUBLICFUNC(this); + if (this.mRecoveredTransactions == null) { + return null; + } + synchronized (this) { + arrayList = new ArrayList(this.mRecoveredTransactions.values()); + } + return arrayList; + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public void refreshAvailableCatalogItems() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.mGooglePlayIabHelper == null || !this.mGooglePlayIabHelper.isServiceAvailable()) { + Log.Helper.LOGW(this, "refreshAvailable returning because billing is unavailable", new Object[0]); + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, new Error(Error.Code.NOT_AVAILABLE, String.valueOf(Error.Code.NOT_AVAILABLE)), null, null); + } else if (Network.getComponent().getStatus() != Network.Status.OK) { + Log.Helper.LOGW(this, "refreshAvailable returning because there is no network connection", new Object[0]); + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, new Error(Error.Code.NETWORK_NO_CONNECTION, String.valueOf(Error.Code.NETWORK_NO_CONNECTION)), null, null); + } else { + networkCallGetAvailableItems(); + } + } + + public void networkCallGetAvailableItems() { + Log.Helper.LOGFUNC(this); + try { + this.m_synergyCatalog.getItemCatalog(new SynergyCatalog.ItemCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.6 + @Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.ItemCallback + public void callback(List list, Exception exc) { + Log.Helper.LOGFUNC(this); + if (exc == null) { + LinkedList linkedList = new LinkedList(); + for (SynergyCatalogItem synergyCatalogItem : list) { + GooglePlayCatalogItem googlePlayCatalogItem = new GooglePlayCatalogItem(); + googlePlayCatalogItem.mItemType = synergyCatalogItem.getItemType(); + googlePlayCatalogItem.mAdditionalInfo = synergyCatalogItem.getAdditionalInfo(); + googlePlayCatalogItem.mDescription = synergyCatalogItem.getDescription(); + googlePlayCatalogItem.mSku = synergyCatalogItem.getSku(); + googlePlayCatalogItem.mTitle = synergyCatalogItem.getTitle(); + googlePlayCatalogItem.mUrl = synergyCatalogItem.getMetaDataUrl(); + googlePlayCatalogItem.mIsFree = synergyCatalogItem.isFree(); + linkedList.add(googlePlayCatalogItem); + } + if (Base.getConfiguration() != NimbleConfiguration.LIVE) { + GooglePlayCatalogItem googlePlayCatalogItem2 = new GooglePlayCatalogItem(); + googlePlayCatalogItem2.mSku = "android.test.purchased"; + googlePlayCatalogItem2.mTitle = "GP Purchased"; + googlePlayCatalogItem2.mDescription = "GP Purchased Desc"; + googlePlayCatalogItem2.mUrl = ""; + googlePlayCatalogItem2.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; + linkedList.add(googlePlayCatalogItem2); + GooglePlayCatalogItem googlePlayCatalogItem3 = new GooglePlayCatalogItem(); + googlePlayCatalogItem3.mSku = "android.test.canceled"; + googlePlayCatalogItem3.mTitle = "GP Canceled"; + googlePlayCatalogItem3.mDescription = "GP Canceled Desc"; + googlePlayCatalogItem3.mUrl = ""; + googlePlayCatalogItem3.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; + linkedList.add(googlePlayCatalogItem3); + GooglePlayCatalogItem googlePlayCatalogItem4 = new GooglePlayCatalogItem(); + googlePlayCatalogItem4.mSku = "android.test.refunded"; + googlePlayCatalogItem4.mTitle = "GP Refunded"; + googlePlayCatalogItem4.mDescription = "GP Refunded Desc"; + googlePlayCatalogItem4.mUrl = ""; + googlePlayCatalogItem4.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; + linkedList.add(googlePlayCatalogItem4); + GooglePlayCatalogItem googlePlayCatalogItem5 = new GooglePlayCatalogItem(); + googlePlayCatalogItem5.mSku = "android.test.item_unavailable"; + googlePlayCatalogItem5.mTitle = "GP Unavailable"; + googlePlayCatalogItem5.mDescription = "GP Unavailable Desc"; + googlePlayCatalogItem5.mUrl = ""; + googlePlayCatalogItem5.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; + linkedList.add(googlePlayCatalogItem5); + } + GooglePlay.this.getGooglePlayPricingForPendingCatalogItems(linkedList, new CatalogItemCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.6.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.CatalogItemCallback + public void onCatalogItemsRetrieved(List list2, Exception exc2) { + GooglePlay.this.onGooglePlayCatalogItemsRefreshed(list2, exc2); + } + }); + return; + } + Log.Helper.LOGE(this, "GetAvailableItems error: " + exc.toString(), new Object[0]); + GooglePlay.this.broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, new Error(Error.Code.UNKNOWN, exc.toString(), exc), null, null); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public List getAvailableCatalogItems() { + Log.Helper.LOGPUBLICFUNC(this); + synchronized (this) { + if (this.mCatalogItems != null && !isCacheExpired()) { + ArrayList arrayList = new ArrayList(this.mCatalogItems.values()); + Collections.sort(arrayList, new Comparator() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.1SkuComparator + @Override // java.util.Comparator + public int compare(NimbleCatalogItem nimbleCatalogItem, NimbleCatalogItem nimbleCatalogItem2) { + return nimbleCatalogItem.getSku().compareTo(nimbleCatalogItem2.getSku()); + } + }); + return arrayList; + } + return null; + } + } + + @Override // com.ea.nimble.mtx.INimbleMTX + public void setPlatformParameters(Map map) { + String str; + Log.Helper.LOGPUBLICFUNC(this); + if (map == null || (str = map.get(GOOGLEPLAY_PLATFORM_PARAMETER_APPLICATION_PUBLIC_KEY)) == null) { + return; + } + this.m_appPublicKey = str; + if (this.mGooglePlayIabHelper != null) { + this.mGooglePlayIabHelper.setApplicationPublicKey(this.m_appPublicKey); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void getGooglePlayPricingForPendingCatalogItems(List list, CatalogItemCallback catalogItemCallback) { + Log.Helper.LOGFUNC(this); + if (list == null || list.isEmpty()) { + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, new Error(Error.Code.UNKNOWN, "Empty catalog item list for GooglePlay catalog query."), null, null); + } else { + final C1GooglePlayCatalogUpdateListener c1GooglePlayCatalogUpdateListener = new C1GooglePlayCatalogUpdateListener(this.mGooglePlayIabHelper, list, catalogItemCallback); + ApplicationEnvironment.getCurrentActivity().runOnUiThread(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.7 + @Override // java.lang.Runnable + public void run() { + try { + c1GooglePlayCatalogUpdateListener.queryGooglePlay(); + } catch (IllegalStateException unused) { + c1GooglePlayCatalogUpdateListener.onQueryInventoryFinished(new IabResult(3, "Billing is unavailable"), null); + } + } + }); + } + } + + /* renamed from: com.ea.nimble.mtx.googleplay.GooglePlay$1GooglePlayCatalogUpdateListener, reason: invalid class name */ + class C1GooglePlayCatalogUpdateListener implements IabHelper.QueryInventoryFinishedListener { + List mCatalogItemList; + IabHelper mIabHelper; + final /* synthetic */ CatalogItemCallback val$callback; + + C1GooglePlayCatalogUpdateListener(IabHelper iabHelper, List list, CatalogItemCallback catalogItemCallback) { + this.val$callback = catalogItemCallback; + this.mCatalogItemList = list; + this.mIabHelper = iabHelper; + } + + void queryGooglePlay() { + ArrayList arrayList = new ArrayList(); + Iterator it = this.mCatalogItemList.iterator(); + while (it.hasNext()) { + arrayList.add(it.next().mSku); + } + Log.Helper.LOGD(this, "Making GooglePlay inventory query for skus: " + arrayList, new Object[0]); + this.mIabHelper.queryInventoryAsync(false, true, arrayList, this); + } + + @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.QueryInventoryFinishedListener + public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory) { + NimbleMTXError nimbleMTXError; + Log.Helper.LOGD(this, "GooglePlayCatalogUpdateListener onQueryInventoryFinished", new Object[0]); + if (iabResult.isFailure()) { + Log.Helper.LOGD(this, "Query inventory error: " + iabResult.getMessage(), new Object[0]); + nimbleMTXError = GooglePlay.this.createNimbleMTXErrorWithGooglePlayError(GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult), "GooglePlay catalog query error"); + } else { + HashSet hashSet = new HashSet(); + for (GooglePlayCatalogItem googlePlayCatalogItem : this.mCatalogItemList) { + SkuDetails skuDetails = inventory.getSkuDetails(googlePlayCatalogItem.mSku); + if (skuDetails != null) { + googlePlayCatalogItem.mTitle = skuDetails.getTitle(); + googlePlayCatalogItem.mDescription = skuDetails.getDescription(); + googlePlayCatalogItem.mPriceWithCurrencyAndFormat = skuDetails.getPrice(); + googlePlayCatalogItem.mPriceDecimal = Utility.validString(skuDetails.getPriceMicros()) ? Float.parseFloat(skuDetails.getPriceMicros()) / 1000000.0f : 0.0f; + googlePlayCatalogItem.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, skuDetails.getCurrencyCode()); + if (skuDetails.getType().equals(IabHelper.ITEM_TYPE_SUBS) && googlePlayCatalogItem.mItemType != NimbleCatalogItem.ItemType.SUBSCRIPTION) { + Log.Helper.LOGW(this, "EA Catalog failed to recognize " + googlePlayCatalogItem.getSku() + " as subscription. Updating item type based on First Party response.", new Object[0]); + googlePlayCatalogItem.mItemType = NimbleCatalogItem.ItemType.SUBSCRIPTION; + } + } else { + Log.Helper.LOGE(this, "Could not get SKU details from GooglePlay for SKU: %s. Removing from results.", googlePlayCatalogItem.mSku); + hashSet.add(googlePlayCatalogItem); + } + } + if (hashSet.size() > 0) { + this.mCatalogItemList.removeAll(hashSet); + } + nimbleMTXError = this.mCatalogItemList.size() == 0 ? new NimbleMTXError(NimbleMTXError.Code.EMPTY_BILLING_CATALOG, "Billing platform returned no matching items") : null; + } + this.val$callback.onCatalogItemsRetrieved(this.mCatalogItemList, nimbleMTXError); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onGooglePlayCatalogItemsRefreshed(List list, Exception exc) { + Log.Helper.LOGFUNC(this); + if (exc == null) { + Log.Helper.LOGD(this, "GooglePlayCatalog Updated.", new Object[0]); + synchronized (this) { + this.mCatalogItems.clear(); + for (GooglePlayCatalogItem googlePlayCatalogItem : list) { + this.mCatalogItems.put(googlePlayCatalogItem.getSku(), googlePlayCatalogItem); + } + } + saveCatalogToPersistence(); + } else { + Log.Helper.LOGE(this, "Error updating GooglePlay Catalog: " + exc, new Object[0]); + } + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, exc != null ? new Error(Error.Code.UNKNOWN, exc.toString(), exc) : null, null, null); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void broadcastLocalEvent(String str, Error error, String str2, Bundle bundle) { + Log.Helper.LOGFUNC(this); + LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()); + Intent intent = new Intent(); + intent.setAction(str); + Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle(); + if (error == null) { + bundle2.putString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "1"); + } else { + bundle2.putParcelable("error", error); + bundle2.putString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, "0"); + } + if (str2 != null) { + bundle2.putString(INimbleMTX.NOTIFICATION_DICTIONARY_KEY_TRANSACTIONID, str2); + } + intent.putExtras(bundle2); + localBroadcastManager.sendBroadcast(intent); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void networkCallGetNonceFromSynergy(final GooglePlayTransaction googlePlayTransaction, final GetNonceCallback getNonceCallback) { + Log.Helper.LOGFUNC(this); + try { + this.m_synergyCatalog.getNonce(new SynergyCatalog.StringCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.8 + @Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.StringCallback + public void callback(String str, Exception exc) { + Log.Helper.LOGFUNC(this); + if (exc == null) { + getNonceCallback.onGetNonceComplete(googlePlayTransaction, str, null); + } else { + getNonceCallback.onGetNonceComplete(googlePlayTransaction, null, new NimbleMTXError(NimbleMTXError.Code.GET_NONCE_ERROR, "Synergy getNonce request error.", exc)); + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + getNonceCallback.onGetNonceComplete(googlePlayTransaction, null, new NimbleMTXError(NimbleMTXError.Code.GET_NONCE_ERROR, "Error making Synergy getNonce request", e)); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public boolean updateTransactionRecordWithNonce(GooglePlayTransaction googlePlayTransaction, String str, Error error) { + NimbleMTXError nimbleMTXError; + Log.Helper.LOGFUNC(this); + if (error == null && str != null && str.length() != 0) { + googlePlayTransaction.mNonce = str; + return true; + } + if (error != null) { + Log.Helper.LOGE(this, "Error making getNonce call to Synergy: " + error, new Object[0]); + nimbleMTXError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy getNonce error", error); + } else { + Log.Helper.LOGE(this, "No nonce in Synergy response for getNonce.", new Object[0]); + nimbleMTXError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "No nonce in Synergy response"); + } + if (googlePlayTransaction != null) { + googlePlayTransaction.mError = nimbleMTXError; + googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + } else { + Log.Helper.LOGE(this, "No transaction record in getNonce error handling. No callback to call.", new Object[0]); + } + return false; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void googlePlayCallPurchaseItem(GooglePlayTransaction googlePlayTransaction) { + Log.Helper.LOGFUNC(this); + googlePlayTransaction.mDeveloperPayload = generateDeveloperPayloadForTransaction(googlePlayTransaction); + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE); + String str = IabHelper.ITEM_TYPE_INAPP; + GooglePlayCatalogItem googlePlayCatalogItem = this.mCatalogItems.get(googlePlayTransaction.getItemSku()); + if (googlePlayCatalogItem != null && googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.SUBSCRIPTION) { + str = IabHelper.ITEM_TYPE_SUBS; + } + this.mGooglePlayIabHelper.launchPurchaseFlow(ApplicationEnvironment.getCurrentActivity(), googlePlayTransaction.getItemSku(), str, googlePlayTransaction.mDeveloperPayload); + } + + @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabPurchaseFinishedListener + public void onIabPurchaseFinished(IabResult iabResult, Purchase purchase) { + GooglePlayTransaction googlePlayTransaction; + Log.Helper.LOGD(this, "IAB Purchase finished: " + iabResult + ", purchase: " + purchase, new Object[0]); + NimbleMTXError nimbleMTXError = null; + byte b = 0; + byte b2 = 0; + if (purchase != null) { + String developerPayload = purchase.getDeveloperPayload(); + String orderId = purchase.getOrderId(); + synchronized (this) { + googlePlayTransaction = null; + for (GooglePlayTransaction googlePlayTransaction2 : this.mPendingTransactions.values()) { + if (Utility.validString(googlePlayTransaction2.mDeveloperPayload) && googlePlayTransaction2.mDeveloperPayload.equals(developerPayload)) { + if (googlePlayTransaction == null) { + googlePlayTransaction = googlePlayTransaction2; + } else { + Log.Helper.LOGE(this, "Multiple transactions with the same developerPayload found! Using the first one. TransactionA: " + googlePlayTransaction.toString() + " TransactionB: " + googlePlayTransaction2.toString(), new Object[0]); + } + } else if (!Utility.validString(orderId) && !Utility.validString(developerPayload) && googlePlayTransaction2.mItemSku.equals(purchase.getSku())) { + Log.Helper.LOGD(this, "Found a matching SKU for pending transaction without orderId or developer payload, this must be a code redemption!", new Object[0]); + if (googlePlayTransaction == null) { + googlePlayTransaction = googlePlayTransaction2; + } else { + Log.Helper.LOGE(this, "Multiple transactions that look like code redemptions found! Using the first one. TransactionA: " + googlePlayTransaction.toString() + " TransactionB: " + googlePlayTransaction2.toString(), new Object[0]); + } + } + } + } + } else { + synchronized (this) { + googlePlayTransaction = null; + for (GooglePlayTransaction googlePlayTransaction3 : this.mPendingTransactions.values()) { + if (googlePlayTransaction3.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE) { + if (googlePlayTransaction == null) { + googlePlayTransaction = googlePlayTransaction3; + } else { + Log.Helper.LOGE(this, "More than one transaction record in WAITING_FOR_GOOGLE_PLAY_RESPONSE state found! Using: " + googlePlayTransaction.getItemSku() + ". Additional transaction for: " + googlePlayTransaction3.getItemSku(), new Object[0]); + } + } + } + } + } + if (googlePlayTransaction == null) { + Log.Helper.LOGD(this, "Transaction record could not be found for purchase", new Object[0]); + new ItemRestorer().restoreItems(); + return; + } + if (iabResult == null || iabResult.isFailure()) { + if (iabResult != null) { + Log.Helper.LOGD(this, "Error purchasing: " + iabResult, new Object[0]); + nimbleMTXError = createNimbleMTXErrorWithGooglePlayError(createGooglePlayErrorFromIabResult(iabResult), "GooglePlay purchase error"); + } + googlePlayTransaction.mError = nimbleMTXError; + googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; + Log.Helper.LOGD(this, "MTX_GOOGLE: Purchase error. Purchase object is: " + purchase, new Object[0]); + updateAdditionalInfoBundleFromIabPurchase(googlePlayTransaction, purchase); + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + if (googlePlayTransaction.mPurchaseCallback != null) { + try { + googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); + return; + } catch (Exception e) { + Log.Helper.LOGE(this, "MTX_GOOGLE: Unhandled exception in mPurchaseCallback: " + e, new Object[0]); + e.printStackTrace(); + return; + } + } + return; + } + Log.Helper.LOGD(this, "GooglePlay Purchase successful.", new Object[0]); + googlePlayTransaction.mReceipt = purchase.getSignature(); + if (googlePlayTransaction.mReceipt == null || googlePlayTransaction.mReceipt.length() == 0) { + Log.Helper.LOGW(this, "Purchase has an empty signature string. Setting to \"xxxxx\" for test.", new Object[0]); + googlePlayTransaction.mReceipt = "xxxxxxxxxxxxxxxxxxxxxxxxx"; + } + updateAdditionalInfoBundleFromIabPurchase(googlePlayTransaction, purchase); + if (this.m_verificationEnabled) { + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION); + if (googlePlayTransaction.mPurchaseCallback != null) { + googlePlayTransaction.mPurchaseCallback.unverifiedReceiptReceived(googlePlayTransaction); + } else { + Log.Helper.LOGE(this, "Transaction missing callback, cannot notify game of unverified receipt", new Object[0]); + } + new PurchaseTransactionVerifier().verifyTransaction(googlePlayTransaction); + return; + } + if (!this.m_reportingEnabled) { + this.mUnrecordedTransactions.remove(googlePlayTransaction); + } + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT); + if (googlePlayTransaction.mPurchaseCallback != null) { + googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); + } else { + Log.Helper.LOGE(this, "Transaction missing callback, cannot notify game of completed purchase", new Object[0]); + } + } + + private class PurchaseTransactionVerifier { + private PurchaseTransactionVerifier() { + } + + public void verifyTransaction(GooglePlayTransaction googlePlayTransaction) { + Log.Helper.LOGFUNC(this); + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE); + GooglePlay.this.networkCallGetNonceFromSynergy(googlePlayTransaction, new GetNonceCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.PurchaseTransactionVerifier.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback + public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction2, String str, Error error) { + Log.Helper.LOGFUNC(this); + if (googlePlayTransaction2.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE) { + return; + } + if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction2, str, error)) { + GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction2, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.PurchaseTransactionVerifier.1.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback + public void onVerificationComplete(Exception exc) { + Log.Helper.LOGFUNC(this); + if (googlePlayTransaction2.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION) { + return; + } + if (exc == null) { + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT); + } else { + Log.Helper.LOGE(this, "Error making recordPurchase call to Synergy: " + exc, new Object[0]); + googlePlayTransaction2.mError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy verification error", exc); + googlePlayTransaction2.mFailedState = googlePlayTransaction2.mGooglePlayTransactionState; + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + } + if (googlePlayTransaction2 == null || googlePlayTransaction2.mPurchaseCallback == null) { + return; + } + googlePlayTransaction2.mPurchaseCallback.purchaseComplete(googlePlayTransaction2); + } + }); + } else { + if (googlePlayTransaction2 == null || googlePlayTransaction2.mPurchaseCallback == null) { + return; + } + googlePlayTransaction2.mPurchaseCallback.purchaseComplete(googlePlayTransaction2); + } + } + }); + } + } + + private class RestoreTransactionVerifier { + private AtomicInteger m_transactionsVerifying; + private ArrayList m_verifiedTransactions; + + private RestoreTransactionVerifier() { + } + + public void verifyTransactions(List list) { + Log.Helper.LOGFUNC(this); + this.m_transactionsVerifying = new AtomicInteger(0); + this.m_verifiedTransactions = new ArrayList<>(); + if (list.size() == 0) { + GooglePlay.this.onRestoreComplete(this.m_verifiedTransactions); + return; + } + for (GooglePlayTransaction googlePlayTransaction : list) { + this.m_transactionsVerifying.incrementAndGet(); + synchronized (GooglePlay.this) { + GooglePlay.this.mPendingTransactions.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); + } + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE); + GooglePlay.this.networkCallGetNonceFromSynergy(googlePlayTransaction, new GetNonceCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.RestoreTransactionVerifier.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback + public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction2, String str, Error error) { + if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction2, str, error)) { + GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction2, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.RestoreTransactionVerifier.1.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback + public void onVerificationComplete(Exception exc) { + if (exc != null) { + googlePlayTransaction2.mError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy verification error", exc); + } + RestoreTransactionVerifier.this.m_verifiedTransactions.add(googlePlayTransaction2); + if (RestoreTransactionVerifier.this.m_transactionsVerifying.decrementAndGet() == 0) { + GooglePlay.this.onRestoreComplete(RestoreTransactionVerifier.this.m_verifiedTransactions); + } + } + }); + } else if (RestoreTransactionVerifier.this.m_transactionsVerifying.decrementAndGet() == 0) { + GooglePlay.this.onRestoreComplete(RestoreTransactionVerifier.this.m_verifiedTransactions); + } + } + }); + } + } + } + + /* JADX INFO: Access modifiers changed from: private */ + /* JADX WARN: Removed duplicated region for block: B:39:0x019f A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public void onRestoreComplete(java.util.List r11) { + /* + Method dump skipped, instructions count: 465 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.mtx.googleplay.GooglePlay.onRestoreComplete(java.util.List):void"); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void networkCallRecordPurchase(final GooglePlayTransaction googlePlayTransaction, final VerifyCallback verifyCallback) { + Log.Helper.LOGFUNC(this); + updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION); + SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.9 + @Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback + public void prepareRequest(final SynergyRequest synergyRequest) { + Log.Helper.LOGFUNC(this); + final IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + component.retrieveAdvertisingId(new IApplicationEnvironment.AdvertisingIdCalback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.9.1 + @Override // com.ea.nimble.IApplicationEnvironment.AdvertisingIdCalback + public void onCallback(String str, boolean z) { + Map playerIdMap; + ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); + ISynergyIdManager component3 = SynergyIdManager.getComponent(); + HashMap hashMap = new HashMap(); + boolean z2 = googlePlayTransaction.getCatalogItem() != null && googlePlayTransaction.getCatalogItem().isFree(); + hashMap.put("transactionId", googlePlayTransaction.getAdditionalInfo().get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID)); + hashMap.put("price", Integer.valueOf((int) (googlePlayTransaction.getPriceDecimal() * 100.0f))); + hashMap.put("currency", googlePlayTransaction.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY)); + hashMap.put("restore", Boolean.valueOf(googlePlayTransaction.getTransactionType() == NimbleMTXTransaction.TransactionType.RESTORE)); + try { + hashMap.put("receipt", googlePlayTransaction.getAdditionalInfo().get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA)); + } catch (Exception unused) { + Log.Helper.LOGE(this, "Exception creating JSON body for /recordPurchase", new Object[0]); + hashMap.put("receipt", ""); + } + String itemSku = googlePlayTransaction.getItemSku(); + String sellIdFromSku = GooglePlay.this.m_synergyCatalog.getSellIdFromSku(itemSku); + if (sellIdFromSku != null) { + hashMap.put("itemSellId", sellIdFromSku); + } else { + hashMap.put("skuAlias", itemSku); + GooglePlayCatalogItem googlePlayCatalogItem = GooglePlay.this.mCatalogItems.get(itemSku); + if (googlePlayCatalogItem != null) { + hashMap.put("itemSellId", googlePlayCatalogItem.getSellId()); + } + } + hashMap.put("masterSellId", component2.getSellId()); + hashMap.put("hwId", component2.getEAHardwareId()); + hashMap.put("signature", googlePlayTransaction.getReceipt()); + hashMap.put("nonce", googlePlayTransaction.getNonce()); + hashMap.put("isFree", Boolean.valueOf(z2)); + String synergyId = component3.getSynergyId(); + if (synergyId != null && synergyId != "") { + hashMap.put("synergyUid", Utility.safeString(synergyId)); + } + HashMap hashMap2 = new HashMap(); + String string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id"); + String bool = Boolean.toString(z); + hashMap2.put("eaDeviceId", Utility.safeString(component2.getEADeviceId())); + hashMap2.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, Utility.safeString(string)); + hashMap2.put("advertiserId", Utility.safeString(str)); + hashMap2.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, Utility.safeString(bool)); + hashMap2.put("aut", Utility.safeString("")); + hashMap.put("didMap", Utility.convertObjectToJSONString(hashMap2)); + if (component != null && (playerIdMap = component.getPlayerIdMap()) != null && playerIdMap.size() > 0) { + hashMap.put("pidMap", Utility.convertObjectToJSONString(playerIdMap)); + } + HashMap hashMap3 = new HashMap(); + hashMap3.put("timestamp", Utility.safeString(Utility.getUTCDateStringFormat(googlePlayTransaction.getTimeStamp()))); + hashMap3.put("bundleId", Utility.safeString(component.getApplicationBundleId())); + hashMap3.put("appName", Utility.safeString(component.getApplicationName())); + 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) { + query.moveToFirst(); + hashMap3.put(ApplicationEnvironment.NIMBLE_PARAMETER_FB_ATTR_ID, query.getString(0)); + } + } catch (IllegalStateException e) { + e.printStackTrace(); + } catch (Exception e2) { + e2.printStackTrace(); + } + hashMap.put("appInfo", Utility.convertObjectToJSONString(hashMap3)); + HashMap hashMap4 = new HashMap(); + 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())); + } + hashMap.put("deviceInfo", Utility.convertObjectToJSONString(hashMap4)); + hashMap.put("schemaVer", "2"); + hashMap.put("clientApiVersion", "2.0.0"); + synergyRequest.jsonData = GooglePlay.this.new JsonData(hashMap); + synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM); + synergyRequest.send(); + } + }); + } + }; + SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.10 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + Exception error = synergyNetworkConnectionHandle.getResponse().getError(); + if (error == null) { + Log.Helper.LOGD(this, "recordPurchase response: " + synergyNetworkConnectionHandle.getResponse().getJsonData().toString(), new Object[0]); + googlePlayTransaction.mIsRecorded = true; + } else if (error instanceof Error) { + Error error2 = (Error) error; + if (error2.getDomain().equals(SynergyServerError.ERROR_DOMAIN) && error2.getCode() != SynergyServerError.Code.AMAZON_SERVER_CONNECTION_ERROR.intValue() && error2.getCode() != SynergyServerError.Code.APPLE_SERVER_CONNECTION_ERROR.intValue()) { + Log.Helper.LOGD(GooglePlay.this, "Transaction " + googlePlayTransaction.mTransactionId + " failed to record with error: " + error2, new Object[0]); + googlePlayTransaction.mIsRecorded = true; + } + } + if (verifyCallback == null || !ApplicationEnvironment.isMainApplicationActive()) { + return; + } + verifyCallback.onVerificationComplete(error); + } + }; + SynergyNetwork.getComponent().sendRequest(new SynergyRequest(SYNERGY_API_VERIFY_AND_RECORD_GOOGLEPLAY_PURCHASE, IHttpRequest.Method.POST, synergyRequestPreparingCallback), synergyNetworkConnectionCallback); + } + + private void googlePlayConsumeItem(GooglePlayTransaction googlePlayTransaction) { + Log.Helper.LOGFUNC(this); + try { + this.mGooglePlayIabHelper.consumeAsync(new Purchase(googlePlayTransaction), new IabHelper.OnConsumeFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.11 + @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnConsumeFinishedListener + public void onConsumeFinished(Purchase purchase, IabResult iabResult) { + GooglePlayTransaction googlePlayTransaction2; + GooglePlayTransaction googlePlayTransaction3; + Log.Helper.LOGFUNC(this); + if (iabResult.isFailure()) { + Log.Helper.LOGE(this, "GooglePlay consume item failed, item SKU: " + purchase.getSku(), new Object[0]); + synchronized (GooglePlay.this) { + googlePlayTransaction3 = GooglePlay.this.mPendingTransactions.get(purchase.getNimbleMTXTransactionId()); + } + if (googlePlayTransaction3 != null) { + googlePlayTransaction3.mError = GooglePlay.this.createNimbleMTXErrorWithGooglePlayError(GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult), "GooglePlay item consumption error."); + googlePlayTransaction3.mFailedState = googlePlayTransaction3.mGooglePlayTransactionState; + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction3, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + if (googlePlayTransaction3.mItemGrantedCallback != null) { + googlePlayTransaction3.mItemGrantedCallback.itemGrantedComplete(googlePlayTransaction3); + return; + } else { + Log.Helper.LOGE(this, "Transaction does not have a consume callback to notify game of the finalize error.", new Object[0]); + return; + } + } + return; + } + Log.Helper.LOGD(this, "GooglePlay consume item success, item SKU: " + purchase.getSku(), new Object[0]); + synchronized (GooglePlay.this) { + googlePlayTransaction2 = GooglePlay.this.mPendingTransactions.get(purchase.getNimbleMTXTransactionId()); + } + if (googlePlayTransaction2 != null) { + GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); + if (googlePlayTransaction2.mItemGrantedCallback != null) { + googlePlayTransaction2.mItemGrantedCallback.itemGrantedComplete(googlePlayTransaction2); + return; + } else { + Log.Helper.LOGE(this, "Transaction does not have a consume callback to notify game.", new Object[0]); + return; + } + } + Log.Helper.LOGE(this, "Unable to find consumed transaction to remove.", new Object[0]); + } + }); + } catch (Exception unused) { + Log.Helper.LOGE(this, "Unable to construct a Purchase object from GooglePlayTransaction. Unable to consume item with Google Play!", new Object[0]); + if (googlePlayTransaction.mItemGrantedCallback != null) { + googlePlayTransaction.mError = new NimbleMTXError(NimbleMTXError.Code.UNABLE_TO_CONSTRUCT_REQUEST, "Unable to construct Purchase object from GooglePlayTransaction."); + googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; + deferredConsumeCallback(googlePlayTransaction.mItemGrantedCallback, googlePlayTransaction); + return; + } + Log.Helper.LOGE(this, "ItemGrantedCallback not set, no way to notify game.", new Object[0]); + } + } + + private String getAppPublicKey() { + return this.m_appPublicKey; + } + + /* JADX INFO: Access modifiers changed from: private */ + public String generateTransactionId() { + return UUID.randomUUID().toString(); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void updateAdditionalInfoBundleFromIabPurchase(GooglePlayTransaction googlePlayTransaction, Purchase purchase) { + Log.Helper.LOGFUNC(this); + if (purchase != null) { + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID, purchase.getOrderId()); + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME, Long.valueOf(purchase.getPurchaseTime())); + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE, Integer.valueOf(purchase.getPurchaseState())); + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN, purchase.getToken()); + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA, purchase.getOriginalJson()); + googlePlayTransaction.mAdditionalInfo.put(GOOGLEPLAY_ADDITIONALINFO_KEY_RECEIPT, purchase.getSignature()); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void updateGooglePlayTransactionRecordState(GooglePlayTransaction googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState googlePlayTransactionState) { + Log.Helper.LOGFUNC(this); + googlePlayTransaction.mGooglePlayTransactionState = googlePlayTransactionState; + googlePlayTransaction.mTimeStamp = new Date(); + savePendingTransactionsToPersistence(); + } + + private void savePendingTransactionsToPersistence() { + HashMap hashMap; + HashMap hashMap2; + Log.Helper.LOGFUNC(this); + synchronized (this) { + hashMap = new HashMap(this.mPendingTransactions); + hashMap2 = new HashMap(this.mRecoveredTransactions); + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.mtx.googleplay", Persistence.Storage.DOCUMENT); + Log.Helper.LOGD(this, "Saving %d pending and %d previously recovered transactions to persistence.", Integer.valueOf(hashMap.size()), Integer.valueOf(hashMap2.size())); + persistenceForNimbleComponent.setValue(PERSISTENCE_PENDING_TRANSACTIONS, hashMap); + persistenceForNimbleComponent.setValue(PERSISTENCE_RECOVERED_TRANSACTIONS, hashMap2); + persistenceForNimbleComponent.synchronize(); + } + + private void saveCatalogToPersistence() { + HashMap hashMap; + Log.Helper.LOGFUNC(this); + synchronized (this) { + hashMap = new HashMap(this.mCatalogItems); + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.mtx.googleplay", Persistence.Storage.DOCUMENT); + Log.Helper.LOGD(this, "Saving %d catalog items to persistence.", Integer.valueOf(hashMap.size())); + persistenceForNimbleComponent.setValue(PERSISTENCE_CATALOG_ITEMS, hashMap); + this.m_cacheTimestamp = Long.valueOf(System.currentTimeMillis()); + persistenceForNimbleComponent.setValue(CACHE_TIMESTAMP_KEY, this.m_cacheTimestamp); + persistenceForNimbleComponent.synchronize(); + } + + private void savePurchasedTransactionsToPersistence() { + HashMap hashMap; + Log.Helper.LOGFUNC(this); + synchronized (this) { + hashMap = new HashMap(this.mPurchasedTransactions); + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.mtx.googleplay", Persistence.Storage.DOCUMENT); + Log.Helper.LOGD(this, "Saving %d purchased transactions to persistence.", Integer.valueOf(hashMap.size())); + persistenceForNimbleComponent.setValue(PERSISTENCE_PURCHASED_TRANSACTIONS, hashMap); + persistenceForNimbleComponent.synchronize(); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void saveUnrecordedTransactionsToPersistence() { + ArrayList arrayList; + Log.Helper.LOGFUNC(this); + synchronized (this) { + arrayList = new ArrayList(this.mUnrecordedTransactions); + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.mtx.googleplay", Persistence.Storage.DOCUMENT); + Log.Helper.LOGD(this, "Saving %d unrecorded transactions to persistence.", Integer.valueOf(arrayList.size())); + persistenceForNimbleComponent.setValue(PERSISTENCE_UNRECORDED_TRANSACTIONS, arrayList); + persistenceForNimbleComponent.synchronize(); + } + + private HashMap filterForResumablePurchaseTransactions(HashMap hashMap) { + Log.Helper.LOGFUNC(this); + HashMap hashMap2 = new HashMap<>(); + if (hashMap == null) { + return hashMap2; + } + for (GooglePlayTransaction googlePlayTransaction : hashMap.values()) { + if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.COMPLETE) { + hashMap2.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); + } + } + return hashMap2; + } + + private List findRecoveredTransactionsWithItemSku(String str) { + Log.Helper.LOGFUNC(this); + ArrayList arrayList = new ArrayList(); + if (str == null) { + return arrayList; + } + synchronized (this) { + for (GooglePlayTransaction googlePlayTransaction : this.mRecoveredTransactions.values()) { + if (googlePlayTransaction.getItemSku().equals(str)) { + arrayList.add(googlePlayTransaction); + } + } + } + return arrayList; + } + + private boolean isTransactionPending() { + Log.Helper.LOGFUNC(this); + return isTransactionPending(true); + } + + private boolean isTransactionPending(boolean z) { + Log.Helper.LOGFUNC(this); + synchronized (this) { + if (this.mPendingTransactions.size() == 0 && (!z || this.mRecoveredTransactions.size() == 0)) { + return false; + } + return true; + } + } + + private void loadFromPersistence() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.mtx.googleplay", Persistence.Storage.DOCUMENT); + Serializable value = persistenceForNimbleComponent.getValue(PERSISTENCE_CATALOG_ITEMS); + if (value != null && value.getClass() == HashMap.class) { + HashMap hashMap = new HashMap<>((HashMap) value); + synchronized (this) { + this.mCatalogItems = hashMap; + Log.Helper.LOGD(this, "Restored %d catalog items from persistence.", Integer.valueOf(this.mCatalogItems.size())); + } + } + Serializable value2 = persistenceForNimbleComponent.getValue(PERSISTENCE_PURCHASED_TRANSACTIONS); + if (value2 != null && value2.getClass() == HashMap.class) { + HashMap hashMap2 = new HashMap<>((HashMap) value2); + synchronized (this) { + this.mPurchasedTransactions = hashMap2; + Log.Helper.LOGD(this, "%d purchased transactions restored from persistence.", Integer.valueOf(this.mPurchasedTransactions.size())); + } + } else { + Log.Helper.LOGD(this, "No purchased transactions to restore.", new Object[0]); + } + Serializable value3 = persistenceForNimbleComponent.getValue(PERSISTENCE_RECOVERED_TRANSACTIONS); + if (value3 != null && value3.getClass() == HashMap.class) { + HashMap hashMap3 = new HashMap<>((HashMap) value3); + synchronized (this) { + this.mRecoveredTransactions = hashMap3; + Log.Helper.LOGD(this, "%d recovered transactions restored from persistence.", Integer.valueOf(this.mRecoveredTransactions.size())); + } + } else { + Log.Helper.LOGD(this, "No recovered transactions to restore.", new Object[0]); + } + Serializable value4 = persistenceForNimbleComponent.getValue(PERSISTENCE_PENDING_TRANSACTIONS); + if (value4 != null && value4.getClass() == HashMap.class) { + HashMap hashMap4 = new HashMap<>((HashMap) value4); + Log.Helper.LOGD(this, "%d pending transactions restored from persistence.", Integer.valueOf(hashMap4.size())); + synchronized (this) { + if (this.mRecoveredTransactions == null) { + this.mRecoveredTransactions = new HashMap<>(); + } + this.mRecoveredTransactions.putAll(filterForResumablePurchaseTransactions(hashMap4)); + Iterator it = this.mRecoveredTransactions.values().iterator(); + while (it.hasNext()) { + this.mPendingTransactions.remove(it.next().getTransactionId()); + } + } + } else { + Log.Helper.LOGD(this, "No pending transactions to restore.", new Object[0]); + } + Serializable value5 = persistenceForNimbleComponent.getValue(PERSISTENCE_UNRECORDED_TRANSACTIONS); + if (value5 != null && (value5 instanceof ArrayList)) { + ArrayList arrayList = (ArrayList) value5; + synchronized (this) { + this.mUnrecordedTransactions = arrayList; + } + this.m_transactionRecorder.recordTransactions(); + } + this.m_cacheTimestamp = (Long) persistenceForNimbleComponent.getValue(CACHE_TIMESTAMP_KEY); + synchronized (this) { + if (this.mRecoveredTransactions != null && this.mRecoveredTransactions.size() > 0) { + Log.Helper.LOGD(this, "Recovered transactions: " + this.mRecoveredTransactions, new Object[0]); + broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_TRANSACTIONS_RECOVERED, null, null, null); + } + } + } + + private void deferredConsumeCallback(final INimbleMTX.ItemGrantedCallback itemGrantedCallback, final NimbleMTXTransaction nimbleMTXTransaction) { + Log.Helper.LOGFUNC(this); + new Timer(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.12 + @Override // java.lang.Runnable + public void run() { + itemGrantedCallback.itemGrantedComplete(nimbleMTXTransaction); + } + }).schedule(DEFERRED_CALLBACK_DELAY, false); + } + + /* JADX INFO: Access modifiers changed from: private */ + public GooglePlayError createGooglePlayErrorFromIabResult(IabResult iabResult) { + GooglePlayError.Code code; + Log.Helper.LOGFUNC(this); + if (iabResult == null || iabResult.getResponse() == 0) { + return null; + } + int response = iabResult.getResponse(); + if (response == 1) { + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_USER_CANCELED; + } else { + switch (response) { + case IabHelper.IABHELPER_SUBSCRIPTION_UPDATE_NOT_AVAILABLE /* -1011 */: + code = GooglePlayError.Code.IABHELPER_SUBSCRIPTION_UPDATE_NOT_AVAILABLE; + break; + case IabHelper.IABHELPER_INVALID_CONSUMPTION /* -1010 */: + code = GooglePlayError.Code.IABHELPER_INVALID_CONSUMPTION; + break; + case IabHelper.IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE /* -1009 */: + code = GooglePlayError.Code.IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE; + break; + case IabHelper.IABHELPER_UNKNOWN_ERROR /* -1008 */: + code = GooglePlayError.Code.IABHELPER_UNKNOWN_ERROR; + break; + case IabHelper.IABHELPER_MISSING_TOKEN /* -1007 */: + code = GooglePlayError.Code.IABHELPER_MISSING_TOKEN; + break; + case IabHelper.IABHELPER_UNKNOWN_PURCHASE_RESPONSE /* -1006 */: + code = GooglePlayError.Code.IABHELPER_UNKNOWN_PURCHASE_RESPONSE; + break; + case IabHelper.IABHELPER_USER_CANCELLED /* -1005 */: + code = GooglePlayError.Code.IABHELPER_USER_CANCELLED; + break; + case IabHelper.IABHELPER_SEND_INTENT_FAILED /* -1004 */: + code = GooglePlayError.Code.IABHELPER_SEND_INTENT_FAILED; + break; + case IabHelper.IABHELPER_VERIFICATION_FAILED /* -1003 */: + code = GooglePlayError.Code.IABHELPER_VERIFICATION_FAILED; + break; + case IabHelper.IABHELPER_BAD_RESPONSE /* -1002 */: + code = GooglePlayError.Code.IABHELPER_BAD_RESPONSE; + break; + case IabHelper.IABHELPER_REMOTE_EXCEPTION /* -1001 */: + code = GooglePlayError.Code.IABHELPER_REMOTE_EXCEPTION; + break; + case -1000: + code = GooglePlayError.Code.IABHELPER_ERROR_BASE; + break; + default: + switch (response) { + case 3: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE; + break; + case 4: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE; + break; + case 5: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_DEVELOPER_ERROR; + break; + case 6: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ERROR; + break; + case 7: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED; + break; + case 8: + code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED; + break; + default: + code = GooglePlayError.Code.UNKNOWN; + break; + } + } + } + return new GooglePlayError(code, iabResult.getMessage()); + } + + /* JADX INFO: Access modifiers changed from: private */ + public NimbleMTXError createNimbleMTXErrorWithGooglePlayError(GooglePlayError googlePlayError, String str) { + Log.Helper.LOGFUNC(this); + NimbleMTXError.Code code = NimbleMTXError.Code.PLATFORM_ERROR; + if (googlePlayError != null) { + int code2 = googlePlayError.getCode(); + if (code2 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_USER_CANCELED.intValue() || code2 == GooglePlayError.Code.IABHELPER_USER_CANCELLED.intValue()) { + code = NimbleMTXError.Code.USER_CANCELED; + } else if (code2 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE.intValue()) { + code = NimbleMTXError.Code.BILLING_NOT_AVAILABLE; + } else if (code2 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE.intValue()) { + code = NimbleMTXError.Code.ITEM_UNAVAILABLE; + } else if (code2 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED.intValue()) { + code = NimbleMTXError.Code.ITEM_ALREADY_OWNED; + } else if (code2 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED.intValue()) { + code = NimbleMTXError.Code.ITEM_NOT_OWNED; + } + } + return new NimbleMTXError(code, str, googlePlayError); + } + + private String generateDeveloperPayloadForTransaction(GooglePlayTransaction googlePlayTransaction) { + Log.Helper.LOGFUNC(this); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMddHHmmss", Locale.US); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return simpleDateFormat.format(new Date()); + } + + private class TransactionRecorder extends BroadcastReceiver implements Runnable, GetNonceCallback { + private double m_requestRetryDelay; + private Timer m_timer; + + private TransactionRecorder() { + this.m_requestRetryDelay = 1.0d; + this.m_timer = new Timer(this); + } + + public void recordTransactions() { + Log.Helper.LOGFUNC(this); + synchronized (GooglePlay.this) { + if (GooglePlay.this.mUnrecordedTransactions != null && GooglePlay.this.mUnrecordedTransactions.size() != 0) { + Log.Helper.LOGD(GooglePlay.this, "Attempting to record transactions", new Object[0]); + if (!ApplicationEnvironment.isMainApplicationActive()) { + Log.Helper.LOGD(GooglePlay.this, "Main application not running, ignoring record", new Object[0]); + return; + } + if (Network.getComponent().getStatus() != Network.Status.OK) { + Log.Helper.LOGD(GooglePlay.this, "Waiting for Network connectivity", new Object[0]); + Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this); + return; + } + synchronized (GooglePlay.this) { + Iterator it = GooglePlay.this.mUnrecordedTransactions.iterator(); + while (it.hasNext()) { + GooglePlay.this.networkCallGetNonceFromSynergy(it.next(), this); + } + } + return; + } + Log.Helper.LOGD(GooglePlay.this, "No transactions to record", new Object[0]); + } + } + + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback + public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction, String str, Error error) { + Log.Helper.LOGFUNC(this); + if (GooglePlay.this.isCancelledError(error)) { + return; + } + if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction, str, error)) { + GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.TransactionRecorder.1 + @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback + public void onVerificationComplete(Exception exc) { + Log.Helper.LOGFUNC(this); + if (GooglePlay.this.isCancelledError(exc)) { + return; + } + if (!googlePlayTransaction.mIsRecorded) { + if (TransactionRecorder.this.m_timer.isRunning()) { + return; + } + TransactionRecorder.this.m_timer.schedule(TransactionRecorder.this.m_requestRetryDelay, false); + } else { + synchronized (GooglePlay.this) { + GooglePlay.this.mUnrecordedTransactions.remove(googlePlayTransaction); + } + GooglePlay.this.saveUnrecordedTransactionsToPersistence(); + TransactionRecorder.this.m_requestRetryDelay = 1.0d; + } + } + }); + } else { + if (this.m_timer.isRunning()) { + return; + } + this.m_timer.schedule(this.m_requestRetryDelay, false); + } + } + + @Override // java.lang.Runnable + public void run() { + this.m_requestRetryDelay = Math.min(this.m_requestRetryDelay * 2.0d, 300.0d); + recordTransactions(); + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGD(GooglePlay.this, "Received network notification", new Object[0]); + if (Network.getComponent().getStatus() == Network.Status.OK) { + Log.Helper.LOGD(GooglePlay.this, "Network status is OK, unregistering receiver and attempting to record transactions", new Object[0]); + Utility.unregisterReceiver(this); + recordTransactions(); + return; + } + Log.Helper.LOGD(GooglePlay.this, "Attempted to recordTransaction but network state was not OK. Aborting and eating my transaction.", new Object[0]); + } + + public void cancel() { + this.m_timer.cancel(); + this.m_requestRetryDelay = 1.0d; + Utility.unregisterReceiver(this); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public boolean isCancelledError(Throwable th) { + Log.Helper.LOGFUNC(this); + if (!(th instanceof Error)) { + return false; + } + Error error = (Error) th; + return (error.getDomain().equals(Error.ERROR_DOMAIN) && error.getCode() == Error.Code.NETWORK_OPERATION_CANCELLED.intValue()) || isCancelledError(error.getCause()); + } + + private boolean isCacheExpired() { + Log.Helper.LOGFUNC(this); + return this.m_cacheTimestamp == null || ((double) (System.currentTimeMillis() - this.m_cacheTimestamp.longValue())) > 3600000.0d; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java new file mode 100644 index 0000000..213c47a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java @@ -0,0 +1,142 @@ +package com.ea.nimble.mtx.googleplay; + +import com.ea.nimble.Log; +import com.ea.nimble.mtx.NimbleCatalogItem; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +public class GooglePlayCatalogItem extends NimbleCatalogItem implements Externalizable { + Map mAdditionalInfo; + String mDescription; + boolean mIsFree; + NimbleCatalogItem.ItemType mItemType; + float mPriceDecimal; + String mPriceWithCurrencyAndFormat; + String mSku; + String mTitle; + String mUrl; + + public GooglePlayCatalogItem() { + Log.Helper.LOGPUBLICFUNC(this); + this.mSku = ""; + this.mTitle = ""; + this.mDescription = ""; + this.mPriceDecimal = 0.0f; + this.mPriceWithCurrencyAndFormat = ""; + this.mItemType = NimbleCatalogItem.ItemType.UNKNOWN; + this.mUrl = ""; + this.mIsFree = false; + this.mAdditionalInfo = new HashMap(); + } + + public GooglePlayCatalogItem(GooglePlayCatalogItem googlePlayCatalogItem) { + this.mSku = new String(googlePlayCatalogItem.mSku); + this.mTitle = new String(googlePlayCatalogItem.mTitle); + this.mDescription = new String(googlePlayCatalogItem.mDescription); + this.mPriceDecimal = googlePlayCatalogItem.mPriceDecimal; + this.mPriceWithCurrencyAndFormat = new String(googlePlayCatalogItem.mPriceWithCurrencyAndFormat); + this.mItemType = googlePlayCatalogItem.mItemType; + this.mUrl = new String(googlePlayCatalogItem.mUrl); + this.mIsFree = googlePlayCatalogItem.mIsFree; + this.mAdditionalInfo = new HashMap(googlePlayCatalogItem.mAdditionalInfo); + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getSku() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mSku; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getSellId() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) { + return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString(); + } + return null; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getTitle() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mTitle; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getDescription() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mDescription; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public float getPriceDecimal() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mPriceDecimal; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getPriceWithCurrencyAndFormat() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mPriceWithCurrencyAndFormat; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public NimbleCatalogItem.ItemType getItemType() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mItemType; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public String getMetaDataUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mUrl; + } + + public boolean isFree() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mIsFree; + } + + @Override // com.ea.nimble.mtx.NimbleCatalogItem + public Map getAdditionalInfo() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mAdditionalInfo; + } + + public String toString() { + Log.Helper.LOGPUBLICFUNC(this); + return "SKU(" + this.mSku + ") Title(" + this.mTitle + ") Price(" + this.mPriceDecimal + ") Currency(" + this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_CURRENCY) + ") PriceStr(" + this.mPriceWithCurrencyAndFormat + ") ItemType(" + this.mItemType + ")"; + } + + @Override // java.io.Externalizable + public void writeExternal(ObjectOutput objectOutput) throws IOException { + Log.Helper.LOGPUBLICFUNC(this); + objectOutput.writeUTF(this.mSku); + objectOutput.writeUTF(this.mTitle); + objectOutput.writeUTF(this.mDescription); + objectOutput.writeFloat(this.mPriceDecimal); + objectOutput.writeUTF(this.mPriceWithCurrencyAndFormat); + objectOutput.writeObject(this.mItemType); + objectOutput.writeBoolean(this.mIsFree); + objectOutput.writeObject(this.mAdditionalInfo); + } + + @Override // java.io.Externalizable + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + Log.Helper.LOGPUBLICFUNC(this); + this.mSku = objectInput.readUTF(); + this.mTitle = objectInput.readUTF(); + this.mDescription = objectInput.readUTF(); + this.mPriceDecimal = objectInput.readFloat(); + this.mPriceWithCurrencyAndFormat = objectInput.readUTF(); + this.mItemType = (NimbleCatalogItem.ItemType) objectInput.readObject(); + this.mIsFree = objectInput.readBoolean(); + this.mAdditionalInfo = (Map) objectInput.readObject(); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java new file mode 100644 index 0000000..6b67a15 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java @@ -0,0 +1,55 @@ +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 { + public static final String ERROR_DOMAIN = "GooglePlayError"; + private static final long serialVersionUID = 1; + + public enum Code { + BILLING_RESPONSE_RESULT_USER_CANCELED(1), + BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE(3), + BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE(4), + BILLING_RESPONSE_RESULT_DEVELOPER_ERROR(5), + BILLING_RESPONSE_RESULT_ERROR(6), + BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED(7), + BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED(8), + IABHELPER_ERROR_BASE(-1000), + IABHELPER_REMOTE_EXCEPTION(IabHelper.IABHELPER_REMOTE_EXCEPTION), + IABHELPER_BAD_RESPONSE(IabHelper.IABHELPER_BAD_RESPONSE), + IABHELPER_VERIFICATION_FAILED(IabHelper.IABHELPER_VERIFICATION_FAILED), + IABHELPER_SEND_INTENT_FAILED(IabHelper.IABHELPER_SEND_INTENT_FAILED), + IABHELPER_USER_CANCELLED(IabHelper.IABHELPER_USER_CANCELLED), + IABHELPER_UNKNOWN_PURCHASE_RESPONSE(IabHelper.IABHELPER_UNKNOWN_PURCHASE_RESPONSE), + IABHELPER_MISSING_TOKEN(IabHelper.IABHELPER_MISSING_TOKEN), + IABHELPER_UNKNOWN_ERROR(IabHelper.IABHELPER_UNKNOWN_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); + + private int m_value; + + Code(int i) { + this.m_value = i; + } + + public int intValue() { + return this.m_value; + } + } + + public GooglePlayError() { + } + + public GooglePlayError(Code code, String str, Throwable th) { + super(ERROR_DOMAIN, code.intValue(), str, th); + } + + public GooglePlayError(Code code, String str) { + super(ERROR_DOMAIN, code.intValue(), str); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java new file mode 100644 index 0000000..209abec --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java @@ -0,0 +1,20 @@ +package com.ea.nimble.mtx.googleplay; + +import com.ea.nimble.NetworkConnectionCallback; +import com.ea.nimble.NetworkConnectionHandle; + +/* loaded from: classes.dex */ +public abstract class GooglePlayNetworkConnectionCallback implements NetworkConnectionCallback { + String mParameter; + GooglePlay mParentGooglePlay; + String mTransactionId; + + @Override // com.ea.nimble.NetworkConnectionCallback + public abstract void callback(NetworkConnectionHandle networkConnectionHandle); + + public GooglePlayNetworkConnectionCallback(GooglePlay googlePlay, String str, String str2) { + this.mParentGooglePlay = googlePlay; + this.mTransactionId = str; + this.mParameter = str2; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java new file mode 100644 index 0000000..ee5ea86 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java @@ -0,0 +1,202 @@ +package com.ea.nimble.mtx.googleplay; + +import com.ea.nimble.Error; +import com.ea.nimble.Log; +import com.ea.nimble.Utility; +import com.ea.nimble.mtx.INimbleMTX; +import com.ea.nimble.mtx.NimbleCatalogItem; +import com.ea.nimble.mtx.NimbleMTX; +import com.ea.nimble.mtx.NimbleMTXTransaction; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +public class GooglePlayTransaction implements NimbleMTXTransaction, Externalizable { + String mTransactionId = ""; + String mReceipt = ""; + String mItemSku = ""; + float mPriceDecimal = 0.0f; + Date mTimeStamp = null; + String mNonce = ""; + Exception mError = null; + GooglePlayCatalogItem mCatalogItem = null; + GooglePlayTransactionState mGooglePlayTransactionState = GooglePlayTransactionState.UNDEFINED; + GooglePlayTransactionState mFailedState = null; + INimbleMTX.PurchaseTransactionCallback mPurchaseCallback = null; + INimbleMTX.FinalizeTransactionCallback mFinalizeCallback = null; + INimbleMTX.ItemGrantedCallback mItemGrantedCallback = null; + NimbleMTXTransaction.TransactionType mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; + String mDeveloperPayload = ""; + boolean mIsRecorded = false; + Map mAdditionalInfo = new HashMap(); + + public enum GooglePlayTransactionState { + UNDEFINED, + WAITING_FOR_PREPURCHASE_INFO, + WAITING_FOR_NONCE, + WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE, + WAITING_FOR_SYNERGY_VERIFICATION, + WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT, + WAITING_FOR_GOOGLEPLAY_CONSUMPTION, + COMPLETE + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public String getTransactionId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mTransactionId; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public String getItemSku() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mItemSku; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public NimbleMTXTransaction.TransactionState getTransactionState() { + Log.Helper.LOGPUBLICFUNC(this); + switch (this.mGooglePlayTransactionState) { + } + return NimbleMTXTransaction.TransactionState.UNDEFINED; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public NimbleMTXTransaction.TransactionType getTransactionType() { + Log.Helper.LOGPUBLICFUNC(this); + if (this.mTransactionType == null) { + return NimbleMTXTransaction.TransactionType.PURCHASE; + } + return this.mTransactionType; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public float getPriceDecimal() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mPriceDecimal; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public String getItemSellId() { + Log.Helper.LOGPUBLICFUNC(this); + List availableCatalogItems = NimbleMTX.getComponent().getAvailableCatalogItems(); + String itemSku = getItemSku(); + if (availableCatalogItems != null) { + for (NimbleCatalogItem nimbleCatalogItem : availableCatalogItems) { + if (nimbleCatalogItem.getSku().equals(itemSku)) { + String sellId = nimbleCatalogItem.getSellId(); + if (Utility.validString(sellId)) { + return sellId; + } + } + } + } + if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) { + return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString(); + } + Log.Helper.LOGW(this, "getItemSellId(): Unable to acquire sell id for transaction with SKU: " + itemSku, new Object[0]); + return ""; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public Date getTimeStamp() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mTimeStamp; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public String getReceipt() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mReceipt; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public Map getAdditionalInfo() { + Log.Helper.LOGPUBLICFUNC(this); + return new HashMap(this.mAdditionalInfo); + } + + public String getNonce() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mNonce; + } + + public String getDeveloperPayload() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mDeveloperPayload; + } + + @Override // com.ea.nimble.mtx.NimbleMTXTransaction + public Exception getError() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mError; + } + + public GooglePlayCatalogItem getCatalogItem() { + Log.Helper.LOGPUBLICFUNC(this); + return this.mCatalogItem; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("GooglePlayTransaction: SKU("); + sb.append(getItemSku()); + sb.append(") State("); + sb.append(this.mGooglePlayTransactionState == null ? "null" : this.mGooglePlayTransactionState.toString()); + sb.append(") Receipt("); + sb.append(getReceipt()); + sb.append(") TimeStamp("); + sb.append(getTimeStamp()); + sb.append(")"); + return sb.toString(); + } + + @Override // java.io.Externalizable + public void writeExternal(ObjectOutput objectOutput) throws IOException { + Log.Helper.LOGPUBLICFUNC(this); + objectOutput.writeUTF(Utility.safeString(this.mTransactionId)); + objectOutput.writeUTF(Utility.safeString(this.mItemSku)); + objectOutput.writeObject(this.mGooglePlayTransactionState); + objectOutput.writeObject(this.mTransactionType); + objectOutput.writeFloat(this.mPriceDecimal); + objectOutput.writeObject(this.mTimeStamp); + objectOutput.writeUTF(Utility.safeString(this.mReceipt)); + objectOutput.writeUTF(Utility.safeString(this.mNonce)); + objectOutput.writeObject(this.mError); + objectOutput.writeObject(this.mCatalogItem); + objectOutput.writeObject(this.mAdditionalInfo); + objectOutput.writeUTF(Utility.safeString(this.mDeveloperPayload)); + objectOutput.writeObject(this.mFailedState); + objectOutput.writeBoolean(this.mIsRecorded); + } + + @Override // java.io.Externalizable + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + Log.Helper.LOGPUBLICFUNC(this); + this.mTransactionId = objectInput.readUTF(); + this.mItemSku = objectInput.readUTF(); + this.mGooglePlayTransactionState = (GooglePlayTransactionState) objectInput.readObject(); + this.mTransactionType = (NimbleMTXTransaction.TransactionType) objectInput.readObject(); + this.mPriceDecimal = objectInput.readFloat(); + this.mTimeStamp = (Date) objectInput.readObject(); + this.mReceipt = objectInput.readUTF(); + this.mNonce = objectInput.readUTF(); + this.mError = (Error) objectInput.readObject(); + this.mCatalogItem = (GooglePlayCatalogItem) objectInput.readObject(); + this.mAdditionalInfo = (Map) objectInput.readObject(); + this.mDeveloperPayload = objectInput.readUTF(); + try { + this.mFailedState = (GooglePlayTransactionState) objectInput.readObject(); + this.mIsRecorded = objectInput.readBoolean(); + } catch (IOException unused) { + } + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java new file mode 100644 index 0000000..cda380b --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java @@ -0,0 +1,196 @@ +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; + public static final boolean DECODE = false; + public static final boolean ENCODE = true; + private static final byte[] ALPHABET = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47}; + private static final byte[] WEBSAFE_ALPHABET = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95}; + private static final byte WHITE_SPACE_ENC = -5; + private static final byte EQUALS_SIGN = 61; + private static final byte EQUALS_SIGN_ENC = -1; + private static final byte NEW_LINE = 10; + private static final byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, WHITE_SPACE_ENC, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 62, -9, -9, -9, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, EQUALS_SIGN, -9, -9, -9, EQUALS_SIGN_ENC, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, NEW_LINE, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -9, -9, -9, -9, -9, -9, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -9, -9, -9, -9, -9}; + private static final byte[] WEBSAFE_DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, WHITE_SPACE_ENC, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 62, -9, -9, 52, 53, 54, 55, 56, 57, 58, 59, 60, EQUALS_SIGN, -9, -9, -9, EQUALS_SIGN_ENC, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, NEW_LINE, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -9, -9, -9, -9, 63, -9, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -9, -9, -9, -9, -9}; + + private Base64() { + } + + private static byte[] encode3to4(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) { + int i4 = (i2 > 0 ? (bArr[i] << 24) >>> 8 : 0) | (i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0) | (i2 > 2 ? (bArr[i + 2] << 24) >>> 24 : 0); + switch (i2) { + case 1: + bArr2[i3] = bArr3[i4 >>> 18]; + bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63]; + bArr2[i3 + 2] = EQUALS_SIGN; + bArr2[i3 + 3] = EQUALS_SIGN; + break; + case 2: + bArr2[i3] = bArr3[i4 >>> 18]; + bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63]; + bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63]; + bArr2[i3 + 3] = EQUALS_SIGN; + break; + case 3: + bArr2[i3] = bArr3[i4 >>> 18]; + bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63]; + bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63]; + bArr2[i3 + 3] = bArr3[i4 & 63]; + break; + } + return bArr2; + } + + public static String encode(byte[] bArr) { + return encode(bArr, 0, bArr.length, ALPHABET, true); + } + + public static String encodeWebSafe(byte[] bArr, boolean z) { + return encode(bArr, 0, bArr.length, WEBSAFE_ALPHABET, z); + } + + 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); + int length = encode.length; + while (!z && length > 0 && encode[length - 1] == 61) { + length--; + } + return new String(encode, 0, length); + } + + public static byte[] encode(byte[] bArr, int i, int i2, byte[] bArr2, int i3) { + int i4 = ((i2 + 2) / 3) * 4; + byte[] bArr3 = new byte[i4 + (i4 / i3)]; + int i5 = i2 - 2; + int i6 = 0; + int i7 = 0; + int i8 = 0; + while (i6 < i5) { + int i9 = ((bArr[i6 + i] << 24) >>> 8) | ((bArr[(i6 + 1) + i] << 24) >>> 16) | ((bArr[(i6 + 2) + i] << 24) >>> 24); + bArr3[i7] = bArr2[i9 >>> 18]; + int i10 = i7 + 1; + bArr3[i10] = bArr2[(i9 >>> 12) & 63]; + bArr3[i7 + 2] = bArr2[(i9 >>> 6) & 63]; + bArr3[i7 + 3] = bArr2[i9 & 63]; + i8 += 4; + if (i8 == i3) { + bArr3[i7 + 4] = NEW_LINE; + i8 = 0; + } else { + i10 = i7; + } + i6 += 3; + i7 = i10 + 4; + } + if (i6 < i2) { + encode3to4(bArr, i6 + i, i2 - i6, bArr3, i7, bArr2); + if (i8 + 4 == i3) { + bArr3[i7 + 4] = NEW_LINE; + } + } + return bArr3; + } + + private static int decode4to3(byte[] bArr, int i, byte[] bArr2, int i2, byte[] bArr3) { + int i3 = i + 2; + if (bArr[i3] == 61) { + bArr2[i2] = (byte) ((((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i]] << 24) >>> 6)) >>> 16); + return 1; + } + int i4 = i + 3; + if (bArr[i4] == 61) { + int i5 = ((bArr3[bArr[i3]] << 24) >>> 18) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i]] << 24) >>> 6); + bArr2[i2] = (byte) (i5 >>> 16); + bArr2[i2 + 1] = (byte) (i5 >>> 8); + return 2; + } + int i6 = ((bArr3[bArr[i4]] << 24) >>> 24) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i3]] << 24) >>> 18); + bArr2[i2] = (byte) (i6 >> 16); + bArr2[i2 + 1] = (byte) (i6 >> 8); + bArr2[i2 + 2] = (byte) i6; + return 3; + } + + public static byte[] decode(String str) throws Base64DecoderException { + byte[] bytes = str.getBytes(); + return decode(bytes, 0, bytes.length); + } + + public static byte[] decodeWebSafe(String str) throws Base64DecoderException { + byte[] bytes = str.getBytes(); + return decodeWebSafe(bytes, 0, bytes.length); + } + + public static byte[] decode(byte[] bArr) throws Base64DecoderException { + return decode(bArr, 0, bArr.length); + } + + public static byte[] decodeWebSafe(byte[] bArr) throws Base64DecoderException { + return decodeWebSafe(bArr, 0, bArr.length); + } + + public static byte[] decode(byte[] bArr, int i, int i2) throws Base64DecoderException { + return decode(bArr, i, i2, DECODABET); + } + + public static byte[] decodeWebSafe(byte[] bArr, int i, int i2) throws Base64DecoderException { + return decode(bArr, i, i2, WEBSAFE_DECODABET); + } + + public static byte[] decode(byte[] bArr, int i, int i2, byte[] bArr2) throws Base64DecoderException { + byte[] bArr3 = new byte[((i2 * 3) / 4) + 2]; + byte[] bArr4 = new byte[4]; + int i3 = 0; + int i4 = 0; + int i5 = 0; + while (true) { + if (i3 >= i2) { + break; + } + int i6 = i3 + i; + byte b = (byte) (bArr[i6] & Byte.MAX_VALUE); + byte b2 = bArr2[b]; + if (b2 < -5) { + throw new Base64DecoderException("Bad Base64 input character at " + i3 + ": " + ((int) bArr[i6]) + "(decimal)"); + } + if (b2 >= -1) { + if (b == 61) { + int i7 = i2 - i3; + byte b3 = (byte) (bArr[(i2 - 1) + i] & Byte.MAX_VALUE); + if (i4 == 0 || i4 == 1) { + throw new Base64DecoderException("invalid padding byte '=' at byte offset " + i3); + } + if ((i4 == 3 && i7 > 2) || (i4 == 4 && i7 > 1)) { + throw new Base64DecoderException("padding byte '=' falsely signals end of encoded value at offset " + i3); + } + if (b3 != 61 && b3 != 10) { + throw new Base64DecoderException("encoded value has invalid trailing byte"); + } + } else { + int i8 = i4 + 1; + bArr4[i4] = b; + if (i8 == 4) { + i5 += decode4to3(bArr4, 0, bArr3, i5, bArr2); + i4 = 0; + } else { + i4 = i8; + } + } + } + i3++; + } + if (i4 != 0) { + if (i4 == 1) { + throw new Base64DecoderException("single trailing character at offset " + (i2 - 1)); + } + bArr4[i4] = EQUALS_SIGN; + i5 += decode4to3(bArr4, 0, bArr3, i5, bArr2); + } + byte[] bArr5 = new byte[i5]; + System.arraycopy(bArr3, 0, bArr5, 0, i5); + return bArr5; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java new file mode 100644 index 0000000..374c2e1 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java @@ -0,0 +1,13 @@ +package com.ea.nimble.mtx.googleplay.util; + +/* loaded from: classes.dex */ +public class Base64DecoderException extends Exception { + private static final long serialVersionUID = 1; + + public Base64DecoderException() { + } + + public Base64DecoderException(String str) { + super(str); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java new file mode 100644 index 0000000..8de151c --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java @@ -0,0 +1,28 @@ +package com.ea.nimble.mtx.googleplay.util; + +/* loaded from: classes.dex */ +public class IabException extends Exception { + private static final long serialVersionUID = 5626567164828265535L; + IabResult mResult; + + public IabException(IabResult iabResult) { + this(iabResult, (Exception) null); + } + + public IabException(int i, String str) { + this(new IabResult(i, str)); + } + + public IabException(IabResult iabResult, Exception exc) { + super(iabResult.getMessage(), exc); + this.mResult = iabResult; + } + + public IabException(int i, String str, Exception exc) { + this(new IabResult(i, str), exc); + } + + public IabResult getResult() { + return this.mResult; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java new file mode 100644 index 0000000..aced720 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java @@ -0,0 +1,789 @@ +package com.ea.nimble.mtx.googleplay.util; + +import android.app.Activity; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.IntentSender; +import android.content.ServiceConnection; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.os.Bundle; +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; +import java.util.List; +import org.json.JSONException; + +/* loaded from: classes.dex */ +public class IabHelper implements LogSource { + public static final int BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE = 3; + public static final int BILLING_RESPONSE_RESULT_DEVELOPER_ERROR = 5; + public static final int BILLING_RESPONSE_RESULT_ERROR = 6; + public static final int BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED = 7; + public static final int BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED = 8; + public static final int BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE = 4; + public static final int BILLING_RESPONSE_RESULT_OK = 0; + public static final int BILLING_RESPONSE_RESULT_USER_CANCELED = 1; + public static final String GET_SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST"; + public static final String GET_SKU_DETAILS_ITEM_TYPE_LIST = "ITEM_TYPE_LIST"; + public static final int IABHELPER_BAD_RESPONSE = -1002; + public static final int IABHELPER_ERROR_BASE = -1000; + public static final int IABHELPER_INVALID_CONSUMPTION = -1010; + public static final int IABHELPER_MISSING_TOKEN = -1007; + public static final int IABHELPER_REMOTE_EXCEPTION = -1001; + public static final int IABHELPER_SEND_INTENT_FAILED = -1004; + public static final int IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE = -1009; + public static final int IABHELPER_SUBSCRIPTION_UPDATE_NOT_AVAILABLE = -1011; + public static final int IABHELPER_UNKNOWN_ERROR = -1008; + public static final int IABHELPER_UNKNOWN_PURCHASE_RESPONSE = -1006; + public static final int IABHELPER_USER_CANCELLED = -1005; + public static final int IABHELPER_VERIFICATION_FAILED = -1003; + public static final String INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN"; + public static final String ITEM_TYPE_INAPP = "inapp"; + public static final String ITEM_TYPE_SUBS = "subs"; + public static final String RESPONSE_BUY_INTENT = "BUY_INTENT"; + public static final String RESPONSE_CODE = "RESPONSE_CODE"; + public static final String RESPONSE_GET_SKU_DETAILS_LIST = "DETAILS_LIST"; + public static final String RESPONSE_INAPP_ITEM_LIST = "INAPP_PURCHASE_ITEM_LIST"; + public static final String RESPONSE_INAPP_PURCHASE_DATA = "INAPP_PURCHASE_DATA"; + public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST"; + public static final String RESPONSE_INAPP_SIGNATURE = "INAPP_DATA_SIGNATURE"; + public static final String RESPONSE_INAPP_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST"; + AsyncOperation mAsyncOperation; + LinkedList mAsyncRequestQueue; + Context mContext; + OnIabPurchaseFinishedListener mPurchaseListener; + String mPurchasingItemType; + int mRequestCode; + IInAppBillingService mService; + ServiceConnection mServiceConn; + String mSignatureBase64; + boolean mDebugLog = false; + String mDebugTag = "IabHelper"; + boolean mSetupDone = false; + boolean mSubscriptionsSupported = false; + boolean mAsyncInProgress = false; + IabPurchaseUpdateReceiver mPurchaseUpdateReceiver = null; + + public interface OnConsumeFinishedListener { + void onConsumeFinished(Purchase purchase, IabResult iabResult); + } + + public interface OnConsumeMultiFinishedListener { + void onConsumeMultiFinished(List list, List list2); + } + + public interface OnIabBroadcastListener { + void receivedBroadcast(); + } + + public interface OnIabPurchaseFinishedListener { + void onIabPurchaseFinished(IabResult iabResult, Purchase purchase); + } + + public interface OnIabSetupFinishedListener { + void onIabSetupFinished(IabResult iabResult); + } + + public interface QueryInventoryFinishedListener { + void onQueryInventoryFinished(IabResult iabResult, Inventory inventory); + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "MTX Google IABHelper"; + } + + private class AsyncOperation { + private String m_name; + private Runnable m_operation; + private boolean m_runInNewThread; + + public AsyncOperation(String str, boolean z, Runnable runnable) { + this.m_name = str; + this.m_runInNewThread = z; + this.m_operation = runnable; + IabHelper.this.checkSetupDone(this.m_name); + } + + public String getName() { + return this.m_name; + } + + public void run() { + if (this.m_runInNewThread) { + new Thread(this.m_operation).start(); + } else { + this.m_operation.run(); + } + } + } + + public IabHelper(Context context, String str, int i) { + this.mSignatureBase64 = null; + this.mContext = context.getApplicationContext(); + if (this.mContext == null) { + logError("IabHelper initializing with null application context!"); + } + this.mSignatureBase64 = str; + this.mRequestCode = i; + logDebug("IAB helper created."); + this.mAsyncRequestQueue = new LinkedList<>(); + } + + public void setApplicationPublicKey(String str) { + this.mSignatureBase64 = str; + } + + public void enableDebugLogging(boolean z, String str) { + this.mDebugLog = z; + this.mDebugTag = str; + } + + public void enableDebugLogging(boolean z) { + this.mDebugLog = z; + } + + public class IabPurchaseUpdateReceiver extends BroadcastReceiver { + private final OnIabBroadcastListener mListener; + + public IabPurchaseUpdateReceiver(OnIabBroadcastListener onIabBroadcastListener) { + this.mListener = onIabBroadcastListener; + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + if (this.mListener != null) { + this.mListener.receivedBroadcast(); + } + } + } + + 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; + if (this.mServiceConn != null) { + logDebug("Unbinding from service."); + if (this.mContext != null) { + 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) { + return false; + } + flagEndAsync(); + if (intent == null) { + logError("Null data in IAB activity result."); + IabResult iabResult = new IabResult(IABHELPER_BAD_RESPONSE, "Null data in IAB result"); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(iabResult, null); + } + return true; + } + int responseCodeFromIntent = getResponseCodeFromIntent(intent); + String stringExtra = intent.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA); + String stringExtra2 = intent.getStringExtra(RESPONSE_INAPP_SIGNATURE); + if (i2 == -1 && responseCodeFromIntent == 0) { + logDebug("Successful resultcode from purchase activity."); + logDebug("Purchase data: " + stringExtra); + logDebug("Data signature: " + stringExtra2); + logDebug("Extras: " + intent.getExtras()); + logDebug("Expected item type: " + this.mPurchasingItemType); + if (stringExtra == null || stringExtra2 == null) { + logError("BUG: either purchaseData or dataSignature is null."); + logDebug("Extras: " + intent.getExtras().toString()); + IabResult iabResult2 = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature"); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(iabResult2, null); + } + return true; + } + try { + Purchase purchase = new Purchase(this.mPurchasingItemType, stringExtra, stringExtra2); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(new IabResult(0, "Success"), purchase); + } + } catch (JSONException e) { + logError("Failed to parse purchase data."); + e.printStackTrace(); + IabResult iabResult3 = new IabResult(IABHELPER_BAD_RESPONSE, "Failed to parse purchase data."); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(iabResult3, null); + } + return true; + } + } else if (i2 == -1) { + logDebug("Result code was OK but in-app billing response was not OK: " + getResponseDesc(responseCodeFromIntent)); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(new IabResult(responseCodeFromIntent, "Problem purchashing item."), null); + } + } else if (i2 == 0) { + logDebug("Google Play Activity canceled - Response: " + getResponseDesc(responseCodeFromIntent)); + IabResult iabResult4 = new IabResult(responseCodeFromIntent, "Problem purchashing item."); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(iabResult4, null); + } + } else { + logError("Purchase failed. Result code: " + Integer.toString(i2) + ". Response: " + getResponseDesc(responseCodeFromIntent)); + IabResult iabResult5 = new IabResult(IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response."); + if (this.mPurchaseListener != null) { + this.mPurchaseListener.onIabPurchaseFinished(iabResult5, null); + } + } + return true; + } + + /* JADX WARN: Code restructure failed: missing block: B:18:0x0035, code lost: + + if (r1.mSubscriptionsSupported == false) goto L23; + */ + /* JADX WARN: Code restructure failed: missing block: B:19:0x0037, code lost: + + r2 = querySkuDetails(r0, r4, com.ea.nimble.mtx.googleplay.util.IabHelper.ITEM_TYPE_SUBS); + */ + /* JADX WARN: Code restructure failed: missing block: B:20:0x003d, code lost: + + if (r2 != 0) goto L21; + */ + /* JADX WARN: Code restructure failed: missing block: B:23:0x0047, code lost: + + throw new com.ea.nimble.mtx.googleplay.util.IabException(r2, "Error refreshing inventory (querying prices of items)."); + */ + /* JADX WARN: Code restructure failed: missing block: B:24:0x0048, code lost: + + r2 = querySkuDetails(r0, r4, com.ea.nimble.mtx.googleplay.util.IabHelper.ITEM_TYPE_INAPP); + */ + /* JADX WARN: Code restructure failed: missing block: B:25:0x004e, code lost: + + if (r2 != 0) goto L26; + */ + /* JADX WARN: Code restructure failed: missing block: B:28:0x0058, code lost: + + throw new com.ea.nimble.mtx.googleplay.util.IabException(r2, "Error refreshing inventory (querying prices of items)."); + */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public com.ea.nimble.mtx.googleplay.util.Inventory queryInventory(boolean r2, boolean r3, java.util.List r4) throws com.ea.nimble.mtx.googleplay.util.IabException { + /* + r1 = this; + java.lang.String r0 = "queryInventory" + r1.checkSetupDone(r0) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + com.ea.nimble.mtx.googleplay.util.Inventory r0 = new com.ea.nimble.mtx.googleplay.util.Inventory // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + r0.() // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 == 0) goto L31 + java.lang.String r2 = "inapp" + int r2 = r1.queryPurchases(r0, r2) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 != 0) goto L29 + boolean r2 = r1.mSubscriptionsSupported // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 == 0) goto L31 + java.lang.String r2 = "subs" + int r2 = r1.queryPurchases(r0, r2) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 != 0) goto L21 + goto L31 + L21: + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + java.lang.String r4 = "Error refreshing inventory (querying owned items)." + r3.(r2, r4) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + throw r3 // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + L29: + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + java.lang.String r4 = "Error refreshing inventory (querying owned items)." + r3.(r2, r4) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + throw r3 // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + L31: + if (r3 == 0) goto L59 + boolean r2 = r1.mSubscriptionsSupported // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 == 0) goto L48 + java.lang.String r2 = "subs" + int r2 = r1.querySkuDetails(r0, r4, r2) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 != 0) goto L40 + goto L48 + L40: + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + java.lang.String r4 = "Error refreshing inventory (querying prices of items)." + r3.(r2, r4) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + throw r3 // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + L48: + java.lang.String r2 = "inapp" + int r2 = r1.querySkuDetails(r0, r4, r2) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + if (r2 != 0) goto L51 + goto L59 + L51: + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + java.lang.String r4 = "Error refreshing inventory (querying prices of items)." + r3.(r2, r4) // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + throw r3 // Catch: org.json.JSONException -> L5a android.os.RemoteException -> L65 + L59: + return r0 + L5a: + r2 = move-exception + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException + r4 = -1002(0xfffffffffffffc16, float:NaN) + java.lang.String r0 = "Error parsing JSON response while refreshing inventory." + r3.(r4, r0, r2) + throw r3 + L65: + r2 = move-exception + com.ea.nimble.mtx.googleplay.util.IabException r3 = new com.ea.nimble.mtx.googleplay.util.IabException + r4 = -1001(0xfffffffffffffc17, float:NaN) + java.lang.String r0 = "Remote exception while refreshing inventory." + r3.(r4, r0, r2) + throw r3 + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.mtx.googleplay.util.IabHelper.queryInventory(boolean, boolean, java.util.List):com.ea.nimble.mtx.googleplay.util.Inventory"); + } + + public void queryInventoryAsync(final boolean z, final boolean z2, final List list, final QueryInventoryFinishedListener queryInventoryFinishedListener) { + Looper myLooper = Looper.myLooper(); + if (myLooper == null) { + myLooper = Looper.getMainLooper(); + } + final Handler handler = new Handler(myLooper); + startOrQueueRunnable(new AsyncOperation("queryInventory", true, new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.3 + @Override // java.lang.Runnable + public void run() { + final Inventory inventory; + final IabResult iabResult = new IabResult(0, "Inventory refresh successful."); + 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); + } + }); + } + })); + } + + public void queryInventoryAsync(QueryInventoryFinishedListener queryInventoryFinishedListener) { + queryInventoryAsync(true, true, null, queryInventoryFinishedListener); + } + + public void queryInventoryAsync(boolean z, boolean z2, QueryInventoryFinishedListener queryInventoryFinishedListener) { + queryInventoryAsync(z, z2, null, queryInventoryFinishedListener); + } + + 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); + } + } + + public void consumeAsync(Purchase purchase, OnConsumeFinishedListener onConsumeFinishedListener) { + ArrayList arrayList = new ArrayList(); + arrayList.add(purchase); + consumeAsyncInternal(arrayList, onConsumeFinishedListener, null); + } + + public void consumeAsync(List list, OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) { + consumeAsyncInternal(list, null, onConsumeMultiFinishedListener); + } + + public static String getResponseDesc(int i) { + String[] split = "0:OK/1:User Canceled/2:Unknown/3:Billing Unavailable/4:Item unavailable/5:Developer Error/6:Error/7:Item Already Owned/8:Item not owned".split("/"); + String[] split2 = "0:OK/-1001:Remote exception during initialization/-1002:Bad response received/-1003:Purchase signature verification failed/-1004:Send intent failed/-1005:User cancelled/-1006:Unknown purchase response/-1007:Missing token/-1008:Unknown error/-1009:Subscriptions not available/-1010:Invalid consumption attempt".split("/"); + if (i <= -1000) { + int i2 = (-1000) - i; + if (i2 >= 0 && i2 < split2.length) { + return split2[i2]; + } + return String.valueOf(i) + ":Unknown IAB Helper Error"; + } + if (i < 0 || i >= split.length) { + return String.valueOf(i) + ":Unknown"; + } + return split[i]; + } + + void checkSetupDone(String str) { + if (this.mSetupDone) { + return; + } + logError("Illegal state for operation (" + str + "): IAB helper is not set up."); + throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + str); + } + + int getResponseCodeFromBundle(Bundle bundle) { + Object obj = bundle.get(RESPONSE_CODE); + if (obj == null) { + logDebug("Bundle with null response code, assuming OK (known issue)"); + return 0; + } + if (obj instanceof Integer) { + return ((Integer) obj).intValue(); + } + if (obj instanceof Long) { + return (int) ((Long) obj).longValue(); + } + logError("Unexpected type for bundle response code."); + logError(obj.getClass().getName()); + throw new RuntimeException("Unexpected type for bundle response code: " + obj.getClass().getName()); + } + + int getResponseCodeFromIntent(Intent intent) { + Object obj = intent.getExtras().get(RESPONSE_CODE); + if (obj == null) { + logError("Intent with no response code, assuming OK (known issue)"); + return 0; + } + if (obj instanceof Integer) { + return ((Integer) obj).intValue(); + } + if (obj instanceof Long) { + return (int) ((Long) obj).longValue(); + } + logError("Unexpected type for intent response code."); + logError(obj.getClass().getName()); + throw new RuntimeException("Unexpected type for intent response code: " + obj.getClass().getName()); + } + + boolean isAsyncInProgress() { + return this.mAsyncInProgress; + } + + void flagStartAsync(AsyncOperation asyncOperation) { + if (this.mAsyncInProgress) { + throw new IllegalStateException("Can't start async operation (" + asyncOperation.getName() + ") because another async operation(" + this.mAsyncOperation.getName() + ") is in progress."); + } + this.mAsyncOperation = asyncOperation; + this.mAsyncInProgress = true; + logDebug("Starting async operation: " + asyncOperation.getName()); + } + + synchronized void flagEndAsync() { + if (this.mAsyncInProgress) { + logDebug("Ending async operation: " + this.mAsyncOperation.getName()); + this.mAsyncOperation = null; + this.mAsyncInProgress = false; + checkAndPopAsyncQueue(); + } + } + + private void enqueueOperation(AsyncOperation asyncOperation) { + logDebug("Enqueuing operation " + asyncOperation.getName() + " to execute after current async op, " + this.mAsyncOperation.getName() + ", is finished."); + this.mAsyncRequestQueue.add(asyncOperation); + } + + private synchronized void startOrQueueRunnable(AsyncOperation asyncOperation) { + if (isAsyncInProgress()) { + enqueueOperation(asyncOperation); + } else { + flagStartAsync(asyncOperation); + asyncOperation.run(); + } + } + + private void checkAndPopAsyncQueue() { + if (this.mAsyncRequestQueue.size() > 0) { + AsyncOperation removeFirst = this.mAsyncRequestQueue.removeFirst(); + flagStartAsync(removeFirst); + removeFirst.run(); + } + } + + /* JADX WARN: Code restructure failed: missing block: B:46:0x01ab, code lost: + + return com.ea.nimble.mtx.googleplay.util.IabHelper.IABHELPER_BAD_RESPONSE; + */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + int queryPurchases(com.ea.nimble.mtx.googleplay.util.Inventory r17, java.lang.String r18) throws org.json.JSONException, android.os.RemoteException, java.lang.IllegalStateException { + /* + Method dump skipped, instructions count: 452 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + 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 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 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 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 list, final OnConsumeFinishedListener onConsumeFinishedListener, final OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) { + Looper myLooper = Looper.myLooper(); + if (myLooper == null) { + myLooper = Looper.getMainLooper(); + } + final Handler handler = new Handler(myLooper); + startOrQueueRunnable(new AsyncOperation("consume", true, new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.4 + @Override // java.lang.Runnable + public void run() { + final ArrayList arrayList = new ArrayList(); + for (Purchase purchase : list) { + try { + IabHelper.this.consume(purchase); + arrayList.add(new IabResult(0, "Successful consume of sku " + purchase.getSku())); + } catch (IabException e) { + arrayList.add(e.getResult()); + } + } + IabHelper.this.flagEndAsync(); + if (onConsumeFinishedListener != null) { + handler.post(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.4.1 + @Override // java.lang.Runnable + public void run() { + onConsumeFinishedListener.onConsumeFinished((Purchase) list.get(0), (IabResult) arrayList.get(0)); + } + }); + } + if (onConsumeMultiFinishedListener != null) { + handler.post(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.util.IabHelper.4.2 + @Override // java.lang.Runnable + public void run() { + onConsumeMultiFinishedListener.onConsumeMultiFinished(list, arrayList); + } + }); + } + } + })); + } + + void logDebug(String str) { + Log.Helper.LOGD(this, str, new Object[0]); + } + + void logError(String str) { + Log.Helper.LOGE(this, str, new Object[0]); + } + + void logWarn(String str) { + Log.Helper.LOGW(this, str, new Object[0]); + } + + public boolean isServiceAvailable() { + return this.mSetupDone && this.mService != null; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java new file mode 100644 index 0000000..0e80822 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java @@ -0,0 +1,36 @@ +package com.ea.nimble.mtx.googleplay.util; + +/* loaded from: classes.dex */ +public class IabResult { + String mMessage; + int mResponse; + + public IabResult(int i, String str) { + this.mResponse = i; + if (str == null || str.trim().length() == 0) { + this.mMessage = IabHelper.getResponseDesc(i); + return; + } + this.mMessage = str + " (response: " + IabHelper.getResponseDesc(i) + ")"; + } + + public int getResponse() { + return this.mResponse; + } + + public String getMessage() { + return this.mMessage; + } + + public boolean isSuccess() { + return this.mResponse == 0; + } + + public boolean isFailure() { + return !isSuccess(); + } + + public String toString() { + return "IabResult: " + getMessage(); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java new file mode 100644 index 0000000..c429739 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java @@ -0,0 +1,57 @@ +package com.ea.nimble.mtx.googleplay.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +public class Inventory { + Map mSkuMap = new HashMap(); + Map mPurchaseMap = new HashMap(); + + Inventory() { + } + + public SkuDetails getSkuDetails(String str) { + return this.mSkuMap.get(str); + } + + public Purchase getPurchase(String str) { + return this.mPurchaseMap.get(str); + } + + public boolean hasPurchase(String str) { + return this.mPurchaseMap.containsKey(str); + } + + public boolean hasDetails(String str) { + return this.mSkuMap.containsKey(str); + } + + public void erasePurchase(String str) { + if (this.mPurchaseMap.containsKey(str)) { + this.mPurchaseMap.remove(str); + } + } + + public List getAllOwnedSkus() { + return new ArrayList(this.mPurchaseMap.keySet()); + } + + public List getAllPurchases() { + return new ArrayList(this.mPurchaseMap.values()); + } + + void addSkuDetails(SkuDetails skuDetails) { + this.mSkuMap.put(skuDetails.getSku(), skuDetails); + } + + void addPurchase(Purchase purchase) { + this.mPurchaseMap.put(purchase.getSku(), purchase); + } + + public List getAllSkuDetails() { + return new ArrayList(this.mSkuMap.values()); + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java new file mode 100644 index 0000000..43e08b2 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java @@ -0,0 +1,119 @@ +package com.ea.nimble.mtx.googleplay.util; + +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.mtx.googleplay.GooglePlay; +import com.ea.nimble.mtx.googleplay.GooglePlayTransaction; +import java.util.Map; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class Purchase { + String mDeveloperPayload; + boolean mIsAutoRenewing; + String mItemType; + String mNimbleMTXTransactionId; + String mOrderId; + String mOriginalJson; + String mPackageName; + int mPurchaseState; + long mPurchaseTime; + String mSignature; + String mSku; + String mToken; + + public Purchase(String str, String str2, String str3) throws JSONException { + this.mItemType = str; + this.mOriginalJson = str2; + JSONObject jSONObject = new JSONObject(this.mOriginalJson); + this.mOrderId = jSONObject.optString("orderId"); + this.mPackageName = jSONObject.optString("packageName"); + this.mSku = jSONObject.optString("productId"); + this.mPurchaseTime = jSONObject.optLong("purchaseTime"); + this.mPurchaseState = jSONObject.optInt("purchaseState"); + this.mDeveloperPayload = jSONObject.optString("developerPayload"); + this.mToken = jSONObject.optString("token", jSONObject.optString("purchaseToken")); + this.mIsAutoRenewing = jSONObject.optBoolean("autoRenewing"); + this.mSignature = str3; + } + + public Purchase(GooglePlayTransaction googlePlayTransaction) throws IllegalArgumentException { + Map additionalInfo = googlePlayTransaction.getAdditionalInfo(); + if (additionalInfo == null) { + throw new IllegalArgumentException("Can't construct Purchase from GooglePlayTransaction without additional info bundle"); + } + String str = (String) additionalInfo.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID); + String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId(); + String itemSku = googlePlayTransaction.getItemSku(); + long longValue = ((Long) additionalInfo.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME)).longValue(); + int intValue = ((Integer) additionalInfo.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE)).intValue(); + String nonce = googlePlayTransaction.getNonce(); + String str2 = (String) additionalInfo.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN); + String receipt = googlePlayTransaction.getReceipt(); + if (str == null || applicationBundleId == null || itemSku == null || nonce == null || str2 == null || receipt == null) { + throw new IllegalArgumentException("Missing data to construct a Purchase object."); + } + this.mOrderId = str; + this.mPackageName = applicationBundleId; + this.mSku = itemSku; + this.mPurchaseTime = longValue; + this.mPurchaseState = intValue; + this.mDeveloperPayload = nonce; + this.mToken = str2; + this.mSignature = receipt; + this.mOriginalJson = "{\"constructedFromTransaction\":1}"; + this.mNimbleMTXTransactionId = googlePlayTransaction.getTransactionId(); + } + + public String getItemType() { + return this.mItemType; + } + + public String getOrderId() { + return this.mOrderId; + } + + public String getPackageName() { + return this.mPackageName; + } + + public String getSku() { + return this.mSku; + } + + public long getPurchaseTime() { + return this.mPurchaseTime; + } + + public int getPurchaseState() { + return this.mPurchaseState; + } + + public String getDeveloperPayload() { + return this.mDeveloperPayload; + } + + public String getToken() { + return this.mToken; + } + + public String getOriginalJson() { + return this.mOriginalJson; + } + + public String getSignature() { + return this.mSignature; + } + + public String getNimbleMTXTransactionId() { + return this.mNimbleMTXTransactionId; + } + + public boolean isAutoRenewing() { + return this.mIsAutoRenewing; + } + + public String toString() { + return "PurchaseInfo:" + this.mOriginalJson; + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java new file mode 100644 index 0000000..2641b39 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java @@ -0,0 +1,70 @@ +package com.ea.nimble.mtx.googleplay.util; + +import android.text.TextUtils; +import android.util.Log; +import java.security.InvalidKeyException; +import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; +import java.security.PublicKey; +import java.security.Signature; +import java.security.SignatureException; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.X509EncodedKeySpec; + +/* loaded from: classes.dex */ +public class Security { + private static final String KEY_FACTORY_ALGORITHM = "RSA"; + private static final String SIGNATURE_ALGORITHM = "SHA1withRSA"; + private static final String TAG = "IABUtil/Security"; + + public static boolean verifyPurchase(String str, String str2, String str3) { + if (str2 == null) { + Log.e(TAG, "data is null"); + return false; + } + if (TextUtils.isEmpty(str3) || verify(generatePublicKey(str), str2, str3)) { + return true; + } + Log.w(TAG, "signature does not match data."); + return false; + } + + public static PublicKey generatePublicKey(String str) { + try { + return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str))); + } catch (Base64DecoderException e) { + Log.e(TAG, "Base64 decoding failed."); + throw new IllegalArgumentException(e); + } catch (NoSuchAlgorithmException e2) { + throw new RuntimeException(e2); + } catch (InvalidKeySpecException e3) { + Log.e(TAG, "Invalid key specification."); + throw new IllegalArgumentException(e3); + } + } + + public static boolean verify(PublicKey publicKey, String str, String str2) { + try { + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(publicKey); + signature.update(str.getBytes()); + if (signature.verify(Base64.decode(str2))) { + return true; + } + Log.e(TAG, "Signature verification failed."); + return false; + } catch (Base64DecoderException unused) { + Log.e(TAG, "Base64 decoding failed."); + return false; + } catch (InvalidKeyException unused2) { + Log.e(TAG, "Invalid key specification."); + return false; + } catch (NoSuchAlgorithmException unused3) { + Log.e(TAG, "NoSuchAlgorithmException."); + return false; + } catch (SignatureException unused4) { + Log.e(TAG, "Signature exception."); + return false; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java new file mode 100644 index 0000000..e93ff52 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java @@ -0,0 +1,60 @@ +package com.ea.nimble.mtx.googleplay.util; + +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class SkuDetails { + String mCurrencyCode; + String mDescription; + String mJson; + String mPrice; + String mPriceMicros; + String mSku; + String mTitle; + String mType; + + public SkuDetails(String str) throws JSONException { + this.mJson = str; + JSONObject jSONObject = new JSONObject(this.mJson); + this.mSku = jSONObject.optString("productId"); + this.mType = jSONObject.optString("type"); + this.mPrice = jSONObject.optString("price"); + this.mPriceMicros = jSONObject.optString("price_amount_micros"); + this.mCurrencyCode = jSONObject.optString("price_currency_code"); + this.mTitle = jSONObject.optString("title"); + this.mDescription = jSONObject.optString("description"); + } + + public String getSku() { + return this.mSku; + } + + public String getType() { + return this.mType; + } + + public String getPrice() { + return this.mPrice; + } + + public String getPriceMicros() { + return this.mPriceMicros; + } + + public String getCurrencyCode() { + return this.mCurrencyCode; + } + + public String getTitle() { + return this.mTitle; + } + + public String getDescription() { + return this.mDescription; + } + + public String toString() { + return "SkuDetails:" + this.mJson; + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/BuildConfig.java b/app/src/main/java/com/ea/nimble/pushtng/BuildConfig.java new file mode 100644 index 0000000..9e3c13c --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/BuildConfig.java @@ -0,0 +1,11 @@ +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"; +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/IPushNotification.java b/app/src/main/java/com/ea/nimble/pushtng/IPushNotification.java new file mode 100644 index 0000000..178d0d6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/IPushNotification.java @@ -0,0 +1,17 @@ +package com.ea.nimble.pushtng; + +import com.ea.eadp.pushnotification.listeners.IPushListener; +import java.util.Date; + +/* loaded from: classes.dex */ +public interface IPushNotification { + String getDisableStatus(); + + boolean getRegistrationStatus(); + + void sendPendingTrackingRequests(); + + void startAsDisabled(String str, Date date, String str2, IPushListener iPushListener); + + void startWithDefaults(String str, Date date, IPushListener iPushListener); +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpRequest.java b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpRequest.java new file mode 100644 index 0000000..e89f23d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpRequest.java @@ -0,0 +1,163 @@ +package com.ea.nimble.pushtng; + +import com.ea.eadp.http.models.HttpRequest; +import com.ea.eadp.http.models.HttpRequestListener; +import com.ea.eadp.http.models.HttpResponse; +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 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 { + private static final String LOG_TAG = "NimbleAndroidHttpRequest"; + private String body; + private HashMap headers; + private INetwork nimbleNetwork; + private URL resource; + + public NimbleAndroidHttpRequest() throws IOException { + try { + this.nimbleNetwork = Network.getComponent(); + this.headers = new HashMap<>(); + } catch (Exception e) { + Log.Helper.LOGES(LOG_TAG, e.toString(), new Object[0]); + throw new IOException("NimbleNetwork unavailble at this time."); + } + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setResource(URL url) { + Log.Helper.LOGPUBLICFUNC(this); + this.resource = url; + return this; + } + + @Override // com.ea.eadp.http.models.HttpRequest + public URL getResource() { + Log.Helper.LOGPUBLICFUNC(this); + return this.resource; + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setHeader(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + this.headers.put(str, str2); + return this; + } + + @Override // com.ea.eadp.http.models.HttpRequest + public String getValueForHeader(String str) { + Log.Helper.LOGPUBLICFUNC(this); + return this.headers.get(str); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setBody(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.body = str; + setHeader("Content-Type", URLEncodedUtils.CONTENT_TYPE); + return this; + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setBody(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + return setBody(str); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setJsonBody(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.body = str; + setHeader("Content-Type", "application/json"); + return this; + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpRequest setJsonBody(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + return setJsonBody(str); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpResponse get() { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Synchronous communication not supported."); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public void getAsync(final HttpRequestListener httpRequestListener) { + Log.Helper.LOGPUBLICFUNC(this); + this.nimbleNetwork.sendGetRequest(this.resource, this.headers, new NetworkConnectionCallback() { // from class: com.ea.nimble.pushtng.NimbleAndroidHttpRequest.1 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + NimbleAndroidHttpRequest.this.sendResponseCallback(networkConnectionHandle, httpRequestListener); + } + }); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpResponse post() { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Synchronous communication not supported."); + } + + @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 + @Override // com.ea.nimble.NetworkConnectionCallback + public void callback(NetworkConnectionHandle networkConnectionHandle) { + NimbleAndroidHttpRequest.this.sendResponseCallback(networkConnectionHandle, httpRequestListener); + } + }); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpResponse put() { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Synchronous communication not supported."); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public void putAsync(HttpRequestListener httpRequestListener) { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Put requests not supported."); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public HttpResponse delete() { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Synchronous communication not supported."); + } + + @Override // com.ea.eadp.http.models.HttpRequest + public void deleteAsync(HttpRequestListener httpRequestListener) { + Log.Helper.LOGPUBLICFUNC(this); + throw new UnsupportedOperationException("Delete requests not supported."); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void sendResponseCallback(NetworkConnectionHandle networkConnectionHandle, HttpRequestListener httpRequestListener) { + NimbleAndroidHttpResponse nimbleAndroidHttpResponse = new NimbleAndroidHttpResponse(); + nimbleAndroidHttpResponse.setCode(networkConnectionHandle.getResponse().getStatusCode()); + URL url = networkConnectionHandle.getResponse().getUrl(); + nimbleAndroidHttpResponse.setUrl(url == null ? null : url.toString()); + try { + nimbleAndroidHttpResponse.setBody(Utility.readStringFromStream(networkConnectionHandle.getResponse().getDataStream())); + } catch (IOException e) { + Log.Helper.LOGES(LOG_TAG, "IOException reading response body: " + e.toString(), new Object[0]); + } + nimbleAndroidHttpResponse.setHeaders(networkConnectionHandle.getResponse().getHeaders()); + httpRequestListener.onComplete(nimbleAndroidHttpResponse); + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpResponse.java b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpResponse.java new file mode 100644 index 0000000..76e63bf --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpResponse.java @@ -0,0 +1,74 @@ +package com.ea.nimble.pushtng; + +import com.ea.eadp.http.models.HttpResponse; +import com.ea.nimble.Log; +import java.util.Map; + +/* loaded from: classes.dex */ +public class NimbleAndroidHttpResponse implements HttpResponse { + private String body; + private int code; + private Map headers; + private String message; + private String url; + + @Override // com.ea.eadp.http.models.HttpResponse + public String getUrl() { + Log.Helper.LOGPUBLICFUNC(this); + return this.url; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public void setUrl(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.url = str; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public int getCode() { + Log.Helper.LOGPUBLICFUNC(this); + return this.code; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public void setCode(int i) { + Log.Helper.LOGPUBLICFUNC(this); + this.code = i; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public String getMessage() { + Log.Helper.LOGPUBLICFUNC(this); + return this.message; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public void setMessage(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.message = str; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public String getBody() { + Log.Helper.LOGPUBLICFUNC(this); + return this.body; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public void setBody(String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.body = str; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public Map getHeaders() { + Log.Helper.LOGPUBLICFUNC(this); + return this.headers; + } + + @Override // com.ea.eadp.http.models.HttpResponse + public void setHeaders(Map map) { + Log.Helper.LOGPUBLICFUNC(this); + this.headers = map; + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpService.java b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpService.java new file mode 100644 index 0000000..b8b0cd7 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimbleAndroidHttpService.java @@ -0,0 +1,19 @@ +package com.ea.nimble.pushtng; + +import com.ea.eadp.http.models.HttpRequest; +import com.ea.eadp.http.services.HttpService; +import com.ea.nimble.Log; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +/* loaded from: classes.dex */ +public class NimbleAndroidHttpService implements HttpService { + @Override // com.ea.eadp.http.services.HttpService + public HttpRequest getResource(String str) throws MalformedURLException, IOException { + Log.Helper.LOGFUNC(this); + NimbleAndroidHttpRequest nimbleAndroidHttpRequest = new NimbleAndroidHttpRequest(); + nimbleAndroidHttpRequest.setResource(new URL(str)); + return nimbleAndroidHttpRequest; + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimbleDeviceIdService.java b/app/src/main/java/com/ea/nimble/pushtng/NimbleDeviceIdService.java new file mode 100644 index 0000000..c7b4e8d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimbleDeviceIdService.java @@ -0,0 +1,22 @@ +package com.ea.nimble.pushtng; + +import com.ea.eadp.deviceid.DeviceIdService; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.Log; +import com.ea.nimble.SynergyEnvironment; + +/* loaded from: classes.dex */ +class NimbleDeviceIdService implements DeviceIdService { + NimbleDeviceIdService() { + } + + @Override // com.ea.eadp.deviceid.DeviceIdService + public String getDeviceId() { + Log.Helper.LOGFUNC(this); + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component != null) { + return component.getEADeviceId(); + } + return null; + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastForwarder.java b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastForwarder.java new file mode 100644 index 0000000..7c21006 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastForwarder.java @@ -0,0 +1,86 @@ +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(); + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastReceiver.java b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastReceiver.java new file mode 100644 index 0000000..85ee98e --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGBroadcastReceiver.java @@ -0,0 +1,13 @@ +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(); + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGIntentService.java b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGIntentService.java new file mode 100644 index 0000000..60e2c32 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/NimblePushTNGIntentService.java @@ -0,0 +1,117 @@ +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(); + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/PushNotification.java b/app/src/main/java/com/ea/nimble/pushtng/PushNotification.java new file mode 100644 index 0000000..5f06d7d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/PushNotification.java @@ -0,0 +1,23 @@ +package com.ea.nimble.pushtng; + +import com.ea.nimble.Base; +import com.ea.nimble.Log; + +/* loaded from: classes.dex */ +public class PushNotification { + public static final String COMPONENT_ID = "com.ea.nimble.pushtng"; + public static final String DISABLED_REASON_GAME_SERVER = "game_server"; + public static final String DISABLED_REASON_OPT_OUT = "opt_out"; + public static final String DISABLED_REASON_REGISTER_FAILURE = "client_register_failure"; + public static final String KEY_TRACKING_TYPE = "trackingType"; + public static final String NOTIFICATION_PUSHTNG_COMPONENT_SETUP_COMPLETE = "nimble.pushtng.componentSetupComplete"; + + private static void initialize() { + Log.Helper.LOGFUNCS("PushNotification"); + Base.registerComponent(new PushNotificationImpl(), "com.ea.nimble.pushtng"); + } + + public static IPushNotification getComponent() { + return (IPushNotification) Base.getComponent("com.ea.nimble.pushtng"); + } +} diff --git a/app/src/main/java/com/ea/nimble/pushtng/PushNotificationImpl.java b/app/src/main/java/com/ea/nimble/pushtng/PushNotificationImpl.java new file mode 100644 index 0000000..392dc6a --- /dev/null +++ b/app/src/main/java/com/ea/nimble/pushtng/PushNotificationImpl.java @@ -0,0 +1,385 @@ +package com.ea.nimble.pushtng; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.content.BroadcastReceiver; +import android.content.Context; +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 com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.ApplicationLifecycle; +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.Global; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.NimbleApplicationConfiguration; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +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; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.TimeZone; + +/* loaded from: classes.dex */ +public class PushNotificationImpl extends Component implements IPushNotification, LogSource, IApplicationLifecycle.ActivityLifecycleCallbacks { + private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent"; + private static final String PERSISTENCE_DISABLED_KEY = "disabled"; + private String disableCheck; + private Boolean disabled; + private long dobFromAgeCompliance = -2147483648L; + private BroadcastReceiver m_ageListener; + private IPushService pushService; + private boolean statusCheck; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.pushtng"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "PushTNG"; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityCreated(Activity activity, Bundle bundle) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityDestroyed(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityPaused(Activity activity) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void 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.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 + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + sendPendingTrackingRequests(); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + if (persistenceForNimbleComponent != null) { + this.disabled = (Boolean) persistenceForNimbleComponent.getValue(PERSISTENCE_DISABLED_KEY); + } + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component.getProductId() != null && component.getSellId() != null && component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_ENS) != null) { + onComponentSetupCompleted(); + } else { + Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, new BroadcastReceiver() { // from class: com.ea.nimble.pushtng.PushNotificationImpl.2 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Bundle extras = intent.getExtras(); + if (extras == null || !extras.getString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT).equals("1")) { + return; + } + PushNotificationImpl.this.onComponentSetupCompleted(); + } + }); + } + ApplicationLifecycle.getComponent().registerActivityLifecycleCallbacks(this); + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + Log.Helper.LOGFUNC(this); + Utility.unregisterReceiver(this.m_ageListener); + this.m_ageListener = null; + ApplicationLifecycle.getComponent().unregisterActivityLifecycleCallbacks(this); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks + public void onActivityResumed(Activity activity) { + sendPendingTrackingRequests(); + } + + /* JADX INFO: Access modifiers changed from: private */ + @TargetApi(26) + public void onComponentSetupCompleted() { + Log.Helper.LOGFUNC(this); + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (component == null) { + Log.Helper.LOGE(this, "Synergy environment is null! Unable to complete component setup for PushTNG.", new Object[0]); + return; + } + String serverUrlWithKey = component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_ENS); + String productId = component.getProductId(); + String sellId = component.getSellId(); + if (serverUrlWithKey == null || productId == null || sellId == null) { + Log.Helper.LOGW(this, "Synergy environment startup requests finished, but data is not available", new Object[0]); + return; + } + Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); + NimbleAndroidHttpService nimbleAndroidHttpService = new NimbleAndroidHttpService(); + NimbleDeviceIdService nimbleDeviceIdService = new NimbleDeviceIdService(); + if (Build.VERSION.SDK_INT >= 26) { + NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification"); + 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); + 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]); + } + + @Override // com.ea.nimble.pushtng.IPushNotification + public void startWithDefaults(String str, Date date, IPushListener iPushListener) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.pushService == null) { + Log.Helper.LOGW(this, "Nimble Component has not yet been initialized.", new Object[0]); + if (iPushListener != null) { + iPushListener.onConnectionError(0, "Nimble Component has not yet been initialized."); + return; + } + 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 + public void startAsDisabled(String str, Date date, String str2, IPushListener iPushListener) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.pushService == null) { + if (iPushListener != null) { + iPushListener.onConnectionError(0, "Nimble Component has not yet been initialized."); + } + } 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); + } + } + } + + @Override // com.ea.nimble.pushtng.IPushNotification + public boolean getRegistrationStatus() { + Log.Helper.LOGPUBLICFUNC(this); + return this.statusCheck; + } + + @Override // com.ea.nimble.pushtng.IPushNotification + public String getDisableStatus() { + Log.Helper.LOGPUBLICFUNC(this); + return this.disableCheck; + } + + @Override // com.ea.nimble.pushtng.IPushNotification + public void sendPendingTrackingRequests() { + Map map; + Log.Helper.LOGPUBLICFUNC(this); + SharedPreferences sharedPreferences = ApplicationEnvironment.getComponent().getApplicationContext().getSharedPreferences("PushTNGTracking", 0); + Gson gson = new Gson(); + ArrayList arrayList = new ArrayList(); + Iterator it = sharedPreferences.getAll().keySet().iterator(); + while (it.hasNext()) { + String string = sharedPreferences.getString(it.next(), null); + if (string != null && (map = (Map) gson.fromJson(string, HashMap.class)) != null && !map.isEmpty()) { + arrayList.add(map); + } + } + Object component = Base.getComponent("com.ea.nimble.tracking"); + if (component != null) { + ITracking iTracking = (ITracking) component; + Iterator it2 = arrayList.iterator(); + while (it2.hasNext()) { + HashMap hashMap = new HashMap((Map) it2.next()); + String remove = hashMap.remove(PushNotification.KEY_TRACKING_TYPE); + hashMap.put(Tracking.KEY_PN_DEVICE_ID, SynergyEnvironment.getComponent().getEADeviceId()); + iTracking.logEvent(remove, hashMap); + } + } + for (Map map2 : arrayList) { + String str = (String) map2.get(PushNotification.KEY_TRACKING_TYPE); + 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); + Bundle bundle = new Bundle(); + bundle.putSerializable("core", hashMap2); + bundle.putString("type", "pn"); + bundle.putString(NotificationCompat.CATEGORY_SERVICE, "aruba"); + bundle.putString("status", str2); + bundle.putString("format", "pn"); + bundle.putString("msg_id", (String) map2.get("NIMBLESTANDARD::KEY_PN_MESSAGE_ID")); + bundle.putString("media", (String) map2.get(Tracking.KEY_PN_MESSAGE_TYPE)); + Intent intent = new Intent(); + intent.setAction(NOTIFICATION_TRACKING2_LOG_EVENT); + intent.putExtras(bundle); + LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent); + } + } + SharedPreferences.Editor edit = sharedPreferences.edit(); + edit.clear(); + edit.commit(); + } + + public static void persistTrackingData(Context context, Map map, String str) { + Log.Helper.LOGPUBLICFUNCS("PushNotificationImpl"); + SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("PushTNGTracking", 0).edit(); + edit.putString(str, new Gson().toJson(map)); + edit.commit(); + } + + private Date getValidDOB(Date date) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + if (date != null && date.getTime() != 0) { + Log.Helper.LOGV(this, "getValidDOB(): Using valid DOB from PushTNG: " + simpleDateFormat.format(date), new Object[0]); + return date; + } + if (this.dobFromAgeCompliance != -2147483648L) { + Date date2 = new Date(this.dobFromAgeCompliance * 1000); + Log.Helper.LOGV(this, "getValidDOB(): Got DOB from AgeCompliance: " + simpleDateFormat.format(date2), new Object[0]); + return date2; + } + Date date3 = new Date(0L); + Log.Helper.LOGV(this, "getValidDOB(): Default DOB to 1/1/1970: " + simpleDateFormat.format(date3), new Object[0]); + return date3; + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/ITracking.java b/app/src/main/java/com/ea/nimble/tracking/ITracking.java new file mode 100644 index 0000000..3f0812c --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/ITracking.java @@ -0,0 +1,26 @@ +package com.ea.nimble.tracking; + +import java.util.Map; + +/* loaded from: classes.dex */ +public interface ITracking { + void addCustomSessionData(String str, String str2); + + void clearCustomSessionData(); + + boolean getEnable(); + + boolean getPostEnable(); + + String getSessionId(); + + void logEvent(String str, Map map); + + void removeCustomSessionData(String str); + + void setEnable(boolean z); + + void setPostEnable(boolean z); + + void setTrackingAttribute(String str, String str2); +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingImplBase.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingImplBase.java new file mode 100644 index 0000000..5ce5a29 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingImplBase.java @@ -0,0 +1,821 @@ +package com.ea.nimble.tracking; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.ea.nimble.ApplicationEnvironment; +import com.ea.nimble.Component; +import com.ea.nimble.EASPDataLoader; +import com.ea.nimble.Global; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.NimbleApplicationConfiguration; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.Utility; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import com.ea.nimble.tracking.Tracking; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ScheduledFuture; + +/* loaded from: classes.dex */ +abstract class NimbleTrackingImplBase extends Component implements ITracking, LogSource { + private static final int DATA_VERSION_CURRENT = 3; + private static final int DEFAULT_MAX_QUEUE_LENGTH = 3; + protected static final double DEFAULT_POST_INTERVAL = 1.0d; + protected static final double DEFAULT_REPOST_MULTIPLIER = 2.0d; + protected static final double DEFAULT_RETRY_DELAY = 1.0d; + protected static final double MAX_POST_RETRY_DELAY = 300.0d; + private static final int MAX_QUEUED_EVENTS = 50; + private static final int MAX_QUEUED_SESSIONS = 50; + public static final String NIMBLE_TRACKING_DEFAULT_POST_ENABLE = "NimbleDefaultTrackingPostFlag"; + protected static final double NOW_POST_INTERVAL = 0.0d; + private static final String ORIGIN_LOGIN_STATUS_STRING_AUTO_LOGGING_IN = "autoLogin"; + private static final String ORIGIN_LOGIN_STATUS_STRING_LIVE_USER = "live"; + private static final String ORIGIN_NOTIFICATION_LOGIN_STATUS_UPDATE_KEY_STATUS = "STATUS"; + private static final String PERSISTENCE_CURRENT_SESSION_ID = "currentSessionObject"; + private static final String PERSISTENCE_ENABLE_FLAG = "trackingEnabledFlag"; + private static final String PERSISTENCE_EVENT_QUEUE_ID = "eventQueue"; + private static final String PERSISTENCE_FIRST_SESSION_ID_NUMBER = "firstSessionIDNumber"; + private static final String PERSISTENCE_LAST_SESSION_ID_NUMBER = "lastSessionIDNumber"; + private static final String PERSISTENCE_LOGGED_IN_TO_ORIGIN_ID = "loggedInToOrigin"; + private static final String PERSISTENCE_POST_ENABLE_FLAG = "trackingPostEnabledFlag"; + private static final String PERSISTENCE_QUEUED_SESSIONS_ID = "queuedSessionObjects"; + private static final String PERSISTENCE_SAVED_SESSION_ID_NUMBER = "savedSession"; + private static final String PERSISTENCE_SESSION_DATA_ID = "sessionData"; + private static final String PERSISTENCE_TOTAL_SESSION_COUNT = "totalSessionCount"; + private static final String PERSISTENCE_TRACKING_ATTRIBUTES = "trackingAttributes"; + private static final String PERSISTENCE_VERSION_ID = "dataVersion"; + private static final String SESSION_FILE_FORMAT = "%sSession%d"; + protected double m_postRetryDelay; + private ScheduledFuture m_postTimer; + protected NimbleTrackingThreadManager m_threadManager; + protected ArrayList m_sessionsToPost = new ArrayList<>(); + private boolean m_enable = true; + private boolean m_isFeatureDisabledFromServer = false; + private ArrayList> m_pendingEvents = new ArrayList<>(); + protected ArrayList m_customSessionData = new ArrayList<>(); + private StartupRequestsFinishedReceiver m_receiver = null; + private BroadcastReceiver m_networkStatusChangedReceiver = null; + protected boolean m_loggedInToOrigin = false; + private OriginLoginStatusChangedReceiver m_originLoginStatusChangedReceiver = null; + protected TrackingBaseSessionObject m_currentSessionObject = new TrackingBaseSessionObject(); + protected double m_postInterval = 1.0d; + private boolean m_isPostPending = false; + protected boolean m_isRequestInProgress = false; + private long m_lastSessionIDNumber = -1; + private long m_firstSessionIDNumber = 0; + private long m_totalSessions = 0; + protected HashMap m_trackingAttributes = new HashMap<>(); + private boolean m_postEnable = true; + private int m_maxQueueLength = 3; + + public static class SessionData implements Serializable { + private static final long serialVersionUID = 465486; + String key; + String value; + } + + protected abstract List> convertEvent(Tracking.Event event); + + protected abstract String getFeatureTag(); + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "TrackingBase"; + } + + protected abstract String getPersistenceIdentifier(); + + protected abstract void packageCurrentSession(); + + protected abstract void postPendingEvents(boolean z); + + private class PostTask implements Runnable { + private boolean m_packageEventsOnExpiry; + + public PostTask(boolean z) { + this.m_packageEventsOnExpiry = false; + Log.Helper.LOGPUBLICFUNC(this); + this.m_packageEventsOnExpiry = z; + } + + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingImplBase.this.postIntervalTimerExpired(this.m_packageEventsOnExpiry); + } + } + + NimbleTrackingImplBase() { + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getEnable() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_enable; + } + + @Override // com.ea.nimble.tracking.ITracking + public void setEnable(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + Object[] objArr = new Object[1]; + objArr[0] = z ? "ENABLED" : "DISABLED"; + Log.Helper.LOGI(this, "setEnable called. enable = %s", objArr); + if (this.m_enable == z) { + return; + } + if (!z) { + HashMap hashMap = new HashMap(); + hashMap.put("eventType", Tracking.EVENT_USER_TRACKING_OPTOUT); + logEvent(Tracking.EVENT_USER_TRACKING_OPTOUT, hashMap); + packageCurrentSession(); + postPendingEvents(false); + if (this.m_currentSessionObject.countOfEvents() > 0) { + Log.Helper.LOGI(this, "Removing %d remaining events that couldn't be sent from queue.", Integer.valueOf(this.m_currentSessionObject.countOfEvents())); + } + this.m_currentSessionObject = new TrackingBaseSessionObject(); + if (this.m_sessionsToPost != null && this.m_sessionsToPost.size() > 0) { + Log.Helper.LOGI(this, "Removing unposted sessions.", new Object[0]); + this.m_sessionsToPost.clear(); + } + killPostTimer(); + } else { + resetPostTimer(); + } + this.m_enable = z; + saveToPersistence(); + } + + private void logEvent(Tracking.Event event, boolean z) { + Log.Helper.LOGFUNC(this); + List> convertEvent = convertEvent(event); + boolean z2 = true; + if (convertEvent != null && !convertEvent.isEmpty()) { + for (Map map : convertEvent) { + this.m_currentSessionObject.events.add(map); + Log.Helper.LOGD(this, "Logged event, %s: \n", map); + } + saveToPersistence(); + if (!z && ((this.m_postTimer == null || (this.m_postTimer.isDone() && !this.m_isRequestInProgress)) && isAbleToPostEvent(false))) { + resetPostTimer(); + } + } + if (this.m_currentSessionObject.events.size() >= 50) { + Log.Helper.LOGD(this, "Current number of events (%d) has reached maximum (%d). Posting event queue now.", Integer.valueOf(this.m_currentSessionObject.events.size()), 50); + } else { + z2 = z; + } + if (z2) { + killPostTimer(); + packageCurrentSession(); + postPendingEvents(z); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void logEvent(String str, Map map) { + Log.Helper.LOGPUBLICFUNC(this); + if (!this.m_enable || this.m_isFeatureDisabledFromServer) { + return; + } + boolean z = false; + if (str.equals(Tracking.EVENT_SESSION_END)) { + Log.Helper.LOGD(this, "Logging session end event, " + str + ". Posting event queue now.", new Object[0]); + z = true; + } + Tracking.Event event = new Tracking.Event(); + event.type = str; + event.parameters = map; + event.timestamp = new Date(); + logEvent(event, z); + } + + protected void resetPostTimer() { + Log.Helper.LOGFUNC(this); + resetPostTimer(this.m_postInterval); + } + + protected void resetPostTimer(double d) { + Log.Helper.LOGFUNC(this); + resetPostTimer(d, true); + } + + protected void resetPostTimer(double d, boolean z) { + Log.Helper.LOGFUNC(this); + double d2 = NOW_POST_INTERVAL; + if (d < NOW_POST_INTERVAL) { + Log.Helper.LOGE(this, "resetPostTimer called with an invalid period: period < 0.0. Timer reset with period 0.0 instead", new Object[0]); + } else { + d2 = d; + } + Log.Helper.LOGI(this, "Resetting event post timer for %s seconds.", Double.valueOf(d)); + killPostTimer(); + this.m_postTimer = this.m_threadManager.createTimer(d2, new PostTask(z)); + } + + private void killPostTimer() { + Log.Helper.LOGFUNC(this); + if (this.m_postTimer != null) { + this.m_postTimer.cancel(false); + this.m_postTimer = null; + } + } + + @Override // com.ea.nimble.Component + protected void setup() { + Log.Helper.LOGFUNC(this); + this.m_postRetryDelay = 1.0d; + 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 + protected void suspend() { + Log.Helper.LOGFUNC(this); + if (this.m_networkStatusChangedReceiver != null) { + Utility.unregisterReceiver(this.m_networkStatusChangedReceiver); + this.m_networkStatusChangedReceiver = null; + } + if (this.m_originLoginStatusChangedReceiver != null) { + Utility.unregisterReceiver(this.m_originLoginStatusChangedReceiver); + this.m_originLoginStatusChangedReceiver = null; + } + killPostTimer(); + saveToPersistence(); + EASPDataLoader.deleteDatFile(EASPDataLoader.getTrackingDatFilePath()); + } + + @Override // com.ea.nimble.Component + protected void resume() { + Log.Helper.LOGFUNC(this); + updateFeatureDisableState(); + if (getEnable()) { + resetPostTimer(); + } + if (this.m_originLoginStatusChangedReceiver == null) { + this.m_originLoginStatusChangedReceiver = new OriginLoginStatusChangedReceiver(); + Utility.registerReceiver(Global.NOTIFICATION_LOGIN_STATUS_CHANGE, this.m_originLoginStatusChangedReceiver); + } + this.m_postRetryDelay = 1.0d; + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + Log.Helper.LOGFUNC(this); + killPostTimer(); + EASPDataLoader.deleteDatFile(EASPDataLoader.getTrackingDatFilePath()); + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGFUNC(this); + NimbleTrackingThreadManager.releaseInstance(); + this.m_threadManager = null; + } + + private void saveToPersistence() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + Log.Helper.LOGD(this, "Saving event queue to persistence (cache storage).", new Object[0]); + try { + try { + persistenceForNimbleComponent.setValue(PERSISTENCE_VERSION_ID, String.valueOf(3)); + persistenceForNimbleComponent.setValue(PERSISTENCE_CURRENT_SESSION_ID, this.m_currentSessionObject); + persistenceForNimbleComponent.setValue(PERSISTENCE_EVENT_QUEUE_ID, this.m_pendingEvents); + persistenceForNimbleComponent.setValue(PERSISTENCE_SESSION_DATA_ID, this.m_customSessionData); + persistenceForNimbleComponent.setValue(PERSISTENCE_LOGGED_IN_TO_ORIGIN_ID, Boolean.valueOf(this.m_loggedInToOrigin)); + persistenceForNimbleComponent.setValue(PERSISTENCE_FIRST_SESSION_ID_NUMBER, Long.valueOf(this.m_firstSessionIDNumber)); + persistenceForNimbleComponent.setValue(PERSISTENCE_LAST_SESSION_ID_NUMBER, Long.valueOf(this.m_lastSessionIDNumber)); + persistenceForNimbleComponent.setValue(PERSISTENCE_TOTAL_SESSION_COUNT, Long.valueOf(this.m_totalSessions)); + persistenceForNimbleComponent.setValue(PERSISTENCE_QUEUED_SESSIONS_ID, this.m_sessionsToPost); + persistenceForNimbleComponent.setValue(PERSISTENCE_TRACKING_ATTRIBUTES, this.m_trackingAttributes); + } catch (OutOfMemoryError e) { + Log.Helper.LOGE(this, "OutOfMemoryError in saving m_sessionsToPost to persistence! MaxQueueLength is %s. Exception: %s", Integer.valueOf(this.m_maxQueueLength), e.getLocalizedMessage()); + } + persistenceForNimbleComponent.synchronize(); + Persistence persistenceForNimbleComponent2 = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + Log.Helper.LOGD(this, "Saving tracking enable/disable flag to persistence (document storage).", new Object[0]); + if (!persistenceForNimbleComponent2.getBackUp()) { + persistenceForNimbleComponent2.setBackUp(true); + } + persistenceForNimbleComponent2.setValue(PERSISTENCE_ENABLE_FLAG, Boolean.valueOf(this.m_enable)); + persistenceForNimbleComponent2.synchronize(); + } catch (Throwable th) { + Log.Helper.LOGE(this, "Caught generic throwable while saving to persistence! Discarding attempt to save. Exception: %s", th.getLocalizedMessage()); + } + } + + private void configureTrackingOnFirstInstall() { + Log.Helper.LOGFUNC(this); + Log.Helper.LOGD(this, "First Install. Look for App Settings to enable/disable tracking", new Object[0]); + String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(Tracking.NIMBLE_TRACKING_DEFAULTENABLE); + if (Utility.validString(configValueAsString)) { + if (configValueAsString.equalsIgnoreCase("enable")) { + Log.Helper.LOGD(this, "Default App Setting : Enable Tracking", new Object[0]); + this.m_enable = true; + return; + } else { + if (configValueAsString.equalsIgnoreCase("disable")) { + Log.Helper.LOGD(this, "Default App Setting : Disable Tracking", new Object[0]); + this.m_enable = false; + return; + } + return; + } + } + android.util.Log.e(Global.NIMBLE_ID, "WARNING! Cannot find valid TrackingEnable from AndroidManifest.xml"); + } + + protected void addObserverForSynergyEnvironmentUpdateFinished() { + Log.Helper.LOGFUNC(this); + if (this.m_receiver == null) { + this.m_receiver = new StartupRequestsFinishedReceiver(); + Utility.registerReceiver(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, this.m_receiver); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onStartupRequestsFinished(Intent intent) { + Log.Helper.LOGFUNC(this); + if (intent.getExtras() == null || !intent.getExtras().getString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT).equals("1")) { + return; + } + int trackingPostInterval = SynergyEnvironment.getComponent().getTrackingPostInterval(); + if (trackingPostInterval < 0 || trackingPostInterval == -1) { + this.m_postInterval = 1.0d; + } else { + this.m_postInterval = trackingPostInterval; + } + if (this.m_sessionsToPost != null) { + Iterator it = this.m_sessionsToPost.iterator(); + while (it.hasNext()) { + TrackingBaseSessionObject next = it.next(); + if (next != null && next.sessionData != null) { + Object obj = next.sessionData.get(SynergyCatalog.MTX_INFO_KEY_SELLID); + if (obj instanceof String) { + String str = (String) obj; + if (Utility.validString(str) && !str.equals("0")) { + String sellId = SynergyEnvironment.getComponent().getSellId(); + next.sessionData.put(SynergyCatalog.MTX_INFO_KEY_SELLID, Utility.safeString(sellId)); + if (sellId == null || sellId.equals("") || sellId.equals("0")) { + Log.Helper.LOGE(this, "Sell Id was still null after synergy update", new Object[0]); + } + } + } + Object obj2 = next.sessionData.get("hwId"); + if ((obj2 instanceof String) && Utility.validString((String) obj2)) { + String eAHardwareId = SynergyEnvironment.getComponent().getEAHardwareId(); + next.sessionData.put("hwId", Utility.safeString(eAHardwareId)); + if (eAHardwareId == null || eAHardwareId.equals("")) { + Log.Helper.LOGE(this, "Hardware Id was still null after synergy update", new Object[0]); + } + } + Object obj3 = next.sessionData.get("deviceId"); + if (obj3 instanceof String) { + String str2 = (String) obj3; + if (Utility.validString(str2) && !str2.equals("0")) { + String eADeviceId = SynergyEnvironment.getComponent().getEADeviceId(); + next.sessionData.put("deviceId", Utility.safeString(eADeviceId)); + if (eADeviceId == null || eADeviceId.equals("") || eADeviceId.equals("0")) { + Log.Helper.LOGE(this, "Device Id was still null after synergy update", new Object[0]); + } + } + } + Object obj4 = next.sessionData.get("synergyId"); + if (obj4 instanceof String) { + String str3 = (String) obj4; + if (Utility.validString(str3) && !str3.equals("0")) { + String synergyId = SynergyEnvironment.getComponent().getSynergyId(); + next.sessionData.put("synergyId", Utility.safeString(synergyId)); + if (synergyId == null || synergyId.equals("") || synergyId.equals("0")) { + Log.Helper.LOGE(this, "Synergy Id was still null after synergy update", new Object[0]); + } + } + } + } + } + } + Log.Helper.LOGI(this, "Synergy environment update successful. Removing observer and re-attempting event post.", new Object[0]); + if (this.m_receiver != null) { + Utility.unregisterReceiver(this.m_receiver); + this.m_receiver = null; + } + if (this.m_isPostPending) { + this.m_isPostPending = false; + resetPostTimer(NOW_POST_INTERVAL); + } + } + + private class StartupRequestsFinishedReceiver extends BroadcastReceiver { + private StartupRequestsFinishedReceiver() { + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, final Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + if (intent.getAction().equals(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED)) { + NimbleTrackingImplBase.this.updateFeatureDisableState(); + NimbleTrackingImplBase.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingImplBase.StartupRequestsFinishedReceiver.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingImplBase.this.onStartupRequestsFinished(intent); + } + }); + } + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onOriginLoginStatusChanged(Intent intent) { + Log.Helper.LOGFUNC(this); + if (intent.getExtras() != null) { + String string = intent.getExtras().getString("STATUS"); + if (string.equals(ORIGIN_LOGIN_STATUS_STRING_LIVE_USER) || string.equals(ORIGIN_LOGIN_STATUS_STRING_AUTO_LOGGING_IN)) { + Log.Helper.LOGI(this, "Login status update, TRUE", new Object[0]); + this.m_loggedInToOrigin = true; + return; + } else { + Log.Helper.LOGI(this, "Login status update, FALSE", new Object[0]); + this.m_loggedInToOrigin = false; + return; + } + } + Log.Helper.LOGI(this, "Login status updated event received without extras bundle. Marking NOT logged in to Origin.", new Object[0]); + this.m_loggedInToOrigin = false; + } + + private class OriginLoginStatusChangedReceiver extends BroadcastReceiver { + private OriginLoginStatusChangedReceiver() { + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, final Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + if (intent.getAction().equals(Global.NOTIFICATION_LOGIN_STATUS_CHANGE)) { + NimbleTrackingImplBase.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingImplBase.OriginLoginStatusChangedReceiver.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingImplBase.this.onOriginLoginStatusChanged(intent); + } + }); + } + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void addCustomSessionData(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (Utility.validString(str) && Utility.validString(str2)) { + SessionData sessionData = new SessionData(); + sessionData.key = str; + sessionData.value = str2; + this.m_customSessionData.add(sessionData); + saveSessionDataToPersistent(); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void removeCustomSessionData(String str) { + Log.Helper.LOGPUBLICFUNC(this); + if (Utility.validString(str)) { + Iterator it = this.m_customSessionData.iterator(); + while (true) { + if (!it.hasNext()) { + break; + } + SessionData next = it.next(); + if (next.key.equals(str)) { + this.m_customSessionData.remove(next); + break; + } + } + saveSessionDataToPersistent(); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void clearCustomSessionData() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.tracking.ITracking + public String getSessionId() { + Log.Helper.LOGPUBLICFUNC(this); + return ""; + } + + private void saveSessionDataToPersistent() { + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.CACHE); + Log.Helper.LOGI(this, "Saving event queue to persistence.", new Object[0]); + persistenceForNimbleComponent.setValue(PERSISTENCE_SESSION_DATA_ID, this.m_customSessionData); + persistenceForNimbleComponent.synchronize(); + } + + protected boolean isAbleToPostEvent(boolean z) { + Log.Helper.LOGFUNC(this); + if (!this.m_enable || this.m_isFeatureDisabledFromServer || !this.m_postEnable) { + return false; + } + if (!z && !ApplicationEnvironment.isMainApplicationActive()) { + Log.Helper.LOGD(this, "isAbleToPostEvent - return because the app is in background", new Object[0]); + return false; + } + if (Network.getComponent().getStatus() != Network.Status.OK) { + if (this.m_networkStatusChangedReceiver == null) { + Log.Helper.LOGD(this, "Network status not OK for event post. Adding receiver for network status change.", new Object[0]); + killPostTimer(); + this.m_networkStatusChangedReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.tracking.NimbleTrackingImplBase.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + if (intent.getAction().equals(Global.NOTIFICATION_NETWORK_STATUS_CHANGE)) { + NimbleTrackingImplBase.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingImplBase.1.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingImplBase.this.onNetworkStatusChange(); + } + }); + } + } + }; + Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkStatusChangedReceiver); + } + return false; + } + if (SynergyEnvironment.getComponent().isDataAvailable()) { + return true; + } + this.m_isPostPending = true; + addObserverForSynergyEnvironmentUpdateFinished(); + return false; + } + + @Override // com.ea.nimble.tracking.ITracking + public void setPostEnable(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + if (this.m_postEnable != z) { + this.m_postEnable = z; + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getComponentId(), Persistence.Storage.DOCUMENT); + persistenceForNimbleComponent.setValue(PERSISTENCE_POST_ENABLE_FLAG, Boolean.valueOf(this.m_postEnable)); + persistenceForNimbleComponent.synchronize(); + if (isAbleToPostEvent(false)) { + resetPostTimer(); + } + } + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getPostEnable() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_postEnable; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onNetworkStatusChange() { + Log.Helper.LOGFUNC(this); + if (Network.getComponent().getStatus() == Network.Status.OK) { + Log.Helper.LOGD(this, "Network status restored, kicking off event post.", new Object[0]); + Utility.unregisterReceiver(this.m_networkStatusChangedReceiver); + this.m_networkStatusChangedReceiver = null; + resetPostTimer(NOW_POST_INTERVAL); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + public void postIntervalTimerExpired(boolean z) { + Log.Helper.LOGFUNC(this); + if (z) { + packageCurrentSession(); + } + postPendingEvents(false); + } + + @Override // com.ea.nimble.tracking.ITracking + public void setTrackingAttribute(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + if (Utility.validString(str) && Utility.validString(str2)) { + this.m_trackingAttributes.put(str, str2); + } + } + + protected void queueCurrentEventsForPost() { + Log.Helper.LOGFUNC(this); + Log.Helper.LOGI(this, "queueCurrentEventsForPost called. Starting queue size: %d", Integer.valueOf(this.m_sessionsToPost.size())); + if (this.m_sessionsToPost == null) { + this.m_sessionsToPost = new ArrayList<>(); + } + if (this.m_currentSessionObject == null) { + Log.Helper.LOGE(this, "Unexpected state, currentSessionObject is null.", new Object[0]); + } else if (this.m_currentSessionObject.countOfEvents() == 0) { + Log.Helper.LOGE(this, "Unexpected state, currentSessionObject events list is null or empty.", new Object[0]); + } else { + addCurrentSessionObjectToBackOfQueue(); + dropExtraSessions(); + } + this.m_currentSessionObject = new TrackingBaseSessionObject(new HashMap(this.m_currentSessionObject.sessionData)); + saveToPersistence(); + } + + private void saveSessionToFile(TrackingBaseSessionObject trackingBaseSessionObject, long j) { + Log.Helper.LOGFUNC(this); + String filenameForSessionID = getFilenameForSessionID(j); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(filenameForSessionID, Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent.getBackUp()) { + persistenceForNimbleComponent.setBackUp(false); + } + try { + persistenceForNimbleComponent.setValue(PERSISTENCE_SAVED_SESSION_ID_NUMBER, trackingBaseSessionObject); + } catch (OutOfMemoryError e) { + Log.Helper.LOGE(this, "OutOfMemoryError occurred while saving a session object to file. Exception: %s", e.getLocalizedMessage()); + } + persistenceForNimbleComponent.synchronize(); + PersistenceService.cleanReferenceToPersistence(filenameForSessionID, Persistence.Storage.DOCUMENT); + } + + private TrackingBaseSessionObject loadSessionFromFile(long j) { + Serializable value; + Log.Helper.LOGFUNC(this); + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(getFilenameForSessionID(j), Persistence.Storage.DOCUMENT); + if (persistenceForNimbleComponent == null || (value = persistenceForNimbleComponent.getValue(PERSISTENCE_SAVED_SESSION_ID_NUMBER)) == null || value.getClass() != TrackingBaseSessionObject.class) { + return null; + } + return (TrackingBaseSessionObject) value; + } + + private String getFilenameForSessionID(long j) { + Log.Helper.LOGFUNC(this); + if (j >= 0) { + return String.format(Locale.US, SESSION_FILE_FORMAT, getComponentId(), Long.valueOf(j)); + } + Log.Helper.LOGE(this, "Trying to find the filename for an invalid sessionID!", new Object[0]); + return null; + } + + protected void removeSessionAndFillQueue(TrackingBaseSessionObject trackingBaseSessionObject) { + Log.Helper.LOGFUNC(this); + this.m_sessionsToPost.remove(trackingBaseSessionObject); + this.m_firstSessionIDNumber++; + this.m_totalSessions--; + fillSessionsToPost(); + saveToPersistence(); + } + + private void addCurrentSessionObjectToBackOfQueue() { + Log.Helper.LOGFUNC(this); + this.m_lastSessionIDNumber++; + this.m_totalSessions++; + if (this.m_sessionsToPost.size() >= this.m_maxQueueLength) { + saveSessionToFile(this.m_currentSessionObject, this.m_lastSessionIDNumber); + } else { + this.m_sessionsToPost.add(this.m_currentSessionObject); + } + saveToPersistence(); + } + + private void fillSessionsToPost() { + Log.Helper.LOGFUNC(this); + for (int size = this.m_sessionsToPost.size(); size < this.m_maxQueueLength; size++) { + long j = this.m_firstSessionIDNumber + size; + if (j > this.m_lastSessionIDNumber) { + return; + } + TrackingBaseSessionObject loadSessionFromFile = loadSessionFromFile(j); + if (loadSessionFromFile != null) { + this.m_sessionsToPost.add(loadSessionFromFile); + PersistenceService.removePersistenceForNimbleComponent(getFilenameForSessionID(j), Persistence.Storage.DOCUMENT); + } else { + this.m_firstSessionIDNumber++; + } + } + } + + private void dropExtraSessions() { + Log.Helper.LOGFUNC(this); + if (dropExtraSessions(true)) { + return; + } + Log.Helper.LOGD(this, "Failed to drop enough sessions. Dropping sessions without checking canDropSession.", new Object[0]); + if (dropExtraSessions(false)) { + return; + } + Log.Helper.LOGE(this, "Still unable to drop enough sessions. Remaining number: " + ((this.m_lastSessionIDNumber - this.m_firstSessionIDNumber) + 1), new Object[0]); + } + + private void dropSessions(ArrayList arrayList, long j) { + Log.Helper.LOGFUNC(this); + for (int i = 0; i < arrayList.size(); i++) { + this.m_sessionsToPost.remove(arrayList.get(i)); + PersistenceService.removePersistenceForNimbleComponent(getFilenameForSessionID(j - i), Persistence.Storage.DOCUMENT); + } + if ((j - arrayList.size()) + 1 == this.m_firstSessionIDNumber) { + this.m_firstSessionIDNumber += arrayList.size(); + } + this.m_totalSessions -= arrayList.size(); + saveToPersistence(); + } + + private boolean dropExtraSessions(boolean z) { + TrackingBaseSessionObject loadSessionFromFile; + Log.Helper.LOGFUNC(this); + if (this.m_totalSessions < 50) { + return true; + } + Log.Helper.LOGD(this, "Current number of sessions (%d) has reached maximum (%d). Removing old sessions.", Long.valueOf(this.m_totalSessions), 50); + ArrayList arrayList = new ArrayList<>(); + long j = this.m_firstSessionIDNumber; + while (j <= this.m_lastSessionIDNumber) { + long j2 = j - this.m_firstSessionIDNumber; + if (j2 < this.m_sessionsToPost.size()) { + loadSessionFromFile = this.m_sessionsToPost.get((int) j2); + } else { + loadSessionFromFile = loadSessionFromFile(j); + if (loadSessionFromFile == null) { + continue; + j++; + } + } + if (arrayList.size() == 0 || isSameSession(arrayList.get(arrayList.size() - 1), loadSessionFromFile)) { + arrayList.add(loadSessionFromFile); + } else { + if (!z || canDropSession(arrayList)) { + dropSessions(arrayList, j - 1); + } + arrayList.clear(); + if (this.m_totalSessions < 50) { + fillSessionsToPost(); + return true; + } + arrayList.add(loadSessionFromFile); + } + j++; + } + if (arrayList.size() > 0 && (!z || canDropSession(arrayList))) { + dropSessions(arrayList, j - 1); + } + fillSessionsToPost(); + return this.m_totalSessions < 50; + } + + protected boolean isSameSession(TrackingBaseSessionObject trackingBaseSessionObject, TrackingBaseSessionObject trackingBaseSessionObject2) { + Log.Helper.LOGFUNC(this); + return false; + } + + protected boolean canDropSession(List list) { + Log.Helper.LOGFUNC(this); + return true; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void updateFeatureDisableState() { + Log.Helper.LOGFUNC(this); + if (SynergyEnvironment.getComponent().isDataAvailable()) { + this.m_isFeatureDisabledFromServer = SynergyEnvironment.getComponent().isFeatureDisabled(getFeatureTag()); + if (this.m_isFeatureDisabledFromServer) { + Log.Helper.LOGI(this, "*** FEATURE DISABLED FROM SERVER ***", new Object[0]); + } + } + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SComponent.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SComponent.java new file mode 100644 index 0000000..e77a4b6 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SComponent.java @@ -0,0 +1,16 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Base; + +/* loaded from: classes.dex */ +class NimbleTrackingS2SComponent extends NimbleTrackingThreadProxy { + static final String COMPONENT_ID = "com.ea.nimble.trackingimpl.s2s"; + + static void initialize() { + Base.registerComponent(new NimbleTrackingS2SComponent(), COMPONENT_ID); + } + + private NimbleTrackingS2SComponent() { + super(new NimbleTrackingS2SImpl()); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SImpl.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SImpl.java new file mode 100644 index 0000000..e2aa74b --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingS2SImpl.java @@ -0,0 +1,664 @@ +package com.ea.nimble.tracking; + +import android.app.Activity; +import android.app.ActivityManager; +import android.content.Context; +import android.content.pm.PackageManager; +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; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.ISynergyIdManager; +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; +import com.ea.nimble.SynergyNetworkConnectionCallback; +import com.ea.nimble.SynergyNetworkConnectionHandle; +import com.ea.nimble.SynergyRequest; +import com.ea.nimble.Utility; +import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; +import java.util.UUID; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class NimbleTrackingS2SImpl extends NimbleTrackingImplBase implements LogSource { + public static final int EVENT_APPRESUMED = 103; + public static final int EVENT_APPSTARTED = 102; + public static final int EVENT_APPSTARTED_AFTERINSTALL = 101; + public static final int EVENT_LEVEL_UP = 108; + public static final int EVENT_MTXVIEW_ITEM_PURCHASED = 105; + private static final String EVENT_PREFIX = "SYNERGYS2S::"; + public static final int EVENT_REFERRERID_RECEIVED = 106; + public static final int EVENT_TUTORIAL_COMPLETE = 107; + public static final int EVENT_USER_REGISTERED = 104; + private static final double MARS_DEFAULT_POST_INTERVAL = 60.0d; + private static final double MARS_MAX_POST_RETRY_DELAY = 86400.0d; + private static final String SYNERGY_API_POST_EVENTS = "/s2s/api/core/postEvents"; + private int m_attributionDataCheckRetryCount = 0; + private boolean m_isAppLaunchAfterInstall = false; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.trackingimpl.s2s"; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "TrackingS2S"; + } + + private boolean checkForAttributionData() { + if (ApplicationEnvironment.getComponent().getParameter(ApplicationEnvironment.NIMBLE_PARAMETER_ATTRIBUTION_DATA) != null || this.m_attributionDataCheckRetryCount >= 3) { + return true; + } + this.m_attributionDataCheckRetryCount++; + Log.Helper.LOGV(this, "checkForAttributionData(): Not available. Retry Count " + this.m_attributionDataCheckRetryCount + "/3", new Object[0]); + resetPostTimer(5.0d); + return false; + } + + protected class JsonData implements ISynergyRequest.IJsonData { + private Map data; + + public JsonData(Map map) { + this.data = map; + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public int size() { + return this.data.size(); + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public Object getData() { + return this.data; + } + } + + NimbleTrackingS2SImpl() { + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected String getFeatureTag() { + Log.Helper.LOGFUNC(this); + return "S2STracker"; + } + + public boolean shouldAttemptReTrans(com.ea.nimble.SynergyNetworkConnectionHandle r5) { + return false; + } + + public double getRetryTime(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + int resultCode = -1; + double retryTime = 1.0; + + // Парсинг resultCode из ответа, если соединение и ответ существуют + if (synergyNetworkConnectionHandle != null) { + try { + ISynergyResponse response = synergyNetworkConnectionHandle.getResponse(); + if (response != null) { + Map jsonData = response.getJsonData(); + if (jsonData != null) { + String codeStr = new JSONObject(jsonData).getString("resultCode"); + Log.Helper.LOGD(this, "getMessage result code " + codeStr + "~", new Object[0]); + resultCode = Integer.parseInt(codeStr); + } + } + } catch (JSONException unused) { + Log.Helper.LOGD(this, "Failed to parse result code in TrackingS2S retransmission check. Defaulting to retryTime of:" + retryTime, new Object[0]); + return retryTime; + } + } + + // Определение времени повтора на основе resultCode + if (resultCode <= -21000 && resultCode >= -22000) { + // Специальный диапазон кодов - используем более агрессивную стратегию повтора + if (this.m_postRetryDelay < 60.0) { + this.m_postRetryDelay = 60.0; + } + retryTime = this.m_postRetryDelay; + this.m_postRetryDelay *= 10.0; + + if (this.m_postRetryDelay > MARS_MAX_POST_RETRY_DELAY) { + this.m_postRetryDelay = MARS_MAX_POST_RETRY_DELAY; + } + } else { + // Стандартная стратегия повтора + retryTime = this.m_postRetryDelay; + this.m_postRetryDelay *= 2.0; + + if (this.m_postRetryDelay > 300.0) { + this.m_postRetryDelay = 300.0; + } + } + + Log.Helper.LOGD(this, "S2S retry delay result code is:" + resultCode + ". Delay will be:" + retryTime, new Object[0]); + + return retryTime; + } + + @Override + protected List> convertEvent(Tracking.Event event) { + Log.Helper.LOGFUNC(this); + + // Проверка на поддерживаемые типы событий + if (!Tracking.isNimbleStandardEvent(event.type) && !isS2SEvent(event.type)) { + return null; + } + + // Инициализация переменных для хранения данных события + int eventType = 0; + String eventName = null; + String keyType01 = "0", keyType02 = "0", keyType03 = "0"; + String value01 = "", value02 = "", value03 = ""; + + // Обработка разных типов событий + if (event.type.equals(Tracking.EVENT_APPSTART_AFTERINSTALL)) { + this.m_isAppLaunchAfterInstall = true; + eventType = 101; + eventName = "Launch"; + } + else if (event.type.equals(Tracking.EVENT_APPSTART_NORMAL) || + event.type.equals(Tracking.EVENT_APPSTART_AFTERUPGRADE) || + event.type.equals(Tracking.EVENT_APPSTART_FROMURL)) { + eventType = 102; + eventName = "Launch"; + } + else if (event.type.equals(Tracking.EVENT_APPSTART_FROMPUSH)) { + eventType = 102; + eventName = "NotificationLaunch"; + } + else if (event.type.equals(Tracking.EVENT_APPRESUME_NORMAL) || + event.type.equals(Tracking.EVENT_APPRESUME_FROMURL) || + event.type.equals(Tracking.EVENT_APPRESUME_FROMEBISU)) { + eventType = 103; + eventName = "Resume"; + } + else if (event.type.equals(Tracking.EVENT_APPRESUME_FROMPUSH)) { + eventType = 103; + eventName = "NotificationResume"; + } + else if (event.type.equals(Tracking.EVENT_USER_REGISTERED)) { + eventType = 104; + eventName = "Registration"; + value01 = event.parameters.get(Tracking.KEY_USERNAME); + keyType01 = "username"; + + if (value01 == null) { + Log.Helper.LOGE(this, "Error: missing event parameter \"%s\"", Tracking.KEY_USERNAME); + } + } + else if (event.type.equals(Tracking.EVENT_MTX_ITEM_PURCHASED)) { + eventType = 105; + eventName = "Purchase"; + value01 = event.parameters.get(Tracking.KEY_MTX_CURRENCY); + value02 = event.parameters.get(Tracking.KEY_MTX_PRICE); + keyType01 = "tvalue"; + keyType02 = "fvalue"; + + if (value01 == null) { + Log.Helper.LOGE(this, "Error: missing event parameter \"%s\"", Tracking.KEY_MTX_CURRENCY); + } + if (value02 == null) { + Log.Helper.LOGE(this, "Error: missing event parameter \"%s\"", Tracking.KEY_MTX_PRICE); + } + } + else if (event.type.equals(Tracking.EVENT_TUTORIAL_COMPLETE)) { + eventType = 107; + eventName = "TutorialComplete"; + } + else if (event.type.equals(Tracking.EVENT_LEVEL_UP)) { + eventType = 108; + eventName = "LevelUp"; + value01 = event.parameters.get(Tracking.KEY_DURATION); + value02 = event.parameters.get(Tracking.KEY_GAMEPLAY_DURATION); + value03 = event.parameters.get(Tracking.KEY_USER_LEVEL); + keyType01 = "duration"; + keyType02 = "gameplayDuration"; + keyType03 = "userLevel"; + } + else if (event.type.equals(TrackingS2S.EVENT_CUSTOM)) { + eventType = Integer.parseInt(event.parameters.get("eventType")); + keyType01 = event.parameters.get("keyType01"); + value01 = event.parameters.get("keyValue01"); + keyType02 = event.parameters.get("keyType02"); + value02 = event.parameters.get("keyValue02"); + keyType03 = event.parameters.get("keyType03"); + value03 = event.parameters.get("keyValue03"); + } + else { + return null; + } + + // Создание карты с данными события + Map eventMap = new HashMap<>(10); + eventMap.put("eventType", String.valueOf(eventType)); + eventMap.put("eventName", eventName); + eventMap.put("timestamp", Utility.getUTCDateStringFormat(event.timestamp)); + eventMap.put("eventKeyType01", keyType01); + eventMap.put("eventValue01", value01 != null ? value01 : ""); + eventMap.put("eventKeyType02", keyType02); + eventMap.put("eventValue02", value02 != null ? value02 : ""); + eventMap.put("eventKeyType03", keyType03); + eventMap.put("eventValue03", value03 != null ? value03 : ""); + eventMap.put("transactionId", UUID.randomUUID().toString()); + + // Обработка специальных событий (запуск/возобновление приложения) + if (eventType == 101 || eventType == 102 || eventType == 103) { + if (this.m_currentSessionObject.countOfEvents() > 0) { + queueCurrentEventsForPost(); + } + Log.Helper.LOGD(this, "Logging application start/resume event. Posting event queue now.", new Object[0]); + resetPostTimer(0.0d); + } + + return Collections.singletonList(eventMap); + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected void postPendingEvents(boolean z) { + Log.Helper.LOGFUNC(this); + if (!isAbleToPostEvent(z)) { + Log.Helper.LOGV(this, "Cannot postPendingEvents (!isAbleToPostEvent())", new Object[0]); + return; + } + if (this.m_isAppLaunchAfterInstall && !checkForAttributionData()) { + Log.Helper.LOGV(this, "Cannot postPendingEvents (Attribution data not available.)", new Object[0]); + return; + } + if (this.m_sessionsToPost == null || this.m_sessionsToPost.size() <= 0) { + Log.Helper.LOGD(this, "No tracking sessions to post.", new Object[0]); + return; + } + TrackingBaseSessionObject trackingBaseSessionObject = this.m_sessionsToPost.get(0); + while (trackingBaseSessionObject == null) { + removeSessionAndFillQueue(null); + if (this.m_sessionsToPost.size() <= 0) { + Log.Helper.LOGD(this, "No valid tracking sessions to post.", new Object[0]); + return; + } + trackingBaseSessionObject = this.m_sessionsToPost.get(0); + } + if (sessionContainsAppInstallEvent(trackingBaseSessionObject)) { + trackingBaseSessionObject.sessionData.put("install_referrer", Utility.convertJSONObjectStringToMap(Utility.safeString(ApplicationEnvironment.getComponent().getParameter(ApplicationEnvironment.NIMBLE_PARAMETER_ATTRIBUTION_DATA)))); + } + SynergyRequest createPostRequest = createPostRequest(trackingBaseSessionObject); + if (createPostRequest == null) { + return; + } + createPostRequest.httpRequest.runInBackground = z; + Log.Helper.LOGD(this, "Event queue marshalled. Incrementing repost count from %d to %d", Integer.valueOf(trackingBaseSessionObject.repostCount), Integer.valueOf(trackingBaseSessionObject.repostCount + 1)); + trackingBaseSessionObject.repostCount++; + this.m_isRequestInProgress = true; + final NimbleTrackingThreadManager acquireInstance = NimbleTrackingThreadManager.acquireInstance(); + try { + TrackingBaseSessionObject finalTrackingBaseSessionObject = trackingBaseSessionObject; + SynergyNetwork.getComponent().sendRequest(createPostRequest, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.tracking.NimbleTrackingS2SImpl.1 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(final SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + acquireInstance.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingS2SImpl.1.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingS2SImpl.this.onPostComplete(synergyNetworkConnectionHandle, finalTrackingBaseSessionObject); + } + }); + NimbleTrackingThreadManager.releaseInstance(); + } + }); + } catch (OutOfMemoryError unused) { + Activity currentActivity = ApplicationEnvironment.getCurrentActivity(); + 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]); + } else { + Log.Helper.LOGI(this, "Out of memory. Dropping current session", new Object[0]); + } + NimbleTrackingThreadManager.releaseInstance(); + double d = this.m_postInterval; + removeSessionAndFillQueue(trackingBaseSessionObject); + this.m_postRetryDelay = 1.0d; + this.m_isRequestInProgress = false; + if (this.m_sessionsToPost != null && !this.m_sessionsToPost.isEmpty()) { + Log.Helper.LOGI(this, "More items found in the queue. Post the next one now. Queue size: %d", Integer.valueOf(this.m_sessionsToPost.size())); + resetPostTimer(0.0d, false); + } else { + Log.Helper.LOGI(this, "No more items found in the queue. Wait on the timer. Queue size: %d", Integer.valueOf(this.m_sessionsToPost.size())); + resetPostTimer(d, true); + } + } + } + + /* JADX INFO: Access modifiers changed from: private */ + /* JADX WARN: Removed duplicated region for block: B:11:0x0078 */ + /* JADX WARN: Removed duplicated region for block: B:17:0x00ad */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public void onPostComplete(com.ea.nimble.SynergyNetworkConnectionHandle r8, com.ea.nimble.tracking.TrackingBaseSessionObject r9) { + /* + r7 = this; + com.ea.nimble.Log.Helper.LOGFUNC(r7) + r0 = 0 + if (r8 == 0) goto Le9 + com.ea.nimble.ISynergyResponse r1 = r8.getResponse() + if (r1 != 0) goto Le + goto Le9 + Le: + com.ea.nimble.ISynergyResponse r1 = r8.getResponse() + java.lang.Exception r1 = r1.getError() + r2 = 4607182418800017408(0x3ff0000000000000, double:1.0) + r4 = 1 + if (r1 != 0) goto L24 + r7.removeSessionAndFillQueue(r9) + r7.m_postRetryDelay = r2 + double r2 = r7.m_postInterval + L22: + r8 = 0 + goto L6d + L24: + com.ea.nimble.ISynergyResponse r1 = r8.getResponse() + com.ea.nimble.IHttpResponse r1 = r1.getHttpResponse() + if (r1 == 0) goto L57 + int r5 = r1.getStatusCode() + r6 = 400(0x190, float:5.6E-43) + if (r5 == r6) goto L3e + int r5 = r1.getStatusCode() + r6 = 415(0x19f, float:5.82E-43) + if (r5 != r6) goto L57 + L3e: + java.lang.String r8 = "Received HTTP status %d. Discarding post." + java.lang.Object[] r5 = new java.lang.Object[r4] + int r1 = r1.getStatusCode() + java.lang.Integer r1 = java.lang.Integer.valueOf(r1) + r5[r0] = r1 + com.ea.nimble.Log.Helper.LOGE(r7, r8, r5) + r7.removeSessionAndFillQueue(r9) + r7.m_postRetryDelay = r2 + double r2 = r7.m_postInterval + goto L22 + L57: + java.lang.String r9 = "Failed to send tracking events. Error: %s" + java.lang.Object[] r1 = new java.lang.Object[r4] + com.ea.nimble.ISynergyResponse r8 = r8.getResponse() + java.lang.Exception r8 = r8.getError() + java.lang.String r8 = r8.getLocalizedMessage() + r1[r0] = r8 + com.ea.nimble.Log.Helper.LOGE(r7, r9, r1) + r8 = 1 + L6d: + java.lang.String r9 = "Telemetry post request finished, resetting isRequestInProgress flag to false." + java.lang.Object[] r1 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGI(r7, r9, r1) + r7.m_isRequestInProgress = r0 + if (r8 == 0) goto Lad + double r8 = r7.m_postRetryDelay + double r1 = r7.m_postRetryDelay + r5 = 4611686018427387904(0x4000000000000000, double:2.0) + double r1 = r1 * r5 + r7.m_postRetryDelay = r1 + double r1 = r7.m_postRetryDelay + r5 = 4643985272004935680(0x4072c00000000000, double:300.0) + int r3 = (r1 > r5 ? 1 : (r1 == r5 ? 0 : -1)) + if (r3 <= 0) goto L8f + r7.m_postRetryDelay = r5 + L8f: + java.lang.String r1 = "Posting a retry with delay of %s due to failed send. Queue size: %d" + r2 = 2 + java.lang.Object[] r2 = new java.lang.Object[r2] + java.lang.Double r3 = java.lang.Double.valueOf(r8) + r2[r0] = r3 + java.util.ArrayList r3 = r7.m_sessionsToPost + int r3 = r3.size() + java.lang.Integer r3 = java.lang.Integer.valueOf(r3) + r2[r4] = r3 + com.ea.nimble.Log.Helper.LOGI(r7, r1, r2) + r7.resetPostTimer(r8, r0) + goto Le8 + Lad: + java.util.ArrayList r8 = r7.m_sessionsToPost + if (r8 == 0) goto Ld2 + java.util.ArrayList r8 = r7.m_sessionsToPost + boolean r8 = r8.isEmpty() + if (r8 != 0) goto Ld2 + java.lang.String r8 = "More items found in the queue. Post the next one now. Queue size: %d" + java.lang.Object[] r9 = new java.lang.Object[r4] + java.util.ArrayList r1 = r7.m_sessionsToPost + int r1 = r1.size() + java.lang.Integer r1 = java.lang.Integer.valueOf(r1) + r9[r0] = r1 + com.ea.nimble.Log.Helper.LOGI(r7, r8, r9) + r8 = 0 + r7.resetPostTimer(r8, r0) + goto Le8 + Ld2: + java.lang.String r8 = "No more items found in the queue. Wait on the timer. Queue size: %d" + java.lang.Object[] r9 = new java.lang.Object[r4] + java.util.ArrayList r1 = r7.m_sessionsToPost + int r1 = r1.size() + java.lang.Integer r1 = java.lang.Integer.valueOf(r1) + r9[r0] = r1 + com.ea.nimble.Log.Helper.LOGI(r7, r8, r9) + r7.resetPostTimer(r2, r4) + Le8: + return + Le9: + java.lang.String r8 = "No response exists in this post!" + java.lang.Object[] r9 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGE(r7, r8, r9) + return + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.tracking.NimbleTrackingS2SImpl.onPostComplete(com.ea.nimble.SynergyNetworkConnectionHandle, com.ea.nimble.tracking.TrackingBaseSessionObject):void"); + } + + protected SynergyRequest createPostRequest(TrackingBaseSessionObject trackingBaseSessionObject) { + Log.Helper.LOGFUNC(this); + HashMap hashMap = new HashMap(); + hashMap.put("apiVer", "1.0.0"); + String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_S2S); + if (serverUrlWithKey == null) { + Log.Helper.LOGI(this, "Tracking server URL from NimbleEnvironment is nil. Adding observer for environment update finish.", new Object[0]); + super.addObserverForSynergyEnvironmentUpdateFinished(); + return null; + } + HashMap hashMap2 = new HashMap(trackingBaseSessionObject.sessionData); + hashMap2.put("now_timestamp", Utility.getUTCDateStringFormat(new Date())); + hashMap2.put("adEvents", trackingBaseSessionObject.events); + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + if (!Utility.validStringObject(hashMap2.get("synergyId"))) { + String synergyId = SynergyIdManager.getComponent().getSynergyId(); + if (Utility.validString(synergyId)) { + Log.Helper.LOGV(this, "Creating post request. No synergyId in session info dictionary, inserting synergyId value %s now.", synergyId); + hashMap2.put("synergyId", synergyId); + } else { + Log.Helper.LOGV(this, "Creating post request. No synergyId in session info dictionary, still no synergyId available now.", new Object[0]); + } + } + if (!Utility.validStringObject(hashMap2.get(SynergyCatalog.MTX_INFO_KEY_SELLID))) { + String safeString = Utility.safeString(component.getSellId()); + if (!Utility.validString(safeString)) { + Log.Helper.LOGE(this, "Creating POST request. Missing sell id.", new Object[0]); + } else { + hashMap2.put(SynergyCatalog.MTX_INFO_KEY_SELLID, safeString); + } + } + if (!Utility.validStringObject(hashMap2.get("deviceId"))) { + String safeString2 = Utility.safeString(component.getEADeviceId()); + if (!Utility.validString(safeString2)) { + Log.Helper.LOGE(this, "Creating POST request. Missing device id.", new Object[0]); + } else { + hashMap2.put("deviceId", safeString2); + } + } + SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_POST_EVENTS, IHttpRequest.Method.POST, null); + synergyRequest.baseUrl = serverUrlWithKey; + synergyRequest.urlParameters = hashMap; + synergyRequest.jsonData = new JsonData(hashMap2); + return synergyRequest; + } + + private Map createEventRequestPostMap() { + String gameSpecifiedPlayerId; + Log.Helper.LOGFUNC(this); + IApplicationEnvironment component = ApplicationEnvironment.getComponent(); + ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); + ISynergyIdManager component3 = SynergyIdManager.getComponent(); + Date date = new Date(); + final HashMap hashMap = new HashMap(); + new NimbleTrackingThreadManager.BlockingRunner() { // from class: com.ea.nimble.tracking.NimbleTrackingS2SImpl.2 + @Override // com.ea.nimble.tracking.NimbleTrackingThreadManager.BlockingRunner + public void run() { + ApplicationEnvironment.getComponent().retrieveAdvertisingId(new IApplicationEnvironment.AdvertisingIdCalback() { // from class: com.ea.nimble.tracking.NimbleTrackingS2SImpl.2.1 + @Override // com.ea.nimble.IApplicationEnvironment.AdvertisingIdCalback + public void onCallback(String str, boolean z) { + hashMap.put("advertiserID", str); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, Boolean.valueOf(z)); + setDone(); + } + }); + } + }; + hashMap.put("bundleId", Utility.safeString(component.getApplicationBundleId())); + hashMap.put(SynergyCatalog.MTX_INFO_KEY_SELLID, Utility.safeString(component2.getSellId())); + hashMap.put("appName", Utility.safeString(component.getApplicationName())); + hashMap.put("appVersion", Utility.safeString(component.getApplicationVersion())); + hashMap.put("deviceId", Utility.safeString(component2.getEADeviceId())); + hashMap.put("deviceNativeId", Utility.safeString(Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id"))); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_NAME, "Android"); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_SYSTEM_VERSION, Build.VERSION.RELEASE); + hashMap.put("deviceType", Build.MODEL); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_BRAND, Build.BRAND); + PackageManager packageManager = component.getApplicationContext().getPackageManager(); + TelephonyManager telephonyManager = (TelephonyManager) component.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE); + hashMap.put("carrierName", Utility.safeString(telephonyManager.getNetworkOperatorName())); + try { + if (packageManager.checkPermission("android.permission.READ_PHONE_STATE", component.getApplicationContext().getPackageName()) == PackageManager.PERMISSION_GRANTED) { + //hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_IMEI, Utility.safeString(telephonyManager.getDeviceId())); + } + } catch (RuntimeException unused) { + Log.Helper.LOGW(this, "Can not check permissions; Package Manager has died", new Object[0]); + } + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, Utility.safeString(Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id"))); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_COUNTRY_CODE, Utility.safeString(Locale.getDefault().getCountry())); + hashMap.put("appLanguage", Utility.safeString(component.getShortApplicationLanguageCode())); + hashMap.put("localization", Utility.safeString(component.getApplicationLanguageCode())); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LANGUAGE, Utility.safeString(Locale.getDefault().getLanguage())); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Utility.safeString(Locale.getDefault().toString())); + hashMap.put("timezone", String.format(Locale.US, "%tZ", Calendar.getInstance())); + hashMap.put("gmtOffset", String.valueOf(TimeZone.getDefault().getOffset(date.getTime()) / 1000)); + hashMap.put("synergyId", Utility.safeString(component3.getSynergyId())); + hashMap.put("jflag", component.isDeviceRooted() ? "1" : "0"); + if (component != null && (gameSpecifiedPlayerId = component.getGameSpecifiedPlayerId()) != null && gameSpecifiedPlayerId.length() > 0) { + hashMap.put("gamePlayerId", gameSpecifiedPlayerId); + } + String configValueAsString = ""; + if (Utility.validString(configValueAsString)) { + hashMap.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) { + query.moveToFirst(); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_FB_ATTR_ID, query.getString(0)); + } + } catch (IllegalStateException e) { + e.printStackTrace(); + } catch (Exception e2) { + e2.printStackTrace(); + } + hashMap.put("originUser", this.m_loggedInToOrigin ? "Y" : "N"); + int size = this.m_customSessionData.size(); + if (size > 0) { + for (int i = 0; i < size; i++) { + hashMap.put(this.m_customSessionData.get(i).key, this.m_customSessionData.get(i).value); + } + } + if (this.m_currentSessionObject != null && this.m_currentSessionObject.events != null) { + hashMap.put("adEvents", new ArrayList(this.m_currentSessionObject.events)); + } + return hashMap; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected void packageCurrentSession() { + Log.Helper.LOGFUNC(this); + if (this.m_currentSessionObject.countOfEvents() > 0) { + this.m_currentSessionObject.sessionData = new HashMap(createEventRequestPostMap()); + if (((ArrayList) this.m_currentSessionObject.sessionData.get("adEvents")).isEmpty()) { + return; + } + queueCurrentEventsForPost(); + } + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected String getPersistenceIdentifier() { + Log.Helper.LOGFUNC(this); + return "S2S"; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected boolean canDropSession(List list) { + Log.Helper.LOGFUNC(this); + TrackingBaseSessionObject trackingBaseSessionObject = list.get(0); + if (trackingBaseSessionObject.events.size() == 0) { + Log.Helper.LOGE(this, "Trying to drop session with no events", new Object[0]); + return true; + } + Iterator> it = trackingBaseSessionObject.events.iterator(); + while (it.hasNext()) { + String str = it.next().get("eventType"); + if (str != null && str.equals(String.valueOf(101))) { + return false; + } + } + return true; + } + + private static boolean isS2SEvent(String str) { + Log.Helper.LOGFUNCS("NimbleTrackingS2SImpl"); + if (str == null) { + return false; + } + return str.startsWith(EVENT_PREFIX); + } + + private boolean sessionContainsAppInstallEvent(TrackingBaseSessionObject trackingBaseSessionObject) { + if (trackingBaseSessionObject == null || trackingBaseSessionObject.events == null) { + return false; + } + Iterator> it = trackingBaseSessionObject.events.iterator(); + while (it.hasNext()) { + if (it.next().get("eventType").equals("101")) { + return true; + } + } + return false; + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyComponent.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyComponent.java new file mode 100644 index 0000000..2f74645 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyComponent.java @@ -0,0 +1,16 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Base; + +/* loaded from: classes.dex */ +class NimbleTrackingSynergyComponent extends NimbleTrackingThreadProxy { + static final String COMPONENT_ID = "com.ea.nimble.trackingimpl.synergy"; + + static void initialize() { + Base.registerComponent(new NimbleTrackingSynergyComponent(), "com.ea.nimble.trackingimpl.synergy"); + } + + private NimbleTrackingSynergyComponent() { + super(new NimbleTrackingSynergyImpl()); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyImpl.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyImpl.java new file mode 100644 index 0000000..87a9276 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingSynergyImpl.java @@ -0,0 +1,1010 @@ +package com.ea.nimble.tracking; + +import android.app.Activity; +import android.app.ActivityManager; +import android.content.BroadcastReceiver; +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; +import com.ea.nimble.IHttpRequest; +import com.ea.nimble.INetwork; +import com.ea.nimble.IOperationalTelemetryDispatch; +import com.ea.nimble.ISynergyEnvironment; +import com.ea.nimble.ISynergyIdManager; +import com.ea.nimble.ISynergyRequest; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Network; +import com.ea.nimble.OperationalTelemetryDispatch; +import com.ea.nimble.SynergyEnvironment; +import com.ea.nimble.SynergyIdManager; +import com.ea.nimble.SynergyNetwork; +import com.ea.nimble.SynergyNetworkConnectionCallback; +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; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Random; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +class NimbleTrackingSynergyImpl extends NimbleTrackingImplBase implements LogSource { + private static final String EVENT_PREFIX = "SYNERGYTRACKING::"; + private static final int MAX_CUSTOM_EVENT_PARAMETERS = 20; + private int m_eventNumber; + private Map m_mainAuthenticator; + private Map m_pidMap; + private String m_sessionId; + private final BroadcastReceiver m_pidInfoUpdateReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.1 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, final Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.1.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.onPidInfoUpdate(intent); + } + }); + } + }; + private final BroadcastReceiver m_mainAuthenticatorUpdateReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.2 + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, final Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.2.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.onMainAuthenticatorUpdate(intent); + } + }); + } + }; + private SynergyIdChangedReceiver m_synergyIdChangedReceiver = new SynergyIdChangedReceiver(); + private List> m_pendingEvents = new ArrayList(); + + @Override // com.ea.nimble.Component + public String getComponentId() { + return IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "TrackingSynergy"; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected String getPersistenceIdentifier() { + return "Synergy"; + } + + protected class JsonData implements ISynergyRequest.IJsonData { + private ArrayList> data; + + public JsonData(ArrayList> arrayList) { + this.data = arrayList; + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public int size() { + return this.data.size(); + } + + @Override // com.ea.nimble.ISynergyRequest.IJsonData + public Object getData() { + return this.data; + } + } + + private class SynergyIdChangedReceiver extends BroadcastReceiver { + private SynergyIdChangedReceiver() { + } + + @Override // android.content.BroadcastReceiver + public void onReceive(Context context, final Intent intent) { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.SynergyIdChangedReceiver.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.onSynergyIdChanged(intent); + } + }); + } + } + + NimbleTrackingSynergyImpl() { + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected String getFeatureTag() { + Log.Helper.LOGFUNC(this); + return "SynergyTracker"; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.Component + protected void restore() { + Log.Helper.LOGFUNC(this); + super.restore(); + Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE, this.m_pidInfoUpdateReceiver); + Utility.registerReceiver(Global.NIMBLE_NOTIFICATION_IDENTITY_MAIN_AUTHENTICATOR_CHANGE, this.m_mainAuthenticatorUpdateReceiver); + wakeup(); + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.Component + protected void cleanup() { + Log.Helper.LOGFUNC(this); + sleep(); + super.cleanup(); + } + + private String generateSynergySessionId() { + Log.Helper.LOGFUNC(this); + String replace = Utility.getUTCDateStringFormat(new Date()).replace("_", ""); + StringBuilder sb = new StringBuilder(24); + sb.append(replace); + int length = 24 - sb.length(); + Random random = new Random(); + for (int i = 0; i < length; i++) { + sb.append(random.nextInt(10)); + } + return sb.toString(); + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.tracking.ITracking + public void setEnable(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + super.setEnable(z); + if (z) { + return; + } + this.m_sessionId = null; + } + + private void resetSession() { + Log.Helper.LOGFUNC(this); + this.m_sessionId = generateSynergySessionId(); + this.m_eventNumber = 1; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected List> convertEvent(Tracking.Event event) { + SynergyConstants fromInt; + Log.Helper.LOGFUNC(this); + SynergyConstants synergyConstants = SynergyConstants.EVT_UNDEFINED; + Integer num = -1; + HashMap hashMap = new HashMap(); + if (!Tracking.isNimbleStandardEvent(event.type) && !isSynergyEvent(event.type)) { + return null; + } + if (event.type.equals(Tracking.EVENT_APPSTART_NORMAL)) { + fromInt = SynergyConstants.EVT_APP_START_NORMALLY; + } else if (event.type.equals(Tracking.EVENT_APPSTART_AFTERINSTALL)) { + fromInt = SynergyConstants.EVT_APP_START_AFTERINSTALL; + } else if (event.type.equals(Tracking.EVENT_APPSTART_AFTERUPGRADE)) { + fromInt = SynergyConstants.EVT_APP_START_AFTERUPGRADE; + } else if (event.type.equals(Tracking.EVENT_APPSTART_FROMURL)) { + fromInt = SynergyConstants.EVT_APP_START_FROM_URL; + } else if (event.type.equals(Tracking.EVENT_APPSTART_FROMPUSH)) { + fromInt = SynergyConstants.EVT_APP_START_FROMPUSH; + addPushTNGTrackingParams(event, hashMap); + } else if (event.type.equals(Tracking.EVENT_SESSION_START)) { + fromInt = this.m_eventNumber > 0 ? SynergyConstants.EVT_APP_RESUME_NORMAL : SynergyConstants.EVT_APP_START_NORMALLY; + } else if (event.type.equals(Tracking.EVENT_APPRESUME_FROMURL)) { + fromInt = SynergyConstants.EVT_APP_RESUME_FROM_URL; + } else if (event.type.equals(Tracking.EVENT_APPRESUME_FROMEBISU)) { + fromInt = SynergyConstants.EVT_APP_RESUME_FROM_EBISU; + } else if (event.type.equals(Tracking.EVENT_APPRESUME_FROMPUSH)) { + fromInt = SynergyConstants.EVT_APP_RESUME_FROM_PUSH; + addPushTNGTrackingParams(event, hashMap); + } else if (event.type.equals(Tracking.EVENT_APPRESUME_NORMAL)) { + fromInt = SynergyConstants.EVT_APP_RESUME_NORMAL; + } else if (event.type.equals(Tracking.EVENT_SESSION_END)) { + fromInt = SynergyConstants.EVT_APP_SESSION_END; + } else if (event.type.equals(Tracking.EVENT_SESSION_TIME)) { + fromInt = SynergyConstants.EVT_APP_SESSION_TIME; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_DURATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_DURATION)); + } else if (event.type.equals(Tracking.EVENT_MTX_ITEM_BEGIN_PURCHASE)) { + fromInt = SynergyConstants.EVT_MTXVIEW_ITEMPURCHASE; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MTX_SELLID.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_MTX_SELLID)); + } else if (event.type.equals(Tracking.EVENT_MTX_ITEM_PURCHASED)) { + fromInt = SynergyConstants.EVT_MTXVIEW_ITEM_PURCHASED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MTX_SELLID.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_MTX_SELLID)); + } else if (event.type.equals(Tracking.EVENT_MTX_FREEITEM_DOWNLOADED)) { + fromInt = SynergyConstants.EVT_MTXVIEW_FREEITEM_DOWNLOADED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MTX_SELLID.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_MTX_SELLID)); + } else if (event.type.equals(Tracking.EVENT_USER_TRACKING_OPTOUT)) { + fromInt = SynergyConstants.EVT_USER_TRACKING_OPTOUT; + } else if (event.type.equals(Tracking.EVENT_PN_DISPLAY_OPT_IN)) { + fromInt = SynergyConstants.EVT_USER_SHOWN_PN_OPTIN_PROMPT; + } else if (event.type.equals(Tracking.EVENT_PN_USER_OPT_IN)) { + fromInt = SynergyConstants.EVT_USER_SHOWN_PN_OPTIN_PROMPT; + hashMap.put("eventKeyType02", event.parameters.get(Integer.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value))); + hashMap.put("eventValue02", "Yes"); + } else if (event.type.equals(Tracking.EVENT_PN_SHOWN_TO_USER)) { + fromInt = SynergyConstants.EVT_PN_SHOWN_TO_USER; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MESSAGEID.value)); + hashMap.put("eventValue01", event.parameters.get("NIMBLESTANDARD::KEY_PN_MESSAGE_ID")); + if (event.parameters.containsKey("NIMBLESTANDARD::KEY_PN_MESSAGE_ID")) { + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_PN_MESSAGE_TYPE)); + } + if (event.parameters.containsKey(Tracking.KEY_PN_DEVICE_ID)) { + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_PN_DEVICE_ID)); + } + } else if (event.type.equals(Tracking.EVENT_PN_RECEIVED)) { + fromInt = SynergyConstants.EVT_PN_RECEIVED; + addPushTNGTrackingParams(event, hashMap); + } else if (event.type.equals(Tracking.EVENT_PN_DEVICE_REGISTERED)) { + fromInt = SynergyConstants.EVT_PN_DEVICE_REGISTERED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_PN_DATE_OF_BIRTH)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_PN_DISABLED_FLAG)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_PN_DEVICE_ID)); + } else if (event.type.equals(Tracking.EVENT_PN_USER_CLICKED_OK)) { + fromInt = SynergyConstants.EVT_PN_SHOWN_TO_USER; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MESSAGEID.value)); + hashMap.put("eventValue01", event.parameters.get("NIMBLESTANDARD::KEY_PN_MESSAGE_ID")); + hashMap.put("eventKeyType02", event.parameters.get(Integer.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value))); + hashMap.put("eventValue02", "Ok"); + } else if (event.type.equals(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION)) { + fromInt = SynergyConstants.EVT_IDENTITY_MIGRATION; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_MIGRATION_GAME_TRIGGERED)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET)); + } else if (event.type.equals(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_LOGIN)) { + fromInt = SynergyConstants.EVT_IDENTITY_LOGIN; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGIN)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET)); + HashMap hashMap2 = new HashMap(); + for (Map.Entry entry : Utility.convertJSONObjectStringToMap(event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGIN)).entrySet()) { + hashMap2.put(entry.getKey(), entry.getValue().toString()); + } + for (Map.Entry entry2 : Utility.convertJSONObjectStringToMap(event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET)).entrySet()) { + hashMap2.put(entry2.getKey(), entry2.getValue().toString()); + } + this.m_pidMap = hashMap2; + this.m_currentSessionObject.sessionData.put("pidMap", this.m_pidMap); + } else if (event.type.equals(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_LOGOUT)) { + fromInt = SynergyConstants.EVT_IDENTITY_LOGOUT; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGOUT)); + HashMap hashMap3 = new HashMap(); + for (Map.Entry entry3 : Utility.convertJSONObjectStringToMap(event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGOUT)).entrySet()) { + hashMap3.put(entry3.getKey(), entry3.getValue().toString()); + } + this.m_pidMap = hashMap3; + this.m_currentSessionObject.sessionData.put("pidMap", this.m_pidMap); + } else if (event.type.equals(Tracking.NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION_STARTED)) { + fromInt = SynergyConstants.EVT_IDENTITY_MIGRATION_STARTED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_MIGRATION_GAME_TRIGGERED)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_JSON_MAP.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET)); + } else if (event.type.equals(Tracking.EVENT_TUTORIAL_COMPLETE)) { + fromInt = SynergyConstants.EVT_GAMEPLAY_PROGRESSION_TUTORIAL_COMPLETE; + } else if (event.type.equals(Tracking.EVENT_LEVEL_UP)) { + fromInt = SynergyConstants.EVT_GP_LEVEL_PROMOTION; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_DURATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_DURATION)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_DURATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_GAMEPLAY_DURATION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_USER_LEVEL)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_SOCIAL_GROUP_CREATED)) { + fromInt = SynergyConstants.EVT_ANTELOPE_SOCIAL_GROUP_CREATED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_SOCIAL_GROUP_DELETED)) { + fromInt = SynergyConstants.EVT_ANTELOPE_SOCIAL_GROUP_DELETED; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MEMBER_ADDED_TO_GROUP)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MEMBER_ADDED_TO_GROUP; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_MEMBER_ID)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MEMBER_REMOVED_FROM_GROUP)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MEMBER_REMOVED_FROM_GROUP; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_MEMBER_ID)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MEMBER_REQUEST_TO_GROUP)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MEMBER_REQUEST_TO_GROUP; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_INVITE_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType04", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue04", event.parameters.get(Tracking.KEY_ANTELOPE_MEMBER_ID)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MEMBER_DENIED_FROM_GROUP)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MEMBER_DENIED_FROM_GROUP; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_GROUP_ID)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_MEMBER_ID)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MESSAGE_SENT_TO_GROUP_CHAT)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MESSAGE_SENT_TO_GROUP_CHAT; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_MESSAGE_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_ID)); + hashMap.put("eventKeyType04", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue04", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_TYPE)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MESSAGE_SENT_TO_INBOX)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MESSAGE_SENT_TO_INBOX; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_MESSAGE_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_ID)); + hashMap.put("eventKeyType04", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue04", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_TYPE)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MESSAGE_SENT_TO_WORLD_CHAT)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MESSAGE_SENT_TO_WORLD_CHAT; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_MESSAGE_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_ID)); + hashMap.put("eventKeyType04", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue04", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_TYPE)); + } else if (event.type.equals(Tracking.EVENT_ANTELOPE_MESSAGE_SENT_TO_P2P_CHAT)) { + fromInt = SynergyConstants.EVT_ANTELOPE_MESSAGE_SENT_TO_P2P_CHAT; + hashMap.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue01", event.parameters.get(Tracking.KEY_ANTELOPE_MESSAGE_TYPE)); + hashMap.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue02", event.parameters.get(Tracking.KEY_ANTELOPE_PROGRESSION)); + hashMap.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue03", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_ID)); + hashMap.put("eventKeyType04", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + hashMap.put("eventValue04", event.parameters.get(Tracking.KEY_ANTELOPE_RECIPIENT_TYPE)); + } else { + if (!event.type.equals(TrackingSynergy.EVENT_CUSTOM)) { + return null; + } + String str = event.parameters.get("eventType"); + try { + int parseInt = Integer.parseInt(str); + fromInt = SynergyConstants.fromInt(parseInt); + if (fromInt == SynergyConstants.EVT_UNDEFINED) { + num = Integer.valueOf(parseInt); + } + parseCustomParameters(event.parameters, hashMap); + } catch (NumberFormatException unused) { + Log.Helper.LOGE(this, "Error: Invalid format for eventType parameter. Expected integer value, got " + str, new Object[0]); + return null; + } + } + for (String 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)); + if (str4 == null) { + str4 = ""; + } + hashMap.put(str2, str4); + } + } + String uTCDateStringFormat = Utility.getUTCDateStringFormat(event.timestamp); + ArrayList arrayList = new ArrayList(); + if (num.intValue() != -1) { + hashMap.put("eventType", String.valueOf(num)); + } else { + hashMap.put("eventType", String.valueOf(fromInt.value)); + } + hashMap.put("timestamp", uTCDateStringFormat); + if (fromInt.isSessionStartEventType()) { + if (this.m_currentSessionObject.countOfEvents() > 0) { + queueCurrentEventsForPost(); + } + resetSession(); + for (Map map : this.m_pendingEvents) { + map.put("session", this.m_sessionId); + map.put("step", String.valueOf(this.m_eventNumber)); + this.m_eventNumber++; + arrayList.add(map); + } + this.m_pendingEvents.clear(); + } else if (this.m_sessionId == null) { + this.m_pendingEvents.add(hashMap); + return null; + } + hashMap.put("session", this.m_sessionId); + hashMap.put("step", String.valueOf(this.m_eventNumber)); + this.m_eventNumber++; + if (fromInt.isSessionStartEventType()) { + Log.Helper.LOGD(this, "Logging session start event, %s. Posting event queue now.", fromInt); + resetPostTimer(0.0d); + } + if (fromInt == SynergyConstants.EVT_APP_SESSION_END) { + this.m_sessionId = null; + } + arrayList.add(hashMap); + return arrayList; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected void postPendingEvents(boolean z) { + Log.Helper.LOGFUNC(this); + if (isAbleToPostEvent(z)) { + if (this.m_sessionsToPost == null || this.m_sessionsToPost.size() <= 0) { + Log.Helper.LOGD(this, "No tracking sessions to post.", new Object[0]); + return; + } + SynergyRequest createPostRequest = createPostRequest(); + if (createPostRequest == null) { + return; + } + createPostRequest.httpRequest.runInBackground = z; + this.m_isRequestInProgress = true; + final NimbleTrackingThreadManager acquireInstance = NimbleTrackingThreadManager.acquireInstance(); + try { + SynergyNetwork.getComponent().sendRequest(createPostRequest, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.3 + @Override // com.ea.nimble.SynergyNetworkConnectionCallback + public void callback(final SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { + Log.Helper.LOGPUBLICFUNC(this); + acquireInstance.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.3.1 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyImpl.this.onPostComplete(synergyNetworkConnectionHandle); + } + }); + NimbleTrackingThreadManager.releaseInstance(); + } + }); + } catch (OutOfMemoryError unused) { + 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]); + } else { + Log.Helper.LOGI(this, "Out of memory. Dropping current session", new Object[0]); + } + NimbleTrackingThreadManager.releaseInstance(); + double d = this.m_postInterval; + this.m_postRetryDelay = 1.0d; + this.m_isRequestInProgress = false; + if (this.m_sessionsToPost != null && !this.m_sessionsToPost.isEmpty()) { + Log.Helper.LOGI(this, "More items found in the queue. Post the next one now. Queue size: %d", Integer.valueOf(this.m_sessionsToPost.size())); + resetPostTimer(0.0d, false); + } else { + Log.Helper.LOGI(this, "No more items found in the queue. Wait on the timer. Queue size: %d", Integer.valueOf(this.m_sessionsToPost.size())); + resetPostTimer(d, true); + } + } + } + } + + private void clearAndRefillSessionsToPost() { + Iterator it = ((ArrayList) this.m_sessionsToPost.clone()).iterator(); + while (it.hasNext()) { + removeSessionAndFillQueue((TrackingBaseSessionObject) it.next()); + } + } + + /* JADX INFO: Access modifiers changed from: private */ + /* JADX WARN: Removed duplicated region for block: B:11:0x0078 */ + /* JADX WARN: Removed duplicated region for block: B:17:0x00ad */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public void onPostComplete(com.ea.nimble.SynergyNetworkConnectionHandle r10) { + /* + r9 = this; + com.ea.nimble.Log.Helper.LOGFUNC(r9) + r0 = 0 + if (r10 == 0) goto Le9 + com.ea.nimble.ISynergyResponse r1 = r10.getResponse() + if (r1 != 0) goto Le + goto Le9 + Le: + com.ea.nimble.ISynergyResponse r1 = r10.getResponse() + java.lang.Exception r1 = r1.getError() + r2 = 4607182418800017408(0x3ff0000000000000, double:1.0) + r4 = 1 + if (r1 != 0) goto L24 + r9.clearAndRefillSessionsToPost() + r9.m_postRetryDelay = r2 + double r2 = r9.m_postInterval + L22: + r10 = 0 + goto L6d + L24: + com.ea.nimble.ISynergyResponse r1 = r10.getResponse() + com.ea.nimble.IHttpResponse r1 = r1.getHttpResponse() + if (r1 == 0) goto L57 + int r5 = r1.getStatusCode() + r6 = 400(0x190, float:5.6E-43) + if (r5 == r6) goto L3e + int r5 = r1.getStatusCode() + r6 = 415(0x19f, float:5.82E-43) + if (r5 != r6) goto L57 + L3e: + java.lang.String r10 = "Received HTTP status %d. Discarding post." + java.lang.Object[] r5 = new java.lang.Object[r4] + int r1 = r1.getStatusCode() + java.lang.Integer r1 = java.lang.Integer.valueOf(r1) + r5[r0] = r1 + com.ea.nimble.Log.Helper.LOGE(r9, r10, r5) + r9.clearAndRefillSessionsToPost() + r9.m_postRetryDelay = r2 + double r2 = r9.m_postInterval + goto L22 + L57: + java.lang.String r1 = "Failed to send tracking events. Error: %s" + java.lang.Object[] r5 = new java.lang.Object[r4] + com.ea.nimble.ISynergyResponse r10 = r10.getResponse() + java.lang.Exception r10 = r10.getError() + java.lang.String r10 = r10.getLocalizedMessage() + r5[r0] = r10 + com.ea.nimble.Log.Helper.LOGE(r9, r1, r5) + r10 = 1 + L6d: + java.lang.String r1 = "Telemetry post request finished, resetting isRequestInProgress flag to false." + java.lang.Object[] r5 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGI(r9, r1, r5) + r9.m_isRequestInProgress = r0 + if (r10 == 0) goto Lad + double r1 = r9.m_postRetryDelay + double r5 = r9.m_postRetryDelay + r7 = 4611686018427387904(0x4000000000000000, double:2.0) + double r5 = r5 * r7 + r9.m_postRetryDelay = r5 + double r5 = r9.m_postRetryDelay + r7 = 4643985272004935680(0x4072c00000000000, double:300.0) + int r10 = (r5 > r7 ? 1 : (r5 == r7 ? 0 : -1)) + if (r10 <= 0) goto L8f + r9.m_postRetryDelay = r7 + L8f: + java.lang.String r10 = "Posting a retry with delay of %s due to failed send. Queue size: %d" + r3 = 2 + java.lang.Object[] r3 = new java.lang.Object[r3] + java.lang.Double r5 = java.lang.Double.valueOf(r1) + r3[r0] = r5 + java.util.ArrayList r5 = r9.m_sessionsToPost + int r5 = r5.size() + java.lang.Integer r5 = java.lang.Integer.valueOf(r5) + r3[r4] = r5 + com.ea.nimble.Log.Helper.LOGI(r9, r10, r3) + r9.resetPostTimer(r1, r0) + goto Le8 + Lad: + java.util.ArrayList r10 = r9.m_sessionsToPost + if (r10 == 0) goto Ld2 + java.util.ArrayList r10 = r9.m_sessionsToPost + boolean r10 = r10.isEmpty() + if (r10 != 0) goto Ld2 + java.lang.String r10 = "More items found in the queue. Post the next one now. Queue size: %d" + java.lang.Object[] r1 = new java.lang.Object[r4] + java.util.ArrayList r2 = r9.m_sessionsToPost + int r2 = r2.size() + java.lang.Integer r2 = java.lang.Integer.valueOf(r2) + r1[r0] = r2 + com.ea.nimble.Log.Helper.LOGI(r9, r10, r1) + r1 = 0 + r9.resetPostTimer(r1, r0) + goto Le8 + Ld2: + java.lang.String r10 = "No more items found in the queue. Wait on the timer. Queue size: %d" + java.lang.Object[] r1 = new java.lang.Object[r4] + java.util.ArrayList r5 = r9.m_sessionsToPost + int r5 = r5.size() + java.lang.Integer r5 = java.lang.Integer.valueOf(r5) + r1[r0] = r5 + com.ea.nimble.Log.Helper.LOGI(r9, r10, r1) + r9.resetPostTimer(r2, r4) + Le8: + return + Le9: + java.lang.String r10 = "No response exists in this post!" + java.lang.Object[] r0 = new java.lang.Object[r0] + com.ea.nimble.Log.Helper.LOGE(r9, r10, r0) + return + */ + throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.onPostComplete(com.ea.nimble.SynergyNetworkConnectionHandle):void"); + } + + protected SynergyRequest createPostRequest() { + Log.Helper.LOGFUNC(this); + String serverUrlWithKey = SynergyEnvironment.getComponent().getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_TRACKING); + if (serverUrlWithKey == null) { + Log.Helper.LOGI(this, "Tracking server URL from NimbleEnvironment is nil. Adding observer for environment update finish.", new Object[0]); + addObserverForSynergyEnvironmentUpdateFinished(); + return null; + } + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + ArrayList arrayList = new ArrayList(); + Iterator it = this.m_sessionsToPost.iterator(); + while (it.hasNext()) { + TrackingBaseSessionObject next = it.next(); + if (next == null) { + removeSessionAndFillQueue(null); + } else { + HashMap hashMap = new HashMap(); + hashMap.putAll(next.sessionData); + hashMap.put("now_timestamp", Utility.getUTCDateStringFormat(new Date())); + ArrayList arrayList2 = new ArrayList(next.events); + for (int i = 0; i < arrayList2.size(); i++) { + ((Map) arrayList2.get(i)).put("repostCount", String.valueOf(next.repostCount)); + } + Log.Helper.LOGD(this, "Event queue marshalled. Incrementing repost count from %d to %d", Integer.valueOf(next.repostCount), Integer.valueOf(next.repostCount + 1)); + next.repostCount++; + hashMap.put("events", arrayList2); + if (!Utility.validStringObject(hashMap.get("uid"))) { + String synergyId = SynergyIdManager.getComponent().getSynergyId(); + if (Utility.validString(synergyId)) { + Log.Helper.LOGV(this, "Creating post request. No uid in session info dictionary, inserting uid value %s now.", synergyId); + hashMap.put("uid", synergyId); + } else { + Log.Helper.LOGV(this, "Creating post request. No uid in session info dictionary, still no uid available now.", new Object[0]); + } + } + if (!Utility.validStringObject(hashMap.get(SynergyCatalog.MTX_INFO_KEY_SELLID))) { + String safeString = Utility.safeString(component.getSellId()); + if (!Utility.validString(safeString)) { + Log.Helper.LOGE(this, "Creating POST request. Missing sell id.", new Object[0]); + } else { + hashMap.put(SynergyCatalog.MTX_INFO_KEY_SELLID, safeString); + } + } + if (!Utility.validStringObject(hashMap.get("hwId"))) { + String safeString2 = Utility.safeString(component.getEAHardwareId()); + if (!Utility.validString(safeString2)) { + Log.Helper.LOGE(this, "Creating POST request. Missing hw id.", new Object[0]); + } else { + hashMap.put("hwId", safeString2); + } + } + if (!Utility.validStringObject(hashMap.get("deviceId"))) { + String safeString3 = Utility.safeString(component.getEADeviceId()); + if (!Utility.validString(safeString3)) { + Log.Helper.LOGE(this, "Creating POST request. Missing device id.", new Object[0]); + } else { + hashMap.put("deviceId", safeString3); + } + } + arrayList.add(hashMap); + } + } + SynergyRequest synergyRequest = new SynergyRequest("/tracking/api/core/logEvent", IHttpRequest.Method.POST, null); + synergyRequest.baseUrl = serverUrlWithKey; + synergyRequest.jsonData = new JsonData(arrayList); + IOperationalTelemetryDispatch component2 = OperationalTelemetryDispatch.getComponent(); + if (component2 != null) { + JSONObject jSONObject = new JSONObject(); + String str = "BASEURL"; + try { + jSONObject.put("BASEURL", synergyRequest.baseUrl); + } catch (JSONException unused) { + } + try { + jSONObject.put("API", synergyRequest.api); + str = "POSTDATA"; + jSONObject.put("POSTDATA", new JSONArray((Collection) arrayList)); + } catch (JSONException unused2) { + str = "API"; + Log.Helper.LOGE(this, "Failed to add " + str + " to eventDict.", new Object[0]); + component2.logEvent(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS, jSONObject); + Utility.sendBroadcast(SynergyConstants.NIMBLE_NOTIFICATION_TRACKING_SYNERGY_POSTING_TO_SERVER); + return synergyRequest; + } + component2.logEvent(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS, jSONObject); + } + Utility.sendBroadcast(SynergyConstants.NIMBLE_NOTIFICATION_TRACKING_SYNERGY_POSTING_TO_SERVER); + return synergyRequest; + } + + private Map generateSessionInfoDictionary(String str) { + String gameSpecifiedPlayerId; + Log.Helper.LOGFUNC(this); + ISynergyEnvironment component = SynergyEnvironment.getComponent(); + ISynergyIdManager component2 = SynergyIdManager.getComponent(); + IApplicationEnvironment component3 = ApplicationEnvironment.getComponent(); + final HashMap hashMap = new HashMap(); + new NimbleTrackingThreadManager.BlockingRunner() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.4 + @Override // com.ea.nimble.tracking.NimbleTrackingThreadManager.BlockingRunner + public void run() { + ApplicationEnvironment.getComponent().retrieveAdvertisingId(new IApplicationEnvironment.AdvertisingIdCalback() { // from class: com.ea.nimble.tracking.NimbleTrackingSynergyImpl.4.1 + @Override // com.ea.nimble.IApplicationEnvironment.AdvertisingIdCalback + public void onCallback(String str2, boolean z) { + hashMap.put("advertiserID", str2); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_LIMIT_AD_TRACKING, Boolean.valueOf(z)); + setDone(); + } + }); + } + }; + String sellId = component.getSellId(); + String eAHardwareId = component.getEAHardwareId(); + String eADeviceId = component.getEADeviceId(); + String str2 = Build.VERSION.RELEASE; + String carrier = ApplicationEnvironment.getComponent().getCarrier(); + String applicationVersion = ApplicationEnvironment.getComponent().getApplicationVersion(); + try { + hashMap.put("timezone", String.format(Locale.US, "%tZ", Calendar.getInstance())); + } catch (Exception e) { + Log.Helper.LOGW(this, "Failed to get timezone abbreviation with error: " + e.getMessage(), new Object[0]); + } + hashMap.put("carrier", carrier); + hashMap.put("pflag", component3.isAppCracked() ? "1" : "0"); + hashMap.put("jflag", component3.isDeviceRooted() ? "1" : "0"); + hashMap.put("firmwareVer", str2); + hashMap.put(SynergyCatalog.MTX_INFO_KEY_SELLID, Utility.safeString(sellId)); + hashMap.put("buildId", Utility.safeString(applicationVersion)); + hashMap.put("sdkVer", Global.NIMBLE_RELEASE_VERSION); + hashMap.put("sdkCfg", "DL"); + hashMap.put("deviceId", Utility.safeString(eADeviceId)); + hashMap.put("hwId", Utility.safeString(eAHardwareId)); + hashMap.put("schemaVer", "2"); + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_PLATFORM, "android"); + String str3 = "N"; + INetwork component4 = Network.getComponent(); + if (component4.getStatus() == Network.Status.OK) { + str3 = component4.isNetworkWifi() ? "W" : "G"; + } + hashMap.put("networkAccess", str3); + hashMap.put("originUser", this.m_loggedInToOrigin ? "Y" : "N"); + String synergyId = Utility.validString(str) ? str : component2.getSynergyId(); + if (synergyId != null) { + hashMap.put("uid", Utility.safeString(synergyId)); + } + hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_ANDROID_ID, Utility.safeString(Settings.Secure.getString(component3.getApplicationContext().getContentResolver(), "android_id"))); + hashMap.put("aut", Utility.safeString("")); + if (this.m_pidMap != null && this.m_pidMap.size() > 0) { + hashMap.put("pidMap", this.m_pidMap); + } + if (component3 != null && (gameSpecifiedPlayerId = component3.getGameSpecifiedPlayerId()) != null && gameSpecifiedPlayerId.length() > 0) { + hashMap.put("gamePlayerId", gameSpecifiedPlayerId); + } + int size = this.m_customSessionData.size(); + if (size > 0) { + for (int i = 0; i < size; i++) { + hashMap.put(this.m_customSessionData.get(i).key, this.m_customSessionData.get(i).value); + } + } + return hashMap; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected void packageCurrentSession() { + Log.Helper.LOGFUNC(this); + if (this.m_currentSessionObject.countOfEvents() > 0) { + Log.Helper.LOGV(this, "Preparing for post, generating session info dictionary.", new Object[0]); + this.m_currentSessionObject.sessionData = new HashMap(generateSessionInfoDictionary(null)); + queueCurrentEventsForPost(); + } + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected boolean isSameSession(TrackingBaseSessionObject trackingBaseSessionObject, TrackingBaseSessionObject trackingBaseSessionObject2) { + Log.Helper.LOGFUNC(this); + if (trackingBaseSessionObject.events.size() == 0 || trackingBaseSessionObject2.events.size() == 0) { + Log.Helper.LOGE(this, "Trying to compare session with no events", new Object[0]); + return true; + } + String str = trackingBaseSessionObject.events.get(0).get("session"); + String str2 = trackingBaseSessionObject2.events.get(0).get("session"); + if (str == null || str2 == null) { + Log.Helper.LOGE(this, "Trying to compare event with no session", new Object[0]); + return true; + } + return str.equals(str2); + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase + protected boolean canDropSession(List list) { + Log.Helper.LOGFUNC(this); + TrackingBaseSessionObject trackingBaseSessionObject = list.get(0); + if (trackingBaseSessionObject.events.size() == 0) { + Log.Helper.LOGE(this, "Trying to drop session with no events", new Object[0]); + return true; + } + Iterator> it = trackingBaseSessionObject.events.iterator(); + while (it.hasNext()) { + String str = it.next().get("eventType"); + if (str != null && str.equals(String.valueOf(SynergyConstants.EVT_APP_START_AFTERINSTALL.value))) { + return false; + } + } + return true; + } + + private void wakeup() { + Log.Helper.LOGFUNC(this); + Utility.registerReceiver(SynergyIdManager.NOTIFICATION_SYNERGY_ID_CHANGED, this.m_synergyIdChangedReceiver); + } + + private void sleep() { + Log.Helper.LOGFUNC(this); + Utility.unregisterReceiver(this.m_synergyIdChangedReceiver); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onSynergyIdChanged(Intent intent) { + Log.Helper.LOGFUNC(this); + String stringExtra = intent.getStringExtra("previousSynergyId"); + String stringExtra2 = intent.getStringExtra("currentSynergyId"); + HashMap hashMap = new HashMap(); + hashMap.put("eventType", String.valueOf(SynergyConstants.EVT_SESSION_END_SYNERGYID_CHANGE.value)); + hashMap.put("keyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_SYNERGYID.value)); + hashMap.put("keyValue01", Utility.safeString(stringExtra)); + hashMap.put("keyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_SYNERGYID.value)); + hashMap.put("keyValue02", Utility.safeString(stringExtra2)); + logEvent(TrackingSynergy.EVENT_CUSTOM, hashMap); + this.m_currentSessionObject.sessionData = new HashMap(generateSessionInfoDictionary(stringExtra)); + queueCurrentEventsForPost(); + hashMap.put("eventType", String.valueOf(SynergyConstants.EVT_NEW_SESSION_START_SYNERGYID_CHANGE.value)); + logEvent(TrackingSynergy.EVENT_CUSTOM, hashMap); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onPidInfoUpdate(Intent intent) { + Log.Helper.LOGFUNC(this); + HashMap hashMap = (HashMap) intent.getSerializableExtra(Global.NIMBLE_IDENTITY_DICTIONARY_KEY_PIDMAP_ID); + if (hashMap == null || hashMap.size() <= 0) { + return; + } + this.m_pidMap = hashMap; + this.m_currentSessionObject.sessionData.put("pidMap", this.m_pidMap); + } + + /* JADX INFO: Access modifiers changed from: private */ + public void onMainAuthenticatorUpdate(Intent intent) { + Log.Helper.LOGFUNC(this); + HashMap hashMap = (HashMap) intent.getSerializableExtra(Tracking.NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE); + if (hashMap == null || hashMap.size() <= 0) { + return; + } + this.m_mainAuthenticator = hashMap; + } + + @Override // com.ea.nimble.tracking.NimbleTrackingImplBase, com.ea.nimble.tracking.ITracking + public String getSessionId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_sessionId; + } + + private static boolean isSynergyEvent(String str) { + Log.Helper.LOGFUNCS("NimbleTrackingSynergyImpl"); + if (str == null) { + return false; + } + return str.startsWith(EVENT_PREFIX); + } + + private void parseCustomParameters(Map map, Map map2) { + Log.Helper.LOGFUNC(this); + ArrayList arrayList = new ArrayList(20); + ArrayList arrayList2 = new ArrayList(20); + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + if (key.startsWith("keyType")) { + try { + int parseInt = Integer.parseInt(key.substring("keyType".length())); + if (parseInt > 0 && parseInt <= 20) { + int i = parseInt - 1; + if (i < arrayList.size()) { + arrayList.set(i, entry.getValue()); + } else { + for (int size = arrayList.size(); size < i; size++) { + arrayList.add(null); + } + arrayList.add(entry.getValue()); + } + } else { + Log.Helper.LOGE(this, "Error: Custom parameter number %d is out of range of 1-%d", Integer.valueOf(parseInt), 20); + } + } catch (NumberFormatException unused) { + Log.Helper.LOGE(this, "Error: Invalid format for keyType parameter. Expected keyType##, got " + key, new Object[0]); + } + } else if (key.startsWith("keyValue")) { + try { + int parseInt2 = Integer.parseInt(key.substring("keyValue".length())); + if (parseInt2 > 0 && parseInt2 <= 20) { + int i2 = parseInt2 - 1; + if (i2 < arrayList2.size()) { + arrayList2.set(i2, entry.getValue()); + } else { + for (int size2 = arrayList2.size(); size2 < i2; size2++) { + arrayList2.add(null); + } + arrayList2.add(entry.getValue()); + } + } else { + Log.Helper.LOGE(this, "Error: Custom parameter number %d is out of range of 1-%d", Integer.valueOf(parseInt2), 20); + } + } catch (NumberFormatException unused2) { + Log.Helper.LOGE(this, "Error: Invalid format for keyValue parameter. Expected keyValue##, got " + key, new Object[0]); + } + } + } + int max = Math.max(arrayList.size(), arrayList2.size()); + int i3 = 0; + while (i3 < max) { + String str = i3 < arrayList.size() ? (String) arrayList.get(i3) : null; + if (str == null) { + str = "0"; + Log.Helper.LOGE(this, "Error: No corresponding keyType entry for parameter number %d", Integer.valueOf(i3 + 1)); + } + String str2 = i3 < arrayList2.size() ? (String) arrayList2.get(i3) : null; + if (str2 == null) { + str2 = ""; + Log.Helper.LOGE(this, "Error: No corresponding keyValue entry for parameter number %d", Integer.valueOf(i3 + 1)); + } + i3++; + map2.put(String.format(Locale.US, "eventKeyType%02d", Integer.valueOf(i3)), str); + map2.put(String.format(Locale.US, "eventValue%02d", Integer.valueOf(i3)), str2); + } + } + + private void addPushTNGTrackingParams(Tracking.Event event, Map map) { + Log.Helper.LOGFUNC(this); + map.put("eventKeyType01", String.valueOf(SynergyConstants.EVT_KEYTYPE_MESSAGEID.value)); + map.put("eventValue01", event.parameters.get("NIMBLESTANDARD::KEY_PN_MESSAGE_ID")); + map.put("eventKeyType02", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + map.put("eventValue02", event.parameters.get(Tracking.KEY_PN_MESSAGE_TYPE)); + map.put("eventKeyType03", String.valueOf(SynergyConstants.EVT_KEYTYPE_ENUMERATION.value)); + map.put("eventValue03", event.parameters.get(Tracking.KEY_PN_DEVICE_ID)); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadManager.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadManager.java new file mode 100644 index 0000000..df82d89 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadManager.java @@ -0,0 +1,126 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Log; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/* loaded from: classes.dex */ +class NimbleTrackingThreadManager { + private static NimbleTrackingThreadManager s_instance; + private static int s_instanceRefs; + private ScheduledExecutorService m_executor = new ScheduledThreadPoolExecutor(1) { // from class: com.ea.nimble.tracking.NimbleTrackingThreadManager.1 + @Override // java.util.concurrent.ThreadPoolExecutor + protected void afterExecute(Runnable runnable, Throwable th) { + Log.Helper.LOGFUNC(this); + super.afterExecute(runnable, th); + if (th == null && (runnable instanceof Future)) { + Future future = (Future) runnable; + if (!future.isCancelled()) { + try { + future.get(); + } catch (InterruptedException unused) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + th = e.getCause(); + } + } + } + if (th != null) { + if (th instanceof Error) { + throw ((Error) th); + } + if (th instanceof RuntimeException) { + throw ((RuntimeException) th); + } + Log.Helper.LOGES("TrackingThreadManager", "Checked exception thrown from Tracking thread:", new Object[0]); + th.printStackTrace(); + } + } + }; + + public static abstract class BlockingRunner { + private boolean m_done = false; + + public abstract void run(); + + public BlockingRunner() { + Log.Helper.LOGPUBLICFUNC(this); + run(); + waitUntilDone(); + } + + protected void setDone() { + Log.Helper.LOGFUNC(this); + synchronized (this) { + this.m_done = true; + notifyAll(); + } + } + + private void waitUntilDone() { + Log.Helper.LOGFUNC(this); + if (this.m_done) { + return; + } + synchronized (this) { + while (!this.m_done) { + try { + wait(); + } catch (InterruptedException unused) { + } + } + } + } + } + + static NimbleTrackingThreadManager acquireInstance() { + if (s_instance == null) { + s_instance = new NimbleTrackingThreadManager(); + } + s_instanceRefs++; + return s_instance; + } + + static void releaseInstance() { + s_instanceRefs--; + if (s_instanceRefs == 0) { + s_instance.shutdown(); + s_instance = null; + } + } + + NimbleTrackingThreadManager() { + } + + ScheduledFuture createTimer(double d, Runnable runnable) { + return this.m_executor.schedule(runnable, (long) (d * 1000.0d), TimeUnit.MILLISECONDS); + } + + void runInWorkerThread(Runnable runnable) { + runInWorkerThread(false, runnable); + } + + void runInWorkerThread(boolean z, Runnable runnable) { + if (z) { + try { + this.m_executor.submit(runnable).get(); + return; + } catch (InterruptedException unused) { + Thread.currentThread().interrupt(); + return; + } catch (ExecutionException unused2) { + return; + } + } + this.m_executor.execute(runnable); + } + + private void shutdown() { + Log.Helper.LOGFUNC(this); + this.m_executor.shutdown(); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadProxy.java b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadProxy.java new file mode 100644 index 0000000..30ae8ec --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/NimbleTrackingThreadProxy.java @@ -0,0 +1,190 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Component; +import com.ea.nimble.Log; +import java.util.Map; + +/* loaded from: classes.dex */ +public abstract class NimbleTrackingThreadProxy extends Component implements ITracking { + private NimbleTrackingImplBase m_impl; + private NimbleTrackingThreadManager m_threadManager; + + protected NimbleTrackingThreadProxy(NimbleTrackingImplBase nimbleTrackingImplBase) { + Log.Helper.LOGFUNC(this); + this.m_impl = nimbleTrackingImplBase; + } + + @Override // com.ea.nimble.Component + protected void setup() { + Log.Helper.LOGFUNC(this); + this.m_threadManager = NimbleTrackingThreadManager.acquireInstance(); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.1 + @Override // java.lang.Runnable + public void run() { + NimbleTrackingThreadProxy.this.m_impl.setup(); + } + }); + } + + @Override // com.ea.nimble.Component + protected void restore() { + Log.Helper.LOGFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.2 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.restore(); + } + }); + } + + @Override // com.ea.nimble.Component + protected void suspend() { + Log.Helper.LOGFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.3 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.suspend(); + } + }); + } + + @Override // com.ea.nimble.Component + protected void resume() { + Log.Helper.LOGFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.4 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.resume(); + } + }); + } + + @Override // com.ea.nimble.Component + protected void cleanup() { + Log.Helper.LOGFUNC(this); + this.m_threadManager.runInWorkerThread(true, new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.5 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.cleanup(); + } + }); + } + + @Override // com.ea.nimble.Component + protected void teardown() { + Log.Helper.LOGFUNC(this); + this.m_threadManager.runInWorkerThread(true, new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.6 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.teardown(); + } + }); + NimbleTrackingThreadManager.releaseInstance(); + this.m_threadManager = null; + } + + @Override // com.ea.nimble.tracking.ITracking + public void setEnable(final boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(true, new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.7 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.setEnable(z); + } + }); + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getEnable() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_impl.getEnable(); + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getPostEnable() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_impl.getPostEnable(); + } + + @Override // com.ea.nimble.tracking.ITracking + public void setPostEnable(final boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(true, new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.8 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.setPostEnable(z); + } + }); + } + + @Override // com.ea.nimble.tracking.ITracking + public void logEvent(final String str, final Map map) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.9 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.logEvent(str, map); + } + }); + } + + @Override // com.ea.nimble.tracking.ITracking + public void addCustomSessionData(final String str, final String str2) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.10 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.addCustomSessionData(str, str2); + } + }); + } + + @Override // com.ea.nimble.tracking.ITracking + public void removeCustomSessionData(final String str) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.11 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.removeCustomSessionData(str); + } + }); + } + + @Override // com.ea.nimble.tracking.ITracking + public void clearCustomSessionData() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.tracking.ITracking + public String getSessionId() { + Log.Helper.LOGPUBLICFUNC(this); + return this.m_impl.getSessionId(); + } + + @Override // com.ea.nimble.tracking.ITracking + public void setTrackingAttribute(final String str, final String str2) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_threadManager.runInWorkerThread(new Runnable() { // from class: com.ea.nimble.tracking.NimbleTrackingThreadProxy.12 + @Override // java.lang.Runnable + public void run() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingThreadProxy.this.m_impl.setTrackingAttribute(str, str2); + } + }); + } + + @Override // com.ea.nimble.Component + public String getComponentId() { + return this.m_impl.getComponentId(); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/SynergyConstants.java b/app/src/main/java/com/ea/nimble/tracking/SynergyConstants.java new file mode 100644 index 0000000..b1847fd --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/SynergyConstants.java @@ -0,0 +1,268 @@ +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_RESUME_FROM_PUSH(10007), + EVT_APP_START_FROM_URL(10009), + EVT_APP_RESUME_FROM_URL(10010), + EVT_NEW_SESSION_START_SYNERGYID_CHANGE(10012), + EVT_IDENTITY_MIGRATION(12000), + EVT_IDENTITY_LOGIN(12001), + EVT_IDENTITY_LOGOUT(12002), + EVT_IDENTITY_MIGRATION_STARTED(12003), + EVT_APP_END_NORMALLY(20000), + EVT_APP_END_ABNORMALLY(20001), + EVT_APP_INTERRUPTED(20002), + EVT_APP_SESSION_END(20003), + EVT_APP_RESUME_FROM_EBISU(20004), + EVT_APP_SESSION_START_EMBED(20005), + EVT_EMBED_OTD_UPGRADE(20006), + EVT_SESSION_END_SYNERGYID_CHANGE(20007), + EVT_USER_SHOWN_PN_OPTIN_PROMPT(20008), + EVT_PN_SHOWN_TO_USER(20009), + EVT_PN_RECEIVED(20015), + EVT_PN_DEVICE_REGISTERED(20016), + EVT_OPT_FULL_PURCHASE(30000), + EVT_MOREGAMES_ENTER(30001), + EVT_MOREGAMES_CLICKTHROUGH(30002), + EVT_MOREGAMES_GAMESELECT(30004), + EVT_MOREGAMES_CATEGORYSELECT(30005), + EVT_MOREGAMES_OVERLAY_APPEARS(30006), + EVT_MOREGAMES_OVERLAY_BUYCLICK(30007), + EVT_ENTER_FULL_GAME_OVERVIEW_SCREEN(30008), + EVT_LITE_ED_GAME_DEMO_START(30009), + EVT_LITE_ED_GAME_DEMO_END(30010), + EVT_MAINMENU_BANNER_CLICK(30011), + EVT_MAINMENU_TICKER_CLICK(30012), + EVT_INSTORE_BANNER_CLICK(30013), + EVT_INSTORE_TICKER_CLICK(30014), + EVT_FEATURED_BANNER_CLICK(30015), + EVT_MOREGAMES_CLICKTHROUGH_FEATURED(30017), + EVT_MOREGAMES_CLICKTHROUGH_SIDEBANNER(30018), + EVT_IPAD_UPSELL_MESSAGE_DISPLAYED(30019), + EVT_IPAD_UPSELL_MESSAGE_NOTHANKS_CLICKED(30020), + EVT_IPAD_UPSELL_MESSAGE_OK_CLICKED(30021), + EVT_IPAD_UPSELL_MESSAGE_LATER_CLICKED(30022), + EVT_UPSELL_VIDEO_CLICKED(30023), + EVT_USER_TRACKING_OPTOUT(30024), + EVT_GAMEPLAY_PROGRESSION_SPGAME_START(30025), + EVT_GAMEPLAY_PROGRESSION_SPGAME_RESTART(30026), + EVT_GAMEPLAY_PROGRESSION_SPGAME_SAVE(30027), + EVT_GAMEPLAY_PROGRESSION_SPGAME_CONTINUE(30028), + EVT_GAMEPLAY_PROGRESSION_SPGAME_QUIT(30029), + EVT_GAMEPLAY_PROGRESSION_SPGAME_COMPLETE(30030), + EVT_GAMEPLAY_PROGRESSION_SPGAME_TIME_SPENT(30031), + EVT_GAMEPLAY_PROGRESSION_SPGAME_SCORE(30032), + EVT_GAMEPLAY_PROGRESSION_TUTORIAL_SKIP(30033), + EVT_GAMEPLAY_PROGRESSION_TUTORIAL_COMPLETE(30034), + EVT_GAMEPLAY_PROGRESSION_CUTSCENE_SKIP(30035), + EVT_GAMEPLAY_PROGRESSION_CONTROLSCHEME_USED(30036), + EVT_GAMEPLAY_PROGRESSION_CHARACTER(30037), + EVT_GAMEPLAY_PROGRESSION_MPGAME_START(30038), + EVT_GAMEPLAY_PROGRESSION_MPGAME_QUIT(30039), + EVT_GAMEPLAY_PROGRESSION_MPGAME_DISCONNECT(30040), + EVT_GAMEPLAY_PROGRESSION_MPGAME_COMPLETE(30041), + EVT_GAMEPLAY_PROGRESSION_MPGAME_TIME_SPENT(30042), + EVT_MULTITASKING_USER_APP_MINIMIZED(30043), + EVT_MULTITASKING_USER_APP_RESUMED(30044), + EVT_MULTITASKING_USER_START_TUTORIAL(30045), + EVT_MTXVIEW_ENTER(40000), + EVT_MTXVIEW_GAMECATEGORY(40001), + EVT_MTXVIEW_ITEMSELECT(40002), + EVT_MTXVIEW_ITEMPURCHASE(40003), + EVT_MTXVIEW_ENTER_FROMCTX(40004), + EVT_MTXVIEW_FREEITEM_DOWNLOADED(40005), + EVT_MTXVIEW_ITEM_PURCHASED(40006), + EVT_IAC_MTX_ITEM_USED(40007), + EVT_MTXVIEW_ITEM_PURCHASED_REFERRERDATA(40008), + EVT_MTXVIEW_ITEMPURCHASE_SLOTDATA(40009), + EVT_MTXVIEW_ITEDISPLAYED(40010), + EVT_IGE_FREE_CREDITS_EARNED(40011), + EVT_IGE_PAID_CREDITS_EARNED(40012), + EVT_IGE_GIFT_RECEIVED(40013), + EVT_IGE_GIFT_SENT(40014), + EVT_IGE_FREE_CREDITS_ITEMS_CLICK(40015), + EVT_IGE_PAID_CREDITS_ITEMS_CLICK(40016), + EVT_IGE_STORE_VISIT(40017), + EVT_IGE_PAID_CREDITS_PURCHASE_REVENUE(40018), + EVT_IGE_PAID_CREDITS_PURCHASE_LEVEL(40019), + EVT_IGE_FREE_CREDITS_PURCHASE_REVENUE(40020), + EVT_IGE_FREE_CREDITS_PURCHASE_LEVEL(40021), + EVT_IGE_GAME_START_CASH_DETAIL(40022), + EVT_OFFERWALL_ITEM_REDEEMED_STORE_EAL(40023), + EVT_OFFERWALL_ITEM_REDEEMED_USER_LEVEL_EAL(40024), + EVT_OFFERWALL_ITEM_CLICK_EAL(40025), + EVT_OFFERWALL_STORE_VISIT_EAL(40026), + EVT_INGAME_AD_CLICK(40027), + EVT_INGAME_LEVEL_FREE_CREDITS_COUNT(40028), + EVT_INGAME_LEVEL_PAID_CREDITS_COUNT(40029), + EVT_USER_LEVEL_MTX_ITEM_PURCHASED(40030), + EVT_IGE_GAME_START_FREE_CREDIT(40031), + EVT_IGE_GAME_START_PAID_CREDIT(40032), + EVT_INGAME_EMAIL_OPEN(50001), + EVT_INGAME_EMAIL_SEND(50002), + EVT_INGAME_EMAIL_RECEIEVE(50003), + EVT_MEDIAPICKER_OPEN(50004), + EVT_ACCESS_BT_MENU(50005), + EVT_BEGIN_BT_SESSION(50006), + EVT_COMPLETE_BT_SESSION(50007), + EVT_ACCESS_WIFI_MENU(50008), + EVT_BEGIN_WIFI_SESSION(50009), + EVT_COMPLETE_WIFI_SESSION(50010), + EVT_USR_ISSUE_PUSH_NOTIFICATION_CHALLENGE(50011), + EVT_LANGUAGE_SELECTED(50012), + EVT_MENU_PROGRESSION_MAINMENU_SELECTED(50013), + EVT_MENU_PROGRESSION_MAINMENU_SUBMENU_SELECTED(50014), + EVT_MENU_PROGRESSION_GAMEMENU_SELECTED(50015), + EVT_MENU_PROGRESSION_GAMEMENU_SUBMENU_SELECTED(50016), + EVT_DEVICE_ORIENTATION_CHANGED(50017), + EVT_ERROR_BLUETOOTH_WIFI_BOTH_ACTIVE(50018), + EVT_ACCESS_INGAME_SCREEN(60001), + EVT_LEAVE_INGAME_SCREEN(60002), + EVT_USER_GAMEPLAY_FUNNEL_EAL(60003), + EVT_USER_TUTORIAL_FUNNEL_EAL(60004), + EVT_USER_TRANSACTION_FUNNEL(60005), + EVT_USER_MESSAGING_FUNNEL(60006), + EVT_USER_SIGNUP_FUNNEL(60007), + EVT_USER_GAME_LOAD_FUNNEL(60008), + EVT_USER_GAME_DOWNLOAD_FUNNEL(60009), + EVT_EVENTS_PURGED(70000), + EVT_GP_LEVEL_PROMOTION(70005), + EVT_GP_LEVEL_PROMOTION_GAMEPLAY_TIME_TOTAL_EAL(70006), + EVT_GP_ACHIEVEMENTS_CHECKPOINTS_EAL(70007), + EVT_GP_XPGAIN_EVENT_EAL(70008), + EVT_GP_EVENT_USER_EAL(70009), + EVT_GP_APP_START_USER_LEVEL_EAL(70010), + EVT_EBISU_EMAIL_PROMPT(80032), + EVT_EBISU_PROMPT_INPUT(80033), + EVT_EBISU_REGISTRATION_FUNNEL(80034), + EVT_EBISU_OPTIONAL_REGISTRATION_FIELDS(80035), + EVT_EBISU_REGISTRATION_ERROR(80036), + EVT_EBISU_SIGNIN_FUNNEL(80037), + EVT_EBISU_SIGNIN_ERROR(80038), + EVT_EBISU_USER_SIGNIN(80039), + EVT_EBISU_USER_FRIENDS_COUNT(80040), + EVT_EBISU_ENTER_EBISUUI(80041), + EVT_EBISU_FRIENDS_VISIT(80042), + EVT_EBISU_FRIEND_SEARCH(80043), + EVT_EBISU_FRIEND_INVITE_SENT(80044), + EVT_EBISU_FRIEND_INVITE_ACCPTED(80045), + EVT_EBISU_NEWSFEED_VISIT(80046), + EVT_EBISU_NEWSFEED_TILE_BUTTON_CLICK(80047), + EVT_EBISU_NEWSFEED_BANNER_CLICK(80048), + EVT_EBISU_NEWSFEED_UPDATES(80049), + EVT_EBISU_PROFILE_VISIT(80050), + EVT_EBISU_LOGO_YES_CLICK(80051), + EVT_EBISU_LOGO_NO_CLICK(80052), + EVT_EBISU_RECOVER_PASSWORD_FUNNEL(80053), + EVT_EBISU_USER_SIGNOUT(80054), + EVT_EBISU_LOAD_FAIL(80055), + EVT_EBISU_FRIEND_PROFILE_BANNER_CLICK(80056), + EVT_EBISU_FRIEND_PROFILE_GAME_ICON_CLICK(80057), + EVT_EBISU_FRIEND_INVITE_REJECTED(80058), + EVT_EBISU_PROFILE_BANNER_CLICK(80059), + EVT_EBISU_PROFILE_GAME_ICON_CLICK(80060), + EVT_ANTELOPE_SOCIAL_GROUP_CREATED(80070), + EVT_ANTELOPE_SOCIAL_GROUP_DELETED(80071), + EVT_ANTELOPE_MEMBER_ADDED_TO_GROUP(80072), + EVT_ANTELOPE_MEMBER_REMOVED_FROM_GROUP(80073), + EVT_ANTELOPE_MEMBER_REQUEST_TO_GROUP(80074), + EVT_ANTELOPE_MEMBER_DENIED_FROM_GROUP(80089), + EVT_ANTELOPE_MESSAGE_SENT_TO_GROUP_CHAT(80075), + EVT_ANTELOPE_MESSAGE_SENT_TO_INBOX(80076), + EVT_ANTELOPE_MESSAGE_SENT_TO_WORLD_CHAT(80077), + EVT_ANTELOPE_MESSAGE_SENT_TO_P2P_CHAT(80078), + EVT_NEXUS_AUTHENTICATOR_LOGIN(80083), + EVT_NEXUS_AUTHENTICATOR_LOGOUT(80084), + 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_FROM_URL(10009), + EVT_APP_ENTER_FOREGROUND_FROM_URL(10010), + EVT_APPEND_NORMALLY(20000), + EVT_APPEND_ABNORMALLY(20001), + EVT_APP_ENTER_FOREGROUND_FROM_EBISU(20004), + EVT_KEYTYPE_NONE(0), + EVT_KEYTYPE_GAME_SELLID(1), + EVT_KEYTYPE_MTX_SELLID(2), + EVT_KEYTYPE_MTX_CATEGORY(3), + EVT_KEYTYPE_SCREEN_NAME(4), + EVT_KEYTYPE_EVENT_COUNT(5), + EVT_KEYTYPE_DURATION(7), + EVT_KEYTYPE_FREQUENCY(8), + EVT_KEYTYPE_FEATURED(10), + EVT_KEYTYPE_DMG_SECTION(11), + EVT_KEYTYPE_GAME_PRODUCTID(12), + EVT_KEYTYPE_DMG_CATEGORY(13), + EVT_KEYTYPE_SCORE(14), + EVT_KEYTYPE_ENUMERATION(15), + EVT_KEYTYPE_TICKERID(16), + EVT_KEYTYPE_BANNERID(17), + EVT_KEYTYPE_MESSAGEID(18), + EVT_KEYTYPE_BANNER_POSITION(19), + EVT_KEYTYPE_LANGUAGE(20), + EVT_KEYTYPE_USER_LEVEL_DATA(21), + EVT_KEYTYPE_FIELD_ID(22), + EVT_KEYTYPE_LOGO_MESSAGE_ID(23), + EVT_KEYTYPE_FIELD_TYPE(24), + EVT_KEYTYPE_SYNERGYID(25), + EVT_KEYTYPE_JSON_MAP(26), + EVT_KEYTYPE_LAST_ENUM(27); + + public static final int EVENT_SYNERGY_CUSTOM = 4; + public static final String NIMBLE_NOTIFICATION_TRACKING_SYNERGY_POSTING_TO_SERVER = "nimble.notification.trackingimpl.synergy.postingToServer"; + public final int value; + + SynergyConstants(int i) { + this.value = i; + } + + public static SynergyConstants fromInt(int i) { + for (SynergyConstants synergyConstants : values()) { + if (synergyConstants.value == i) { + return synergyConstants; + } + } + return EVT_UNDEFINED; + } + + public boolean isSessionStartEventType() { + switch (this) { + case EVT_APP_START_NORMALLY: + case EVT_APP_START_FROMPUSH: + case EVT_APP_START_AFTERINSTALL: + case EVT_APP_START_AFTERUPGRADE: + case EVT_APP_RESUME_NORMAL: + case EVT_APP_RESUME_FROM_PUSH: + case EVT_APP_START_FROM_URL: + case EVT_APP_RESUME_FROM_URL: + case EVT_NEW_SESSION_START_SYNERGYID_CHANGE: + return true; + default: + return false; + } + } + + public boolean isSessionEndEventType() { + switch (this) { + case EVT_APP_SESSION_END: + case EVT_APP_SESSION_TIME: + return true; + default: + return false; + } + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/Tracking.java b/app/src/main/java/com/ea/nimble/tracking/Tracking.java new file mode 100644 index 0000000..f01a3cd --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/Tracking.java @@ -0,0 +1,124 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Base; +import com.ea.nimble.Log; +import java.util.Date; +import java.util.Map; + +/* loaded from: classes.dex */ +public class Tracking { + private static final String APP_RESUME_EVENT_PREFIX = "APPRESUME_"; + private static final String APP_START_EVENT_PREFIX = "APPSTART_"; + public static final String COMPONENT_ID = "com.ea.nimble.tracking"; + public static final String EVENT_ANTELOPE_MEMBER_ADDED_TO_GROUP = "NIMBLESTANDARD::ANTELOPE_MEMBER_ADDED_TO_GROUP"; + public static final String EVENT_ANTELOPE_MEMBER_DENIED_FROM_GROUP = "NIMBLESTANDARD::ANTELOPE_MEMBER_DENIED_FROM_GROUP"; + public static final String EVENT_ANTELOPE_MEMBER_REMOVED_FROM_GROUP = "NIMBLESTANDARD::ANTELOPE_MEMBER_REMOVED_FROM_GROUP"; + public static final String EVENT_ANTELOPE_MEMBER_REQUEST_TO_GROUP = "NIMBLESTANDARD::ANTELOPE_MEMBER_REQUEST_TO_GROUP"; + public static final String EVENT_ANTELOPE_MESSAGE_SENT_TO_GROUP_CHAT = "NIMBLESTANDARD::ANTELOPE_MESSAGE_SENT_TO_GROUP_CHAT"; + public static final String EVENT_ANTELOPE_MESSAGE_SENT_TO_INBOX = "NIMBLESTANDARD::ANTELOPE_MESSAGE_SENT_TO_INBOX"; + public static final String EVENT_ANTELOPE_MESSAGE_SENT_TO_P2P_CHAT = "NIMBLESTANDARD::ANTELOPE_MESSAGE_SENT_TO_P2P_CHAT"; + public static final String EVENT_ANTELOPE_MESSAGE_SENT_TO_WORLD_CHAT = "NIMBLESTANDARD::ANTELOPE_MESSAGE_SENT_TO_WORLD_CHAT"; + public static final String EVENT_ANTELOPE_SOCIAL_GROUP_CREATED = "NIMBLESTANDARD::ANTELOPE_SOCIAL_GROUP_CREATED"; + public static final String EVENT_ANTELOPE_SOCIAL_GROUP_DELETED = "NIMBLESTANDARD::ANTELOPE_SOCIAL_GROUP_DELETED"; + public static final String EVENT_APPRESUME_FROMEBISU = "NIMBLESTANDARD::APPRESUME_FROMEBISU"; + public static final String EVENT_APPRESUME_FROMPUSH = "NIMBLESTANDARD::APPRESUME_FROMPUSH"; + public static final String EVENT_APPRESUME_FROMURL = "NIMBLESTANDARD::APPRESUME_FROMURL"; + public static final String EVENT_APPRESUME_NORMAL = "NIMBLESTANDARD::APPRESUME_NORMAL"; + public static final String EVENT_APPSTART_AFTERINSTALL = "NIMBLESTANDARD::APPSTART_AFTERINSTALL"; + public static final String EVENT_APPSTART_AFTERUPGRADE = "NIMBLESTANDARD::APPSTART_AFTERUPGRADE"; + public static final String EVENT_APPSTART_FROMPUSH = "NIMBLESTANDARD::APPSTART_FROMPUSH"; + public static final String EVENT_APPSTART_FROMURL = "NIMBLESTANDARD::APPSTART_FROMURL"; + public static final String EVENT_APPSTART_NORMAL = "NIMBLESTANDARD::APPSTART_NORMAL"; + public static final String EVENT_LEVEL_UP = "NIMBLESTANDARD::LEVEL_UP"; + public static final String EVENT_MTX_FREEITEM_DOWNLOADED = "NIMBLESTANDARD::MTX_FREEITEM_DOWNLOADED"; + public static final String EVENT_MTX_ITEM_BEGIN_PURCHASE = "NIMBLESTANDARD::MTX_ITEM_BEGIN_PURCHASE"; + public static final String EVENT_MTX_ITEM_PURCHASED = "NIMBLESTANDARD::MTX_ITEM_PURCHASED"; + public static final String EVENT_PN_DEVICE_REGISTERED = "NIMBLESTANDARD::PN_DEVICE_REGISTERED"; + public static final String EVENT_PN_DISPLAY_OPT_IN = "NIMBLESTANDARD::PN_DISPLAY_OPT_IN"; + public static final String EVENT_PN_RECEIVED = "NIMBLESTANDARD::PN_RECEIVED"; + public static final String EVENT_PN_SHOWN_TO_USER = "NIMBLESTANDARD::PN_SHOWN_TO_USER"; + public static final String EVENT_PN_USER_CLICKED_OK = "NIMBLESTANDARD::PN_USER_CLICKED_OK"; + public static final String EVENT_PN_USER_OPT_IN = "NIMBLESTANDARD::PN_USER_OPT_IN"; + public static final String EVENT_REFERRERID_RECEIVED = "NIMBLESTANDARD::REFERRER_ID_RECEIVED"; + public static final String EVENT_SESSION_END = "NIMBLESTANDARD::SESSION_END"; + public static final String EVENT_SESSION_START = "NIMBLESTANDARD::SESSION_START"; + public static final String EVENT_SESSION_TIME = "NIMBLESTANDARD::SESSION_TIME"; + public static final String EVENT_TUTORIAL_COMPLETE = "NIMBLESTANDARD::TUTORIAL_COMPLETE"; + public static final String EVENT_USER_REGISTERED = "NIMBLESTANDARD::USER_REGISTERED"; + public static final String EVENT_USER_TRACKING_OPTOUT = "NIMBLESTANDARD::USER_TRACKING_OPTOUT"; + public static final String KEY_ANTELOPE_GROUP_ID = "NIMBLESTANDARD::KEY_ANTELOPE_GROUP_ID"; + public static final String KEY_ANTELOPE_GROUP_TYPE = "NIMBLESTANDARD::KEY_ANTELOPE_GROUP_TYPE"; + public static final String KEY_ANTELOPE_INVITE_TYPE = "NIMBLESTANDARD::KEY_ANTELOPE_INVITE_TYPE"; + public static final String KEY_ANTELOPE_MEMBER_ID = "NIMBLESTANDARD::KEY_ANTELOPE_MEMBER_ID"; + public static final String KEY_ANTELOPE_MESSAGE_TYPE = "NIMBLESTANDARD::KEY_ANTELOPE_MESSAGE_TYPE"; + public static final String KEY_ANTELOPE_PROGRESSION = "NIMBLESTANDARD::KEY_ANTELOPE_PROGRESSION"; + public static final String KEY_ANTELOPE_RECIPIENT_ID = "NIMBLESTANDARD::KEY_ANTELOPE_RECIPIENT_ID"; + public static final String KEY_ANTELOPE_RECIPIENT_TYPE = "NIMBLESTANDARD::KEY_ANTELOPE_RECIPIENT_TYPE"; + public static final String KEY_DURATION = "NIMBLESTANDARD::KEY_DURATION"; + public static final String KEY_GAMEPLAY_DURATION = "NIMBLESTANDARD::KEY_GAMEPLAY_DURATION"; + public static final String KEY_MTX_CURRENCY = "NIMBLESTANDARD::KEY_MTX_CURRENCY"; + public static final String KEY_MTX_PRICE = "NIMBLESTANDARD::KEY_MTX_PRICE"; + public static final String KEY_MTX_SELLID = "NIMBLESTANDARD::KEY_MTX_SELLID"; + public static final String KEY_PN_DATE_OF_BIRTH = "NIMBLESTANDARD::KEY_PN_DATE_OF_BIRTH"; + public static final String KEY_PN_DEVICE_ID = "NIMBLESTANDARD::KEY_PN_DEVICE_ID"; + public static final String KEY_PN_DISABLED_FLAG = "NIMBLESTANDARD::KEY_PN_DISABLED_FLAG"; + public static final String KEY_PN_MESSAGE_ID = "NIMBLESTANDARD::KEY_PN_MESSAGE_ID"; + public static final String KEY_PN_MESSAGE_TYPE = "NIMBLESTANDARD::KEY_PN_MESSAGE_TYPE"; + public static final String KEY_REFERRER_ID = "NIMBLESTANDARD::KEY_REFERRER_ID"; + public static final String KEY_USERNAME = "NIMBLESTANDARD::KEY_USERNAME"; + public static final String KEY_USER_LEVEL = "NIMBLESTANDARD::KEY_USER_LEVEL"; + public static final String NIMBLE_TRACKING_ATTRIBUTE_PROGRESSION_LEVEL = "NIMBLESTANDARD::ATTRIBUTE_PROGRESSION_LEVEL"; + public static final String NIMBLE_TRACKING_DEFAULTENABLE = "com.ea.nimble.tracking.defaultEnable"; + public static final String NIMBLE_TRACKING_EVENT_IDENTITY_LOGIN = "NIMBLESTANDARD::IDENTITY_LOGIN"; + public static final String NIMBLE_TRACKING_EVENT_IDENTITY_LOGOUT = "NIMBLESTANDARD::IDENTITY_LOGOUT"; + public static final String NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION = "NIMBLESTANDARD::IDENTITY_MIGRATION"; + public static final String NIMBLE_TRACKING_EVENT_IDENTITY_MIGRATION_STARTED = "NIMBLESTANDARD::IDENTITY_MIGRATION_STARTED"; + public static final String NIMBLE_TRACKING_KEY_IDENTITY_MAP_SOURCE = "NIMBLESTANDARD::KEY_IDENTITY_SOURCE"; + public static final String NIMBLE_TRACKING_KEY_IDENTITY_MAP_TARGET = "NIMBLESTANDARD::KEY_IDENTITY_TARGET"; + public static final String NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGIN = "NIMBLESTANDARD::KEY_IDENTITY_PIDMAP_LOGIN"; + public static final String NIMBLE_TRACKING_KEY_IDENTITY_PIDMAP_LOGOUT = "NIMBLESTANDARD::KEY_IDENTITY_PIDMAP_LOGOUT"; + public static final String NIMBLE_TRACKING_KEY_MIGRATION_GAME_TRIGGERED = "NIMBLESTANDARD::KEY_MIGRATION_GAME_TRIGGERED"; + public static final String NIMBLE_TRACKING_KEY_PN_MESSAGEID = "NIMBLESTANDARD::KEY_PN_MESSAGE_ID"; + private static final String SESSION_END_EVENT_PREFIX = "SESSION_END"; + private static final String SESSION_START_EVENT_PREFIX = "SESSION_START"; + private static final String STANDARD_EVENT_PREFIX = "NIMBLESTANDARD::"; + + public static class Event { + Map parameters; + Date timestamp; + String type; + } + + public static ITracking getComponent() { + return (ITracking) Base.getComponent("com.ea.nimble.tracking"); + } + + private static void initialize() { + Log.Helper.LOGFUNCS("Tracking"); + Base.registerComponent(new TrackingWrangler(), "com.ea.nimble.tracking"); + } + + public static boolean isNimbleStandardEvent(String str) { + Log.Helper.LOGPUBLICFUNCS("Tracking"); + if (str == null) { + return false; + } + return str.startsWith(STANDARD_EVENT_PREFIX); + } + + public static boolean isSessionStartEvent(String str) { + Log.Helper.LOGPUBLICFUNCS("Tracking"); + if (str == null) { + return false; + } + return str.startsWith(APP_START_EVENT_PREFIX, STANDARD_EVENT_PREFIX.length()) || str.startsWith(APP_RESUME_EVENT_PREFIX, STANDARD_EVENT_PREFIX.length()) || str.startsWith(SESSION_START_EVENT_PREFIX, STANDARD_EVENT_PREFIX.length()); + } + + public static boolean isSessionEndEvent(String str) { + Log.Helper.LOGPUBLICFUNCS("Tracking"); + if (str == null) { + return false; + } + return str.startsWith(SESSION_END_EVENT_PREFIX, STANDARD_EVENT_PREFIX.length()); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingBaseSessionObject.java b/app/src/main/java/com/ea/nimble/tracking/TrackingBaseSessionObject.java new file mode 100644 index 0000000..7cf0e99 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingBaseSessionObject.java @@ -0,0 +1,51 @@ +package com.ea.nimble.tracking; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* loaded from: classes.dex */ +public class TrackingBaseSessionObject implements Externalizable { + private static final long serialVersionUID = 1; + public List> events; + public int repostCount; + public Map sessionData; + + public TrackingBaseSessionObject() { + this.events = new ArrayList(); + this.sessionData = new HashMap(); + this.repostCount = 0; + } + + public TrackingBaseSessionObject(Map map) { + this.events = new ArrayList(); + this.sessionData = map; + this.repostCount = 0; + } + + public int countOfEvents() { + if (this.events == null) { + return 0; + } + return this.events.size(); + } + + @Override // java.io.Externalizable + public void writeExternal(ObjectOutput objectOutput) throws IOException { + objectOutput.writeObject(this.events); + objectOutput.writeObject(this.sessionData); + objectOutput.writeInt(this.repostCount); + } + + @Override // java.io.Externalizable + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + this.events = (List) objectInput.readObject(); + this.sessionData = (Map) objectInput.readObject(); + this.repostCount = objectInput.readInt(); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingEventWrangler.java b/app/src/main/java/com/ea/nimble/tracking/TrackingEventWrangler.java new file mode 100644 index 0000000..5d8944d --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingEventWrangler.java @@ -0,0 +1,272 @@ +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; +import com.ea.nimble.Component; +import com.ea.nimble.EASPDataLoader; +import com.ea.nimble.IApplicationLifecycle; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Persistence; +import com.ea.nimble.PersistenceService; +import com.ea.nimble.SynergyEnvironment; +import java.io.FileNotFoundException; +import java.util.HashMap; +import java.util.Map; + +/* loaded from: classes.dex */ +class TrackingEventWrangler extends Component implements IApplicationLifecycle.ApplicationLifecycleCallbacks, LogSource, IApplicationLifecycle.ActivityEventCallbacks { + private static final String APP_VERSION_PERSISTENCE_ID = "applicationBundleVersion"; + public static final String COMPONENT_ID = "com.ea.nimble.tracking.eventwrangler"; + private Intent m_newIntent; + private Long m_sessionStartTimestamp; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return COMPONENT_ID; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Tracking"; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onActivityResult(Activity activity, int i, int i2, Intent intent) { + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public boolean onBackPressed() { + return true; + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onWindowFocusChanged(boolean z) { + } + + private TrackingEventWrangler() { + } + + private static void initialize() { + Log.Helper.LOGFUNCS("TrackingEventWrangler"); + Base.registerComponent(new TrackingEventWrangler(), COMPONENT_ID); + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + ApplicationLifecycle.getComponent().registerApplicationLifecycleCallbacks(this); + ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this); + } + + @Override // com.ea.nimble.Component + public void cleanup() { + Log.Helper.LOGPUBLICFUNC(this); + ApplicationLifecycle.getComponent().unregisterApplicationLifecycleCallbacks(this); + ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationLaunch(Intent intent) { + if (intent.getData() != null) { + logAndCheckEvent(Tracking.EVENT_APPSTART_FROMURL); + return; + } + if (intent.getStringExtra("PushNotification") != null) { + Log.Helper.LOGI(this, "Awesome. PN launched me", new Object[0]); + HashMap hashMap = new HashMap(); + addPushTNGTrackingParams(intent.getExtras(), hashMap); + if (hashMap.isEmpty()) { + logAndCheckEvent(Tracking.EVENT_APPSTART_FROMPUSH); + return; + } else { + logAndCheckEvent(Tracking.EVENT_APPSTART_FROMPUSH, hashMap); + return; + } + } + Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); + String stringValue = persistenceForNimbleComponent.getStringValue(APP_VERSION_PERSISTENCE_ID); + if (stringValue == null) { + stringValue = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.CACHE).getStringValue(APP_VERSION_PERSISTENCE_ID); + } + String applicationVersion = ApplicationEnvironment.getComponent().getApplicationVersion(); + Log.Helper.LOGD(this, "Current app version, %s. Cached app version, %s", applicationVersion, stringValue); + if (stringValue == null) { + persistenceForNimbleComponent.setValue(APP_VERSION_PERSISTENCE_ID, applicationVersion); + EASPDataLoader.EASPDataBuffer eASPDataBuffer = null; + try { + eASPDataBuffer = EASPDataLoader.loadDatFile(EASPDataLoader.getTrackingDatFilePath()); + } catch (FileNotFoundException unused) { + Log.Helper.LOGD(this, "No EASP tracking file.", new Object[0]); + } catch (Exception unused2) { + Log.Helper.LOGE(this, "Exception loading EASP tracking file.", new Object[0]); + } + if (eASPDataBuffer != null) { + Log.Helper.LOGD(this, "EASP tracking file found. Counting as app update.", new Object[0]); + logAndCheckEvent(Tracking.EVENT_APPSTART_AFTERUPGRADE); + return; + } else { + logAndCheckEvent(Tracking.EVENT_APPSTART_AFTERINSTALL); + return; + } + } + if (!stringValue.equals(applicationVersion)) { + persistenceForNimbleComponent.setValue(APP_VERSION_PERSISTENCE_ID, applicationVersion); + logAndCheckEvent(Tracking.EVENT_APPSTART_AFTERUPGRADE); + } else { + logAndCheckEvent(Tracking.EVENT_APPSTART_NORMAL); + } + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationSuspend() { + logAndCheckEvent(Tracking.EVENT_SESSION_END); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationResume() { + if (ApplicationEnvironment.getCurrentActivity().getIntent().getData() != null) { + logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMURL); + return; + } + if (this.m_newIntent != null) { + if (this.m_newIntent.getData() != null) { + logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMURL); + } else if (this.m_newIntent.getStringExtra("PushNotification") != null) { + HashMap hashMap = new HashMap(); + addPushTNGTrackingParams(this.m_newIntent.getExtras(), hashMap); + if (hashMap.isEmpty()) { + logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMPUSH); + } else { + logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMPUSH, hashMap); + } + } else { + logAndCheckEvent(Tracking.EVENT_APPRESUME_NORMAL); + } + this.m_newIntent = null; + return; + } + logAndCheckEvent(Tracking.EVENT_APPRESUME_NORMAL); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks + public void onApplicationQuit() { + logAndCheckEvent(Tracking.EVENT_SESSION_END); + } + + @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks + public void onNewIntent(Activity activity, Intent intent) { + this.m_newIntent = intent; + } + + public void logAndCheckEvent(String str) { + Log.Helper.LOGPUBLICFUNC(this); + 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 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.() + 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 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()); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingS2S.java b/app/src/main/java/com/ea/nimble/tracking/TrackingS2S.java new file mode 100644 index 0000000..0bc5083 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingS2S.java @@ -0,0 +1,10 @@ +package com.ea.nimble.tracking; + +/* loaded from: classes.dex */ +public class TrackingS2S { + public static final String EVENT_CUSTOM = "SYNERGYS2S::CUSTOM"; + + private static void initialize() { + NimbleTrackingS2SComponent.initialize(); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingSynergy.java b/app/src/main/java/com/ea/nimble/tracking/TrackingSynergy.java new file mode 100644 index 0000000..981f404 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingSynergy.java @@ -0,0 +1,10 @@ +package com.ea.nimble.tracking; + +/* loaded from: classes.dex */ +public class TrackingSynergy { + public static final String EVENT_CUSTOM = "SYNERGYTRACKING::CUSTOM"; + + private static void initialize() { + NimbleTrackingSynergyComponent.initialize(); + } +} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java b/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java new file mode 100644 index 0000000..1ed2224 --- /dev/null +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java @@ -0,0 +1,140 @@ +package com.ea.nimble.tracking; + +import com.ea.nimble.Base; +import com.ea.nimble.Component; +import com.ea.nimble.IOperationalTelemetryDispatch; +import com.ea.nimble.Log; +import com.ea.nimble.LogSource; +import com.ea.nimble.Utility; +import java.util.Map; + +/* loaded from: classes.dex */ +public class TrackingWrangler extends Component implements ITracking, LogSource { + private boolean m_sessionIsActive = false; + private ITracking[] m_trackingComponents; + + @Override // com.ea.nimble.Component + public String getComponentId() { + return "com.ea.nimble.tracking"; + } + + @Override // com.ea.nimble.LogSource + public String getLogSourceTitle() { + return "Tracking"; + } + + @Override // com.ea.nimble.Component + public void restore() { + Log.Helper.LOGPUBLICFUNC(this); + Object[] componentList = Base.getComponentList("com.ea.nimble.trackingimpl"); + this.m_trackingComponents = new ITracking[componentList.length]; + for (int i = 0; i < componentList.length; i++) { + this.m_trackingComponents[i] = (ITracking) componentList[i]; + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void setEnable(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + StringBuilder sb = new StringBuilder(); + sb.append(z ? "ENABLE" : "DISABLE"); + sb.append(" tracking"); + Log.Helper.LOGD(this, sb.toString(), new Object[0]); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.setEnable(z); + } + if (z) { + ((TrackingEventWrangler) Base.getComponent(TrackingEventWrangler.COMPONENT_ID)).logAndCheckEvent(Tracking.EVENT_SESSION_START); + } + } + + public void setSessionState(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + this.m_sessionIsActive = z; + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getEnable() { + Log.Helper.LOGPUBLICFUNC(this); + boolean z = false; + for (ITracking iTracking : this.m_trackingComponents) { + z = z || iTracking.getEnable(); + } + return z; + } + + @Override // com.ea.nimble.tracking.ITracking + public boolean getPostEnable() { + Log.Helper.LOGPUBLICFUNC(this); + boolean z = false; + for (ITracking iTracking : this.m_trackingComponents) { + z = z || iTracking.getPostEnable(); + } + return z; + } + + @Override // com.ea.nimble.tracking.ITracking + public void setPostEnable(boolean z) { + Log.Helper.LOGPUBLICFUNC(this); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.setPostEnable(z); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void logEvent(String str, Map map) { + Log.Helper.LOGPUBLICFUNC(this); + if (!this.m_sessionIsActive) { + Log.Helper.LOGD(this, "Ignoring event %s because there is not an active session", str); + return; + } + Log.Helper.LOGD(this, "LogEvent type(%s) parameters(%s)", str, Utility.convertLiteralMapToString(map)); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.logEvent(str, map); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void addCustomSessionData(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.addCustomSessionData(str, str2); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void removeCustomSessionData(String str) { + Log.Helper.LOGPUBLICFUNC(this); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.removeCustomSessionData(str); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void setTrackingAttribute(String str, String str2) { + Log.Helper.LOGPUBLICFUNC(this); + for (ITracking iTracking : this.m_trackingComponents) { + iTracking.setTrackingAttribute(str, str2); + } + } + + @Override // com.ea.nimble.tracking.ITracking + public void clearCustomSessionData() { + Log.Helper.LOGPUBLICFUNC(this); + } + + @Override // com.ea.nimble.tracking.ITracking + public String getSessionId() { + Log.Helper.LOGPUBLICFUNC(this); + NimbleTrackingSynergyComponent nimbleTrackingSynergyComponent = (NimbleTrackingSynergyComponent) Base.getComponent(IOperationalTelemetryDispatch.EVENTTYPE_TRACKING_SYNERGY_PAYLOADS); + if (nimbleTrackingSynergyComponent == null) { + return ""; + } + String sessionId = nimbleTrackingSynergyComponent.getSessionId(); + return Utility.validString(sessionId) ? sessionId : ""; + } + + static TrackingWrangler getComponent() { + return (TrackingWrangler) Tracking.getComponent(); + } +} diff --git a/app/src/main/java/com/eamobile/ADCTelemetry.java b/app/src/main/java/com/eamobile/ADCTelemetry.java new file mode 100644 index 0000000..74ef045 --- /dev/null +++ b/app/src/main/java/com/eamobile/ADCTelemetry.java @@ -0,0 +1,309 @@ +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 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 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 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; + } + } +} diff --git a/app/src/main/java/com/eamobile/DownloadActivity.java b/app/src/main/java/com/eamobile/DownloadActivity.java new file mode 100644 index 0000000..89305fa --- /dev/null +++ b/app/src/main/java/com/eamobile/DownloadActivity.java @@ -0,0 +1,49 @@ +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); + } +} diff --git a/app/src/main/java/com/eamobile/DownloadActivityInternal.java b/app/src/main/java/com/eamobile/DownloadActivityInternal.java new file mode 100644 index 0000000..9e1db9f --- /dev/null +++ b/app/src/main/java/com/eamobile/DownloadActivityInternal.java @@ -0,0 +1,2213 @@ +package com.eamobile; + +import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.wifi.SupplicantState; +import android.net.wifi.WifiManager; +import android.os.Build; +import android.os.Environment; +import android.os.Handler; +import android.provider.Settings; +import android.support.v4.media.session.PlaybackStateCompat; +import android.telephony.TelephonyManager; +import android.util.DisplayMetrics; +import android.view.Display; +import com.eamobile.download.AssetManager; +import com.eamobile.download.Constants; +import com.eamobile.download.Device; +import com.eamobile.download.DownloadFileData; +import com.eamobile.download.DownloadProgress; +import com.eamobile.download.LocalZipExtractorEvent; +import com.eamobile.download.Logging; +import com.eamobile.download.MemoryStatus; +import com.eamobile.download.RemoteZipExtractorEvent; +import com.eamobile.download.ZipExtractor; +import com.eamobile.views.CheckUpdatesView; +import com.eamobile.views.CheckingHostIpView; +import com.eamobile.views.ContactingServerView; +import com.eamobile.views.CustomView; +import com.eamobile.views.DeletingAssetsView; +import com.eamobile.views.DownloadFailedView; +import com.eamobile.views.DownloadMsgView; +import com.eamobile.views.DownloadProgressView; +import com.eamobile.views.InvalidAssetVersionView; +import com.eamobile.views.NetworkUnavailableView; +import com.eamobile.views.ServerErrorView; +import com.eamobile.views.Show3GView; +import com.eamobile.views.ShowBGView; +import com.eamobile.views.ShowWifiView; +import com.eamobile.views.SpaceUnavailableView; +import com.eamobile.views.UnSupportedDeviceView; +import com.eamobile.views.UpdatesFoundView; +import com.facebook.internal.AnalyticsEvents; +import com.facebook.internal.ServerProtocol; +import com.facebook.places.model.PlaceFields; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Properties; +import javax.microedition.khronos.opengles.GL10; +import javax.microedition.khronos.opengles.GL11; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHeaders; +import org.apache.http.client.methods.HttpGet; +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.BasicHttpParams; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.protocol.HTTP; +import org.json.JSONObject; + +/* loaded from: classes.dex */ +public class DownloadActivityInternal { + static final String DOWNLOAD_URL_CONFIG_FILE = "DownloadURL.indicate"; + public static final int ERROR_ASSETS_NOT_FOUND = 5002; + public static final int ERROR_CHECKSUM_MATCH_FAILED = -11; + public static final int ERROR_CHECKSUM_NOT_FOUND = -10; + public static final int ERROR_CONNECTION_UNAVAILABLE = -16; + public static final int ERROR_CORRUPTED_ZIP = -12; + public static final int ERROR_DOWNLOAD_TIMEOUT = -1; + public static final int ERROR_FILE_LIST_RETRIEVE_FAILED = -15; + public static final int ERROR_MISSING_CHECKSUMS = -13; + public static final int ERROR_UNEXPECTED_SERVER_ERROR = -14; + public static final int ERROR_UNSUPPORTED_ASSET_VERSION = -17; + public static final int ERROR_UNSUPPORTED_DEVICE = 5001; + 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 final String RESOURCES_PATH = "downloadcontent/"; + public static final int STATE_3G_UNAVAILABLE = 7; + public static final int STATE_BG_VIEW = 11; + public static final int STATE_CHECKING_HOST_IP = 15; + public static final int STATE_CHECK_UPDATES = 8; + public static final int STATE_CONTACTING_SERVER = 14; + public static final int STATE_DOWNLOADING_ASSETS = 2; + public static final int STATE_FAILURE = 5; + public static final int STATE_INVALID = -1; + public static final int STATE_SERVER_ERROR = 13; + public static final int STATE_SHOW_3G_DIALOG = 10; + public static final int STATE_SHOW_DELETING_ASSETS = 16; + public static final int STATE_SHOW_DOWNLOAD_MSG = 1; + public static final int STATE_SHOW_WIFI_DIALOG = 6; + public static final int STATE_SPACE_UNAVAILABLE = 4; + public static final int STATE_SUCCESS = 3; + public static final int STATE_UNSUPPORTED_DEVICE = 12; + public static final int STATE_UPDATES_FOUND = 9; + protected static DownloadProgress downloadProgress; + private static int height; + private static Activity instance; + private static boolean isInitialized; + protected static Language language; + private static int width; + private String activityAssetPath; + private boolean activityUseExternal; + private AssetManager assetManager; + String bgFileName; + private Bitmap bmpBg; + private boolean callSetAssetPathAux; + private CheckUpdatesView checkUpdatesView; + private CheckingHostIpView checkingHostIpView; + private boolean configLoaded; + private ContactingServerView contactingServerView; + private DeletingAssetsView deletingAssetsView; + private Device deviceFallback; + private DownloadFailedView downloadFailedView; + private DownloadFileData[] downloadFileData; + private DownloadMsgView downloadMsgView; + private DownloadProgressView downloadProgressView; + String glExtensions; + private InvalidAssetVersionView invalidAssetVersionView; + Context mContext; + IDownloadActivity mDownloadActivity; + Handler mHandler; + private String mLocale; + private NetworkUnavailableView networkUnavailableView; + private ArrayList overrideDevices; + private CustomView pCurrentView; + protected int percent_downloaded; + private ServerErrorView serverErrorView; + private Show3GView show3GView; + private ShowBGView showBGView; + private ShowWifiView showWifiView; + private SpaceUnavailableView spaceUnavailableView; + private UnSupportedDeviceView unSupportedDeviceView; + private UpdatesFoundView updatesFoundView; + private WifiReceiver wifiReceiver; + private static String[] STATE_STRINGS = {"", "STATE_SHOW_DOWNLOAD_MSG", "STATE_DOWNLOADING_ASSETS", "STATE_SUCCESS", "STATE_SPACE_UNAVAILABLE", "STATE_FAILURE", "STATE_SHOW_WIFI_DIALOG", "STATE_3G_UNAVAILABLE", "STATE_CHECK_UPDATES", "STATE_UPDATES_FOUND", "STATE_SHOW_3G_DIALOG", "STATE_BG_VIEW", "STATE_UNSUPPORTED_DEVICE", "STATE_SERVER_ERROR", "STATE_CONTACTING_SERVER", "STATE_CHECKING_HOST_IP", "STATE_SHOW_DELETING_ASSETS"}; + static String DOWNLOAD_URL = null; + static String MIN_ASSET_VERSION_REQUIRED = null; + static int MASTER_SELL_ID = 0; + static int TOTAL_SPACE_MB = 0; + static int TOTAL_SPACE_MB_MIN = 0; + static int PRODUCT_ID = 0; + static int TIMEOUT = 10000; + static int NUMBER_OF_HOURS_TO_UPDATE_CHECKING = 0; + static boolean UNCOMPRESS_ZIP_ON_DEVICE = false; + static boolean CUSTOM_PROGRESS_BAR = true; + static boolean USE_OLD_PROGRESS_BAR = false; + static boolean DISABLE_3G = false; + static boolean USE_INTERNAL_STORAGE = false; + private static boolean FORCE_WAKE_DURING_DOWNLOAD = false; + static boolean DO_NOT_OPEN_STORAGE_SETTINGS = false; + static boolean DELETE_ASSETS_ON_UPDATE = false; + static boolean UNSAFE_ASSET_DELETION_ON_UPDATE = false; + static boolean REDOWNLOAD_ON_SCREEN_SIZE_CHANGE = false; + static boolean ALTERNATIVE_DATA_FOLDER = false; + static boolean RETRIEVE_FULL_SCREEN_RESOLUTION = false; + private static boolean isDownloadRange = false; + private static int pState = -1; + private static int pStatePrev = -1; + private static int totalDownloadSizeMB = 0; + private static long spaceNeededToDownload = -1; + private static long spaceAvailableToDownload = -1; + private static String resolution = ""; + private static ArrayList mErrorList = new ArrayList<>(); + private static String[] EXPECTED_PERMISSIONS = {"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_WIFI_STATE", "android.permission.ACCESS_NETWORK_STATE", "android.permission.CHANGE_NETWORK_STATE", "android.permission.INTERNET", "android.permission.READ_PHONE_STATE", "android.permission.WAKE_LOCK"}; + private static volatile boolean changingState = false; + static DownloadActivityInternal mMainActivity = null; + static boolean unknownHostExceptionTryAgain = true; + + public static String getResourcesPath() { + return RESOURCES_PATH; + } + + protected static Activity getInstance() { + return instance; + } + + public static DownloadActivityInternal getMainActivity() { + return mMainActivity; + } + + public static boolean isInitialized() { + return isInitialized; + } + + private void printADCLibInfo() { + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("[ADC lib info]"); + if (Constants.ADC_BUILD_LOCAL.equalsIgnoreCase(ServerProtocol.DIALOG_RETURN_SCOPES_TRUE)) { + Logging.DEBUG_OUT("\t[WARNING] This version of ADC was built locally and should not be used in production."); + } + Logging.DEBUG_OUT("\tADC build version: @ADC_BUILD_VERSION_DYNAMIC_VALUE@"); + Logging.DEBUG_OUT("\tADC build time: @ADC_BUILD_TIME_DYNAMIC_VALUE@"); + Logging.DEBUG_OUT(" "); + } + + private void printDeviceAndAppInfo() { + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("[Device/App info]"); + Logging.DEBUG_OUT("\tDevice: " + getDeviceString()); + Logging.DEBUG_OUT("\tBrand: " + getBrand()); + Logging.DEBUG_OUT("\tAndroid Unique ID: " + getAndroidUniqueId()); + Logging.DEBUG_OUT("\tApplication name: " + getApplicationName()); + Logging.DEBUG_OUT("\tAPK version: " + getAPKVersion()); + Logging.DEBUG_OUT(" "); + } + + public DownloadActivityInternal(Context context) { + this(context, "title.png"); + } + + public DownloadActivityInternal(Context context, String str) { + this.overrideDevices = new ArrayList<>(); + this.deviceFallback = null; + this.downloadFileData = null; + this.mLocale = "en"; + this.percent_downloaded = 0; + this.mDownloadActivity = null; + this.glExtensions = null; + this.bmpBg = null; + this.callSetAssetPathAux = false; + this.activityAssetPath = ""; + this.activityUseExternal = false; + this.configLoaded = false; + Logging.DEBUG_INIT(); + this.mHandler = new Handler(); + if (mMainActivity == null) { + mMainActivity = this; + } + if (this.assetManager == null) { + this.assetManager = new AssetManager(); + } + this.mContext = context; + this.bgFileName = str; + Logging.DEBUG_OUT("DownloadActivityInternal.init()"); + initScreens(context); + } + + public void setAssetPath(String str, boolean z) { + if (this.configLoaded) { + setAssetPathAux(str, z); + return; + } + this.callSetAssetPathAux = true; + this.activityAssetPath = str; + this.activityUseExternal = z; + } + + private void setAssetPathAux(String str, boolean z) { + String str2 = ""; + String str3 = ""; + String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath(); + String absolutePath2 = this.mContext.getFilesDir().getAbsolutePath(); + String str4 = null; + if (USE_INTERNAL_STORAGE) { + str2 = "" + this.mContext.getFilesDir().getAbsolutePath(); + str3 = "" + absolutePath2; + } else if (z) { + str2 = "" + absolutePath; + str3 = "" + absolutePath2; + } else { + Logging.DEBUG_OUT("User entered an absolute path."); + if (str.startsWith(absolutePath)) { + USE_INTERNAL_STORAGE = false; + str4 = str.replaceFirst(absolutePath, absolutePath2); + } else if (str.startsWith(absolutePath2)) { + USE_INTERNAL_STORAGE = true; + str4 = str.replaceFirst(absolutePath2, absolutePath); + } + } + if (str != null) { + str2 = str2 + str; + } + this.assetManager.setAssetPath(str2); + if (ALTERNATIVE_DATA_FOLDER) { + if (str4 == null) { + str4 = str3 + str; + } + this.assetManager.setAlternativeAssetPath(str4); + Logging.DEBUG_OUT("\tsetAlternativeAssetPath(), mAlternativeAssetPath = " + str4); + } + Logging.DEBUG_OUT("\tsetAssetPath(), mAssetPath = " + str2); + } + + public void init(Activity activity, IDownloadActivity iDownloadActivity, Context context, Object obj) { + Logging.DEBUG_OUT("Calling: DownloadActivityInternal init()"); + this.mContext = context; + if (instance == null) { + instance = activity; + this.mDownloadActivity = iDownloadActivity; + } + printADCLibInfo(); + printDeviceAndAppInfo(); + loadConfigProperties(); + loadOverrides(); + checkPermissions(); + checkLanguageChange(); + checkBackgroundImage(); + if (downloadProgress == null) { + downloadProgress = new DownloadProgress(); + } + if (obj != null) { + try { + if (obj instanceof GL10) { + this.glExtensions = ((GL10) obj).glGetString(7939); + } else if (obj instanceof GL11) { + this.glExtensions = ((GL11) obj).glGetString(7939); + } + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while trying to get GL Extensions:" + e); + } + } + if (this.wifiReceiver == null) { + this.wifiReceiver = new WifiReceiver(); + instance.registerReceiver(this.wifiReceiver, new IntentFilter("android.net.wifi.RSSI_CHANGED")); + this.wifiReceiver.updateWifiInfo(); + } + if (!isInitialized) { + boolean z = true; + isInitialized = true; + if (ALTERNATIVE_DATA_FOLDER) { + this.assetManager.useAlternativeAssetPath(false); + if (!this.assetManager.assetsFoundLocally()) { + this.assetManager.useAlternativeAssetPath(true); + if (!this.assetManager.assetsFoundLocally()) { + this.assetManager.useAlternativeAssetPath(false); + z = false; + } + } + } else { + z = this.assetManager.assetsFoundLocally(); + } + ADCTelemetry.getInstance().onCreate(this.assetManager.getAssetPath()); + if (z) { + if (shouldSkipUpdateCheck()) { + setState(11); + return; + } else { + setState(14); + return; + } + } + setState(14); + return; + } + setState(pState); + } + + private boolean shouldSkipUpdateCheck() { + Logging.DEBUG_OUT("DownloadActivityInternal shouldSkipUpdateCheck()"); + if (NUMBER_OF_HOURS_TO_UPDATE_CHECKING > 0) { + Properties loadAssetInfo = this.assetManager.loadAssetInfo(); + if (loadAssetInfo != null) { + String property = loadAssetInfo.getProperty("updateCheckLastTime"); + if (property != null) { + try { + long parseLong = Long.parseLong(property); + Logging.DEBUG_OUT("Last time checked for update: " + parseLong); + long time = new Date().getTime(); + Logging.DEBUG_OUT("Current time: " + time); + long j = time - parseLong; + if (j < 0) { + Logging.DEBUG_OUT("Time travel not allowed!"); + return false; + } + int i = (int) (j / 3600000); + Logging.DEBUG_OUT("Number of hours since last update checking: " + i); + Logging.DEBUG_OUT("Number of hours needed: " + NUMBER_OF_HOURS_TO_UPDATE_CHECKING); + return i < NUMBER_OF_HOURS_TO_UPDATE_CHECKING; + } catch (Exception e) { + Logging.DEBUG_OUT_STACK(e); + return false; + } + } + Logging.DEBUG_OUT("Property updateCheckLastTime not found."); + return false; + } + Logging.DEBUG_OUT("AssetInfo file could not be read."); + return false; + } + Logging.DEBUG_OUT("NUMBER_OF_HOURS_TO_UPDATE_CHECKING not defined or invalid."); + return false; + } + + public boolean chooseAvailableMemory() { + if (ALTERNATIVE_DATA_FOLDER) { + if (isSpaceAvailableForDownload()) { + this.assetManager.useAlternativeAssetPath(false); + Logging.DEBUG_OUT("Memory space is available in main location."); + return true; + } + if (isSpaceAvailableForAlternativeDownload()) { + this.assetManager.useAlternativeAssetPath(true); + Logging.DEBUG_OUT("Memory space is available only in alternative location."); + return true; + } + Logging.DEBUG_OUT("Memory space is not available."); + return false; + } + return isSpaceAvailableForDownload(); + } + + public void checkServerContent(Boolean bool) { + boolean z = false; + int updateDownloadFilesData = getMainActivity().updateDownloadFilesData(false); + if ((updateDownloadFilesData == 5001 || updateDownloadFilesData == 5002) && this.deviceFallback != null) { + updateDownloadFilesData = getMainActivity().updateDownloadFilesData(true); + } + if (this.downloadFileData != null && spaceNeededToDownload > 0) { + spaceNeededToDownload -= this.assetManager.getTotalSize(this.assetManager.getDownloadList(this.downloadFileData)); + } + if (ALTERNATIVE_DATA_FOLDER) { + this.assetManager.useAlternativeAssetPath(false); + if (!this.assetManager.assetsFoundLocally()) { + this.assetManager.useAlternativeAssetPath(true); + if (!this.assetManager.assetsFoundLocally()) { + this.assetManager.useAlternativeAssetPath(false); + } + } + z = true; + } else { + z = this.assetManager.assetsFoundLocally(); + } + if (!z) { + Logging.DEBUG_OUT("Assets not found on the device. ADC will try to download from the server."); + if (updateDownloadFilesData != 0) { + recordError(updateDownloadFilesData); + if (updateDownloadFilesData == 5001) { + Logging.DEBUG_OUT("[ERROR] Unsupported device: unable to find assets"); + Logging.DEBUG_OUT("\tfor resolution: " + resolution); + Logging.DEBUG_OUT("\ton server: " + DOWNLOAD_URL); + setState(12); + return; + } + if (updateDownloadFilesData == -15) { + Logging.DEBUG_OUT("[ERROR] Failed to retrieve download file list"); + if (bool.booleanValue()) { + Logging.DEBUG_OUT("Ignoring ERROR_FILE_LIST_RETRIEVE_FAILED and going to STATE_SHOW_WIFI_DIALOG."); + setState(6); + return; + } + } else { + Logging.DEBUG_OUT("[ERROR] Error from Server: " + updateDownloadFilesData); + } + this.serverErrorView.setErrorCode(updateDownloadFilesData); + setState(13); + return; + } + if (!chooseAvailableMemory()) { + setState(4); + return; + } else { + if (getState() != 2) { + setState(1); + return; + } + return; + } + } + Logging.DEBUG_OUT("checkServerContent(): assets found on the device."); + if (updateDownloadFilesData == 0) { + long time = new Date().getTime(); + Logging.DEBUG_OUT("Saving update checking timestamp: " + time); + Properties loadAssetInfo = this.assetManager.loadAssetInfo(); + if (loadAssetInfo == null) { + loadAssetInfo = new Properties(); + } + loadAssetInfo.setProperty("updateCheckLastTime", "" + time); + this.assetManager.saveAssetInfo(loadAssetInfo); + setState(8); + return; + } + if (updateDownloadFilesData == -15) { + Logging.DEBUG_OUT("[ERROR] Failed to retrieve download file list."); + } else if (updateDownloadFilesData == 5001 || updateDownloadFilesData == 5002) { + Logging.DEBUG_OUT("[ERROR] Assets found on the device but server returned error code " + updateDownloadFilesData + " while checking for assets."); + } + setState(11); + } + + public boolean useCustomProgressBar() { + return CUSTOM_PROGRESS_BAR; + } + + public boolean useOldProgressBar() { + return USE_OLD_PROGRESS_BAR; + } + + public boolean is3GDisabled() { + return DISABLE_3G; + } + + public boolean isAmazonDevice() { + return getManufacturer().equalsIgnoreCase("amazon"); + } + + private String getResolutionUsingDisplayMetrics() { + Logging.DEBUG_OUT("Calling getResolutionUsingDisplayMetrics()..."); + DisplayMetrics displayMetrics = new DisplayMetrics(); + instance.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + Logging.DEBUG_OUT("displayMetrics: " + displayMetrics.toString()); + width = displayMetrics.widthPixels; + height = displayMetrics.heightPixels; + return width + "x" + height; + } + + private String getResolutionUsingUndocumentedMethods() { + Logging.DEBUG_OUT("Calling getResolutionUsingUndocumentedMethods()..."); + try { + Display defaultDisplay = instance.getWindowManager().getDefaultDisplay(); + Method method = Display.class.getMethod("getRawWidth", new Class[0]); + Method method2 = Display.class.getMethod("getRawHeight", new Class[0]); + width = ((Integer) method.invoke(defaultDisplay, new Object[0])).intValue(); + height = ((Integer) method2.invoke(defaultDisplay, new Object[0])).intValue(); + if (instance.getRequestedOrientation() == 0) { + if (width < height) { + int i = width; + width = height; + height = i; + } + } else if (width > height) { + int i2 = width; + width = height; + height = i2; + } + return width + "x" + height; + } catch (IllegalAccessException e) { + Logging.DEBUG_OUT("An IllegalAccessException exception occurred in getResolutionUsingUndocumentedMethods()."); + Logging.DEBUG_OUT_STACK(e); + return null; + } catch (IllegalArgumentException e2) { + Logging.DEBUG_OUT("An IllegalArgumentException exception occurred in getResolutionUsingUndocumentedMethods()."); + Logging.DEBUG_OUT_STACK(e2); + return null; + } catch (NoSuchMethodException e3) { + Logging.DEBUG_OUT("A NoSuchMethodException exception occurred in getResolutionUsingUndocumentedMethods()."); + Logging.DEBUG_OUT_STACK(e3); + return null; + } catch (InvocationTargetException e4) { + Logging.DEBUG_OUT("An InvocationTargetException exception occurred in getResolutionUsingUndocumentedMethods()."); + Logging.DEBUG_OUT_STACK(e4); + return null; + } catch (Exception e5) { + Logging.DEBUG_OUT("An Exception exception occurred in getResolutionUsingUndocumentedMethods()."); + Logging.DEBUG_OUT_STACK(e5); + return null; + } + } + + private String getResolution() { + Device device = getDevice(getModel()); + if (device != null) { + return device.getResolutionString(); + } + String resolutionUsingUndocumentedMethods = RETRIEVE_FULL_SCREEN_RESOLUTION ? getResolutionUsingUndocumentedMethods() : null; + if (resolutionUsingUndocumentedMethods == null) { + resolutionUsingUndocumentedMethods = getResolutionUsingDisplayMetrics(); + } + if (instance.getRequestedOrientation() == 0) { + Logging.DEBUG_OUT("SCREEN_ORIENTATION_LANDSCAPE"); + } else { + Logging.DEBUG_OUT("SCREEN_ORIENTATION_PORTRAIT"); + } + return resolutionUsingUndocumentedMethods; + } + + private Device getDevice(String str) { + if (this.overrideDevices == null) { + return null; + } + for (int i = 0; i < this.overrideDevices.size(); i++) { + Device device = this.overrideDevices.get(i); + if (device.getName().equals(str)) { + return device; + } + } + return null; + } + + public WifiReceiver getWifiReceiver() { + return this.wifiReceiver; + } + + private void unregisterWifiReceiver() { + try { + try { + if (this.wifiReceiver != null) { + instance.unregisterReceiver(this.wifiReceiver); + } + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while unregistering WifiReceiver."); + Logging.DEBUG_OUT_STACK(e); + } + } finally { + this.wifiReceiver = null; + } + } + + protected long calculateDownloaded(File file) { + long length; + File[] listFiles = file.listFiles(); + long j = 0; + if (listFiles == null) { + return 0L; + } + for (int i = 0; i < listFiles.length; i++) { + if (listFiles[i].isDirectory()) { + length = calculateDownloaded(listFiles[i]); + } else { + length = listFiles[i].length(); + } + j += length; + } + return j; + } + + protected boolean isSpaceAvailableForDownload() { + long availableExternalMemorySize; + long j = spaceNeededToDownload; + if (j <= 0) { + long calculateDownloaded = ((TOTAL_SPACE_MB * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) - calculateDownloaded(new File(this.assetManager.getAssetPath())); + j = calculateDownloaded > 0 ? calculateDownloaded : PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED; + spaceNeededToDownload = j; + } + if (USE_INTERNAL_STORAGE) { + availableExternalMemorySize = MemoryStatus.getAvailableInternalMemorySize(); + Logging.DEBUG_OUT("Using main location: Internal Storage is " + availableExternalMemorySize); + } else { + availableExternalMemorySize = MemoryStatus.getAvailableExternalMemorySize(); + Logging.DEBUG_OUT("Using main location: External Storage is " + availableExternalMemorySize); + } + return availableExternalMemorySize >= j; + } + + protected boolean isSpaceAvailableForAlternativeDownload() { + long availableInternalMemorySize; + long j = spaceNeededToDownload; + if (j <= 0) { + long calculateDownloaded = ((TOTAL_SPACE_MB * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) - calculateDownloaded(new File(this.assetManager.getAssetPath())); + j = calculateDownloaded > 0 ? calculateDownloaded : PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED; + spaceNeededToDownload = j; + } + if (USE_INTERNAL_STORAGE) { + availableInternalMemorySize = MemoryStatus.getAvailableExternalMemorySize(); + Logging.DEBUG_OUT("Using alternative location: External Storage is " + availableInternalMemorySize); + } else { + availableInternalMemorySize = MemoryStatus.getAvailableInternalMemorySize(); + Logging.DEBUG_OUT("Using alternative location: Internal Storage is " + availableInternalMemorySize); + } + return availableInternalMemorySize >= j; + } + + public boolean checkForUpdates() { + if (ALTERNATIVE_DATA_FOLDER) { + this.assetManager.useAlternativeAssetPath(false); + if (this.assetManager.assetsFoundLocally() && !this.assetManager.checkForUpdates(this.downloadFileData)) { + Logging.DEBUG_OUT("Assets on main location and update NOT found."); + return false; + } + this.assetManager.useAlternativeAssetPath(true); + if (this.assetManager.assetsFoundLocally()) { + if (this.assetManager.checkForUpdates(this.downloadFileData)) { + Logging.DEBUG_OUT("Assets on alternative location and update found."); + return true; + } + Logging.DEBUG_OUT("Assets on alternative location and no update NOT found."); + return false; + } + Logging.DEBUG_OUT("[ERROR] Something very wrong happened: assets have been found previously, but cannot be found anymore."); + this.assetManager.useAlternativeAssetPath(false); + return true; + } + return this.assetManager.checkForUpdates(this.downloadFileData); + } + + private void checkBackgroundImage() { + Logging.DEBUG_OUT("Calling: DownloadActivityInternal checkBackgroundImage()"); + if (this.mContext == null || getBackgroundBitmap() != null) { + return; + } + try { + InputStream open = this.mContext.getAssets().open(getResourcesPath() + this.bgFileName); + if (open != null) { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inTempStorage = new byte[4096]; + setBackgroundBitmap(Bitmap.createBitmap(BitmapFactory.decodeStream(open, null, options))); + open.close(); + } + Logging.DEBUG_OUT("\tCreating background image"); + } catch (IOException unused) { + setBackgroundBitmap(null); + } + } + + private void checkLanguageChange() { + Logging.DEBUG_OUT("Calling: DownloadActivityInternal checkLanguageChange()"); + if (this.mContext == null || this.mContext.getResources().getConfiguration().locale.toString().equalsIgnoreCase(this.mLocale)) { + return; + } + language = new Language(); + this.mLocale = this.mContext.getResources().getConfiguration().locale.toString(); + String language2 = this.mContext.getResources().getConfiguration().locale.getLanguage(); + Logging.DEBUG_OUT("\tLocale: " + this.mLocale); + Logging.DEBUG_OUT("\tLanguage: " + language2); + if (language.loadStrings(this.mLocale) || language.loadStrings(language2)) { + return; + } + this.mLocale = "en"; + language.loadStrings("en"); + } + + public void onPause() { + Logging.DEBUG_OUT("DownloadActivityInternal.onPause()"); + if (this.pCurrentView != null) { + this.pCurrentView.pause(); + } + } + + public void startWifiDownload(final boolean z) { + Thread thread = new Thread() { // from class: com.eamobile.DownloadActivityInternal.1 + @Override // java.lang.Thread, java.lang.Runnable + public void run() { + while (DownloadActivityInternal.changingState) { + } + if (DownloadActivityInternal.this.isWifiAvailable()) { + Logging.DEBUG_OUT("checking wifi: OK"); + if (z) { + DownloadActivityInternal.this.cleanState(6); + if (DownloadActivityInternal.getTotalDownloadSizeMB() == 0) { + DownloadActivityInternal.this.setState(14); + return; + } else { + DownloadActivityInternal.this.setState(2); + return; + } + } + DownloadActivityInternal.this.setState(2); + return; + } + Logging.DEBUG_OUT("checking wifi: FAILED"); + if (z) { + DownloadActivityInternal.this.resumeState(6); + } else { + DownloadActivityInternal.this.setState(6); + } + } + }; + Logging.DEBUG_OUT("startWifiDownload"); + setState(15); + thread.start(); + } + + public void onResume() { + Logging.DEBUG_OUT("DownloadActivityInternal.onResume()"); + if (getState() == 6) { + startWifiDownload(true); + return; + } + if (getState() == 4) { + if (chooseAvailableMemory()) { + cleanState(4); + if (!this.assetManager.assetsFoundLocally()) { + setState(1); + return; + } else { + setState(8); + return; + } + } + resumeState(4); + return; + } + resumeState(getState()); + } + + public void onWindowFocusChanged(boolean z) { + Logging.DEBUG_OUT("DownloadActivityInternal.onWindowFocusChanged(focus == " + z + ")"); + if (instance != null) { + instance.getWindow().getDecorView().setSystemUiVisibility(5894); + } + } + + protected void initScreens(Context context) { + if (this.downloadMsgView == null) { + this.downloadMsgView = new DownloadMsgView(context); + } + if (this.showWifiView == null) { + this.showWifiView = new ShowWifiView(context); + } + if (this.networkUnavailableView == null) { + this.networkUnavailableView = new NetworkUnavailableView(context); + } + if (this.downloadProgressView == null) { + this.downloadProgressView = new DownloadProgressView(context); + } + if (this.downloadFailedView == null) { + this.downloadFailedView = new DownloadFailedView(context); + } + if (this.spaceUnavailableView == null) { + this.spaceUnavailableView = new SpaceUnavailableView(context); + } + if (this.checkUpdatesView == null) { + this.checkUpdatesView = new CheckUpdatesView(context); + } + if (this.updatesFoundView == null) { + this.updatesFoundView = new UpdatesFoundView(context); + } + if (this.show3GView == null) { + this.show3GView = new Show3GView(context); + } + if (this.showBGView == null) { + this.showBGView = new ShowBGView(context); + } + if (this.unSupportedDeviceView == null) { + this.unSupportedDeviceView = new UnSupportedDeviceView(context); + } + if (this.serverErrorView == null) { + this.serverErrorView = new ServerErrorView(context); + } + if (this.contactingServerView == null) { + this.contactingServerView = new ContactingServerView(context); + } + if (this.checkingHostIpView == null) { + this.checkingHostIpView = new CheckingHostIpView(context); + } + if (this.invalidAssetVersionView == null) { + this.invalidAssetVersionView = new InvalidAssetVersionView(context); + } + if (this.deletingAssetsView == null) { + this.deletingAssetsView = new DeletingAssetsView(context); + } + } + + public static long getSizeDownloaded() { + return downloadProgress.getSizeDownloaded(); + } + + public static long getRealDownloaded() { + return downloadProgress.getRealDownloaded(); + } + + public static boolean getFlagLastReportDownload() { + return downloadProgress.getFlagLastReportDownload(); + } + + public static void setFlagLastReportDownload(boolean z) { + downloadProgress.setFlagLastReportDownload(z); + } + + public int getPercentDownloaded() { + double sizeDownloaded = ((getSizeDownloaded() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / totalDownloadSizeMB; + if (this.percent_downloaded < 100) { + Double.isNaN(sizeDownloaded); + this.percent_downloaded = (int) (sizeDownloaded * 100.0d); + } else { + this.percent_downloaded = 100; + } + return this.percent_downloaded; + } + + public boolean checkLocalAssetVersion() { + if (MIN_ASSET_VERSION_REQUIRED != null) { + return this.assetManager.isAssetVersionCompatible(MIN_ASSET_VERSION_REQUIRED); + } + return true; + } + + public void setState(int i) { + try { + switch (i) { + case 1: + this.pCurrentView = this.downloadMsgView; + break; + case 2: + this.pCurrentView = this.downloadProgressView; + break; + case 3: + if (checkLocalAssetVersion()) { + Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = -1"); + this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); + ADCTelemetry.getInstance().sendTelemetry(1); + try { + Thread.sleep(1000L); + } catch (Exception unused) { + } + ADCTelemetry.getInstance().onDestroy(); + Logging.DEBUG_CLOSE(); + return; + } + this.pCurrentView = this.invalidAssetVersionView; + break; + case 4: + this.pCurrentView = this.spaceUnavailableView; + break; + case 5: + this.downloadFailedView.setErrorCode(getLastError()); + ADCTelemetry.getInstance().sendTelemetry(3, "MINOR ERROR - error code=" + Integer.toString(getLastError())); + this.pCurrentView = this.downloadFailedView; + break; + case 6: + this.pCurrentView = this.showWifiView; + break; + case 7: + this.pCurrentView = this.networkUnavailableView; + break; + case 8: + this.pCurrentView = this.checkUpdatesView; + break; + case 9: + this.pCurrentView = this.updatesFoundView; + break; + case 10: + this.pCurrentView = this.show3GView; + break; + case 11: + this.pCurrentView = this.showBGView; + break; + case 12: + ADCTelemetry.getInstance().sendTelemetry(3, "CRITICAL ERROR - error code=" + Integer.toString(getLastError())); + this.pCurrentView = this.unSupportedDeviceView; + break; + case 13: + ADCTelemetry.getInstance().sendTelemetry(3, "CRITICAL ERROR - error code=" + Integer.toString(getLastError())); + this.pCurrentView = this.serverErrorView; + break; + case 14: + this.pCurrentView = this.contactingServerView; + break; + case 15: + this.pCurrentView = this.checkingHostIpView; + break; + case 16: + this.pCurrentView = this.deletingAssetsView; + break; + } + Runnable runnable = new Runnable() { // from class: com.eamobile.DownloadActivityInternal.2 + @Override // java.lang.Runnable + public void run() { + Logging.DEBUG_OUT("DownloadActivityInternal setState - Making a new runnable to init."); + if (DownloadActivityInternal.instance != null && DownloadActivityInternal.this.pCurrentView != null) { + DownloadActivityInternal.instance.runOnUiThread(new Runnable() { // from class: com.eamobile.DownloadActivityInternal.2.1 + @Override // java.lang.Runnable + public void run() { + Logging.DEBUG_OUT("setState: pCurrentView = " + DownloadActivityInternal.this.pCurrentView); + Logging.DEBUG_OUT("setState: before calling pCurrentView.init()"); + DownloadActivityInternal.this.pCurrentView.init(); + Logging.DEBUG_OUT("setState: after calling pCurrentView.init()"); + DownloadActivityInternal.instance.setContentView(DownloadActivityInternal.this.pCurrentView); + Logging.DEBUG_OUT("setState: after calling setContentView"); + } + }); + } + boolean unused2 = DownloadActivityInternal.changingState = false; + } + }; + changingState = true; + this.mHandler.postDelayed(runnable, 20L); + pStatePrev = pState; + pState = i; + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred in setState:"); + Logging.DEBUG_OUT_STACK(e); + } + } + + public void resumeState(int i) { + StringBuilder sb = new StringBuilder(); + sb.append("DownloadActivityInternal resumeState: "); + sb.append(i == -1 ? "STATE_INVALID" : STATE_STRINGS[i]); + Logging.DEBUG_OUT(sb.toString()); + try { + switch (i) { + case 1: + this.pCurrentView = this.downloadMsgView; + break; + case 2: + this.pCurrentView = this.downloadProgressView; + break; + case 3: + if (checkLocalAssetVersion()) { + Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = -1"); + this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); + Logging.DEBUG_CLOSE(); + return; + } + this.pCurrentView = this.invalidAssetVersionView; + break; + case 4: + this.pCurrentView = this.spaceUnavailableView; + break; + case 5: + this.pCurrentView = this.downloadFailedView; + break; + case 6: + this.pCurrentView = this.showWifiView; + break; + case 7: + this.pCurrentView = this.networkUnavailableView; + break; + case 8: + this.pCurrentView = this.checkUpdatesView; + break; + case 9: + this.pCurrentView = this.updatesFoundView; + break; + case 10: + this.pCurrentView = this.show3GView; + break; + case 11: + this.pCurrentView = this.showBGView; + break; + case 12: + this.pCurrentView = this.unSupportedDeviceView; + break; + case 13: + this.pCurrentView = this.serverErrorView; + break; + case 14: + this.pCurrentView = this.contactingServerView; + break; + case 15: + this.pCurrentView = this.checkingHostIpView; + break; + case 16: + this.pCurrentView = this.deletingAssetsView; + break; + } + this.mHandler.postDelayed(new Runnable() { // from class: com.eamobile.DownloadActivityInternal.3 + @Override // java.lang.Runnable + public void run() { + Logging.DEBUG_OUT("DownloadActivityInternal resumeState - Making a new runnable to resume."); + if (DownloadActivityInternal.instance == null || DownloadActivityInternal.this.pCurrentView == null) { + return; + } + Logging.DEBUG_OUT("resumeState: pCurrentView = " + DownloadActivityInternal.this.pCurrentView); + Logging.DEBUG_OUT("resumeState: before calling pCurrentView.resume()"); + DownloadActivityInternal.this.pCurrentView.resume(); + Logging.DEBUG_OUT("resumeState: after calling pCurrentView.resume()"); + } + }, 20L); + pState = i; + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while resuming State:"); + Logging.DEBUG_OUT_STACK(e); + } + } + + public int getState() { + return pState; + } + + public String getStateName() { + return pState != -1 ? STATE_STRINGS[pState] : "STATE_INVALID"; + } + + protected int getPreviousState() { + return pStatePrev; + } + + public void onDestroy() { + Logging.DEBUG_OUT("DownloadActivityInternal.onDestroy()"); + unregisterWifiReceiver(); + cleanStates(); + isInitialized = false; + instance = null; + downloadProgress = null; + this.assetManager = null; + mMainActivity = null; + language = null; + } + + public void destroyDownloadActvity() { + if (getBackgroundBitmap() != null) { + getBackgroundBitmap().recycle(); + setBackgroundBitmap(null); + } + unregisterWifiReceiver(); + cleanStates(); + isInitialized = false; + instance = null; + mMainActivity = null; + downloadProgress = null; + this.assetManager = null; + pState = -1; + } + + /* JADX INFO: Access modifiers changed from: private */ + public void cleanState(int i) { + try { + switch (i) { + case 1: + this.pCurrentView = this.downloadMsgView; + break; + case 2: + this.pCurrentView = this.downloadProgressView; + break; + case 3: + if (checkLocalAssetVersion()) { + Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = -1"); + this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); + Logging.DEBUG_CLOSE(); + return; + } + this.pCurrentView = this.invalidAssetVersionView; + break; + case 4: + this.pCurrentView = this.spaceUnavailableView; + break; + case 5: + this.pCurrentView = this.downloadFailedView; + break; + case 6: + this.pCurrentView = this.showWifiView; + break; + case 7: + this.pCurrentView = this.networkUnavailableView; + break; + case 8: + this.pCurrentView = this.checkUpdatesView; + break; + case 9: + this.pCurrentView = this.updatesFoundView; + break; + case 10: + this.pCurrentView = this.show3GView; + break; + case 11: + this.pCurrentView = this.showBGView; + break; + case 12: + this.pCurrentView = this.unSupportedDeviceView; + break; + case 13: + this.pCurrentView = this.serverErrorView; + break; + case 14: + this.pCurrentView = this.contactingServerView; + break; + case 15: + this.pCurrentView = this.checkingHostIpView; + break; + case 16: + this.pCurrentView = this.deletingAssetsView; + break; + } + this.pCurrentView.clean(); + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while cleaning state:" + e); + } + } + + private void cleanStates() { + if (this.downloadMsgView != null) { + this.downloadMsgView.clean(); + } + if (this.showWifiView != null) { + this.showWifiView.clean(); + } + if (this.networkUnavailableView != null) { + this.networkUnavailableView.clean(); + } + if (this.downloadProgressView != null) { + this.downloadProgressView.clean(); + } + if (this.downloadFailedView != null) { + this.downloadFailedView.clean(); + } + if (this.spaceUnavailableView != null) { + this.spaceUnavailableView.clean(); + } + if (this.checkUpdatesView != null) { + this.checkUpdatesView.clean(); + } + if (this.updatesFoundView != null) { + this.updatesFoundView.clean(); + } + if (this.show3GView != null) { + this.show3GView.clean(); + } + if (this.showBGView != null) { + this.showBGView.clean(); + } + if (this.unSupportedDeviceView != null) { + this.unSupportedDeviceView.clean(); + } + if (this.serverErrorView != null) { + this.serverErrorView.clean(); + } + if (this.contactingServerView != null) { + this.contactingServerView.clean(); + } + if (this.checkingHostIpView != null) { + this.checkingHostIpView.clean(); + } + if (this.invalidAssetVersionView != null) { + this.invalidAssetVersionView.clean(); + } + if (this.deletingAssetsView != null) { + this.deletingAssetsView.clean(); + } + this.showBGView = null; + this.show3GView = null; + this.updatesFoundView = null; + this.checkUpdatesView = null; + this.downloadMsgView = null; + this.showWifiView = null; + this.networkUnavailableView = null; + this.downloadProgressView = null; + this.downloadFailedView = null; + this.spaceUnavailableView = null; + this.unSupportedDeviceView = null; + this.serverErrorView = null; + this.contactingServerView = null; + this.checkingHostIpView = null; + this.invalidAssetVersionView = null; + this.deletingAssetsView = null; + } + + public boolean isWifiAvailable() { + WifiManager wifiManager = (WifiManager) instance.getApplicationContext().getSystemService("wifi"); + boolean isWifiEnabled = wifiManager.isWifiEnabled(); + return isWifiEnabled ? wifiManager.getConnectionInfo().getSupplicantState() == SupplicantState.COMPLETED : isWifiEnabled; + } + + public boolean canFindHostIP() { + try { + Logging.DEBUG_OUT("Getting host name from URL: " + DOWNLOAD_URL); + Logging.DEBUG_OUT("Host name: " + new URL(DOWNLOAD_URL).getHost()); + try { + BasicHttpParams basicHttpParams = new BasicHttpParams(); + HttpConnectionParams.setConnectionTimeout(basicHttpParams, 5000); + HttpConnectionParams.setSoTimeout(basicHttpParams, 5000); + return new DefaultHttpClient(basicHttpParams).execute((HttpUriRequest) new HttpGet(DOWNLOAD_URL)).getStatusLine().getStatusCode() == 200; + } catch (Exception e) { + Logging.DEBUG_OUT_STACK(e); + return false; + } + } catch (MalformedURLException unused) { + Logging.DEBUG_OUT("Not found: URL is malformed"); + return false; + } + } + + public void startWifiManager() { + try { + instance.startActivity(new Intent("android.settings.WIFI_SETTINGS")); + } catch (ActivityNotFoundException unused) { + Logging.DEBUG_OUT("[ERROR] Unable to find an Activity to open Wifi settings."); + instance.startActivity(new Intent("android.settings.SETTINGS")); + } + } + + protected void start3GManager() { + instance.startActivity(new Intent("android.settings.NETWORK_OPERATOR_SETTINGS")); + } + + public void startDataManagement() { + instance.startActivity(new Intent("android.settings.MEMORY_CARD_SETTINGS")); + } + + protected boolean isConnected() { + NetworkInfo activeNetworkInfo = ((ConnectivityManager) instance.getSystemService("connectivity")).getActiveNetworkInfo(); + return activeNetworkInfo != null && activeNetworkInfo.isConnected() && activeNetworkInfo.isAvailable(); + } + + public boolean test3GNetwork() { + NetworkInfo activeNetworkInfo = ((ConnectivityManager) instance.getSystemService("connectivity")).getActiveNetworkInfo(); + if (activeNetworkInfo == null || !activeNetworkInfo.isConnected() || !activeNetworkInfo.isAvailable()) { + return false; + } + if (activeNetworkInfo.getType() != 1) { + activeNetworkInfo.getType(); + } + return true; + } + + protected int is3G() { + NetworkInfo activeNetworkInfo = ((ConnectivityManager) instance.getSystemService("connectivity")).getActiveNetworkInfo(); + return (activeNetworkInfo != null && activeNetworkInfo.isConnected() && activeNetworkInfo.isAvailable() && activeNetworkInfo.getType() == 0) ? 1 : 0; + } + + public boolean testNetwork(int[] iArr) { + iArr[0] = -1; + NetworkInfo activeNetworkInfo = ((ConnectivityManager) instance.getSystemService("connectivity")).getActiveNetworkInfo(); + if (activeNetworkInfo == null || !activeNetworkInfo.isConnected() || !activeNetworkInfo.isAvailable()) { + return false; + } + iArr[0] = activeNetworkInfo.getType(); + return true; + } + + public void updateDownload() { + this.assetManager.prepareSDCard(); + if (DELETE_ASSETS_ON_UPDATE) { + if (UNSAFE_ASSET_DELETION_ON_UPDATE) { + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + Logging.DEBUG_OUT("Deleting assets without any additional checking:"); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + Logging.DEBUG_OUT(" "); + setState(16); + return; + } + Logging.DEBUG_OUT("Checking for asset deletion:"); + Properties loadAssetInfo = this.assetManager.loadAssetInfo(); + if (loadAssetInfo != null) { + String property = loadAssetInfo.getProperty("packageName"); + if (property != null) { + Logging.DEBUG_OUT("packageName read from AssetInfo.indicate: " + property); + Logging.DEBUG_OUT("application packageName: " + this.mContext.getPackageName()); + if (property.equals(this.mContext.getPackageName())) { + Logging.DEBUG_OUT("packageNames match"); + setState(16); + return; + } + Logging.DEBUG_OUT("packageNames DO NOT match"); + } else { + Logging.DEBUG_OUT("packageName not found"); + } + } else { + Logging.DEBUG_OUT("properties not found"); + } + } + setState(1); + } + + public void deleteAssets() { + if (UNSAFE_ASSET_DELETION_ON_UPDATE) { + this.assetManager.deleteEntireDownloadFolder(); + } else { + this.assetManager.deleteAssets(); + } + } + + public boolean startDownload() { + Logging.DEBUG_OUT("DownloadActivityInternal.startDownload()"); + this.assetManager.saveStateDownloadStarted(); + if (this.downloadFileData != null && this.downloadFileData.length > 0) { + totalDownloadSizeMB = getTotalDownloadSize(this.downloadFileData); + Logging.DEBUG_OUT("Total Download Size: " + totalDownloadSizeMB + " MB"); + boolean startDownloadingFiles = startDownloadingFiles(this.downloadFileData); + Logging.DEBUG_OUT("startDownload expectedResult: " + startDownloadingFiles); + return startDownloadingFiles; + } + checkServerContent(false); + return false; + } + + private boolean startDownloadingFiles(DownloadFileData[] downloadFileDataArr) { + if (!isConnected()) { + Logging.DEBUG_OUT("[ERROR] Connection unavailable"); + recordError(-16); + return false; + } + int i = 0; + boolean z = false; + while (true) { + try { + if (i >= downloadFileDataArr.length) { + break; + } + DownloadFileData downloadFileData = downloadFileDataArr[i]; + if (downloadFileData.getType() == 1) { + if (!UNCOMPRESS_ZIP_ON_DEVICE) { + Logging.DEBUG_OUT("File to download (ZIP): " + downloadFileData.getFileName()); + Logging.DEBUG_OUT("Files will be downloaded using a ZipInputStream: will NOT be ale to resume"); + Hashtable checksumsHashtable = getChecksumsHashtable(downloadFileData.getFileName(), downloadFileDataArr); + if (checksumsHashtable == null) { + Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); + recordError(-13); + return false; + } + if (!this.assetManager.isFileDownloaded(downloadFileData.getFileName())) { + Logging.DEBUG_OUT("Downloading file: " + downloadFileData.getFileName()); + z = downloadAndValidateZipFile(downloadFileData, checksumsHashtable); + if (!z) { + break; + } + this.assetManager.saveState(downloadFileData.getFileName() + "\t" + downloadFileData.getVersion(), null); + downloadProgress.setCurrentFile("n_" + downloadFileData.getFileName(), downloadFileData.getSize()); + downloadProgress.fillCurrentFileDownload(false); + } else { + Logging.DEBUG_OUT("File already downloaded:" + downloadFileData.getFileName()); + downloadProgress.setCurrentFile("n_" + downloadFileData.getFileName(), downloadFileData.getSize()); + downloadProgress.fillCurrentFileDownload(true); + setFlagLastReportDownload(false); + z = true; + } + } else { + Logging.DEBUG_OUT("File to download (ZIP): " + downloadFileData.getFileName()); + Logging.DEBUG_OUT("Zip will be downloaded and uncompressed on device: resume is possible"); + Hashtable checksumsHashtable2 = getChecksumsHashtable(downloadFileData.getFileName(), downloadFileDataArr); + if (checksumsHashtable2 == null) { + Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); + recordError(-13); + return false; + } + if (!this.assetManager.isFileDownloaded(downloadFileData.getFileName())) { + Logging.DEBUG_OUT("Downloading file: " + downloadFileData.getFileName()); + if (!downloadOtherFile(downloadFileData, null)) { + z = false; + break; + } + z = extractAndValidateFilesFromZip(downloadFileData.getFileName(), checksumsHashtable2); + new File(this.assetManager.getFilePath(downloadFileData.getFileName())).delete(); + if (z) { + this.assetManager.saveState(downloadFileData.getFileName() + "\t" + downloadFileData.getVersion(), null); + } else { + recordError(-12); + break; + } + } else { + Logging.DEBUG_OUT("File already downloaded:" + downloadFileData.getFileName()); + downloadProgress.setCurrentFile("n_" + downloadFileData.getFileName(), downloadFileData.getSize()); + downloadProgress.fillCurrentFileDownload(true); + setFlagLastReportDownload(false); + z = true; + } + } + } else if (downloadFileData.getType() == 3) { + Logging.DEBUG_OUT("File to download (NON-ZIP): " + downloadFileData.getFileName()); + Hashtable checksumsHashtable3 = getChecksumsHashtable(downloadFileData.getFileName(), downloadFileDataArr); + if (checksumsHashtable3 == null) { + Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); + recordError(-13); + return false; + } + if (!this.assetManager.isFileDownloaded(downloadFileData.getFileName())) { + Logging.DEBUG_OUT("Downloading file: " + downloadFileData.getFileName()); + z = downloadOtherFile(downloadFileData, checksumsHashtable3); + if (!z) { + break; + } + this.assetManager.saveState(downloadFileData.getFileName() + "\t" + downloadFileData.getVersion(), null); + } else { + Logging.DEBUG_OUT("File already downloaded:" + downloadFileData.getFileName()); + downloadProgress.setCurrentFile("n_" + downloadFileData.getFileName(), downloadFileData.getSize()); + downloadProgress.fillCurrentFileDownload(true); + setFlagLastReportDownload(false); + z = true; + } + } else { + continue; + } + i++; + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while downloading files: " + e); + Logging.DEBUG_OUT_STACK(e); + return false; + } + } + if (z) { + this.assetManager.saveStateDownloadFinished(); + this.assetManager.saveDownloadListFile(downloadFileDataArr); + this.assetManager.saveAssetInfo(generateAssetInfo()); + this.percent_downloaded = 100; + Logging.DEBUG_OUT("[FINISHED] All files downloaded successfully."); + } else { + Logging.DEBUG_OUT("[ERROR] Assets download failed."); + } + return z; + } + + public boolean checkScreenSizeChange() { + if (!REDOWNLOAD_ON_SCREEN_SIZE_CHANGE) { + return false; + } + Logging.DEBUG_OUT("Checking for screen size change..."); + Properties loadAssetInfo = this.assetManager.loadAssetInfo(); + if (loadAssetInfo != null) { + String property = loadAssetInfo.getProperty("width"); + String property2 = loadAssetInfo.getProperty("height"); + if (property != null && property2 != null) { + try { + int parseInt = Integer.parseInt(property); + int parseInt2 = Integer.parseInt(property2); + Logging.DEBUG_OUT("Device width: " + width); + Logging.DEBUG_OUT("Assets width: " + parseInt); + Logging.DEBUG_OUT("Device height: " + height); + Logging.DEBUG_OUT("Assets height: " + parseInt2); + if (parseInt == width && parseInt2 == height) { + Logging.DEBUG_OUT("NO screen change detected."); + return false; + } + Logging.DEBUG_OUT("Screen change detected."); + return true; + } catch (Exception e) { + Logging.DEBUG_OUT("Invalid information."); + Logging.DEBUG_OUT_STACK(e); + return false; + } + } + Logging.DEBUG_OUT("No information found."); + return false; + } + Logging.DEBUG_OUT("No information found."); + return false; + } + + private Properties generateAssetInfo() { + Properties properties = new Properties(); + properties.setProperty("packageName", this.mContext.getPackageName()); + properties.setProperty("width", String.valueOf(width)); + properties.setProperty("height", String.valueOf(height)); + return properties; + } + + /* JADX WARN: Removed duplicated region for block: B:92:0x020b A[Catch: Exception -> 0x020e, TRY_ENTER, TRY_LEAVE, TryCatch #2 {Exception -> 0x020e, blocks: (B:30:0x01ed, B:92:0x020b), top: B:3:0x0002 }] */ + /* JADX WARN: Removed duplicated region for block: B:94:? A[RETURN, SYNTHETIC] */ + /* JADX WARN: Removed duplicated region for block: B:95:0x0206 A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private boolean downloadOtherFile(com.eamobile.download.DownloadFileData r12, java.util.Hashtable r13) { + /* + Method dump skipped, instructions count: 539 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.downloadOtherFile(com.eamobile.download.DownloadFileData, java.util.Hashtable):boolean"); + } + + private boolean extractAndValidateFilesFromZip(String str, Hashtable hashtable) { + Logging.DEBUG_OUT("Extracting files from Zip: " + str); + try { + FileInputStream fileInputStream = new FileInputStream(this.assetManager.getFilePath(str)); + Thread.sleep(1000L); + return checkZipExtractorResult(new ZipExtractor().extractFiles(fileInputStream, hashtable, this.assetManager.getAssetPath(), TIMEOUT, new LocalZipExtractorEvent())); + } catch (IOException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException unused) { + return false; + } + } + + private boolean checkZipExtractorResult(int i) { + switch (i) { + case -4: + recordError(-11); + break; + case -3: + setStateChecksumError(); + break; + case -2: + case -1: + recordError(-12); + break; + } + return false; + } + + private boolean downloadAndValidateZipFile(DownloadFileData downloadFileData, Hashtable hashtable) { + String fileURL = downloadFileData.getFileURL(); + Logging.DEBUG_OUT("Downloading Zip:" + fileURL); + try { + URLConnection openConnection = new URL(fileURL).openConnection(); + openConnection.setConnectTimeout(30000); + openConnection.setReadTimeout(30000); + InputStream inputStream = openConnection.getInputStream(); + if (inputStream == null) { + return false; + } + return checkZipExtractorResult(new ZipExtractor().extractFiles(inputStream, hashtable, this.assetManager.getAssetPath(), TIMEOUT, new RemoteZipExtractorEvent(downloadProgress, downloadFileData))); + } catch (MalformedURLException e) { + e.printStackTrace(); + return false; + } catch (IOException e2) { + e2.printStackTrace(); + return false; + } + } + + /* JADX WARN: Removed duplicated region for block: B:45:0x00b4 A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private java.util.Hashtable getChecksumsHashtable(java.lang.String r8, com.eamobile.download.DownloadFileData[] r9) { + /* + Method dump skipped, instructions count: 192 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.getChecksumsHashtable(java.lang.String, com.eamobile.download.DownloadFileData[]):java.util.Hashtable"); + } + + private DownloadFileData getMatchingChecksumFile(String str, DownloadFileData[] downloadFileDataArr) { + for (int i = 0; i < downloadFileDataArr.length; i++) { + if (downloadFileDataArr[i].getType() == 2 && downloadFileDataArr[i].getFileName().contains(str)) { + return downloadFileDataArr[i]; + } + } + return null; + } + + /* JADX WARN: Removed duplicated region for block: B:33:0x030a A[Catch: Exception -> 0x047e, TryCatch #0 {Exception -> 0x047e, blocks: (B:31:0x025d, B:33:0x030a, B:35:0x0326, B:39:0x0330, B:40:0x033c, B:42:0x0342, B:44:0x03d6, B:45:0x03df, B:47:0x03e5, B:49:0x041b, B:53:0x0430, B:55:0x0438, B:58:0x0440, B:60:0x0448, B:64:0x0453, B:71:0x0469), top: B:30:0x025d, inners: #3 }] */ + /* JADX WARN: Removed duplicated region for block: B:72:0x047d A[RETURN] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private int updateDownloadFilesData(boolean r19) { + /* + Method dump skipped, instructions count: 1166 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.updateDownloadFilesData(boolean):int"); + } + + public void recordError(int i) { + mErrorList.add(Integer.valueOf(i)); + Logging.DEBUG_OUT("ERROR OCCURRED: " + i + " (total: " + mErrorList.size() + ")"); + } + + public int getLastError() { + if (mErrorList.size() == 0) { + return 0; + } + return mErrorList.get(mErrorList.size() - 1).intValue(); + } + + public int getNumErrors() { + return mErrorList.size(); + } + + public void setStateChecksumError() { + recordError(-10); + this.serverErrorView.setErrorCode(getLastError()); + setState(13); + } + + private JSONObject sendHttpPost(String str, JSONObject jSONObject) { + InputStream inputStream; + try { + CloseableHttpClient defaultHttpClient = new DefaultHttpClient(); + HttpConnectionParams.setConnectionTimeout(defaultHttpClient.getParams(), 10000); + HttpPost httpPost = new HttpPost(str); + httpPost.setEntity(new StringEntity(jSONObject.toString())); + httpPost.setHeader(HttpHeaders.ACCEPT, "application/json"); + httpPost.setHeader("Content-type", "application/json"); + HttpEntity entity = defaultHttpClient.execute((HttpUriRequest) httpPost).getEntity(); + if (entity != null) { + inputStream = entity.getContent(); + try { + try { + JSONObject jSONObject2 = new JSONObject(convertStreamToString(inputStream)); + unknownHostExceptionTryAgain = true; + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused) { + } + } + return jSONObject2; + } catch (Throwable th) { + th = th; + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused2) { + } + } + throw th; + } + } catch (Exception e) { + e = e; + Logging.DEBUG_OUT("[ERROR] An exception occurred in sendHttpPost while trying to obtain the file list."); + Logging.DEBUG_OUT_STACK(e); + Logging.DEBUG_OUT("URL: " + str); + Logging.DEBUG_OUT("jsonObjSend: " + jSONObject); + if (unknownHostExceptionTryAgain) { + Logging.DEBUG_OUT("Trying sendHttpPost again..."); + unknownHostExceptionTryAgain = false; + JSONObject sendHttpPost = sendHttpPost(str, jSONObject); + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused3) { + } + } + return sendHttpPost; + } + Logging.DEBUG_OUT("Already tried sendHttpPost after failure."); + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused4) { + } + } + return null; + } + } + } catch (Exception e2) { + e = e2; + inputStream = null; + } catch (Throwable th2) { + th = th2; + inputStream = null; + } + return null; + } + + protected String getAndroidUniqueId() { + String string = Settings.Secure.getString(instance.getContentResolver(), "android_id"); + String deviceId = ((TelephonyManager) instance.getSystemService(PlaceFields.PHONE)).getDeviceId(); + if (string != null) { + return "androidId=" + string + "&imei=" + deviceId; + } + return "imei=" + deviceId; + } + + protected String getDeviceString() { + String str = getManufacturer() + com.google.android.vending.expansion.downloader.Constants.FILENAME_SEQUENCE_SEPARATOR + getModel(); + try { + return URLEncoder.encode(str, HTTP.UTF_8); + } catch (Exception e) { + Logging.DEBUG_OUT("getDeviceString Encode Exception:" + e); + return str; + } + } + + protected String getManufacturer() { + try { + return Build.MANUFACTURER; + } catch (Exception e) { + Logging.DEBUG_OUT("getManufacturer Exception:" + e); + return AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN; + } + } + + protected String getModel() { + try { + return Build.MODEL; + } catch (Exception e) { + Logging.DEBUG_OUT("getModel Exception:" + e); + return AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN; + } + } + + protected String getBrand() { + String str = Build.BRAND; + try { + return URLEncoder.encode(str, HTTP.UTF_8); + } catch (Exception unused) { + return str; + } + } + + public String getApplicationName() { + try { + return instance.getString(instance.getPackageManager().getPackageInfo(instance.getPackageName(), 0).applicationInfo.labelRes); + } catch (PackageManager.NameNotFoundException unused) { + return ""; + } + } + + protected String getAPKVersion() { + try { + return instance.getPackageManager().getPackageInfo(instance.getPackageName(), 0).versionName; + } catch (PackageManager.NameNotFoundException unused) { + return ""; + } + } + + public void startGameActivity(int i) { + ADCTelemetry.getInstance().sendTelemetry(4); + try { + Thread.sleep(1000L); + } catch (InterruptedException unused) { + } + ADCTelemetry.getInstance().onDestroy(); + Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = " + i); + this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), i); + Logging.DEBUG_CLOSE(); + } + + private String readUrlFromFile() { + try { + File file = new File(this.assetManager.getFilePath(DOWNLOAD_URL_CONFIG_FILE)); + if (file.exists()) { + BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); + String readLine = bufferedReader.readLine(); + bufferedReader.close(); + return readLine; + } + Logging.DEBUG_OUT("\t\tDownloadURL.indicate does not exist."); + return null; + } catch (Exception e) { + Logging.DEBUG_OUT("\t\tException while reading DownloadURL.indicate: " + e); + return null; + } + } + + private void checkPermissions() { + try { + PackageManager packageManager = this.mContext.getPackageManager(); + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("[uses-permission tags]"); + Logging.DEBUG_OUT("Checking permissions for package: " + this.mContext.getPackageName()); + List asList = Arrays.asList(packageManager.getPackageInfo(this.mContext.getPackageName(), 4096).requestedPermissions); + boolean z = false; + for (int i = 0; i < EXPECTED_PERMISSIONS.length; i++) { + if (!asList.contains(EXPECTED_PERMISSIONS[i])) { + Logging.DEBUG_OUT("\tPermission " + EXPECTED_PERMISSIONS[i] + " is missing."); + z = true; + } + } + if (z) { + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + Logging.DEBUG_OUT("\tOne or more expected permissions is missing. Please check uses-permission tags in AndroidManifest.xml"); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + } else { + Logging.DEBUG_OUT("\tPermissions OK."); + } + Logging.DEBUG_OUT(" "); + } catch (Exception e) { + Logging.DEBUG_OUT_STACK(e); + } + } + + private void loadConfigProperties() { + try { + try { + Properties properties = new Properties(); + properties.load(instance.getAssets().open(getResourcesPath() + "config.properties")); + MASTER_SELL_ID = Integer.parseInt(properties.getProperty("MASTER_SELL_ID").trim()); + TOTAL_SPACE_MB = Integer.parseInt(properties.getProperty("TOTAL_SPACE_MB").trim()); + PRODUCT_ID = Integer.parseInt(properties.getProperty("PRODUCT_ID").trim()); + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("[config.properties]"); + Logging.DEBUG_OUT("\tMASTER_SELL_ID: " + MASTER_SELL_ID); + Logging.DEBUG_OUT("\tPRODUCT_ID: " + PRODUCT_ID); + Logging.DEBUG_OUT("\tTOTAL_SPACE_MB: " + TOTAL_SPACE_MB); + String property = properties.getProperty("USE_INTERNAL_STORAGE"); + if (property != null) { + USE_INTERNAL_STORAGE = Boolean.parseBoolean(property.trim()); + } + Logging.DEBUG_OUT("\tUSE_INTERNAL_STORAGE: " + USE_INTERNAL_STORAGE); + String property2 = properties.getProperty("ALTERNATIVE_DATA_FOLDER"); + if (property2 != null) { + ALTERNATIVE_DATA_FOLDER = Boolean.parseBoolean(property2.trim()); + } + Logging.DEBUG_OUT("\tALTERNATIVE_DATA_FOLDER: " + ALTERNATIVE_DATA_FOLDER); + String property3 = properties.getProperty("DATA_FOLDER"); + if (property3 != null) { + Logging.DEBUG_OUT("\tDATA_FOLDER: " + property3); + setAssetPathAux(property3, true); + } else { + Logging.DEBUG_OUT("\tDATA_FOLDER not specified in config.properties"); + if (this.callSetAssetPathAux) { + setAssetPathAux(this.activityAssetPath, this.activityUseExternal); + } else { + Logging.DEBUG_OUT("[ERROR] DATA_FOLDER not specified in config.properties and setAssetPath() was not called from game's activity."); + } + } + String property4 = properties.getProperty("TIMEOUT"); + if (property4 != null) { + try { + int parseInt = Integer.parseInt(property4.trim()); + if (parseInt > 0) { + TIMEOUT = parseInt * 1000; + Logging.DEBUG_OUT("\tTIMEOUT read from config.properties"); + } + } catch (Exception e) { + Logging.DEBUG_OUT("\t" + e.toString()); + } + } + Logging.DEBUG_OUT("\tTIMEOUT: " + TIMEOUT + " milliseconds"); + String property5 = properties.getProperty("READ_DOWNLOAD_URL_FROM_SDCARD"); + if (property5 != null) { + property5 = property5.trim(); + } + if (Boolean.parseBoolean(property5)) { + Logging.DEBUG_OUT("\tWill try to read DOWNLOAD_URL from SD card..."); + String readUrlFromFile = readUrlFromFile(); + if (readUrlFromFile != null) { + Logging.DEBUG_OUT("\t\tOK: DOWNLOAD_URL read from SD Card"); + DOWNLOAD_URL = readUrlFromFile; + } else { + Logging.DEBUG_OUT("\t\tFAILED. Will use DOWNLOAD_URL defined in config.properties"); + DOWNLOAD_URL = properties.getProperty("DOWNLOAD_URL").trim(); + } + } else { + DOWNLOAD_URL = properties.getProperty("DOWNLOAD_URL").trim(); + } + Logging.DEBUG_OUT("\tDOWNLOAD_URL: " + DOWNLOAD_URL); + String property6 = properties.getProperty("UNCOMPRESS_ZIP_ON_DEVICE"); + if (property6 != null) { + property6 = property6.trim(); + } + UNCOMPRESS_ZIP_ON_DEVICE = Boolean.parseBoolean(property6); + Logging.DEBUG_OUT("\tUNCOMPRESS_ZIP_ON_DEVICE: " + UNCOMPRESS_ZIP_ON_DEVICE); + String property7 = properties.getProperty("CUSTOM_PROGRESS_BAR"); + if (property7 != null) { + CUSTOM_PROGRESS_BAR = Boolean.parseBoolean(property7.trim()); + } + Logging.DEBUG_OUT("\tCUSTOM_PROGRESS_BAR: " + CUSTOM_PROGRESS_BAR); + String property8 = properties.getProperty("USE_OLD_PROGRESS_BAR"); + if (property8 != null) { + USE_OLD_PROGRESS_BAR = Boolean.parseBoolean(property8.trim()); + } + Logging.DEBUG_OUT("\tUSE_OLD_PROGRESS_BAR: " + USE_OLD_PROGRESS_BAR); + String property9 = properties.getProperty("TOTAL_SPACE_MB_MIN"); + if (property9 != null) { + try { + TOTAL_SPACE_MB_MIN = Integer.parseInt(property9.trim()); + } catch (Exception e2) { + Logging.DEBUG_OUT("\t" + e2.toString()); + } + } + Logging.DEBUG_OUT("\tTOTAL_SPACE_MB_MIN: " + TOTAL_SPACE_MB_MIN); + if (TOTAL_SPACE_MB_MIN > 0 && TOTAL_SPACE_MB > TOTAL_SPACE_MB_MIN) { + isDownloadRange = true; + } else { + isDownloadRange = false; + } + String property10 = properties.getProperty("DISABLE_3G"); + if (property10 != null) { + DISABLE_3G = Boolean.parseBoolean(property10.trim()); + } + Logging.DEBUG_OUT("\tDISABLE_3G: " + DISABLE_3G); + String property11 = properties.getProperty("FORCE_WAKE_DURING_DOWNLOAD"); + if (property11 != null) { + setForceWakeDuringDownload(Boolean.parseBoolean(property11.trim())); + } + Logging.DEBUG_OUT("\tFORCE_WAKE_DURING_DOWNLOAD: " + getForceWakeDuringDownload()); + String property12 = properties.getProperty("DO_NOT_OPEN_STORAGE_SETTINGS"); + if (property12 != null) { + DO_NOT_OPEN_STORAGE_SETTINGS = Boolean.parseBoolean(property12.trim()); + } + Logging.DEBUG_OUT("\tDO_NOT_OPEN_STORAGE_SETTINGS: " + DO_NOT_OPEN_STORAGE_SETTINGS); + MIN_ASSET_VERSION_REQUIRED = properties.getProperty("MIN_ASSET_VERSION_REQUIRED"); + Logging.DEBUG_OUT("\tMIN_ASSET_VERSION_REQUIRED: " + MIN_ASSET_VERSION_REQUIRED); + String property13 = properties.getProperty("DELETE_ASSETS_ON_UPDATE"); + if (property13 != null) { + DELETE_ASSETS_ON_UPDATE = Boolean.parseBoolean(property13.trim()); + } + Logging.DEBUG_OUT("\tDELETE_ASSETS_ON_UPDATE: " + DELETE_ASSETS_ON_UPDATE); + String property14 = properties.getProperty("UNSAFE_ASSET_DELETION_ON_UPDATE"); + if (property14 != null) { + UNSAFE_ASSET_DELETION_ON_UPDATE = Boolean.parseBoolean(property14.trim()); + } + Logging.DEBUG_OUT("\tUNSAFE_ASSET_DELETION_ON_UPDATE: " + UNSAFE_ASSET_DELETION_ON_UPDATE); + if (UNSAFE_ASSET_DELETION_ON_UPDATE) { + Logging.DEBUG_OUT(" "); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + Logging.DEBUG_OUT("\tUNSAFE_ASSET_DELETION_ON_UPDATE = true"); + Logging.DEBUG_OUT("\tADC will delete the entire download folder before an update"); + Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); + Logging.DEBUG_OUT(" "); + } + String property15 = properties.getProperty("REDOWNLOAD_ON_SCREEN_SIZE_CHANGE"); + if (property15 != null) { + REDOWNLOAD_ON_SCREEN_SIZE_CHANGE = Boolean.parseBoolean(property15.trim()); + } + Logging.DEBUG_OUT("\tREDOWNLOAD_ON_SCREEN_SIZE_CHANGE: " + REDOWNLOAD_ON_SCREEN_SIZE_CHANGE); + String property16 = properties.getProperty("NUMBER_OF_HOURS_TO_UPDATE_CHECKING"); + if (property16 != null) { + try { + NUMBER_OF_HOURS_TO_UPDATE_CHECKING = Integer.parseInt(property16.trim()); + Logging.DEBUG_OUT("\tNUMBER_OF_HOURS_TO_UPDATE_CHECKING read from config.properties"); + } catch (Exception e3) { + Logging.DEBUG_OUT("\t" + e3.toString()); + } + } + Logging.DEBUG_OUT("\tNUMBER_OF_HOURS_TO_UPDATE_CHECKING: " + NUMBER_OF_HOURS_TO_UPDATE_CHECKING + " hours"); + String property17 = properties.getProperty("RETRIEVE_FULL_SCREEN_RESOLUTION"); + if (property17 != null) { + RETRIEVE_FULL_SCREEN_RESOLUTION = Boolean.parseBoolean(property17.trim()); + } + Logging.DEBUG_OUT("\tRETRIEVE_FULL_SCREEN_RESOLUTION: " + RETRIEVE_FULL_SCREEN_RESOLUTION); + this.configLoaded = true; + } catch (Exception e4) { + Logging.DEBUG_OUT("\tException while loading properties: config.properties" + e4); + } + } finally { + Logging.DEBUG_OUT(" "); + } + } + + /* JADX WARN: Code restructure failed: missing block: B:51:0x00f3, code lost: + + r0.close(); + */ + /* JADX WARN: Code restructure failed: missing block: B:53:?, code lost: + + return; + */ + /* JADX WARN: Code restructure failed: missing block: B:54:0x00f7, code lost: + + r0 = move-exception; + */ + /* JADX WARN: Code restructure failed: missing block: B:55:0x00f8, code lost: + + r0.printStackTrace(); + */ + /* JADX WARN: Code restructure failed: missing block: B:56:0x00fb, code lost: + + return; + */ + /* JADX WARN: Code restructure failed: missing block: B:60:0x00fe, code lost: + + r0.close(); + */ + /* JADX WARN: Code restructure failed: missing block: B:62:?, code lost: + + return; + */ + /* JADX WARN: Code restructure failed: missing block: B:63:0x0102, code lost: + + r0 = move-exception; + */ + /* JADX WARN: Code restructure failed: missing block: B:64:0x0103, code lost: + + r0.printStackTrace(); + */ + /* JADX WARN: Code restructure failed: missing block: B:65:0x0106, code lost: + + return; + */ + /* JADX WARN: Code restructure failed: missing block: B:69:0x0109, code lost: + + r0.close(); + */ + /* JADX WARN: Code restructure failed: missing block: B:71:?, code lost: + + return; + */ + /* JADX WARN: Code restructure failed: missing block: B:72:0x010d, code lost: + + r0 = move-exception; + */ + /* JADX WARN: Code restructure failed: missing block: B:73:0x010e, code lost: + + r0.printStackTrace(); + */ + /* JADX WARN: Code restructure failed: missing block: B:74:0x0111, code lost: + + return; + */ + /* JADX WARN: Multi-variable type inference failed */ + /* JADX WARN: Removed duplicated region for block: B:89:0x0129 A[EXC_TOP_SPLITTER, SYNTHETIC] */ + /* JADX WARN: Type inference failed for: r0v1, types: [java.lang.String] */ + /* JADX WARN: Type inference failed for: r0v4 */ + /* JADX WARN: Type inference failed for: r0v8, types: [java.io.InputStream] */ + /* JADX WARN: Type inference failed for: r2v1, types: [android.content.res.AssetManager] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + private void loadOverrides() { + /* + Method dump skipped, instructions count: 318 + To view this dump change 'Code comments level' option to 'DEBUG' + */ + throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.loadOverrides():void"); + } + + public String getRequiredSpaceForDownload() { + if (spaceNeededToDownload > 0) { + return "" + ((spaceNeededToDownload / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID); + } + return "" + TOTAL_SPACE_MB; + } + + public String getAvailableSpaceForDownload() { + return "" + ((spaceAvailableToDownload / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID); + } + + public String getSpaceRangeForDownload() { + if (spaceNeededToDownload > 0) { + return "" + ((spaceNeededToDownload / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID); + } + if (!isDownloadRange) { + return "" + TOTAL_SPACE_MB; + } + return "" + TOTAL_SPACE_MB_MIN + com.google.android.vending.expansion.downloader.Constants.FILENAME_SEQUENCE_SEPARATOR + TOTAL_SPACE_MB; + } + + private String convertStreamToString(InputStream inputStream) { + StringBuilder sb; + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 8192); + StringBuilder sb2 = new StringBuilder(); + while (true) { + try { + try { + String readLine = bufferedReader.readLine(); + if (readLine != null) { + sb2.append(readLine + "\n"); + } else { + try { + break; + } catch (IOException e) { + e = e; + sb = new StringBuilder(); + sb.append("convertStreamToString Unable to close reader:"); + sb.append(e); + Logging.DEBUG_OUT(sb.toString()); + return sb2.toString(); + } + } + } catch (IOException e2) { + Logging.DEBUG_OUT("convertStreamToString Exception:" + e2); + try { + bufferedReader.close(); + } catch (IOException e3) { + e = e3; + sb = new StringBuilder(); + sb.append("convertStreamToString Unable to close reader:"); + sb.append(e); + Logging.DEBUG_OUT(sb.toString()); + return sb2.toString(); + } + } + } catch (Throwable th) { + try { + bufferedReader.close(); + } catch (IOException e4) { + Logging.DEBUG_OUT("convertStreamToString Unable to close reader:" + e4); + } + throw th; + } + } + bufferedReader.close(); + return sb2.toString(); + } + + public boolean canOpenStorageSettings() { + return !DO_NOT_OPEN_STORAGE_SETTINGS; + } + + public int getTotalDownloadSize(DownloadFileData[] downloadFileDataArr) { + totalDownloadSizeMB = 0; + int i = 0; + for (DownloadFileData downloadFileData : downloadFileDataArr) { + try { + i += downloadFileData.getSize(); + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while calculating download size:" + e); + } + } + totalDownloadSizeMB = (i / 1024) / 1024; + return totalDownloadSizeMB; + } + + public static int getTotalDownloadSizeMB() { + return totalDownloadSizeMB; + } + + public static String getTotalDownloadSizeMBString() { + return Integer.toString(totalDownloadSizeMB); + } + + public long getTotalDownloadSizeForNonZipFiles(DownloadFileData[] downloadFileDataArr) { + long j = 0; + for (int i = 0; i < downloadFileDataArr.length; i++) { + try { + if (downloadFileDataArr[i].getType() != 1) { + j += downloadFileDataArr[i].getSize(); + } + } catch (Exception e) { + Logging.DEBUG_OUT("[ERROR] An exception occurred while calculating download size for non-zip files:"); + Logging.DEBUG_OUT_STACK(e); + } + } + return j; + } + + public Bitmap getBackgroundBitmap() { + return this.bmpBg; + } + + public void setBackgroundBitmap(Bitmap bitmap) { + this.bmpBg = bitmap; + } + + public static boolean getForceWakeDuringDownload() { + return FORCE_WAKE_DURING_DOWNLOAD; + } + + public static void setForceWakeDuringDownload(boolean z) { + FORCE_WAKE_DURING_DOWNLOAD = z; + } +} diff --git a/app/src/main/java/com/eamobile/IDeviceData.java b/app/src/main/java/com/eamobile/IDeviceData.java new file mode 100644 index 0000000..24680ab --- /dev/null +++ b/app/src/main/java/com/eamobile/IDeviceData.java @@ -0,0 +1,8 @@ +package com.eamobile; + +import com.eamobile.download.DeviceData; + +/* loaded from: classes.dex */ +public interface IDeviceData { + void onRetrievedDeviceData(DeviceData deviceData); +} diff --git a/app/src/main/java/com/eamobile/IDownloadActivity.java b/app/src/main/java/com/eamobile/IDownloadActivity.java new file mode 100644 index 0000000..70b227e --- /dev/null +++ b/app/src/main/java/com/eamobile/IDownloadActivity.java @@ -0,0 +1,11 @@ +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); +} diff --git a/app/src/main/java/com/eamobile/Language.java b/app/src/main/java/com/eamobile/Language.java new file mode 100644 index 0000000..2769d28 --- /dev/null +++ b/app/src/main/java/com/eamobile/Language.java @@ -0,0 +1,246 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/WifiReceiver.java b/app/src/main/java/com/eamobile/WifiReceiver.java new file mode 100644 index 0000000..1ca38e2 --- /dev/null +++ b/app/src/main/java/com/eamobile/WifiReceiver.java @@ -0,0 +1,63 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/AssetManager.java b/app/src/main/java/com/eamobile/download/AssetManager.java new file mode 100644 index 0000000..476a838 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/AssetManager.java @@ -0,0 +1,654 @@ +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 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 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 arrayList) { + return arrayList.contains(file); + } + + private ArrayList getDirList() { + int i; + try { + ArrayList 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.(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.(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.(r2) // Catch: java.lang.Throwable -> L78 java.lang.Exception -> L7a + r5 = 8192(0x2000, float:1.148E-41) + r3.(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.() // 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 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); + } + } +} diff --git a/app/src/main/java/com/eamobile/download/ChecksumValidator.java b/app/src/main/java/com/eamobile/download/ChecksumValidator.java new file mode 100644 index 0000000..5f21923 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/ChecksumValidator.java @@ -0,0 +1,44 @@ +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; + } + } +} diff --git a/app/src/main/java/com/eamobile/download/Constants.java b/app/src/main/java/com/eamobile/download/Constants.java new file mode 100644 index 0000000..8e7cd77 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/Constants.java @@ -0,0 +1,9 @@ +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; +} diff --git a/app/src/main/java/com/eamobile/download/Device.java b/app/src/main/java/com/eamobile/download/Device.java new file mode 100644 index 0000000..db50636 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/Device.java @@ -0,0 +1,33 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/DeviceData.java b/app/src/main/java/com/eamobile/download/DeviceData.java new file mode 100644 index 0000000..d9d3c82 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/DeviceData.java @@ -0,0 +1,119 @@ +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 getSupportedTextureTypes() { + EnumSet 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 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 "; + } + } +} diff --git a/app/src/main/java/com/eamobile/download/DownloadFileData.java b/app/src/main/java/com/eamobile/download/DownloadFileData.java new file mode 100644 index 0000000..d58ebdc --- /dev/null +++ b/app/src/main/java/com/eamobile/download/DownloadFileData.java @@ -0,0 +1,75 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/DownloadProgress.java b/app/src/main/java/com/eamobile/download/DownloadProgress.java new file mode 100644 index 0000000..8973860 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/DownloadProgress.java @@ -0,0 +1,91 @@ +package com.eamobile.download; + +import java.util.HashMap; + +/* loaded from: classes.dex */ +public class DownloadProgress { + private FileProgress currentFileProgress; + private boolean isLastReportDownload; + private HashMap 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; + } +} diff --git a/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java new file mode 100644 index 0000000..6ed9be2 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java @@ -0,0 +1,12 @@ +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); +} diff --git a/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java new file mode 100644 index 0000000..4ac3313 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java @@ -0,0 +1,22 @@ +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"); + } +} diff --git a/app/src/main/java/com/eamobile/download/LockManager.java b/app/src/main/java/com/eamobile/download/LockManager.java new file mode 100644 index 0000000..dd5dcb0 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/LockManager.java @@ -0,0 +1,90 @@ +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."); + } +} diff --git a/app/src/main/java/com/eamobile/download/Logging.java b/app/src/main/java/com/eamobile/download/Logging.java new file mode 100644 index 0000000..6467263 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/Logging.java @@ -0,0 +1,60 @@ +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(); + } + } + } +} diff --git a/app/src/main/java/com/eamobile/download/MemoryStatus.java b/app/src/main/java/com/eamobile/download/MemoryStatus.java new file mode 100644 index 0000000..70256ce --- /dev/null +++ b/app/src/main/java/com/eamobile/download/MemoryStatus.java @@ -0,0 +1,62 @@ +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(); + } +} diff --git a/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java b/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java new file mode 100644 index 0000000..813a900 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java @@ -0,0 +1,54 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/ReadThread.java b/app/src/main/java/com/eamobile/download/ReadThread.java new file mode 100644 index 0000000..e49d0f8 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/ReadThread.java @@ -0,0 +1,55 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java new file mode 100644 index 0000000..812c8de --- /dev/null +++ b/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java @@ -0,0 +1,34 @@ +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); + } +} diff --git a/app/src/main/java/com/eamobile/download/SpeedCalculator.java b/app/src/main/java/com/eamobile/download/SpeedCalculator.java new file mode 100644 index 0000000..4398065 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/SpeedCalculator.java @@ -0,0 +1,41 @@ +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; + } +} diff --git a/app/src/main/java/com/eamobile/download/ZipExtractor.java b/app/src/main/java/com/eamobile/download/ZipExtractor.java new file mode 100644 index 0000000..8aacd01 --- /dev/null +++ b/app/src/main/java/com/eamobile/download/ZipExtractor.java @@ -0,0 +1,32 @@ +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 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"); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java b/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java new file mode 100644 index 0000000..51ceb99 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java @@ -0,0 +1,8 @@ +package com.eamobile.licensing; + +/* loaded from: classes.dex */ +public interface ILicenseServerActivityCallback { + void onLicenseResultEnd(); + + void onLicenseResultStart(); +} diff --git a/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java b/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java new file mode 100644 index 0000000..a1002f3 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java @@ -0,0 +1,264 @@ +package com.eamobile.licensing; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Handler; +import android.os.HandlerThread; +import com.android.vending.licensing.as; +import com.android.vending.licensing.bd; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; + +/* loaded from: classes.dex */ +public class LicenseServerActivity { + private static boolean H = false; + private static Activity I = null; + private static int N = -1; + private static int O = -1; + public static final String a = "com.android.vending.licensing.eapref"; + static final int l = -1; + static final int m = 13; + static final int n = 14; + static final int o = 15; + static final int p = 16; + static final int q = 17; + static final int r = 18; + static final int s = 19; + static final int t = 20; + static final int u = 21; + protected static final String v = "licenseserver/"; + protected static g w; + private static LicenseServerActivity z; + private r A; + private as B; + private String C; + private Context D; + private String E; + private b J; + private d K; + private a L; + private String M; + public q b; + public bd c; + byte[] d; + String e; + public String j; + private Handler F = null; + public Handler f = null; + Handler g = null; + public Handler h = null; + public Handler i = null; + private boolean G = false; + Bitmap k = null; + private String P = "en"; + ILicenseServerActivityCallback x = null; + ArrayList y = new ArrayList(); + + private LicenseServerActivity() { + } + + protected static Activity b() { + return I; + } + + private void g() { + if (this.B != null) { + this.B.a(); + this.B = null; + } + I = null; + z = null; + } + + public static LicenseServerActivity getInstance() { + if (z == null) { + z = new LicenseServerActivity(); + } + return z; + } + + private void h() { + if (this.L != null) { + this.L.b(); + } + if (this.K != null) { + this.K.b(); + } + } + + public boolean LastCheckPointCheck() { + return this.c.a().a().equals(this.M); + } + + public void a() { + this.f.post(new n(this)); + } + + /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ + /* JADX WARN: Removed duplicated region for block: B:13:0x0025 A[Catch: Exception -> 0x0010, TryCatch #0 {Exception -> 0x0010, blocks: (B:10:0x000d, B:11:0x0021, B:13:0x0025, B:14:0x0031, B:17:0x0012, B:18:0x0018, B:19:0x001b, B:20:0x001e), top: B:6:0x0007 }] */ + /* + Code decompiled incorrectly, please refer to instructions dump. + To view partially-correct code enable 'Show inconsistent code' option in preferences + */ + public void a(int r3) { + /* + r2 = this; + int r0 = com.eamobile.licensing.LicenseServerActivity.O + if (r3 != r0) goto L5 + return + L5: + r0 = 15 + if (r3 == r0) goto L1e + r0 = 0 + switch(r3) { + case 19: goto L1b; + case 20: goto L18; + case 21: goto L12; + default: goto Ld; + } + Ld: + r2.J = r0 // Catch: java.lang.Exception -> L10 + goto L21 + L10: + r3 = move-exception + goto L38 + L12: + r2.J = r0 // Catch: java.lang.Exception -> L10 + r2.a() // Catch: java.lang.Exception -> L10 + goto L21 + L18: + com.eamobile.licensing.a r0 = r2.L // Catch: java.lang.Exception -> L10 + goto Ld + L1b: + com.eamobile.licensing.d r0 = r2.K // Catch: java.lang.Exception -> L10 + goto Ld + L1e: + com.eamobile.licensing.d r0 = r2.K // Catch: java.lang.Exception -> L10 + goto Ld + L21: + com.eamobile.licensing.b r0 = r2.J // Catch: java.lang.Exception -> L10 + if (r0 == 0) goto L31 + com.eamobile.licensing.b r0 = r2.J // Catch: java.lang.Exception -> L10 + r0.a() // Catch: java.lang.Exception -> L10 + android.app.Activity r0 = com.eamobile.licensing.LicenseServerActivity.I // Catch: java.lang.Exception -> L10 + com.eamobile.licensing.b r1 = r2.J // Catch: java.lang.Exception -> L10 + r0.setContentView(r1) // Catch: java.lang.Exception -> L10 + L31: + int r0 = com.eamobile.licensing.LicenseServerActivity.N // Catch: java.lang.Exception -> L10 + com.eamobile.licensing.LicenseServerActivity.O = r0 // Catch: java.lang.Exception -> L10 + com.eamobile.licensing.LicenseServerActivity.N = r3 // Catch: java.lang.Exception -> L10 + goto L4c + L38: + java.lang.StringBuilder r0 = new java.lang.StringBuilder + r0.() + java.lang.String r1 = "Exception in setState:" + r0.append(r1) + r0.append(r3) + java.lang.String r3 = r0.toString() + com.eamobile.licensing.z.a(r3) + L4c: + return + */ + throw new UnsupportedOperationException("Method not decompiled: com.eamobile.licensing.LicenseServerActivity.a(int):void"); + } + + protected void a(Context context) { + if (this.L == null) { + this.L = new a(context); + } + if (this.K == null) { + this.K = new d(context); + } + } + + public void c() { + } + + public int d() { + return N; + } + + public void destroyLicenseServerActvity() { + if (this.k != null) { + this.k.recycle(); + this.k = null; + } + h(); + H = false; + N = -1; + g(); + } + + protected int e() { + return O; + } + + protected void f() { + h(); + H = false; + N = -1; + g(); + } + + public void initLicenseServerActivity(Activity activity, ILicenseServerActivityCallback iLicenseServerActivityCallback, Context context, byte[] bArr, String str, String str2, String str3) { + if (this.G) { + return; + } + this.G = true; + this.M = str3; + if (this.M == null) { + this.M = "001"; + } + this.g = new h(this); + this.C = str2; + this.D = context; + this.d = bArr; + this.e = str; + this.F = new i(this); + this.h = new j(this); + this.i = new k(this); + HandlerThread handlerThread = new HandlerThread("waitting thread"); + handlerThread.start(); + this.f = new Handler(handlerThread.getLooper()); + h hVar = null; + this.b = new q(this, hVar); + this.A = new r(this, hVar); + this.y.add(new l(this)); + this.y.add(new m(this)); + this.f.post(new o(this)); + if (I == null) { + I = activity; + this.x = iLicenseServerActivityCallback; + } + try { + InputStream open = context.getAssets().open("licenseserver/title.png"); + if (open != null) { + this.k = Bitmap.createBitmap(BitmapFactory.decodeStream(open)); + open.close(); + } + z.a("CREATING BITMAP IMAGE"); + } catch (IOException unused) { + this.k = null; + } + if (w == null) { + w = new g(); + this.P = context.getResources().getConfiguration().locale.toString(); + String language = context.getResources().getConfiguration().locale.getLanguage(); + z.a("Locale>>>>>:" + this.P); + z.a("Language>>>>>:" + language); + if (!w.a(this.P) && !w.a(language)) { + this.P = "en"; + w.a("en"); + } + } + a(context); + if (H) { + return; + } + H = true; + a(20); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/a.java b/app/src/main/java/com/eamobile/licensing/a.java new file mode 100644 index 0000000..c2b623e --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/a.java @@ -0,0 +1,48 @@ +package com.eamobile.licensing; + +import android.app.ProgressDialog; +import android.content.Context; +import android.view.View; + +/* loaded from: classes.dex */ +public class a extends b { + ProgressDialog a; + + public a(Context context) { + super(context); + this.b = context; + } + + private void a(View view) { + this.a = new com.a.a.h(this.b); + this.a.setCancelable(true); + this.a.setTitle(g.a(2)); + this.a.setMessage(g.a(3)); + this.a.setIndeterminate(true); + this.a.setCancelable(false); + this.a.show(); + } + + @Override // com.eamobile.licensing.b, com.eamobile.licensing.f + public void a() { + super.a(); + a(this); + } + + @Override // com.eamobile.licensing.b, com.eamobile.licensing.f + public void b() { + super.b(); + try { + this.a.dismiss(); + } catch (Exception unused) { + } + } + + @Override // android.view.View + protected void onWindowVisibilityChanged(int i) { + super.onWindowVisibilityChanged(i); + if (i == 8) { + this.a.cancel(); + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/b.java b/app/src/main/java/com/eamobile/licensing/b.java new file mode 100644 index 0000000..ccb43ef --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/b.java @@ -0,0 +1,40 @@ +package com.eamobile.licensing; + +import android.content.Context; +import android.widget.Button; +import android.widget.LinearLayout; + +/* loaded from: classes.dex */ +public class b extends LinearLayout implements f { + protected static final float c = 16.0f; + protected Context b; + + public b(Context context) { + super(context); + this.b = context; + } + + public static Button a(Context context, LinearLayout linearLayout, String str) { + Button button = new Button(context); + button.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + button.setPadding(15, 15, 15, 15); + button.setTextSize(c); + button.setText(str); + linearLayout.addView(button); + return button; + } + + public void a() { + c(); + } + + public void b() { + } + + protected void c() { + setLayoutParams(new LinearLayout.LayoutParams(-1, -2)); + setOrientation(1); + setGravity(48); + setBackgroundDrawable(new c(this)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/c.java b/app/src/main/java/com/eamobile/licensing/c.java new file mode 100644 index 0000000..bb7e059 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/c.java @@ -0,0 +1,35 @@ +package com.eamobile.licensing; + +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; + +/* loaded from: classes.dex */ +class c extends Drawable { + final /* synthetic */ b a; + + c(b bVar) { + this.a = bVar; + } + + @Override // android.graphics.drawable.Drawable + public void draw(Canvas canvas) { + if (LicenseServerActivity.getInstance().k != null) { + canvas.drawBitmap(LicenseServerActivity.getInstance().k, (canvas.getWidth() - LicenseServerActivity.getInstance().k.getWidth()) >> 1, (canvas.getHeight() - LicenseServerActivity.getInstance().k.getHeight()) >> 1, (Paint) null); + } + } + + @Override // android.graphics.drawable.Drawable + public int getOpacity() { + return 0; + } + + @Override // android.graphics.drawable.Drawable + public void setAlpha(int i) { + } + + @Override // android.graphics.drawable.Drawable + public void setColorFilter(ColorFilter colorFilter) { + } +} diff --git a/app/src/main/java/com/eamobile/licensing/d.java b/app/src/main/java/com/eamobile/licensing/d.java new file mode 100644 index 0000000..754adca --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/d.java @@ -0,0 +1,41 @@ +package com.eamobile.licensing; + +import android.app.Dialog; +import android.content.Context; +import android.view.View; + +/* loaded from: classes.dex */ +public class d extends b { + Dialog a; + + public d(Context context) { + super(context); + this.b = context; + } + + private void a(View view) { + String a = g.a(1); + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + if (licenseServerActivity.j != null) { + a = a + " " + licenseServerActivity.j; + } + com.a.a.b bVar = new com.a.a.b(this.b); + bVar.b(a).a(g.a(3)).a(false).b(g.a(0), new e(this)); + bVar.b(); + } + + @Override // com.eamobile.licensing.b, com.eamobile.licensing.f + public void a() { + super.a(); + a(this); + } + + @Override // com.eamobile.licensing.b, com.eamobile.licensing.f + public void b() { + super.b(); + try { + this.a.dismiss(); + } catch (Exception unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/e.java b/app/src/main/java/com/eamobile/licensing/e.java new file mode 100644 index 0000000..7fea0ab --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/e.java @@ -0,0 +1,20 @@ +package com.eamobile.licensing; + +import android.content.DialogInterface; + +/* loaded from: classes.dex */ +class e implements DialogInterface.OnClickListener { + final /* synthetic */ d a; + + e(d dVar) { + this.a = dVar; + } + + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + try { + LicenseServerActivity.getInstance().a(); + } catch (Throwable unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/f.java b/app/src/main/java/com/eamobile/licensing/f.java new file mode 100644 index 0000000..2e7b3f8 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/f.java @@ -0,0 +1,8 @@ +package com.eamobile.licensing; + +/* loaded from: classes.dex */ +public interface f { + void a(); + + void b(); +} diff --git a/app/src/main/java/com/eamobile/licensing/g.java b/app/src/main/java/com/eamobile/licensing/g.java new file mode 100644 index 0000000..f1de99a --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/g.java @@ -0,0 +1,199 @@ +package com.eamobile.licensing; + +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 g { + public static final int a = 0; + public static final int b = 1; + public static final int c = 2; + public static final int d = 3; + public static final String[] e = new String[4]; + public static final int g = 2; + public static final int h = 1; + public static final char i = '\n'; + private static final int j = 4; + private static int l; + public final int f = 8096; + private String k; + + public static char a(DataInput dataInput) { + int readUnsignedByte; + if (l == 2) { + int readUnsignedShort = dataInput.readUnsignedShort(); + readUnsignedByte = ((readUnsignedShort & 255) << 8) | (readUnsignedShort >> 8); + } else { + readUnsignedByte = dataInput.readUnsignedByte(); + } + return (char) readUnsignedByte; + } + + public static String a(int i2) { + return a(i2, null); + } + + public static String a(int i2, String[] strArr) { + String str = e[i2]; + if (strArr != null) { + try { + if (strArr.length > 0) { + int i3 = 0; + while (str.indexOf("%%") != -1 && i3 < strArr.length) { + int indexOf = str.indexOf("%%"); + i3++; + str = str.substring(0, indexOf) + strArr[i3] + str.substring(indexOf + 2); + } + } + } catch (Exception e2) { + z.a("Exception e:" + e2); + } + } + return str; + } + + public static String a(DataInput dataInput, char c2, boolean z) { + StringBuffer stringBuffer = new StringBuffer(); + while (true) { + char a2 = a(dataInput); + if (a2 == c2) { + break; + } + stringBuffer.append(a2); + } + String stringBuffer2 = stringBuffer.toString(); + if (stringBuffer2 != null) { + return stringBuffer2.trim(); + } + return null; + } + + public static int b(String str) { + DataInputStream dataInputStream; + DataInputStream dataInputStream2 = null; + try { + try { + dataInputStream = new DataInputStream(LicenseServerActivity.b().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 String a() { + return this.k; + } + + public boolean a(String str) { + InputStream inputStream; + if (str == null) { + return false; + } + String str2 = "licenseserver/" + str + ".txt"; + z.a("Opening file: " + str2); + InputStream inputStream2 = null; + try { + try { + inputStream = LicenseServerActivity.b().getAssets().open(str2); + } catch (FileNotFoundException unused) { + } catch (Exception e2) { + e = e2; + } + try { + try { + if (inputStream == null) { + z.a("Couldn't find file: " + str2); + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused2) { + } + } + return false; + } + Vector vector = new Vector(); + DataInputStream dataInputStream = new DataInputStream(inputStream); + l = b(str2); + if (l == 2) { + dataInputStream.skipBytes(2); + } + boolean z = true; + while (z) { + try { + vector.addElement(a(dataInputStream, '\n', true)); + } catch (Exception unused3) { + z = false; + } + } + for (int i2 = 0; i2 < e.length; i2++) { + e[i2] = ((String) vector.elementAt(i2)).toString(); + } + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception unused4) { + } + } + this.k = str; + return true; + } catch (FileNotFoundException unused5) { + inputStream2 = inputStream; + z.a("File 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 e3) { + e = e3; + inputStream2 = inputStream; + z.a("Exception caught: " + e); + if (inputStream2 != null) { + try { + inputStream2.close(); + } catch (Exception unused8) { + } + } + return false; + } + } catch (Throwable th2) { + th = th2; + inputStream = null; + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/h.java b/app/src/main/java/com/eamobile/licensing/h.java new file mode 100644 index 0000000..9597e66 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/h.java @@ -0,0 +1,24 @@ +package com.eamobile.licensing; + +import android.os.Handler; +import android.os.Message; + +/* loaded from: classes.dex */ +class h extends Handler { + final /* synthetic */ LicenseServerActivity a; + + h(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // android.os.Handler + public void handleMessage(Message message) { + r rVar; + try { + LicenseServerActivity licenseServerActivity = this.a; + rVar = this.a.A; + licenseServerActivity.a(rVar.a); + } catch (Exception unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/i.java b/app/src/main/java/com/eamobile/licensing/i.java new file mode 100644 index 0000000..0414001 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/i.java @@ -0,0 +1,21 @@ +package com.eamobile.licensing; + +import android.os.Handler; +import android.os.Message; + +/* loaded from: classes.dex */ +class i extends Handler { + final /* synthetic */ LicenseServerActivity a; + + i(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // android.os.Handler + public void handleMessage(Message message) { + try { + this.a.b.e(); + } catch (Exception unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/j.java b/app/src/main/java/com/eamobile/licensing/j.java new file mode 100644 index 0000000..d28b4d4 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/j.java @@ -0,0 +1,21 @@ +package com.eamobile.licensing; + +import android.os.Handler; +import android.os.Message; + +/* loaded from: classes.dex */ +class j extends Handler { + final /* synthetic */ LicenseServerActivity a; + + j(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // android.os.Handler + public void handleMessage(Message message) { + try { + this.a.x.onLicenseResultStart(); + } catch (Exception unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/k.java b/app/src/main/java/com/eamobile/licensing/k.java new file mode 100644 index 0000000..fcf8770 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/k.java @@ -0,0 +1,21 @@ +package com.eamobile.licensing; + +import android.os.Handler; +import android.os.Message; + +/* loaded from: classes.dex */ +class k extends Handler { + final /* synthetic */ LicenseServerActivity a; + + k(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // android.os.Handler + public void handleMessage(Message message) { + try { + this.a.x.onLicenseResultEnd(); + } catch (Exception unused) { + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/l.java b/app/src/main/java/com/eamobile/licensing/l.java new file mode 100644 index 0000000..d808f69 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/l.java @@ -0,0 +1,18 @@ +package com.eamobile.licensing; + +/* loaded from: classes.dex */ +class l implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + l(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + if (licenseServerActivity.x != null) { + licenseServerActivity.i.sendEmptyMessage(1); + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/m.java b/app/src/main/java/com/eamobile/licensing/m.java new file mode 100644 index 0000000..18e265d --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/m.java @@ -0,0 +1,18 @@ +package com.eamobile.licensing; + +/* loaded from: classes.dex */ +class m implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + m(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + if (licenseServerActivity.x != null) { + licenseServerActivity.h.sendEmptyMessage(1); + } + } +} diff --git a/app/src/main/java/com/eamobile/licensing/n.java b/app/src/main/java/com/eamobile/licensing/n.java new file mode 100644 index 0000000..6cc2341 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/n.java @@ -0,0 +1,20 @@ +package com.eamobile.licensing; + +import android.os.Handler; + +/* loaded from: classes.dex */ +class n implements Runnable { + int a = 0; + final /* synthetic */ LicenseServerActivity b; + + n(LicenseServerActivity licenseServerActivity) { + this.b = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Handler handler; + handler = this.b.F; + handler.sendEmptyMessage(1); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/o.java b/app/src/main/java/com/eamobile/licensing/o.java new file mode 100644 index 0000000..2ad3c7b --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/o.java @@ -0,0 +1,56 @@ +package com.eamobile.licensing; + +import android.os.Handler; + +/* loaded from: classes.dex */ +class o implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + o(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + String str; + Handler handler; + Runnable sVar; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + str = licenseServerActivity.M; + switch (str.hashCode() % 7) { + case 0: + handler = licenseServerActivity.f; + sVar = new s(this.a); + break; + case 1: + handler = licenseServerActivity.f; + sVar = new t(this.a); + break; + case 2: + handler = licenseServerActivity.f; + sVar = new u(this.a); + break; + case 3: + handler = licenseServerActivity.f; + sVar = new v(this.a); + break; + case 4: + handler = licenseServerActivity.f; + sVar = new w(this.a); + break; + case 5: + handler = licenseServerActivity.f; + sVar = new x(this.a); + break; + case 6: + handler = licenseServerActivity.f; + sVar = new y(this.a); + break; + default: + handler = licenseServerActivity.f; + sVar = new s(this.a); + break; + } + handler.post(sVar); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/p.java b/app/src/main/java/com/eamobile/licensing/p.java new file mode 100644 index 0000000..61288ad --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/p.java @@ -0,0 +1,20 @@ +package com.eamobile.licensing; + +import com.android.vending.licensing.as; + +/* loaded from: classes.dex */ +class p implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + p(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + as asVar; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + asVar = licenseServerActivity.B; + asVar.a(licenseServerActivity.b); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/q.java b/app/src/main/java/com/eamobile/licensing/q.java new file mode 100644 index 0000000..7f51a9f --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/q.java @@ -0,0 +1,63 @@ +package com.eamobile.licensing; + +import com.android.vending.licensing.aq; +import com.android.vending.licensing.ar; +import java.security.SecureRandom; + +/* loaded from: classes.dex */ +class q implements aq { + int a; + final /* synthetic */ LicenseServerActivity b; + + private q(LicenseServerActivity licenseServerActivity) { + this.b = licenseServerActivity; + this.a = 0; + } + + /* synthetic */ q(LicenseServerActivity licenseServerActivity, h hVar) { + this(licenseServerActivity); + } + + @Override // com.android.vending.licensing.aq + public void a() { + } + + @Override // com.android.vending.licensing.aq + public void a(ar arVar) { + r rVar; + this.a = 0; + rVar = this.b.A; + rVar.a = 19; + int ordinal = arVar.ordinal(); + int abs = (Math.abs(new SecureRandom().nextInt()) % 1000) + 1000; + LicenseServerActivity.getInstance().j = Integer.toString(abs) + Integer.toString(ordinal); + this.b.g.sendEmptyMessage(1); + } + + @Override // com.android.vending.licensing.aq + public void b() { + } + + @Override // com.android.vending.licensing.aq + public void c() { + String str; + String str2; + this.a = 1; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + str = licenseServerActivity.E; + str2 = licenseServerActivity.M; + if (str == str2) { + this.b.g.sendEmptyMessage(1); + } + } + + @Override // com.android.vending.licensing.aq + public void d() { + this.a = 0; + this.b.g.sendEmptyMessage(1); + } + + public void e() { + LicenseServerActivity.getInstance().f.post((Runnable) this.b.y.get(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/r.java b/app/src/main/java/com/eamobile/licensing/r.java new file mode 100644 index 0000000..1e0ab4b --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/r.java @@ -0,0 +1,36 @@ +package com.eamobile.licensing; + +import com.android.vending.licensing.at; + +/* loaded from: classes.dex */ +class r implements at { + public int a; + final /* synthetic */ LicenseServerActivity b; + + private r(LicenseServerActivity licenseServerActivity) { + this.b = licenseServerActivity; + this.a = 21; + } + + /* synthetic */ r(LicenseServerActivity licenseServerActivity, h hVar) { + this(licenseServerActivity); + } + + @Override // com.android.vending.licensing.at + public void a() { + this.a = 15; + } + + @Override // com.android.vending.licensing.at + public void b() { + this.a = 15; + } + + @Override // com.android.vending.licensing.at + public void c() { + String str; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + str = licenseServerActivity.M; + licenseServerActivity.E = str; + } +} diff --git a/app/src/main/java/com/eamobile/licensing/s.java b/app/src/main/java/com/eamobile/licensing/s.java new file mode 100644 index 0000000..b2db4f8 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/s.java @@ -0,0 +1,40 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.au; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class s implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + s(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.a aVar = new com.android.vending.licensing.a(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new au(context, aVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new com.android.vending.licensing.o(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/t.java b/app/src/main/java/com/eamobile/licensing/t.java new file mode 100644 index 0000000..17d0c15 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/t.java @@ -0,0 +1,40 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.av; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class t implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + t(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.b bVar = new com.android.vending.licensing.b(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new av(context, bVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new com.android.vending.licensing.s(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/u.java b/app/src/main/java/com/eamobile/licensing/u.java new file mode 100644 index 0000000..c0c076e --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/u.java @@ -0,0 +1,40 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.aw; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class u implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + u(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.c cVar = new com.android.vending.licensing.c(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new aw(context, cVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new com.android.vending.licensing.w(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/v.java b/app/src/main/java/com/eamobile/licensing/v.java new file mode 100644 index 0000000..ff963bf --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/v.java @@ -0,0 +1,41 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.aa; +import com.android.vending.licensing.ax; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class v implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + v(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.d dVar = new com.android.vending.licensing.d(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new ax(context, dVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new aa(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/w.java b/app/src/main/java/com/eamobile/licensing/w.java new file mode 100644 index 0000000..330cab8 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/w.java @@ -0,0 +1,41 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.ae; +import com.android.vending.licensing.ay; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class w implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + w(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.e eVar = new com.android.vending.licensing.e(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new ay(context, eVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new ae(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/x.java b/app/src/main/java/com/eamobile/licensing/x.java new file mode 100644 index 0000000..c2275e9 --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/x.java @@ -0,0 +1,41 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.ai; +import com.android.vending.licensing.az; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class x implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + x(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.f fVar = new com.android.vending.licensing.f(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new az(context, fVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new ai(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/y.java b/app/src/main/java/com/eamobile/licensing/y.java new file mode 100644 index 0000000..4eeed2d --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/y.java @@ -0,0 +1,41 @@ +package com.eamobile.licensing; + +import android.content.Context; +import com.android.vending.licensing.am; +import com.android.vending.licensing.ba; +import com.android.vending.licensing.bd; + +/* loaded from: classes.dex */ +class y implements Runnable { + final /* synthetic */ LicenseServerActivity a; + + y(LicenseServerActivity licenseServerActivity) { + this.a = licenseServerActivity; + } + + @Override // java.lang.Runnable + public void run() { + Context context; + String str; + String str2; + r rVar; + Context context2; + String str3; + String str4; + LicenseServerActivity licenseServerActivity = LicenseServerActivity.getInstance(); + context = licenseServerActivity.D; + byte[] bArr = licenseServerActivity.d; + String str5 = licenseServerActivity.e; + str = licenseServerActivity.M; + com.android.vending.licensing.g gVar = new com.android.vending.licensing.g(bArr, str5, str); + str2 = licenseServerActivity.M; + rVar = licenseServerActivity.A; + licenseServerActivity.c = new ba(context, gVar, str2, rVar); + context2 = licenseServerActivity.D; + bd bdVar = licenseServerActivity.c; + str3 = licenseServerActivity.C; + str4 = licenseServerActivity.M; + licenseServerActivity.B = new am(context2, bdVar, str3, str4); + licenseServerActivity.f.post(new p(this.a)); + } +} diff --git a/app/src/main/java/com/eamobile/licensing/z.java b/app/src/main/java/com/eamobile/licensing/z.java new file mode 100644 index 0000000..fb49ebf --- /dev/null +++ b/app/src/main/java/com/eamobile/licensing/z.java @@ -0,0 +1,44 @@ +package com.eamobile.licensing; + +import android.os.Environment; +import android.util.Log; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/* loaded from: classes.dex */ +public class z { + public static boolean a; + static OutputStream b; + + public static void a() { + if (a) { + try { + b = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/debug.txt", true); + } catch (Throwable th) { + th.printStackTrace(); + } + } + } + + public static void a(String str) { + if (a) { + Log.w("DownloadActivity", str); + try { + b.write((str + "\n").getBytes()); + } catch (IOException unused) { + } + } + } + + public static void b() { + if (a) { + try { + b.flush(); + b.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/app/src/main/java/com/eamobile/views/CheckUpdatesView.java b/app/src/main/java/com/eamobile/views/CheckUpdatesView.java new file mode 100644 index 0000000..4dd4747 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/CheckUpdatesView.java @@ -0,0 +1,98 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.View; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; +import com.eamobile.download.Logging; + +/* loaded from: classes.dex */ +public class CheckUpdatesView extends CustomView { + protected static final int MSG_NO_UPDATES = 0; + protected static final int MSG_UPDATE_FOUND = 1; + Dialog dialog; + public Handler handler; + boolean updateFound; + + private void showContent(View view) { + } + + public CheckUpdatesView(Context context) { + super(context); + this.updateFound = false; + this.handler = new Handler() { // from class: com.eamobile.views.CheckUpdatesView.3 + @Override // android.os.Handler + public void handleMessage(Message message) { + if (message.what == 1) { + Logging.DEBUG_OUT("An update has been found"); + CheckUpdatesView.this.dialog.dismiss(); + if (DownloadActivityInternal.getMainActivity() != null) { + DownloadActivityInternal.getMainActivity().setState(9); + return; + } + return; + } + if (message.what == 0) { + Logging.DEBUG_OUT("No updates found"); + CheckUpdatesView.this.dialog.dismiss(); + if (DownloadActivityInternal.getMainActivity() != null) { + DownloadActivityInternal.getMainActivity().setState(11); + } + } + } + }; + this.context = context; + } + + /* JADX WARN: Type inference failed for: r0v3, types: [com.eamobile.views.CheckUpdatesView$2] */ + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + this.dialog = ProgressDialog.show(this.context, Language.getString(21), Language.getString(22), true); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.CheckUpdatesView.1 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + new Thread() { // from class: com.eamobile.views.CheckUpdatesView.2 + @Override // java.lang.Thread, java.lang.Runnable + public void run() { + CheckUpdatesView.this.updateFound = DownloadActivityInternal.getMainActivity().checkForUpdates(); + if (CheckUpdatesView.this.updateFound) { + CheckUpdatesView.this.handler.sendEmptyMessage(1); + } else if (DownloadActivityInternal.getMainActivity() != null && DownloadActivityInternal.getMainActivity().checkScreenSizeChange()) { + CheckUpdatesView.this.handler.sendEmptyMessage(1); + } else { + CheckUpdatesView.this.handler.sendEmptyMessage(0); + } + } + }.start(); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + if (this.dialog != null) { + this.dialog.dismiss(); + } + } catch (Exception e) { + Logging.DEBUG_OUT("CheckUpdates View clean:" + e); + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } +} diff --git a/app/src/main/java/com/eamobile/views/CheckingHostIpView.java b/app/src/main/java/com/eamobile/views/CheckingHostIpView.java new file mode 100644 index 0000000..8d16ad8 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/CheckingHostIpView.java @@ -0,0 +1,21 @@ +package com.eamobile.views; + +import android.content.Context; + +/* loaded from: classes.dex */ +public class CheckingHostIpView extends CustomView { + public CheckingHostIpView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + } +} diff --git a/app/src/main/java/com/eamobile/views/ContactingServerView.java b/app/src/main/java/com/eamobile/views/ContactingServerView.java new file mode 100644 index 0000000..cd31abf --- /dev/null +++ b/app/src/main/java/com/eamobile/views/ContactingServerView.java @@ -0,0 +1,74 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.View; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; +import com.eamobile.download.Logging; + +/* loaded from: classes.dex */ +public class ContactingServerView extends CustomView { + protected static final int MSG_DONE = 1; + Dialog dialog; + public Handler handler; + + private void showContent(View view) { + } + + public ContactingServerView(Context context) { + super(context); + this.handler = new Handler() { // from class: com.eamobile.views.ContactingServerView.3 + @Override // android.os.Handler + public void handleMessage(Message message) { + ContactingServerView.this.dialog.dismiss(); + } + }; + this.context = context; + } + + /* JADX WARN: Type inference failed for: r0v3, types: [com.eamobile.views.ContactingServerView$2] */ + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + this.dialog = ProgressDialog.show(this.context, Language.getString(37), Language.getString(38), true); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.ContactingServerView.1 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + new Thread() { // from class: com.eamobile.views.ContactingServerView.2 + @Override // java.lang.Thread, java.lang.Runnable + public void run() { + DownloadActivityInternal.getMainActivity().checkServerContent(true); + ContactingServerView.this.handler.sendEmptyMessage(1); + } + }.start(); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + if (this.dialog != null) { + this.dialog.dismiss(); + } + } catch (Exception e) { + Logging.DEBUG_OUT("CheckUpdates View clean:" + e); + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } +} diff --git a/app/src/main/java/com/eamobile/views/CustomProgressBar.java b/app/src/main/java/com/eamobile/views/CustomProgressBar.java new file mode 100644 index 0000000..d73a53a --- /dev/null +++ b/app/src/main/java/com/eamobile/views/CustomProgressBar.java @@ -0,0 +1,49 @@ +package com.eamobile.views; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.RectF; +import android.support.v4.view.InputDeviceCompat; +import android.view.View; + +/* loaded from: classes.dex */ +public class CustomProgressBar extends View { + private Paint paint; + private float progress; + + public CustomProgressBar(Context context) { + super(context); + this.paint = new Paint(); + this.progress = 0.0f; + } + + public void setProgress(float f) { + if (f < 0.0f) { + f = 0.0f; + } + if (f > 1.0f) { + f = 1.0f; + } + this.progress = f; + } + + @Override // android.view.View + protected void onMeasure(int i, int i2) { + super.onMeasure(i, i2); + setMeasuredDimension(View.MeasureSpec.getSize(i), 34); + } + + @Override // android.view.View + public void onDraw(Canvas canvas) { + this.paint.setColor(-1); + this.paint.setStrokeWidth(0.0f); + this.paint.setAntiAlias(true); + this.paint.setStyle(Paint.Style.FILL); + this.paint.setARGB(180, 120, 120, 120); + canvas.drawRect(new RectF(10.0f, 1.0f, getWidth() - 10, 33.0f), this.paint); + this.paint.setStyle(Paint.Style.FILL); + this.paint.setColor(InputDeviceCompat.SOURCE_ANY); + canvas.drawRect(new RectF(11, 2.0f, ((int) Math.floor(((r0 - 1) - 11) * this.progress)) + 11, 32.0f), this.paint); + } +} diff --git a/app/src/main/java/com/eamobile/views/CustomProgressDialog.java b/app/src/main/java/com/eamobile/views/CustomProgressDialog.java new file mode 100644 index 0000000..fb644db --- /dev/null +++ b/app/src/main/java/com/eamobile/views/CustomProgressDialog.java @@ -0,0 +1,335 @@ +package com.eamobile.views; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.view.KeyEvent; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; +import com.eamobile.download.ZipExtractor; +import java.io.IOException; +import java.io.InputStream; + +/* loaded from: classes.dex */ +public class CustomProgressDialog extends CustomView implements IProgressDialog { + private static final int WIFI_LAYOUT_ID = 90; + private static final int WIFI_LAYOUT_WIFI_TEXTVIEW_ID = 92; + private static final int WIFI_LAYOUT_WIFI_VIEW_ID = 91; + private static final int WIFI_LEVELS = 4; + private static final int WIFI_LEVELS_ENABLED = 3; + private static boolean alwaysSwitchTo3G = false; + private static boolean showDialogSwitchTo3G = false; + private static boolean wifiSwitchedTo3G = true; + private AlertDialog alertDialog; + private Bitmap[] bmpWifi; + private int[] connectionType; + private CustomProgressBar customProgressBar; + private Dialog dialog; + private boolean exitConfirmation; + private Boolean isLoadedBmpWifi; + private LinearLayout mainLayout; + private int max; + private int progress; + private float speed; + private TextView wifiTextView; + + public CustomProgressDialog(Context context) { + super(context); + this.exitConfirmation = false; + this.connectionType = new int[1]; + this.bmpWifi = null; + this.context = context; + this.dialog = null; + this.customProgressBar = null; + this.mainLayout = null; + this.progress = 0; + this.max = 0; + if (this.bmpWifi == null) { + this.bmpWifi = new Bitmap[4]; + } + for (int i = 0; i < 4; i++) { + try { + InputStream open = context.getAssets().open(DownloadActivityInternal.getResourcesPath() + "adc-wifi" + i + ".png"); + if (open != null) { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inTempStorage = new byte[4096]; + this.bmpWifi[i] = Bitmap.createBitmap(BitmapFactory.decodeStream(open, null, options)); + open.close(); + } + } catch (IOException unused) { + this.bmpWifi[i] = null; + } + } + this.isLoadedBmpWifi = true; + for (int i2 = 0; i2 < 4; i2++) { + this.isLoadedBmpWifi = Boolean.valueOf(this.isLoadedBmpWifi.booleanValue() && this.bmpWifi[i2] != null); + } + } + + @Override // com.eamobile.views.IProgressDialog + public void initDialog() { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(20)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setId(1); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 2, 10, 18); + textView.setTextSize(1, 16.0f); + textView.setText("..."); + scrollView.addView(textView); + this.customProgressBar = new CustomProgressBar(this.context); + linearLayout.addView(scrollView); + this.mainLayout.addView(this.customProgressBar); + this.mainLayout.addView(linearLayout); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setId(90); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(19); + if (this.isLoadedBmpWifi.booleanValue()) { + ImageView imageView = new ImageView(this.context); + imageView.setId(91); + imageView.setPadding(10, 0, 10, 10); + imageView.setImageBitmap(null); + imageView.setClickable(false); + linearLayout2.addView(imageView); + } + this.wifiTextView = new TextView(this.context); + this.wifiTextView.setId(92); + this.wifiTextView.setClickable(false); + this.wifiTextView.setCursorVisible(false); + this.wifiTextView.setTextSize(1, 16.0f); + if (!this.isLoadedBmpWifi.booleanValue()) { + this.wifiTextView.setPadding(10, 0, 10, 10); + } + linearLayout2.addView(this.wifiTextView); + this.mainLayout.addView(linearLayout2); + } + + @Override // com.eamobile.views.IProgressDialog + public void dismissDialog() { + if (this.isLoadedBmpWifi.booleanValue()) { + this.mainLayout.removeView((LinearLayout) this.dialog.findViewById(90)); + } + if (this.bmpWifi != null) { + for (int i = 0; i < 4; i++) { + if (this.bmpWifi[i] != null) { + this.bmpWifi[i].recycle(); + this.bmpWifi[i] = null; + } + } + this.bmpWifi = null; + } + this.wifiTextView = null; + if (this.alertDialog != null) { + this.alertDialog.dismiss(); + this.alertDialog = null; + this.exitConfirmation = false; + } + this.dialog.dismiss(); + } + + @Override // com.eamobile.views.IProgressDialog + public boolean isDialogValid() { + return this.dialog != null; + } + + @Override // com.eamobile.views.IProgressDialog + public void showDialogContent() { + if (this.dialog != null) { + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + updateWifiInfo(); + if (showDialogSwitchTo3G) { + ZipExtractor.setPause(true); + showDialogSwitchTo3G = false; + String string = Language.getString(46); + String string2 = Language.getString(47); + String string3 = Language.getString(48); + String string4 = Language.getString(49); + this.alertDialog = new AlertDialog.Builder(this.context).create(); + this.alertDialog.setCancelable(true); + this.alertDialog.setCanceledOnTouchOutside(false); + this.alertDialog.setMessage(string); + this.alertDialog.setButton(-1, string2, new DialogInterface.OnClickListener() { // from class: com.eamobile.views.CustomProgressDialog.1 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + CustomProgressDialog.this.alertDialog.dismiss(); + CustomProgressDialog.this.alertDialog = null; + CustomProgressDialog.this.exitConfirmation = false; + CustomProgressDialog.this.showDialogContent(); + ZipExtractor.setPause(false); + } + }); + this.alertDialog.setButton(-3, string3, new DialogInterface.OnClickListener() { // from class: com.eamobile.views.CustomProgressDialog.2 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + boolean unused = CustomProgressDialog.alwaysSwitchTo3G = true; + CustomProgressDialog.this.alertDialog.dismiss(); + CustomProgressDialog.this.alertDialog = null; + CustomProgressDialog.this.exitConfirmation = false; + CustomProgressDialog.this.showDialogContent(); + ZipExtractor.setPause(false); + } + }); + this.alertDialog.setButton(-2, string4, new DialogInterface.OnClickListener() { // from class: com.eamobile.views.CustomProgressDialog.3 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.CustomProgressDialog.4 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84 || i == 4; + } + }); + this.alertDialog.show(); + this.exitConfirmation = true; + } + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.CustomProgressDialog.5 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.CustomProgressDialog.6 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + String string5 = Language.getString(41); + String string6 = Language.getString(17); + String string7 = Language.getString(18); + TextView textView = new TextView(CustomProgressDialog.this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setSingleLine(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 18.0f); + textView.setTextColor(-1); + textView.setText(string5); + CustomProgressDialog.this.alertDialog = new AlertDialog.Builder(CustomProgressDialog.this.context).create(); + CustomProgressDialog.this.alertDialog.setCancelable(true); + CustomProgressDialog.this.alertDialog.setCanceledOnTouchOutside(false); + CustomProgressDialog.this.alertDialog.setView(textView); + CustomProgressDialog.this.alertDialog.setButton(-1, string6, new DialogInterface.OnClickListener() { // from class: com.eamobile.views.CustomProgressDialog.6.1 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface2, int i) { + dialogInterface2.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + CustomProgressDialog.this.alertDialog.setButton(-2, string7, new DialogInterface.OnClickListener() { // from class: com.eamobile.views.CustomProgressDialog.6.2 + @Override // android.content.DialogInterface.OnClickListener + public void onClick(DialogInterface dialogInterface2, int i) { + CustomProgressDialog.this.alertDialog.dismiss(); + CustomProgressDialog.this.alertDialog = null; + CustomProgressDialog.this.exitConfirmation = false; + CustomProgressDialog.this.showDialogContent(); + } + }); + CustomProgressDialog.this.alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.CustomProgressDialog.6.3 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface2) { + CustomProgressDialog.this.alertDialog.dismiss(); + CustomProgressDialog.this.alertDialog = null; + CustomProgressDialog.this.exitConfirmation = false; + CustomProgressDialog.this.showDialogContent(); + } + }); + CustomProgressDialog.this.alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.CustomProgressDialog.6.4 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface2, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + CustomProgressDialog.this.alertDialog.show(); + CustomProgressDialog.this.exitConfirmation = true; + } + }); + } + if (this.alertDialog == null || !this.exitConfirmation) { + return; + } + this.alertDialog.show(); + this.dialog.hide(); + } + + @Override // com.eamobile.views.IProgressDialog + public void updateDialog() { + if (this.max > 0) { + this.customProgressBar.setProgress(this.progress / this.max); + this.customProgressBar.invalidate(); + int floor = (int) Math.floor(r0 * 100.0f); + String format = String.format("%.0f", Float.valueOf(this.speed)); + String replace = (floor + "% " + Language.getString(36)).replace("%1", "" + this.progress).replace("%2", "" + this.max).replace("%3", "" + format); + updateWifiInfo(); + ((TextView) this.dialog.findViewById(1)).setText(replace); + } + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadProgress(int i) { + this.progress = i; + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadMax(int i) { + this.max = i; + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadSpeed(float f) { + this.speed = f; + } + + private void updateWifiInfo() { + if (((LinearLayout) this.dialog.findViewById(90)) == null || DownloadActivityInternal.getMainActivity() == null) { + return; + } + if (DownloadActivityInternal.getMainActivity().isWifiAvailable()) { + wifiSwitchedTo3G = false; + int wifiLevel = DownloadActivityInternal.getMainActivity().getWifiReceiver().getWifiLevel(); + String str = " " + Language.getString(16) + ": " + DownloadActivityInternal.getMainActivity().getWifiReceiver().getWifiName(); + if (!this.isLoadedBmpWifi.booleanValue()) { + str = str + " (" + Language.getString(35) + ": " + wifiLevel + "/3)"; + } else if (wifiLevel >= 0 && wifiLevel < 4) { + ((ImageView) this.dialog.findViewById(91)).setImageBitmap(this.bmpWifi[wifiLevel]); + } + this.wifiTextView.setText(str); + return; + } + int[] iArr = {-1}; + if (!alwaysSwitchTo3G && !wifiSwitchedTo3G && DownloadActivityInternal.getMainActivity().testNetwork(iArr) && iArr[0] == 0) { + wifiSwitchedTo3G = true; + showDialogSwitchTo3G = true; + showDialogContent(); + } + if (this.isLoadedBmpWifi.booleanValue()) { + ((ImageView) this.dialog.findViewById(91)).setImageBitmap(this.bmpWifi[0]); + } + this.wifiTextView.setText(Language.getString(16) + ": " + Language.getString(40)); + } +} diff --git a/app/src/main/java/com/eamobile/views/CustomView.java b/app/src/main/java/com/eamobile/views/CustomView.java new file mode 100644 index 0000000..71b0167 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/CustomView.java @@ -0,0 +1,96 @@ +package com.eamobile.views; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; + +/* loaded from: classes.dex */ +public class CustomView extends LinearLayout implements IDownloadView { + protected static final float TEXT_BODY_SIZE = 16.0f; + protected static final float TEXT_TITLE_SIZE = 18.0f; + protected Context context; + protected Handler mHandler; + + public void clean() { + } + + public void pause() { + } + + public void resume() { + } + + public CustomView(Context context) { + super(context); + this.context = context; + } + + public void init() { + showBackground(); + ((Activity) this.context).getWindow().getDecorView().setSystemUiVisibility(5894); + } + + protected void showBackground() { + setLayoutParams(new LinearLayout.LayoutParams(-1, -2)); + setOrientation(1); + setGravity(48); + setBackgroundDrawable(new BackGround()); + } + + class BackGround extends Drawable { + @Override // android.graphics.drawable.Drawable + public int getOpacity() { + return 0; + } + + @Override // android.graphics.drawable.Drawable + public void setAlpha(int i) { + } + + @Override // android.graphics.drawable.Drawable + public void setColorFilter(ColorFilter colorFilter) { + } + + BackGround() { + } + + @Override // android.graphics.drawable.Drawable + public void draw(Canvas canvas) { + if (DownloadActivityInternal.getMainActivity() == null || DownloadActivityInternal.getMainActivity().getBackgroundBitmap() == null) { + return; + } + canvas.drawBitmap(DownloadActivityInternal.getMainActivity().getBackgroundBitmap(), (canvas.getWidth() - DownloadActivityInternal.getMainActivity().getBackgroundBitmap().getWidth()) >> 1, (canvas.getHeight() - DownloadActivityInternal.getMainActivity().getBackgroundBitmap().getHeight()) >> 1, (Paint) null); + } + } + + public static Button addButton(Context context, LinearLayout linearLayout, String str) { + Button button = new Button(context); + button.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + button.setPadding(15, 15, 15, 15); + button.setTextSize(1, TEXT_BODY_SIZE); + button.setText(str); + linearLayout.addView(button); + return button; + } + + public static TextView addTitle(Context context, LinearLayout linearLayout, String str) { + TextView textView = new TextView(context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setSingleLine(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, TEXT_TITLE_SIZE); + textView.setTextColor(-1); + textView.setText(str); + linearLayout.addView(textView); + return textView; + } +} diff --git a/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java b/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java new file mode 100644 index 0000000..3c090a8 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java @@ -0,0 +1,106 @@ +package com.eamobile.views; + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; +import com.eamobile.download.Logging; +import java.lang.reflect.Method; + +/* loaded from: classes.dex */ +public class DefaultProgressDialog extends CustomView implements IProgressDialog { + private static Method mSetProgressNumberFormat; + private ProgressDialog dialog; + private int max; + private int progress; + private float speed; + + public DefaultProgressDialog(Context context) { + super(context); + this.context = context; + mSetProgressNumberFormat = null; + this.dialog = null; + this.progress = 0; + this.max = 0; + } + + @Override // com.eamobile.views.IProgressDialog + public void initDialog() { + try { + mSetProgressNumberFormat = ProgressDialog.class.getMethod("setProgressNumberFormat", String.class); + } catch (NoSuchMethodException unused) { + } + this.dialog = new ProgressDialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.setMessage(Language.getString(20)); + this.dialog.setProgressStyle(1); + this.dialog.setProgress(0); + } + + @Override // com.eamobile.views.IProgressDialog + public void dismissDialog() { + this.dialog.dismiss(); + } + + @Override // com.eamobile.views.IProgressDialog + public boolean isDialogValid() { + return this.dialog != null; + } + + @Override // com.eamobile.views.IProgressDialog + public void showDialogContent() { + if (this.dialog != null) { + this.dialog.show(); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.DefaultProgressDialog.1 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.DefaultProgressDialog.2 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + } + } + + @Override // com.eamobile.views.IProgressDialog + public void updateDialog() { + try { + if (mSetProgressNumberFormat != null) { + this.dialog.setMax(this.max); + try { + String format = String.format("%.0f", Float.valueOf(this.speed)); + mSetProgressNumberFormat.invoke(this.dialog, "%d MB of %d MB " + format + " Kb/s"); + this.dialog.setProgress(this.progress); + } catch (Exception unused) { + this.dialog.setProgress(DownloadActivityInternal.getMainActivity().getPercentDownloaded()); + } + } + } catch (Exception e) { + Logging.DEBUG_OUT("Exception here:" + e); + this.dialog.setProgress(DownloadActivityInternal.getMainActivity().getPercentDownloaded()); + } + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadProgress(int i) { + this.progress = i; + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadMax(int i) { + this.max = i; + } + + @Override // com.eamobile.views.IProgressDialog + public void setDownloadSpeed(float f) { + this.speed = f; + } +} diff --git a/app/src/main/java/com/eamobile/views/DeletingAssetsView.java b/app/src/main/java/com/eamobile/views/DeletingAssetsView.java new file mode 100644 index 0000000..68395de --- /dev/null +++ b/app/src/main/java/com/eamobile/views/DeletingAssetsView.java @@ -0,0 +1,83 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.View; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; +import com.eamobile.download.Logging; + +/* loaded from: classes.dex */ +public class DeletingAssetsView extends CustomView { + Dialog dialog; + public Handler handler; + boolean updateFound; + + private void showContent(View view) { + } + + public DeletingAssetsView(Context context) { + super(context); + this.updateFound = false; + this.handler = new Handler() { // from class: com.eamobile.views.DeletingAssetsView.3 + @Override // android.os.Handler + public void handleMessage(Message message) { + DeletingAssetsView.this.dialog.dismiss(); + if (DownloadActivityInternal.getMainActivity() != null) { + DownloadActivityInternal.getMainActivity().setState(1); + } + } + }; + this.context = context; + } + + /* JADX WARN: Type inference failed for: r0v3, types: [com.eamobile.views.DeletingAssetsView$2] */ + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + this.dialog = ProgressDialog.show(this.context, "", Language.getString(45), true); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.DeletingAssetsView.1 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + new Thread() { // from class: com.eamobile.views.DeletingAssetsView.2 + @Override // java.lang.Thread, java.lang.Runnable + public void run() { + try { + Thread.sleep(300L); + } catch (InterruptedException e) { + Logging.DEBUG_OUT_STACK(e); + } + DownloadActivityInternal.getMainActivity().deleteAssets(); + DeletingAssetsView.this.handler.sendEmptyMessage(0); + } + }.start(); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + if (this.dialog != null) { + this.dialog.dismiss(); + } + } catch (Exception e) { + Logging.DEBUG_OUT("CheckUpdates View clean:" + e); + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } +} diff --git a/app/src/main/java/com/eamobile/views/DownloadFailedView.java b/app/src/main/java/com/eamobile/views/DownloadFailedView.java new file mode 100644 index 0000000..bb87cb2 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/DownloadFailedView.java @@ -0,0 +1,114 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.ADCTelemetry; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class DownloadFailedView extends CustomView { + Dialog dialog; + int errorCode; + Button lskBtn; + LinearLayout mainLayout; + + public DownloadFailedView(Context context) { + super(context); + this.errorCode = 0; + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + showContent(this); + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(11)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(12, new String[]{"" + this.errorCode})); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(14)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.DownloadFailedView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.DownloadFailedView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + DownloadFailedView.this.dialog.dismiss(); + ADCTelemetry.getInstance().sendTelemetry(2); + DownloadActivityInternal.getMainActivity().setState(2); + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.DownloadFailedView.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } + + public void setErrorCode(int i) { + this.errorCode = i; + } +} diff --git a/app/src/main/java/com/eamobile/views/DownloadMsgView.java b/app/src/main/java/com/eamobile/views/DownloadMsgView.java new file mode 100644 index 0000000..611a187 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/DownloadMsgView.java @@ -0,0 +1,117 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.ADCTelemetry; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class DownloadMsgView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + int spaceRequiredMB; + + public DownloadMsgView(Context context) { + super(context); + this.spaceRequiredMB = 0; + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(0)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + DownloadActivityInternal.getMainActivity(); + textView.setText(Language.getString(50, new String[]{DownloadActivityInternal.getMainActivity().getApplicationName(), DownloadActivityInternal.getTotalDownloadSizeMBString(), DownloadActivityInternal.getMainActivity().getSpaceRangeForDownload()})); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(5)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + ADCTelemetry.getInstance().sendTelemetry(0); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.DownloadMsgView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.DownloadMsgView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + DownloadMsgView.this.dialog.dismiss(); + if (!DownloadActivityInternal.getMainActivity().chooseAvailableMemory()) { + DownloadActivityInternal.getMainActivity().setState(4); + } else { + DownloadActivityInternal.getMainActivity().startWifiDownload(false); + } + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.DownloadMsgView.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/DownloadProgressView.java b/app/src/main/java/com/eamobile/views/DownloadProgressView.java new file mode 100644 index 0000000..d40df5e --- /dev/null +++ b/app/src/main/java/com/eamobile/views/DownloadProgressView.java @@ -0,0 +1,217 @@ +package com.eamobile.views; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.os.SystemClock; +import android.support.v4.media.session.PlaybackStateCompat; +import android.view.View; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.download.LockManager; +import com.eamobile.download.Logging; +import com.eamobile.download.SpeedCalculator; +import com.google.android.vending.expansion.downloader.Constants; +import java.util.Timer; +import java.util.TimerTask; + +/* loaded from: classes.dex */ +public class DownloadProgressView extends CustomView { + protected static final int MSG_DOWNLOAD_FAILURE = 2; + protected static final int MSG_DOWNLOAD_RETRY = 1; + public static boolean downloaded; + private static Timer t; + private LockManager lockManager; + private IProgressDialog progressDialog; + public Handler progressHandler; + private SpeedCalculator speedCalculator; + private float timeSeconds; + private RetryTimerTask timerTask; + + public DownloadProgressView(Context context) { + super(context); + this.speedCalculator = null; + this.timeSeconds = 0.0f; + this.progressHandler = new Handler() { // from class: com.eamobile.views.DownloadProgressView.2 + @Override // android.os.Handler + public void handleMessage(Message message) { + try { + if (DownloadActivityInternal.getMainActivity() == null || !DownloadActivityInternal.isInitialized()) { + return; + } + int totalDownloadSizeMB = DownloadActivityInternal.getTotalDownloadSizeMB(); + int sizeDownloaded = (int) ((DownloadActivityInternal.getSizeDownloaded() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID); + DownloadActivityInternal.setFlagLastReportDownload(true); + if (totalDownloadSizeMB > 0) { + if (DownloadProgressView.this.speedCalculator == null) { + Logging.DEBUG_OUT("DownloadProgressView: creating a new SpeedCalculator"); + DownloadProgressView.this.speedCalculator = new SpeedCalculator(0.05f); + DownloadProgressView.this.timeSeconds = SystemClock.uptimeMillis() / 1000.0f; + } else { + DownloadProgressView.this.speedCalculator.reportAmount(DownloadActivityInternal.getRealDownloaded() / 1024.0f, (SystemClock.uptimeMillis() / 1000.0f) - DownloadProgressView.this.timeSeconds); + } + DownloadProgressView.this.progressDialog.setDownloadMax(totalDownloadSizeMB); + DownloadProgressView.this.progressDialog.setDownloadProgress(sizeDownloaded); + DownloadProgressView.this.progressDialog.setDownloadSpeed(DownloadProgressView.this.speedCalculator.getCurrentSpeed()); + DownloadProgressView.this.progressDialog.updateDialog(); + } + if (DownloadActivityInternal.getMainActivity().getPercentDownloaded() >= 100 && DownloadProgressView.downloaded) { + Logging.DEBUG_OUT("Going to State SUCCESS"); + DownloadProgressView.this.progressDialog.dismissDialog(); + DownloadActivityInternal.getMainActivity().setState(11); + } else { + if (message.what == 1 && !DownloadProgressView.downloaded) { + Logging.DEBUG_OUT("Going to State RETRY"); + Timer unused = DownloadProgressView.t = new Timer(); + DownloadProgressView.this.timerTask = DownloadProgressView.this.new RetryTimerTask(); + DownloadProgressView.t.schedule(DownloadProgressView.this.timerTask, 0L, Constants.ACTIVE_THREAD_WATCHDOG); + return; + } + if (message.what == 2) { + Logging.DEBUG_OUT("Going to State FAILURE"); + DownloadProgressView.this.progressDialog.dismissDialog(); + DownloadActivityInternal.getMainActivity().setState(5); + } + } + } catch (Exception e) { + Logging.DEBUG_OUT("Exception here:" + e + ",DownloadActivityInternal.getMainActivity():" + DownloadActivityInternal.getMainActivity()); + Logging.DEBUG_OUT_STACK(e); + } + } + }; + Logging.DEBUG_OUT("DownloadProgressView constructor"); + this.context = context; + this.lockManager = new LockManager(context); + } + + @Override // com.eamobile.views.CustomView + public void pause() { + Logging.DEBUG_OUT("DownloadProgressView pause"); + if (!DownloadActivityInternal.getForceWakeDuringDownload() || this.lockManager == null) { + return; + } + this.lockManager.releaseWakeLock(); + } + + @Override // com.eamobile.views.CustomView + public void resume() { + Logging.DEBUG_OUT("DownloadProgressView resume"); + if (this.progressDialog == null || !this.progressDialog.isDialogValid()) { + return; + } + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + Logging.DEBUG_OUT("DownloadProgressView init"); + if (DownloadActivityInternal.getMainActivity().useCustomProgressBar() && !DownloadActivityInternal.getMainActivity().useOldProgressBar()) { + this.progressDialog = new CustomProgressDialog(this.context); + } else { + this.progressDialog = new DefaultProgressDialog(this.context); + } + this.progressDialog.initDialog(); + new Thread(new Runnable() { // from class: com.eamobile.views.DownloadProgressView.1 + /* JADX WARN: Type inference failed for: r0v3, types: [com.eamobile.views.DownloadProgressView$1$1] */ + @Override // java.lang.Runnable + public void run() { + try { + DownloadProgressView.downloaded = false; + new Thread() { // from class: com.eamobile.views.DownloadProgressView.1.1 + @Override // java.lang.Thread, java.lang.Runnable + public void run() { + Logging.DEBUG_OUT("STARTING A NEW DOWNLOAD >>>>>>>"); + DownloadProgressView.downloaded = DownloadActivityInternal.getMainActivity().startDownload(); + Logging.DEBUG_OUT("DOWNLOADED in PROGRESS VIEW:" + DownloadProgressView.downloaded); + if (DownloadProgressView.downloaded || DownloadActivityInternal.getMainActivity() == null) { + return; + } + Logging.DEBUG_OUT("Failed to download assets. Internal state: " + DownloadActivityInternal.getMainActivity().getStateName()); + if (DownloadProgressView.this.encounteredFatalDownloadError()) { + return; + } + DownloadProgressView.this.progressHandler.sendEmptyMessage(1); + } + }.start(); + Logging.DEBUG_OUT("DownloadProgressView before background loop downloaded=" + DownloadProgressView.downloaded); + while (!DownloadProgressView.downloaded && DownloadActivityInternal.isInitialized()) { + Thread.sleep(100L); + DownloadProgressView.this.progressHandler.sendMessage(DownloadProgressView.this.progressHandler.obtainMessage()); + } + } catch (Exception e) { + Logging.DEBUG_OUT("DownloadProgressView init Exception:" + e); + } + } + }).start(); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + Logging.DEBUG_OUT("DownloadProgressView clean"); + try { + if (this.progressDialog != null && this.progressDialog.isDialogValid()) { + this.progressDialog.dismissDialog(); + } + } catch (Exception e) { + Logging.DEBUG_OUT("DownloadProgressView Clean Exception:" + e); + } + if (this.lockManager != null) { + this.lockManager.releaseWifiLock(); + } + if (!DownloadActivityInternal.getForceWakeDuringDownload() || this.lockManager == null) { + return; + } + this.lockManager.releaseWakeLock(); + } + + private void showContent(View view) { + Logging.DEBUG_OUT("DownloadProgressView showContent"); + this.progressDialog.showDialogContent(); + if (this.lockManager != null) { + this.lockManager.acquireWifiLock(); + } + if (!DownloadActivityInternal.getForceWakeDuringDownload() || this.lockManager == null) { + return; + } + this.lockManager.acquireWakeLock(); + } + + public boolean encounteredFatalDownloadError() { + int state = DownloadActivityInternal.getMainActivity().getState(); + return state == 12 || state == 13; + } + + class RetryTimerTask extends TimerTask { + static final int QTY_RETRY = 10; + int numTries = 10; + + RetryTimerTask() { + } + + @Override // java.util.TimerTask, java.lang.Runnable + public void run() { + Logging.DEBUG_OUT("Attempting to download assets (attempt " + (10 - this.numTries) + "/10) in RetryTimerTask"); + if (this.numTries > 0) { + DownloadProgressView.this.progressHandler.sendEmptyMessage(0); + if (DownloadActivityInternal.getMainActivity().startDownload()) { + Logging.DEBUG_OUT("Download: Successful (in RetryTimerTask, after " + (10 - this.numTries) + " attempt(s))."); + DownloadProgressView.t.cancel(); + DownloadProgressView.downloaded = true; + this.numTries = 0; + } else if (DownloadActivityInternal.getMainActivity() != null && DownloadProgressView.this.encounteredFatalDownloadError()) { + DownloadProgressView.t.cancel(); + DownloadProgressView.this.progressHandler.sendEmptyMessage(2); + this.numTries = 0; + } + this.numTries--; + return; + } + Logging.DEBUG_OUT("Download: Failed (in RetryTimerTask)."); + DownloadProgressView.t.cancel(); + DownloadProgressView.this.progressHandler.sendEmptyMessage(2); + this.numTries = 0; + } + } +} diff --git a/app/src/main/java/com/eamobile/views/IDownloadView.java b/app/src/main/java/com/eamobile/views/IDownloadView.java new file mode 100644 index 0000000..f31377a --- /dev/null +++ b/app/src/main/java/com/eamobile/views/IDownloadView.java @@ -0,0 +1,8 @@ +package com.eamobile.views; + +/* loaded from: classes.dex */ +public interface IDownloadView { + void clean(); + + void init(); +} diff --git a/app/src/main/java/com/eamobile/views/IProgressDialog.java b/app/src/main/java/com/eamobile/views/IProgressDialog.java new file mode 100644 index 0000000..aa443df --- /dev/null +++ b/app/src/main/java/com/eamobile/views/IProgressDialog.java @@ -0,0 +1,20 @@ +package com.eamobile.views; + +/* loaded from: classes.dex */ +public interface IProgressDialog { + void dismissDialog(); + + void initDialog(); + + boolean isDialogValid(); + + void setDownloadMax(int i); + + void setDownloadProgress(int i); + + void setDownloadSpeed(float f); + + void showDialogContent(); + + void updateDialog(); +} diff --git a/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java b/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java new file mode 100644 index 0000000..c943e7f --- /dev/null +++ b/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java @@ -0,0 +1,111 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class InvalidAssetVersionView extends CustomView { + Dialog dialog; + Button exitBtn; + LinearLayout mainLayout; + + public InvalidAssetVersionView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(42)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(43)); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.exitBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.exitBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.InvalidAssetVersionView.1 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + InvalidAssetVersionView.this.dialog.dismiss(); + try { + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } catch (Throwable unused) { + } + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.InvalidAssetVersionView.2 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.InvalidAssetVersionView.3 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java b/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java new file mode 100644 index 0000000..26bdcc2 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java @@ -0,0 +1,122 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class NetworkUnavailableView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + Button rskBtn; + + public NetworkUnavailableView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(9)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(10)); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(16)); + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.NetworkUnavailableView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.NetworkUnavailableView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + NetworkUnavailableView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startWifiManager(); + if (DownloadActivityInternal.getMainActivity().isWifiAvailable()) { + DownloadActivityInternal.getMainActivity().setState(2); + } else { + DownloadActivityInternal.getMainActivity().setState(6); + } + } + }); + this.rskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.NetworkUnavailableView.3 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + NetworkUnavailableView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.NetworkUnavailableView.4 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/ServerErrorView.java b/app/src/main/java/com/eamobile/views/ServerErrorView.java new file mode 100644 index 0000000..10b14be --- /dev/null +++ b/app/src/main/java/com/eamobile/views/ServerErrorView.java @@ -0,0 +1,114 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class ServerErrorView extends CustomView { + Dialog dialog; + int errorCode; + Button lskBtn; + LinearLayout mainLayout; + + public ServerErrorView(Context context) { + super(context); + this.errorCode = 0; + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(33)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(34, new String[]{"" + this.errorCode})); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.ServerErrorView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.ServerErrorView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + ServerErrorView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.ServerErrorView.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } + + public void setErrorCode(int i) { + this.errorCode = i; + } +} diff --git a/app/src/main/java/com/eamobile/views/Show3GView.java b/app/src/main/java/com/eamobile/views/Show3GView.java new file mode 100644 index 0000000..ef7e3ce --- /dev/null +++ b/app/src/main/java/com/eamobile/views/Show3GView.java @@ -0,0 +1,123 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class Show3GView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + Button rskBtn; + + public Show3GView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(39)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(24) + " " + Language.getString(29)); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(17)); + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.Show3GView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().setState(6); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.Show3GView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + Show3GView.this.dialog.dismiss(); + if (!DownloadActivityInternal.getMainActivity().test3GNetwork()) { + DownloadActivityInternal.getMainActivity().setState(7); + } else if (DownloadActivityInternal.getTotalDownloadSizeMB() != 0) { + DownloadActivityInternal.getMainActivity().setState(2); + } else { + DownloadActivityInternal.getMainActivity().setState(14); + } + } + }); + this.rskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.Show3GView.3 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + Show3GView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.Show3GView.4 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/ShowBGView.java b/app/src/main/java/com/eamobile/views/ShowBGView.java new file mode 100644 index 0000000..17639c5 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/ShowBGView.java @@ -0,0 +1,48 @@ +package com.eamobile.views; + +import android.content.Context; +import android.os.CountDownTimer; +import android.view.View; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.download.Logging; + +/* loaded from: classes.dex */ +public class ShowBGView extends CustomView { + public ShowBGView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + Logging.DEBUG_OUT("ShowBGView.init: before calling showContent"); + showContent(this); + Logging.DEBUG_OUT("ShowBGView.init: after calling showContent"); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + } + + @Override // com.eamobile.views.CustomView + public void resume() { + Logging.DEBUG_OUT("ShowBGView.resume"); + } + + private void showContent(View view) { + new CountDownTimer(1000L, 100L) { // from class: com.eamobile.views.ShowBGView.1 + @Override // android.os.CountDownTimer + public void onTick(long j) { + } + + @Override // android.os.CountDownTimer + public void onFinish() { + if (DownloadActivityInternal.getMainActivity() != null) { + DownloadActivityInternal.getMainActivity().setState(3); + } + } + }.start(); + } +} diff --git a/app/src/main/java/com/eamobile/views/ShowWifiView.java b/app/src/main/java/com/eamobile/views/ShowWifiView.java new file mode 100644 index 0000000..6ad6a05 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/ShowWifiView.java @@ -0,0 +1,140 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class ShowWifiView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + Button midBtn; + Button rskBtn; + + public ShowWifiView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(7)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + if (DownloadActivityInternal.getMainActivity().isAmazonDevice()) { + textView.setText(Language.getString(32)); + } else if (DownloadActivityInternal.getMainActivity().is3GDisabled()) { + textView.setText(Language.getString(8)); + } else { + textView.setText(Language.getString(8) + " " + Language.getString(31)); + } + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + if (!DownloadActivityInternal.getMainActivity().isAmazonDevice()) { + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(16)); + if (!DownloadActivityInternal.getMainActivity().is3GDisabled()) { + this.midBtn = addButton(this.context, linearLayout2, Language.getString(23)); + } + } + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.ShowWifiView.1 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.ShowWifiView.2 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().setState(1); + } + }); + if (!DownloadActivityInternal.getMainActivity().isAmazonDevice()) { + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.ShowWifiView.3 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + ShowWifiView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startWifiManager(); + } + }); + if (!DownloadActivityInternal.getMainActivity().is3GDisabled()) { + this.midBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.ShowWifiView.4 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + ShowWifiView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().setState(10); + } + }); + } + } + this.rskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.ShowWifiView.5 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + ShowWifiView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + } +} diff --git a/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java b/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java new file mode 100644 index 0000000..99e99a7 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java @@ -0,0 +1,127 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class SpaceUnavailableView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + Button rskBtn; + + public SpaceUnavailableView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(3)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(51, new String[]{DownloadActivityInternal.getMainActivity().getRequiredSpaceForDownload(), DownloadActivityInternal.getMainActivity().getAvailableSpaceForDownload()})); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + if (DownloadActivityInternal.getMainActivity().canOpenStorageSettings()) { + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(2)); + } + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.rskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.SpaceUnavailableView.1 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + SpaceUnavailableView.this.dialog.dismiss(); + try { + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } catch (Throwable unused) { + } + } + }); + if (DownloadActivityInternal.getMainActivity().canOpenStorageSettings()) { + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.SpaceUnavailableView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + SpaceUnavailableView.this.dialog.dismiss(); + try { + DownloadActivityInternal.getMainActivity().startDataManagement(); + } catch (Throwable unused) { + } + } + }); + } + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.SpaceUnavailableView.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.SpaceUnavailableView.4 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java b/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java new file mode 100644 index 0000000..03356c9 --- /dev/null +++ b/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java @@ -0,0 +1,108 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class UnSupportedDeviceView extends CustomView { + Dialog dialog; + Button lskBtn; + LinearLayout mainLayout; + + public UnSupportedDeviceView(Context context) { + super(context); + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(27)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + textView.setText(Language.getString(28)); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.UnSupportedDeviceView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.UnSupportedDeviceView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + UnSupportedDeviceView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.UnSupportedDeviceView.3 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/com/eamobile/views/UpdatesFoundView.java b/app/src/main/java/com/eamobile/views/UpdatesFoundView.java new file mode 100644 index 0000000..bce7ebc --- /dev/null +++ b/app/src/main/java/com/eamobile/views/UpdatesFoundView.java @@ -0,0 +1,133 @@ +package com.eamobile.views; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import com.eamobile.DownloadActivityInternal; +import com.eamobile.Language; + +/* loaded from: classes.dex */ +public class UpdatesFoundView extends CustomView { + Dialog dialog; + boolean localAssetsOK; + Button lskBtn; + LinearLayout mainLayout; + Button rskBtn; + + public UpdatesFoundView(Context context) { + super(context); + this.localAssetsOK = true; + this.context = context; + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void init() { + super.init(); + createContent(this); + showContent(this); + } + + @Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView + public void clean() { + super.clean(); + try { + this.dialog.dismiss(); + } catch (Exception unused) { + } + } + + @Override // com.eamobile.views.CustomView + public void resume() { + if (this.dialog != null) { + showContent(this); + } + } + + private void createContent(View view) { + this.localAssetsOK = DownloadActivityInternal.getMainActivity().checkLocalAssetVersion(); + this.dialog = new Dialog(this.context); + this.dialog.setCancelable(true); + this.dialog.setCanceledOnTouchOutside(false); + this.dialog.requestWindowFeature(1); + this.mainLayout = new LinearLayout(this.context); + this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + this.mainLayout.setOrientation(1); + this.mainLayout.setGravity(16); + addTitle(this.context, this.mainLayout, Language.getString(25)); + LinearLayout linearLayout = new LinearLayout(this.context); + linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout.setOrientation(1); + linearLayout.setGravity(16); + ScrollView scrollView = new ScrollView(this.context); + scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + scrollView.setForegroundGravity(16); + TextView textView = new TextView(this.context); + textView.setClickable(false); + textView.setCursorVisible(false); + textView.setPadding(10, 10, 10, 10); + textView.setTextSize(1, 16.0f); + String string = Language.getString(26, new String[]{DownloadActivityInternal.getMainActivity().getApplicationName(), DownloadActivityInternal.getMainActivity().getSpaceRangeForDownload()}); + String string2 = Language.getString(44); + if (!this.localAssetsOK) { + string = string + "\n" + string2; + } + textView.setText(string); + scrollView.addView(textView); + LinearLayout linearLayout2 = new LinearLayout(this.context); + linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); + linearLayout2.setPadding(5, 0, 5, 5); + linearLayout2.setOrientation(0); + linearLayout2.setGravity(80); + this.lskBtn = addButton(this.context, linearLayout2, Language.getString(5)); + if (this.localAssetsOK) { + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(18)); + } else { + this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); + } + linearLayout.addView(scrollView); + this.mainLayout.addView(linearLayout); + this.mainLayout.addView(linearLayout2); + } + + private void showContent(View view) { + this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.eamobile.views.UpdatesFoundView.1 + @Override // android.content.DialogInterface.OnCancelListener + public void onCancel(DialogInterface dialogInterface) { + dialogInterface.dismiss(); + DownloadActivityInternal.getMainActivity().setState(3); + } + }); + this.lskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.UpdatesFoundView.2 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + UpdatesFoundView.this.dialog.dismiss(); + DownloadActivityInternal.getMainActivity().updateDownload(); + } + }); + this.rskBtn.setOnClickListener(new View.OnClickListener() { // from class: com.eamobile.views.UpdatesFoundView.3 + @Override // android.view.View.OnClickListener + public void onClick(View view2) { + UpdatesFoundView.this.dialog.dismiss(); + if (UpdatesFoundView.this.localAssetsOK) { + DownloadActivityInternal.getMainActivity().setState(11); + } else { + DownloadActivityInternal.getMainActivity().startGameActivity(0); + } + } + }); + this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.eamobile.views.UpdatesFoundView.4 + @Override // android.content.DialogInterface.OnKeyListener + public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { + return i == 82 || i == 84 || i == 4; + } + }); + this.dialog.setContentView(this.mainLayout); + this.dialog.show(); + } +} diff --git a/app/src/main/java/org/fmod/FMODAudioDevice.java b/app/src/main/java/org/fmod/FMODAudioDevice.java new file mode 100644 index 0000000..bba1050 --- /dev/null +++ b/app/src/main/java/org/fmod/FMODAudioDevice.java @@ -0,0 +1,108 @@ +package org.fmod; + +import android.media.AudioTrack; +import android.util.Log; +import java.nio.ByteBuffer; + +/* loaded from: classes.dex */ +public class FMODAudioDevice implements Runnable { + private static int FMOD_INFO_DSPBUFFERLENGTH = 1; + private static int FMOD_INFO_DSPNUMBUFFERS = 2; + private static int FMOD_INFO_MIXERRUNNING = 3; + private static int FMOD_INFO_SAMPLERATE = 0; + private static int NUMCHANNELS = 2; + private Thread mThread = null; + private AudioTrack mTrack = null; + private boolean mRunning = false; + private boolean mInitialised = false; + + private native int fmodGetInfo(int i); + + private native int fmodProcess(ByteBuffer byteBuffer); + + public boolean isMixing() { + return this.mInitialised; + } + + public void start() { + if (this.mThread != null) { + stop(); + } + this.mThread = new Thread(this); + this.mThread.setPriority(10); + this.mRunning = true; + this.mThread.start(); + } + + public void stop() { + while (this.mThread != null) { + this.mRunning = false; + try { + this.mThread.join(); + this.mThread = null; + } catch (InterruptedException unused) { + } + } + } + + @Override // java.lang.Runnable + public void run() { + ByteBuffer byteBuffer = null; + byte[] bArr = null; + int i = 3; + while (this.mRunning) { + if (!this.mInitialised) { + int fmodGetInfo = fmodGetInfo(FMOD_INFO_SAMPLERATE); + if (fmodGetInfo > 0) { + int minBufferSize = AudioTrack.getMinBufferSize(fmodGetInfo, 3, 2); + int fmodGetInfo2 = fmodGetInfo(FMOD_INFO_DSPBUFFERLENGTH); + int fmodGetInfo3 = fmodGetInfo(FMOD_INFO_DSPNUMBUFFERS); + Log.i("fmod", "FMOD: AudioDevice::run : Min buffer size: " + minBufferSize + " bytes"); + int i2 = fmodGetInfo3 * fmodGetInfo2 * 2; + int i3 = NUMCHANNELS * i2 > minBufferSize ? i2 * NUMCHANNELS : minBufferSize; + Log.i("fmod", "FMOD: AudioDevice::run : Actual buffer size: " + i3 + " bytes"); + byteBuffer = ByteBuffer.allocateDirect(fmodGetInfo2 * 2 * NUMCHANNELS); + bArr = new byte[byteBuffer.capacity()]; + this.mTrack = new AudioTrack(3, fmodGetInfo, 3, 2, i3, 1); + if (this.mTrack.getState() == 1) { + this.mTrack.play(); + this.mInitialised = true; + } else { + this.mTrack.release(); + this.mTrack = null; + i--; + if (i == 0) { + Log.e("fmod", "FMOD: AudioDevice::run : Couldn't initialize AudioTrack, giving up"); + this.mRunning = false; + } else { + Log.w("fmod", "FMOD: AudioDevice::run : Couldn't initialize AudioTrack, retrying..."); + try { + Thread.sleep(1000L); + } catch (InterruptedException unused) { + } + } + } + } else { + Thread.sleep(100L); + } + } else if (fmodGetInfo(FMOD_INFO_MIXERRUNNING) == 1) { + fmodProcess(byteBuffer); + byteBuffer.get(bArr); + byteBuffer.position(0); + this.mTrack.write(bArr, 0, byteBuffer.capacity()); + } else { + shutDown(); + } + } + shutDown(); + } + + private void shutDown() { + if (this.mTrack != null) { + this.mTrack.stop(); + this.mTrack.release(); + this.mTrack = null; + } + this.mInitialised = false; + } +} diff --git a/app/src/main/jniLibs/armeabi-v7a/libNimble.so b/app/src/main/jniLibs/armeabi-v7a/libNimble.so new file mode 100644 index 0000000..139665a Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libNimble.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libapp.so b/app/src/main/jniLibs/armeabi-v7a/libapp.so new file mode 100644 index 0000000..6ca295b Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libapp.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so b/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so new file mode 100644 index 0000000..9c16b51 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libfmodevent.so b/app/src/main/jniLibs/armeabi-v7a/libfmodevent.so new file mode 100644 index 0000000..fc0aeae Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libfmodevent.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libfmodex.so b/app/src/main/jniLibs/armeabi-v7a/libfmodex.so new file mode 100644 index 0000000..25da1d4 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libfmodex.so differ diff --git a/app/src/main/jniLibs/x86/libNimble.so b/app/src/main/jniLibs/x86/libNimble.so new file mode 100644 index 0000000..7092cab Binary files /dev/null and b/app/src/main/jniLibs/x86/libNimble.so differ diff --git a/app/src/main/jniLibs/x86/libapp.so b/app/src/main/jniLibs/x86/libapp.so new file mode 100644 index 0000000..5d73ef9 Binary files /dev/null and b/app/src/main/jniLibs/x86/libapp.so differ diff --git a/app/src/main/jniLibs/x86/libc++_shared.so b/app/src/main/jniLibs/x86/libc++_shared.so new file mode 100644 index 0000000..cb61731 Binary files /dev/null and b/app/src/main/jniLibs/x86/libc++_shared.so differ diff --git a/app/src/main/jniLibs/x86/libfmodevent.so b/app/src/main/jniLibs/x86/libfmodevent.so new file mode 100644 index 0000000..62d690d Binary files /dev/null and b/app/src/main/jniLibs/x86/libfmodevent.so differ diff --git a/app/src/main/jniLibs/x86/libfmodex.so b/app/src/main/jniLibs/x86/libfmodex.so new file mode 100644 index 0000000..f444636 Binary files /dev/null and b/app/src/main/jniLibs/x86/libfmodex.so differ diff --git a/app/src/main/res/drawable-hdpi/icon.png b/app/src/main/res/drawable-hdpi/icon.png new file mode 100644 index 0000000..d0805cc Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon.png differ diff --git a/app/src/main/res/drawable-hdpi/icon_round.png b/app/src/main/res/drawable-hdpi/icon_round.png new file mode 100644 index 0000000..4168402 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_round.png differ diff --git a/app/src/main/res/drawable-hdpi/iconb.png b/app/src/main/res/drawable-hdpi/iconb.png new file mode 100644 index 0000000..7f14e51 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/iconb.png differ diff --git a/app/src/main/res/drawable-hdpi/iconw.png b/app/src/main/res/drawable-hdpi/iconw.png new file mode 100644 index 0000000..a228c6d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/iconw.png differ diff --git a/app/src/main/res/drawable-ldpi/icon.png b/app/src/main/res/drawable-ldpi/icon.png new file mode 100644 index 0000000..fafb776 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/icon.png differ diff --git a/app/src/main/res/drawable-ldpi/icon_round.png b/app/src/main/res/drawable-ldpi/icon_round.png new file mode 100644 index 0000000..8c511b6 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/icon_round.png differ diff --git a/app/src/main/res/drawable-ldpi/iconb.png b/app/src/main/res/drawable-ldpi/iconb.png new file mode 100644 index 0000000..696f1e1 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/iconb.png differ diff --git a/app/src/main/res/drawable-ldpi/iconw.png b/app/src/main/res/drawable-ldpi/iconw.png new file mode 100644 index 0000000..6ae8029 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/iconw.png differ diff --git a/app/src/main/res/drawable-mdpi/icon.png b/app/src/main/res/drawable-mdpi/icon.png new file mode 100644 index 0000000..edbba7d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon.png differ diff --git a/app/src/main/res/drawable-mdpi/icon_round.png b/app/src/main/res/drawable-mdpi/icon_round.png new file mode 100644 index 0000000..b343173 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_round.png differ diff --git a/app/src/main/res/drawable-mdpi/iconb.png b/app/src/main/res/drawable-mdpi/iconb.png new file mode 100644 index 0000000..6f3d805 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/iconb.png differ diff --git a/app/src/main/res/drawable-mdpi/iconw.png b/app/src/main/res/drawable-mdpi/iconw.png new file mode 100644 index 0000000..23087a3 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/iconw.png differ diff --git a/app/src/main/res/drawable-xhdpi/icon.png b/app/src/main/res/drawable-xhdpi/icon.png new file mode 100644 index 0000000..1c48a2b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon.png differ diff --git a/app/src/main/res/drawable-xhdpi/icon_round.png b/app/src/main/res/drawable-xhdpi/icon_round.png new file mode 100644 index 0000000..2fb2511 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_round.png differ diff --git a/app/src/main/res/drawable-xhdpi/iconb.png b/app/src/main/res/drawable-xhdpi/iconb.png new file mode 100644 index 0000000..7f14e51 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/iconb.png differ diff --git a/app/src/main/res/drawable-xhdpi/iconw.png b/app/src/main/res/drawable-xhdpi/iconw.png new file mode 100644 index 0000000..a228c6d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/iconw.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon.png b/app/src/main/res/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..3d2d8ec Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_round.png b/app/src/main/res/drawable-xxhdpi/icon_round.png new file mode 100644 index 0000000..9418d6e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_round.png differ diff --git a/app/src/main/res/drawable-xxhdpi/iconb.png b/app/src/main/res/drawable-xxhdpi/iconb.png new file mode 100644 index 0000000..7f14e51 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/iconb.png differ diff --git a/app/src/main/res/drawable-xxhdpi/iconw.png b/app/src/main/res/drawable-xxhdpi/iconw.png new file mode 100644 index 0000000..a228c6d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/iconw.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/icon.png b/app/src/main/res/drawable-xxxhdpi/icon.png new file mode 100644 index 0000000..8378e8b Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/icon_round.png b/app/src/main/res/drawable-xxxhdpi/icon_round.png new file mode 100644 index 0000000..1097df3 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_round.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/iconb.png b/app/src/main/res/drawable-xxxhdpi/iconb.png new file mode 100644 index 0000000..7f14e51 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/iconb.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/iconw.png b/app/src/main/res/drawable-xxxhdpi/iconw.png new file mode 100644 index 0000000..a228c6d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/iconw.png differ diff --git a/app/src/main/res/drawable/icon.png b/app/src/main/res/drawable/icon.png new file mode 100644 index 0000000..d0805cc Binary files /dev/null and b/app/src/main/res/drawable/icon.png differ diff --git a/app/src/main/res/drawable/icon_round.png b/app/src/main/res/drawable/icon_round.png new file mode 100644 index 0000000..4168402 Binary files /dev/null and b/app/src/main/res/drawable/icon_round.png differ diff --git a/app/src/main/res/drawable/iconb.png b/app/src/main/res/drawable/iconb.png new file mode 100644 index 0000000..7f14e51 Binary files /dev/null and b/app/src/main/res/drawable/iconb.png differ diff --git a/app/src/main/res/drawable/iconw.png b/app/src/main/res/drawable/iconw.png new file mode 100644 index 0000000..a228c6d Binary files /dev/null and b/app/src/main/res/drawable/iconw.png differ diff --git a/app/src/main/res/layout/webview.xml b/app/src/main/res/layout/webview.xml new file mode 100644 index 0000000..b9cf032 --- /dev/null +++ b/app/src/main/res/layout/webview.xml @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/adaptive_icon.xml b/app/src/main/res/mipmap-anydpi-v26/adaptive_icon.xml new file mode 100644 index 0000000..22c6e51 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/adaptive_icon.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/adaptive_icon_round.xml b/app/src/main/res/mipmap-anydpi-v26/adaptive_icon_round.xml new file mode 100644 index 0000000..22c6e51 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/adaptive_icon_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-hdpi/adaptive_icon.png b/app/src/main/res/mipmap-hdpi/adaptive_icon.png new file mode 100644 index 0000000..be530de Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/adaptive_icon.png differ diff --git a/app/src/main/res/mipmap-hdpi/adaptive_icon_background.png b/app/src/main/res/mipmap-hdpi/adaptive_icon_background.png new file mode 100644 index 0000000..62dbc35 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/adaptive_icon_background.png differ diff --git a/app/src/main/res/mipmap-hdpi/adaptive_icon_foreground.png b/app/src/main/res/mipmap-hdpi/adaptive_icon_foreground.png new file mode 100644 index 0000000..17765f3 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/adaptive_icon_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/adaptive_icon_round.png b/app/src/main/res/mipmap-hdpi/adaptive_icon_round.png new file mode 100644 index 0000000..ebed352 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/adaptive_icon_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/adaptive_icon.png b/app/src/main/res/mipmap-mdpi/adaptive_icon.png new file mode 100644 index 0000000..311c293 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/adaptive_icon.png differ diff --git a/app/src/main/res/mipmap-mdpi/adaptive_icon_background.png b/app/src/main/res/mipmap-mdpi/adaptive_icon_background.png new file mode 100644 index 0000000..e2f405a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/adaptive_icon_background.png differ diff --git a/app/src/main/res/mipmap-mdpi/adaptive_icon_foreground.png b/app/src/main/res/mipmap-mdpi/adaptive_icon_foreground.png new file mode 100644 index 0000000..1c864f5 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/adaptive_icon_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/adaptive_icon_round.png b/app/src/main/res/mipmap-mdpi/adaptive_icon_round.png new file mode 100644 index 0000000..3da18d5 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/adaptive_icon_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/adaptive_icon.png b/app/src/main/res/mipmap-xhdpi/adaptive_icon.png new file mode 100644 index 0000000..2e89b55 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/adaptive_icon.png differ diff --git a/app/src/main/res/mipmap-xhdpi/adaptive_icon_background.png b/app/src/main/res/mipmap-xhdpi/adaptive_icon_background.png new file mode 100644 index 0000000..7accf79 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/adaptive_icon_background.png differ diff --git a/app/src/main/res/mipmap-xhdpi/adaptive_icon_foreground.png b/app/src/main/res/mipmap-xhdpi/adaptive_icon_foreground.png new file mode 100644 index 0000000..ccc8e9a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/adaptive_icon_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/adaptive_icon_round.png b/app/src/main/res/mipmap-xhdpi/adaptive_icon_round.png new file mode 100644 index 0000000..8bf6f95 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/adaptive_icon_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/adaptive_icon.png b/app/src/main/res/mipmap-xxhdpi/adaptive_icon.png new file mode 100644 index 0000000..97603e0 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/adaptive_icon.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/adaptive_icon_background.png b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_background.png new file mode 100644 index 0000000..47cf508 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_background.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/adaptive_icon_foreground.png b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_foreground.png new file mode 100644 index 0000000..1a960bb Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/adaptive_icon_round.png b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_round.png new file mode 100644 index 0000000..fd4fc6b Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/adaptive_icon_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/adaptive_icon.png b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon.png new file mode 100644 index 0000000..6cd9c5a Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_background.png b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_background.png new file mode 100644 index 0000000..1604b84 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_background.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_foreground.png b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_foreground.png new file mode 100644 index 0000000..7a64a9c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_round.png b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_round.png new file mode 100644 index 0000000..e710ebb Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/adaptive_icon_round.png differ diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml new file mode 100644 index 0000000..fc0907d --- /dev/null +++ b/app/src/main/res/values-af/strings.xml @@ -0,0 +1,47 @@ + + + Navigeer tuis + %1$s, %2$s + %1$s, %2$s, %3$s + Navigeer op + Nog opsies + Klaar + Sien alles + Kies \'n program + AF + AAN + Soek … + Vee navraag uit + Soeknavraag + Soek + Dien navraag in + Stemsoektog + Deel met + Deel met %s + Vou in + Besoek <b>facebook.com/device</b> en voer die kode wat hierbo gewys word, in. + Onvoorsiene fout terwyl die prent afgelaai is. + WebView-aanmelding vereis INTERNET-toestemming + AndroidManifest-fout + Hou van + Hou van + Laai tans … + Kanselleer + Teken aan + Gaan voort met Facebook + Meld aan met Facebook + Teken uit + Teken uit + Aangemeld as: %1$s + Aangemeld met Facebook + Stuur + Deel + Maak die Facebook-toepassing op jou mobiele toestel oop en soek kennisgewings om jou rekening te koppel. + - OF - + Nie jy nie? + Gaan voort as %1$s + Bevestig aanmelding + Jy is in beheer – kies watter inligting jy met toepassings wil deel. + Soek + 999+ + diff --git a/app/src/main/res/values-am/strings.xml b/app/src/main/res/values-am/strings.xml new file mode 100644 index 0000000..b42453e --- /dev/null +++ b/app/src/main/res/values-am/strings.xml @@ -0,0 +1,24 @@ + + + ወደ መነሻ ይዳስሱ + %1$s፣ %2$s + %1$s፣ %2$s፣ %3$s + ወደ ላይ ይዳስሱ + ተጨማሪ አማራጮች + ተከናውኗል + ሁሉንም ይመልከቱ + መተግበሪያ ይምረጡ + ጠፍቷል + በርቷል + ፈልግ… + መጠይቅ አጽዳ + የፍለጋ ጥያቄ + ፍለጋ + መጠይቅ ያስረክቡ + የድምፅ ፍለጋ + ከሚከተለው ጋር ያጋሩ + ከ%s ጋር ያጋሩ + ሰብስብ + ፈልግ + 999+ + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml new file mode 100644 index 0000000..e709e47 --- /dev/null +++ b/app/src/main/res/values-ar/strings.xml @@ -0,0 +1,47 @@ + + + التنقل إلى الشاشة الرئيسية + %1$s، %2$s + %1$s، %2$s، %3$s + التنقل إلى أعلى + خيارات إضافية + تم + عرض الكل + اختيار تطبيق + إيقاف + تشغيل + بحث… + محو طلب البحث + طلب البحث + بحث + إرسال طلب البحث + البحث الصوتي + مشاركة مع + ‏مشاركة مع %s + تصغير + تفضل بزيارة <b>facebook.com/device</b> وإدخال الرمز الموضح أعلاه. + حدث خطأ غير متوقع أثناء تنزيل صورة. + يتطلب تسجيل دخول WebView الحصول إلى إذن INTERNET + خطأ AndroidManifest + أعجبك + أعجبني + جارٍ التحميل… + إلغاء + تسجيل الدخول + متابعة بحساب فيسبوك + تسجيل الدخول بحساب فيسبوك + تسجيل الخروج + تسجيل الخروج + تم تسجيل الدخول باسم: %1$s + تم تسجيل الدخول باستخدام حساب فيسبوك + إرسال + مشاركة + لربط حسابك، افتح تطبيق فيسبوك على جهازك المحمول وراجع الإشعارات. + - أو - + لست أنت؟ + متابعة باسم %1$s + تأكيد تسجيل الدخول + أنت المتحكم في الأمر - يمكنك اختيار المعلومات التي تود مشاركتها مع التطبيقات. + البحث + +999 + diff --git a/app/src/main/res/values-az-rAZ/strings.xml b/app/src/main/res/values-az-rAZ/strings.xml new file mode 100644 index 0000000..75354e8 --- /dev/null +++ b/app/src/main/res/values-az-rAZ/strings.xml @@ -0,0 +1,23 @@ + + + Evə naviqasiya et + %1$s, %2$s + %1$s, %2$s, %3$s + Yuxarı get + Digər variantlar + Hazırdır + Hamısına baxın + Tətbiq seçin + DEAKTİV + AKTİV + Axtarış... + Sorğunu təmizlə + Axtarış sorğusu + Axtarış + Sorğunu göndərin + Səsli axtarış + Bununla paylaşın + Dağıt + Axtarış + 999+ + diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-az/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-b+sr+Latn/strings.xml b/app/src/main/res/values-b+sr+Latn/strings.xml new file mode 100644 index 0000000..2bc0fd9 --- /dev/null +++ b/app/src/main/res/values-b+sr+Latn/strings.xml @@ -0,0 +1,24 @@ + + + Odlazak na Početnu + %1$s, %2$s + %1$s, %2$s, %3$s + Kretanje nagore + Još opcija + Gotovo + Prikaži sve + Izbor aplikacije + ISKLJUČI + UKLJUČI + Pretražite... + Brisanje upita + Upit za pretragu + Pretraga + Slanje upita + Glasovna pretraga + Deli sa + Deli sa aplikacijom %s + Skupi + Pretraži + >999 + diff --git a/app/src/main/res/values-be-rBY/strings.xml b/app/src/main/res/values-be-rBY/strings.xml new file mode 100644 index 0000000..e1f9057 --- /dev/null +++ b/app/src/main/res/values-be-rBY/strings.xml @@ -0,0 +1,24 @@ + + + Перайсці на галоўную старонку + %1$s, %2$s + %1$s, %2$s, %3$s + Перайсці ўверх + Дадатковыя параметры + Гатова + Прагледзець усё + Выбраць праграму + ВЫКЛ. + УКЛ. + Пошук... + Выдалiць запыт + Запыт на пошук + Пошук + Адправіць запыт + Галасавы пошук + Абагуліць з + Абагуліць з %s + Згарнуць + Пошук + больш за 999 + diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml new file mode 100644 index 0000000..47cbbea --- /dev/null +++ b/app/src/main/res/values-be/strings.xml @@ -0,0 +1,4 @@ + + + больш за 999 + diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml new file mode 100644 index 0000000..168e745 --- /dev/null +++ b/app/src/main/res/values-bg/strings.xml @@ -0,0 +1,24 @@ + + + Придвижване към „Начало“ + „%1$s“ – %2$s + „%1$s“, „%2$s“ – %3$s + Придвижване нагоре + Още опции + Готово + Вижте всички + Изберете приложение + ИЗКЛ. + ВКЛ. + Търсете… + Изчистване на заявката + Заявка за търсене + Търсене + Изпращане на заявката + Гласово търсене + Споделяне със: + Споделяне със: %s + Свиване + Търсене + 999+ + diff --git a/app/src/main/res/values-bn-rBD/strings.xml b/app/src/main/res/values-bn-rBD/strings.xml new file mode 100644 index 0000000..f899a9c --- /dev/null +++ b/app/src/main/res/values-bn-rBD/strings.xml @@ -0,0 +1,24 @@ + + + হোম এ নেভিগেট করুন + %1$s, %2$s + %1$s, %2$s, %3$s + উপরের দিকে নেভিগেট করুন + আরো বিকল্প + সম্পন্ন হয়েছে + সবগুলো দেখুন + একটি অ্যাপ্লিকেশান বেছে নিন + বন্ধ + চালু + অনুসন্ধান... + ক্যোয়ারী সাফ করুন + ক্যোয়ারী অনুসন্ধান করুন + অনুসন্ধান করুন + ক্যোয়ারী জমা দিন + ভয়েস অনুসন্ধান + এর সাথে শেয়ার করুন + %s এর সাথে শেয়ার করুন + সঙ্কুচিত করুন + অনুসন্ধান করুন + ৯৯৯+ + diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml new file mode 100644 index 0000000..aa03f2d --- /dev/null +++ b/app/src/main/res/values-bn/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> দেখুন এবং উপরে দেখানো কোডটিকে প্রবেশ করান৷ + একটি ছবি ডাউনলোড করার সময় অপ্রত্যাশিত ত্রুটি ঘটেছে৷ + WebView লগ ইনের ইন্টারনেটের অনুমতি প্রয়োজন + AndroidManifest ত্রুটি + পছন্দ করেছে + লাইক + লোড হচ্ছে… + বাতিল করুন + লগ ইন করুন + Facebook এর সাথে চালিয়ে যান + Facebook দিয়ে লগইন করুন + লগ আউট করুন + লগ আউট করুন + %1$s হিসাবে লগ ইন করা হয়েছে। + Facebook ব্যবহার করার মাধ্যমে লগ ইন করা হয়েছে + পাঠান + শেয়ার করুন + আপনার অ্যাকাউন্ট সংযুক্ত করতে, আপনার মোবাইল ডিভাইসে Facebook অ্যাপ খুলুন এবং বিজ্ঞপ্তিগুলির জন্য পরীক্ষা করুন। + - বা - + আপনি নন? + %1$s হিসাবে চালিয়ে যান + লগ ইন নিশ্চিত করুন + আপনার নিয়ন্ত্রণ রয়েছে - আপনি অ্যাপগুলির সাথে কোন তথ্য শেয়ার করতে চান সেটি বেছে নিন। + ৯৯৯+ + diff --git a/app/src/main/res/values-bs-rBA/strings.xml b/app/src/main/res/values-bs-rBA/strings.xml new file mode 100644 index 0000000..9c41406 --- /dev/null +++ b/app/src/main/res/values-bs-rBA/strings.xml @@ -0,0 +1,24 @@ + + + Vrati se na početnu stranicu + %1$s, %2$s + %1$s, %2$s, %3$s + Navigiraj prema gore + Više opcija + Završeno + Vidi sve + Odaberite aplikaciju + ISKLJUČI + UKLJUČI + Pretraži... + Obriši upit + Pretraži upit + Traži + Pošalji upit + Pretraživanje glasom + Podijeli sa + Podijeli sa %s + Skupi + Pretraži + >999 + diff --git a/app/src/main/res/values-bs/strings.xml b/app/src/main/res/values-bs/strings.xml new file mode 100644 index 0000000..5901c6c --- /dev/null +++ b/app/src/main/res/values-bs/strings.xml @@ -0,0 +1,4 @@ + + + >999 + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml new file mode 100644 index 0000000..e0fcd8d --- /dev/null +++ b/app/src/main/res/values-ca/strings.xml @@ -0,0 +1,24 @@ + + + Navega a la pàgina d\'inici + %1$s, %2$s + %1$s, %2$s, %3$s + Navega cap a dalt + Més opcions + Fet + Mostra\'ls tots + Selecciona una aplicació + DESACTIVAT + ACTIVAT + Cerca... + Esborra la consulta + Consulta de cerca + Cerca + Envia la consulta + Cerca per veu + Comparteix amb + Comparteix amb %s + Replega + Cerca + +999 + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml new file mode 100644 index 0000000..c118df0 --- /dev/null +++ b/app/src/main/res/values-cs/strings.xml @@ -0,0 +1,47 @@ + + + Přejít na plochu + %1$s – %2$s + %1$s, %2$s – %3$s + Přejít nahoru + Více možností + Hotovo + Zobrazit vše + Vybrat aplikaci + VYPNUTO + ZAPNUTO + Vyhledat… + Smazat dotaz + Vyhledávací dotaz + Hledat + Odeslat dotaz + Hlasové vyhledávání + Sdílet pomocí + Sdílet pomocí %s + Sbalit + Přejděte na <b>facebook.com/device</b> a zadejte nahoře uvedený kód. + Neočekávaná chyba při stahování obrázku. + WebView vyžaduje oprávnění pro INTERNET + Chyba AndroidManifest + To se mi už líbí + To se mi líbí + Načítání... + Zrušit + Přihlášení + Pokračovat přes Facebook + Přihlásit se přes Facebook + Odhlásit se + Odhlásit se + Přihlášen(a) jako: %1$s + Přihlášení přes Facebook + Odeslat + Sdílet + Pokud chcete připojit svůj účet, spusťte aplikaci Facebook ve svém mobilním zařízení a zkontrolujte upozornění. + - NEBO - + Nejste to vy? + Pokračovat jako %1$s + Potvrďte přihlášení + Je to jen na vás – nastavte si, které informace chcete s aplikacemi sdílet. + Hledat + 999+ + diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml new file mode 100644 index 0000000..030e956 --- /dev/null +++ b/app/src/main/res/values-da/strings.xml @@ -0,0 +1,46 @@ + + + Naviger hjem + %1$s, %2$s + %1$s, %2$s, %3$s + Naviger op + Flere muligheder + Luk + Se alle + Vælg en app + FRA + TIL + Søg… + Ryd forespørgslen + Søgeforespørgsel + Søg + Indsend forespørgslen + Talesøgning + Del med + Del med %s + Skjul + Gå til <b>facebook.com/device</b> og indtast koden, som er vist ovenfor. + Uventet fejl under download af billede. + WebView-login kræver INTERNET-tilladelse + Fejl i AndroidManifest + Synes godt om + Synes godt om + Indlæser … + Annuller + Log på + Fortsæt med Facebook + Log på med Facebook + Log af + Log af + Logget på som %1$s + Logget på med Facebook + Del + For at tilslutte din konto skal du åbne Facebook-appen på din mobilenhed og se efter, om der er notifikationer. + - ELLER - + Ikke dig? + Fortsæt som %1$s + Bekræft login + Du har kontrollen – Vælg, hvilke informationer du vil dele med apps. + Søg + 999+ + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml new file mode 100644 index 0000000..5ec72aa --- /dev/null +++ b/app/src/main/res/values-de/strings.xml @@ -0,0 +1,47 @@ + + + Zur Startseite + %1$s: %2$s + %1$s, %2$s: %3$s + Nach oben + Weitere Optionen + Fertig + Alle ansehen + App auswählen + Aus + An + Suchen… + Suchanfrage löschen + Suchanfrage + Suchen + Suchanfrage senden + Sprachsuche + Freigeben für + Freigeben für %s + Minimieren + Gehe zu <b>facebook.com/device</b> und gib den oben angezeigten Code ein. + Unerwarteter Fehler beim Herunterladen eines Bildes. + WebView-Anmeldung erfordert INTERNET-Berechtigung + AndroidOffensichtlicher Fehler + Gefällt dir + Gefällt mir + Wird geladen ... + Abbrechen + Melde dich an + Weiter mit Facebook + Mit Facebook anmelden + Abmelden + Abmelden + Angemeldet als: %1$s + Mit Facebook angemeldet + Senden + Teilen + Öffne die Facebook-App auf deinem Mobilgerät, um dich mit deinem Konto zu verbinden und nach Benachrichtigungen zu suchen. + - ODER - + Das bist du nicht? + Weiter als %1$s + Anmeldung bestätigen + Du bestimmst, welche Informationen du mit Apps teilen möchtest. + Suchen + 999+ + diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml new file mode 100644 index 0000000..1b87c7c --- /dev/null +++ b/app/src/main/res/values-el/strings.xml @@ -0,0 +1,47 @@ + + + Πλοήγηση στην αρχική σελίδα + %1$s, %2$s + %1$s, %2$s, %3$s + Πλοήγηση προς τα επάνω + Περισσότερες επιλογές + Τέλος + Προβολή όλων + Επιλέξτε κάποια εφαρμογή + ΑΠΕΝΕΡΓΟΠΟΙΗΣΗ + ΕΝΕΡΓΟΠΟΙΗΣΗ + Αναζήτηση… + Διαγραφή ερωτήματος + Ερώτημα αναζήτησης + Αναζήτηση + Υποβολή ερωτήματος + Φωνητική αναζήτηση + Κοινή χρήση με + Κοινή χρήση με %s + Σύμπτυξη + Πηγαίνετε στη διεύθυνση <b>facebook.com/device</b> και εισαγάγετε τον παραπάνω κωδικό. + Παρουσιάστηκε μη αναμενόμενο σφάλμα κατά τη λήψη μιας εικόνας. + Για σύνδεση στην εφαρμογή WebView απαιτείται άδεια INTERNET + Σφάλμα AndroidManifest + Σας αρέσει + Μου αρέσει! + Φόρτωση... + Ακύρωση + Σύνδεση + Συνέχεια με το Facebook + Συνδεθείτε μέσω Facebook + Αποσύνδεση + Αποσύνδεση + Έχετε συνδεθεί ως: %1$s + Έγινε σύνδεση μέσω Facebook + Αποστολή + Κοινοποιήστε + Για να συνδέσετε το λογαριασμό σας, ανοίξτε την εφαρμογή Facebook στη φορητή συσκευή σας και ελέγξτε για ειδοποιήσεις. + - Ή - + Δεν είστε εσείς; + Συνέχεια ως %1$s + Επιβεβαίωση σύνδεσης + Εσείς έχετε τον έλεγχο - επιλέξτε ποιες πληροφορίες θέλετε να κοινοποιείτε στις εφαρμογές. + Αναζήτηση + 999+ + diff --git a/app/src/main/res/values-en-rAU/strings.xml b/app/src/main/res/values-en-rAU/strings.xml new file mode 100644 index 0000000..9d51355 --- /dev/null +++ b/app/src/main/res/values-en-rAU/strings.xml @@ -0,0 +1,24 @@ + + + Navigate home + %1$s, %2$s + %1$s, %2$s, %3$s + Navigate up + More options + Done + See all + Choose an app + OFF + ON + Search… + Clear query + Search query + Search + Submit query + Voice search + Share with + Share with %s + Collapse + Search + 999+ + diff --git a/app/src/main/res/values-en-rGB/strings.xml b/app/src/main/res/values-en-rGB/strings.xml new file mode 100644 index 0000000..53a2a98 --- /dev/null +++ b/app/src/main/res/values-en-rGB/strings.xml @@ -0,0 +1,28 @@ + + + Navigate home + %1$s, %2$s + %1$s, %2$s, %3$s + Navigate up + More options + Done + See all + Choose an app + OFF + ON + Search… + Clear query + Search query + Search + Submit query + Voice search + Share with + Share with %s + Collapse + WebView login requires Internet permission + AndroidManifest error + Loading… + You\'re in control – choose what information you want to share with apps. + Search + 999+ + diff --git a/app/src/main/res/values-en-rIN/strings.xml b/app/src/main/res/values-en-rIN/strings.xml new file mode 100644 index 0000000..9d51355 --- /dev/null +++ b/app/src/main/res/values-en-rIN/strings.xml @@ -0,0 +1,24 @@ + + + Navigate home + %1$s, %2$s + %1$s, %2$s, %3$s + Navigate up + More options + Done + See all + Choose an app + OFF + ON + Search… + Clear query + Search query + Search + Submit query + Voice search + Share with + Share with %s + Collapse + Search + 999+ + diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml new file mode 100644 index 0000000..6e96164 --- /dev/null +++ b/app/src/main/res/values-es-rES/strings.xml @@ -0,0 +1,26 @@ + + + Visita <b>facebook.com/device</b> e introduce el código que se muestra más arriba. + Se ha producido un error inesperado al descargar una imagen. + El inicio de sesión en WebView requiere permisos de INTERNET + Error de AndroidManifest + Te gusta + Me gusta + Cargando… + Cancelar + Entrar + Continuar con Facebook + Inicia sesión con Facebook + Salir + Salir + Sesión iniciada como: %1$s + Has iniciado sesión con Facebook + Enviar + Compartir + Para conectar tu cuenta, abre la aplicación de Facebook en tu dispositivo móvil y comprueba las notificaciones. + - O - + ¿No eres tú? + Continuar como %1$s + Confirmar inicio de sesión + Tú decides qué información quieres compartir con las aplicaciones. + diff --git a/app/src/main/res/values-es-rUS/strings.xml b/app/src/main/res/values-es-rUS/strings.xml new file mode 100644 index 0000000..b2e3dd6 --- /dev/null +++ b/app/src/main/res/values-es-rUS/strings.xml @@ -0,0 +1,24 @@ + + + Navegar a la página principal + %1$s, %2$s + %1$s, %2$s, %3$s + Navegar hacia arriba + Más opciones + Listo + Ver todo + Elige una aplicación. + DESACTIVADO + ACTIVADO + Buscar… + Eliminar la consulta + Consulta de búsqueda + Búsqueda + Enviar consulta + Búsqueda por voz + Compartir con + Compartir con %s + Contraer + Buscar + 999+ + diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml new file mode 100644 index 0000000..acbc85e --- /dev/null +++ b/app/src/main/res/values-es/strings.xml @@ -0,0 +1,47 @@ + + + Ir a la pantalla de inicio + %1$s, %2$s + %1$s, %2$s, %3$s + Desplazarse hacia arriba + Más opciones + Listo + Ver todo + Seleccionar una aplicación + NO + + Buscar… + Borrar consulta + Consulta + Buscar + Enviar consulta + Búsqueda por voz + Compartir con + Compartir con %s + Contraer + Ve a <b>facebook.com/device</b> e ingresa el código que se muestra arriba. + Se produjo un error inesperado al descargar una imagen. + El inicio de sesión de WebView requiere permisos de INTERNET + Error de AndroidManifest + Te gusta + Me gusta + Cargando... + Cancelar + Entrar + Continuar con Facebook + Iniciar sesión con Facebook + Salir + Salir + Sesión iniciada como: %1$s + Iniciaste sesión con Facebook + Enviar + Compartir + Para conectar tu cuenta, abre la aplicación de Facebook en tu dispositivo móvil y comprueba las notificaciones. + o + ¿No eres tú? + Continuar como %1$s + Confirmar inicio de sesión + Tú decides qué información quieres compartir con las aplicaciones. + Buscar + +999 + diff --git a/app/src/main/res/values-et-rEE/strings.xml b/app/src/main/res/values-et-rEE/strings.xml new file mode 100644 index 0000000..e8b8950 --- /dev/null +++ b/app/src/main/res/values-et-rEE/strings.xml @@ -0,0 +1,24 @@ + + + Navigeerimine avaekraanile + %1$s, %2$s + %1$s, %2$s, %3$s + Navigeerimine üles + Rohkem valikuid + Valmis + Kuva kõik + Valige rakendus + VÄLJAS + SEES + Otsige … + Päringu tühistamine + Otsingupäring + Otsing + Päringu esitamine + Häälotsing + Jagamine: + Jagamine kasutajaga %s + Ahendamine + Otsing + 999+ + diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-et/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-eu-rES/strings.xml b/app/src/main/res/values-eu-rES/strings.xml new file mode 100644 index 0000000..4b47e71 --- /dev/null +++ b/app/src/main/res/values-eu-rES/strings.xml @@ -0,0 +1,24 @@ + + + Joan orri nagusira + %1$s, %2$s + %1$s, %2$s, %3$s + Joan gora + Aukera gehiago + Eginda + Ikusi guztiak + Aukeratu aplikazio bat + DESAKTIBATUTA + AKTIBATUTA + Bilatu… + Garbitu kontsulta + Bilaketa-kontsulta + Bilatu + Bidali kontsulta + Ahots bidezko bilaketa + Partekatu hauekin + Partekatu %s erabiltzailearekin + Tolestu + Bilatu + 999+ + diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-eu/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml new file mode 100644 index 0000000..d568534 --- /dev/null +++ b/app/src/main/res/values-fa/strings.xml @@ -0,0 +1,24 @@ + + + پیمایش به صفحه اصلی + ‏%1$s‏، %2$s + ‏%1$s‏، %2$s‏، %3$s + پیمایش به بالا + گزینه‌های بیشتر + تمام + مشاهده همه + انتخاب برنامه + خاموش + روشن + جستجو… + پاک کردن عبارت جستجو + عبارت جستجو + جستجو + ارسال عبارت جستجو + جستجوی شفاهی + اشتراک‌گذاری با + ‏اشتراک‌گذاری با %s + کوچک کردن + جستجو + ۹۹۹+ + diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml new file mode 100644 index 0000000..322059f --- /dev/null +++ b/app/src/main/res/values-fi/strings.xml @@ -0,0 +1,47 @@ + + + Siirry etusivulle + %1$s, %2$s + %1$s, %2$s, %3$s + Siirry ylös + Lisää + Valmis + Näytä kaikki + Valitse sovellus + POIS KÄYTÖSTÄ + KÄYTÖSSÄ + Haku… + Tyhjennä kysely + Hakulauseke + Haku + Lähetä kysely + Puhehaku + Jakaminen: + Jakaminen: %s + Kutista + Siirry osoitteeseen <b>facebook.com/device</b> ja anna oheinen koodi. + Kuvaa ladattaessa tapahtui yllättävä virhe. + WebView-sisäänkirjautuminen edellyttää Internet-lupaa + AndroidManifest-virhe + Tykätty + Tykkää + Ladataan... + Peruuta + Kirjaudu sisään + Jatka Facebookissa + Kirjaudu Facebook-tunnuksilla + Kirjaudu ulos + Kirjaudu ulos + Kirjautunut sisään nimellä %1$s + Kirjauduttu sisään Facebook-tunnuksilla + Lähetä + Jaa + Liitä tilisi avaamalla Facebook-sovellus matkapuhelimellasi ja tarkistamalla ilmoitukset. + - TAI - + Etkö ole tämä henkilö? + Jatka nimellä %1$s + Vahvista sisäänkirjautuminen + Sinä päätät - valitse mitkä tiedot haluat jakaa sovelluksille + Haku + 999+ + diff --git a/app/src/main/res/values-fr-rCA/strings.xml b/app/src/main/res/values-fr-rCA/strings.xml new file mode 100644 index 0000000..49a68a2 --- /dev/null +++ b/app/src/main/res/values-fr-rCA/strings.xml @@ -0,0 +1,24 @@ + + + Revenir à l\'accueil + %1$s, %2$s + %1$s, %2$s, %3$s + Revenir en haut de la page + Plus d\'options + Terminé + Voir toutes les chaînes + Sélectionnez une application + DÉSACTIVÉ + ACTIVÉ + Recherche en cours... + Effacer la requête + Requête de recherche + Rechercher + Envoyer la requête + Recherche vocale + Partager + Partager avec %s + Réduire + Rechercher + >999 + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml new file mode 100644 index 0000000..e30b4f9 --- /dev/null +++ b/app/src/main/res/values-fr/strings.xml @@ -0,0 +1,47 @@ + + + Revenir à l\'accueil + %1$s, %2$s + %1$s, %2$s, %3$s + Revenir en haut de la page + Plus d\'options + OK + Tout afficher + Sélectionner une application + DÉSACTIVÉ + ACTIVÉ + Rechercher… + Effacer la requête + Requête de recherche + Rechercher + Envoyer la requête + Recherche vocale + Partager avec + Partager avec %s + Réduire + Consultez <b>facebook.com/device</b> et entrez le code affiché ci-dessus. + Une erreur inattendue s’est produite lors du téléchargement d’une image. + La connexion à WebView nécessite une autorisation INTERNET + Erreur AndroidManifest + J’aime déjà + J’aime + Chargement... + Annuler + Connectez-vous + Continuer avec Facebook + Se connecter avec Facebook + Déconnexion + Déconnexion + Connecté(e) en tant que : %1$s + Connecté(e) avec Facebook + Envoyer + Publier + Pour associer votre compte, ouvrez l’app Facebook sur votre appareil mobile et vérifiez les notifications. + - OU - + Ce n’est pas vous ? + Continuer en tant que %1$s + Confirmer la connexion + Vous avez le contrôle - choisissez les informations que vous voulez partager avec les apps. + Rechercher + >999 + diff --git a/app/src/main/res/values-gl-rES/strings.xml b/app/src/main/res/values-gl-rES/strings.xml new file mode 100644 index 0000000..36db5c0 --- /dev/null +++ b/app/src/main/res/values-gl-rES/strings.xml @@ -0,0 +1,24 @@ + + + Ir á páxina de inicio + %1$s, %2$s + %1$s, %2$s, %3$s + Desprazarse cara arriba + Máis opcións + Feito + Ver todas + Escoller unha aplicación + DESACTIVAR + ACTIVAR + Buscar… + Borrar consulta + Consulta de busca + Buscar + Enviar consulta + Busca de voz + Compartir con + Compartir con %s + Contraer + Buscar + >999 + diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml new file mode 100644 index 0000000..5901c6c --- /dev/null +++ b/app/src/main/res/values-gl/strings.xml @@ -0,0 +1,4 @@ + + + >999 + diff --git a/app/src/main/res/values-gu-rIN/strings.xml b/app/src/main/res/values-gu-rIN/strings.xml new file mode 100644 index 0000000..7ab43b9 --- /dev/null +++ b/app/src/main/res/values-gu-rIN/strings.xml @@ -0,0 +1,24 @@ + + + હોમ પર નેવિગેટ કરો + %1$s, %2$s + %1$s, %2$s, %3$s + ઉપર નેવિગેટ કરો + વધુ વિકલ્પો + થઈ ગયું + બધું જુઓ + એક ઍપ્લિકેશન પસંદ કરો + બંધ + ચાલુ + શોધો… + ક્વેરી સાફ કરો + શોધ ક્વેરી + શોધો + ક્વેરી સબમિટ કરો + વૉઇસ શોધ + આની સાથે શેર કરો + %s સાથે શેર કરો + સંકુચિત કરો + શોધો + 999+ + diff --git a/app/src/main/res/values-gu/strings.xml b/app/src/main/res/values-gu/strings.xml new file mode 100644 index 0000000..e688ef2 --- /dev/null +++ b/app/src/main/res/values-gu/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b&gt ની મુલકાત લો; અને ઉપર આપેલો કોડ દાખલ કરો. + છબી ડાઉનલોડ કરતી વખતે એક અનપેક્ષિત ભૂલ આવી. + WebView લૉગિનને ઇન્ટરનેટ પરવાનગીની જરૂર છે + AndroidManifest ભૂલ + ગમ્યું + પસંદ કરો + લોડ થઈ રહ્યું છે… + રદ કરો + લૉગ ઇન કરો + Facebook સાથે ચાલુ રાખો + Facebook થી લૉગિન કરો + લૉગ આઉટ કરો + લૉગ આઉટ કરો + %1$s: તરીકે લૉગ ઇન છે + તમે Facebook નો ઉપયોગ કરીને લોગ ઇન કર્યું છે + મોકલો + શેર કરો + તમારા એકાઉન્ટ સાથે કનેક્ટ કરવા માટે, તમારા મોબાઇલ ઉપકરણ પર Facebook એપ્લિકેશન ખોલો અને સૂચનાઓ માટે તપાસો. + - અથવા - + તમે નથી? + %1$s તરીકે ચાલુ રાખો + લૉગિનની પુષ્ટિ કરો + તમે નિયંત્રણમાં છો - તમે એપ્લિકેશન્સ સાથે શું માહિતી શેર કરવા માંગો પસંદ કરો. + 999+ + diff --git a/app/src/main/res/values-h720dp/dimens.xml b/app/src/main/res/values-h720dp/dimens.xml new file mode 100644 index 0000000..4ba8679 --- /dev/null +++ b/app/src/main/res/values-h720dp/dimens.xml @@ -0,0 +1,4 @@ + + + 54dp + diff --git a/app/src/main/res/values-hdpi/drawables.xml b/app/src/main/res/values-hdpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-hdpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-hdpi/styles.xml b/app/src/main/res/values-hdpi/styles.xml new file mode 100644 index 0000000..86098ea --- /dev/null +++ b/app/src/main/res/values-hdpi/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml new file mode 100644 index 0000000..f62e827 --- /dev/null +++ b/app/src/main/res/values-hi/strings.xml @@ -0,0 +1,47 @@ + + + मुख्यपृष्ठ पर नेविगेट करें + %1$s, %2$s + %1$s, %2$s, %3$s + ऊपर नेविगेट करें + अधिक विकल्प + पूर्ण + सभी देखें + कोई एप्‍लिकेशन चुनें + बंद + चालू + खोजा जा रहा है… + क्‍वेरी साफ़ करें + खोज क्वेरी + खोजें + क्वेरी सबमिट करें + ध्वनि खोज + इसके द्वारा साझा करें + %s के साथ साझा करें + संक्षिप्त करें + <b>facebook.com/device</b> पर विज़िट करें और ऊपर दिखाया गया कोड डालें. + चित्र डाउनलोड करते समय अनपेक्षित त्रुटि हुई. + WebView लॉग इन के लिए इंटरनेट अनुमति आवश्यक है + AndroidManifest गलती + पसंद किया + पसंद करें + लोड हो रहा है... + रद्द करें + लॉग इन + Facebook के साथ जारी रखें + Facebook से लॉग इन करें + लॉग आउट करें + लॉग आउट करें + इस रूप में लॉग इन हैं: %1$s + Facebook का उपयोग करके लॉग इन किया है + भेजें + साझा करें + अपने खाते से कनेक्ट करने के लिए, अपने मोबाइल डिवाइस पर Facebook एप्लिकेशन खोलें और सूचनाएँ जाँचें. + - या - + आप नहीं हैं? + %1$s के रूप में जारी रखें + लॉग इन कन्फ़र्म करें + नियंत्रण आपके पास है - चुनें कि आप एप्लिकेशन के साथ कौन सी जानकारी साझा करना चाहते हैं. + खोज + 999+ + diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml new file mode 100644 index 0000000..e568725 --- /dev/null +++ b/app/src/main/res/values-hr/strings.xml @@ -0,0 +1,47 @@ + + + Idi na početnu + %1$s, %2$s + %1$s, %2$s, %3$s + Idi gore + Dodatne opcije + Gotovo + Prikaži sve + Odabir aplikacije + ISKLJUČENO + UKLJUČENO + Pretražite… + Izbriši upit + Upit za pretraživanje + Pretraživanje + Pošalji upit + Glasovno pretraživanje + Dijeljenje sa + Dijeljenje sa: %s + Sažmi + Posjetitw <b>facebook.com/device</b> i unesite gore prikazani kôd. + Neočekivana pogreška prilikom preuzimanja slike. + Prijava WebView zahtijeva dopuštenje za INTERNET + Pogreška AndroidManifest + Označeno sa \"sviđa mi se\" + Sviđa mi se + Učitavanje... + Odustani + Prijava + Nastavak uz Facebook + Prijavi se putem Facebooka + Odjava + Odjava + Prijavljeni ste kao: %1$s + Prijavljeni ste putem Facebooka + Pošalji + Podijeli + Za povezivanje svog računa otvorite aplikaciju Facebook na mobilnom uređaju i pročitajte obavijesti. + - ILI - + Ovo niste vi? + Nastavite kao %1$s + Potvrdi prijavu + Vi odlučujete – odaberite koje informacije želite podijeliti s aplikacijama. + Pretraživanje + 999+ + diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml new file mode 100644 index 0000000..f825229 --- /dev/null +++ b/app/src/main/res/values-hu/strings.xml @@ -0,0 +1,47 @@ + + + Ugrás a főoldalra + %1$s, %2$s + %1$s, %2$s, %3$s + Felfelé mozgatás + További lehetőségek + Kész + Összes megtekintése + Válasszon ki egy alkalmazást + KI + BE + Keresés… + Lekérdezés törlése + Keresési lekérdezés + Keresés + Lekérdezés küldése + Hangalapú keresés + Megosztás a következővel: + Megosztás a következővel: %s + Összecsukás + Keresd fel a <b>facebook.com/device</b> címet, és írd be a fent megjelenített kódot. + Váratlan hiba történt a kép letöltésekor. + A WebView-bejelentkezéshez „INTERNET” jogosultság szükséges. + AndroidManifest hiba + Kedvelt + Tetszik + Betöltés… + Mégsem + Belépés + Folytatás a Facebookkal + Bejelentkezés Facebookkal + Kijelentkezés + Kijelentkezés + Bejelentkezve %1$s néven + Bejelentkezve a Facebook használatával + Küldés + Megosztás + A fiók hozzákapcsolásához nyisd meg a mobilkészülékeden a Facebook alkalmazást, és nézd meg az értesítéseket. + - VAGY - + Nem te vagy az? + Folytatás mint %1$s + Bejelentkezés megerősítése + Te irányítasz – válaszd ki, milyen adatokat szeretnél megosztani az alkalmazásokkal. + Keresés + 999+ + diff --git a/app/src/main/res/values-hy-rAM/strings.xml b/app/src/main/res/values-hy-rAM/strings.xml new file mode 100644 index 0000000..c6c972d --- /dev/null +++ b/app/src/main/res/values-hy-rAM/strings.xml @@ -0,0 +1,24 @@ + + + Ուղղվել տուն + %1$s, %2$s + %1$s, %2$s, %3$s + Ուղղվել վերև + Այլ ընտրանքներ + Կատարված է + Տեսնել բոլորը + Ընտրել ծրագիր + ԱՆՋԱՏՎԱԾ + ՄԻԱՑՎԱԾ + Որոնում... + Մաքրել հարցումը + Որոնման հարցում + Որոնել + Ուղարկել հարցումը + Ձայնային որոնում + Կիսվել + Կիսվել %s-ի միջոցով + Թաքցնել + Որոնել + 999+ + diff --git a/app/src/main/res/values-hy/strings.xml b/app/src/main/res/values-hy/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-hy/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml new file mode 100644 index 0000000..00478f6 --- /dev/null +++ b/app/src/main/res/values-id/strings.xml @@ -0,0 +1,25 @@ + + + Kunjungi <b>facebook.com/device</b> dan masukkan kode yang ditampilkan di atas. + Kesalahan yang tidak diharapkan saat mengunduh gambar. + Masuk WebView memerlukan izin INTERNET + Kesalahan AndroidManifest + Disukai + Suka + Memuat… + Batal + Masuk + Lanjutkan dengan Facebook + Masuk menggunakan Facebook + Keluar + Keluar + Masuk sebagai: %1$s + Masuk menggunakan Facebook + Kirim + Berbagi + Untuk menghubungkan akun Anda, buka aplikasi Facebook di perangkat seluler Anda dan periksa pemberitahuan. + - ATAU - + Bukan Anda? + Konfirmasikan Masuk + Anda memegang kendali - pilih info yang ingin Anda bagikan dengan aplikasi. + diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml new file mode 100644 index 0000000..b6f617c --- /dev/null +++ b/app/src/main/res/values-in/strings.xml @@ -0,0 +1,47 @@ + + + Navigasi ke beranda + %1$s, %2$s + %1$s, %2$s, %3$s + Navigasi naik + Opsi lain + Selesai + Lihat semua + Pilih aplikasi + NONAKTIF + AKTIF + Telusuri... + Hapus kueri + Kueri penelusuran + Telusuri + Kirim kueri + Penelusuran suara + Bagikan dengan + Bagikan dengan %s + Ciutkan + Kunjungi <b>facebook.com/device</b> dan masukkan kode yang ditampilkan di bawah ini. + Kesalahan tak terduga ketika mengunduh gambar. + Masuk Tampilan Web memerlukan izin INTERNET + Terjadi Kesalahan AndroidManifest + Suka + Suka + Memuat… + Batalkan + Masuk + Lanjutkan dengan Facebook + Masuk dengan Facebook + Keluar + Keluar + Masuk sebagai: %1$s + Masuk menggunakan Facebook + Kirim + Bagikan + Untuk menghubungkan akun Anda, buka aplikasi Facebook di perangkat seluler Anda dan lihat pemberitahuan. + - ATAU - + Bukan Anda? + Lanjutkan sebagai %1$s + Konfirmasikan Masuk + Anda memegang kendali - pilih info apa yang ingin Anda bagikan dengan aplikasi. + Telusuri + 999+ + diff --git a/app/src/main/res/values-is-rIS/strings.xml b/app/src/main/res/values-is-rIS/strings.xml new file mode 100644 index 0000000..13d56d0 --- /dev/null +++ b/app/src/main/res/values-is-rIS/strings.xml @@ -0,0 +1,24 @@ + + + Fara heim + %1$s, %2$s + %1$s, %2$s, %3$s + Fara upp + Fleiri valkostir + Lokið + Sjá allt + Veldu forrit + SLÖKKT + KVEIKT + Leita… + Hreinsa fyrirspurn + Leitarfyrirspurn + Leita + Senda fyrirspurn + Raddleit + Deila með + Deila með %s + Minnka + Leita + 999+ + diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-is/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml new file mode 100644 index 0000000..7822d07 --- /dev/null +++ b/app/src/main/res/values-it/strings.xml @@ -0,0 +1,47 @@ + + + Vai alla home page + %1$s, %2$s + %1$s, %2$s, %3$s + Vai in alto + Altre opzioni + Fine + Visualizza tutte + Scegli un\'applicazione + OFF + ON + Cerca… + Cancella query + Query di ricerca + Cerca + Invia query + Ricerca vocale + Condividi con + Condividi con %s + Comprimi + Visita <b>facebook.com/device</b> e inserisci il codice mostrato qui sotto. + Errore imprevisto durante il download dell\'immagine. + L\'accesso alla visualizzazione Web richiede le autorizzazioni Internet + Errore AndroidManifest + Ti piace + Mi piace + Caricamento in corso... + Annulla + Accedi + Continua con Facebook + Accedi con Facebook + Esci + Esci + Accesso effettuato come %1$s + Accesso effettuato tramite Facebook + Invia + Condividi + Per connettere il tuo account, apri l\'app Facebook dal tuo dispositivo mobile e controlla le notifiche. + - oppure - + Non sei tu? + Continua come %1$s + Conferma accesso + Il controllo è nelle tue mani: scegli quali informazioni condividere con le app. + Ricerca + 999+ + diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml new file mode 100644 index 0000000..e5c87e7 --- /dev/null +++ b/app/src/main/res/values-iw/strings.xml @@ -0,0 +1,47 @@ + + + נווט לדף הבית + ‏%1$s‏, %2$s + ‏%1$s‏, %2$s‏, %3$s + נווט למעלה + עוד אפשרויות + בוצע + ראה הכל + בחר אפליקציה + כבוי + פועל + חפש… + מחק שאילתה + שאילתת חיפוש + חפש + שלח שאילתה + חיפוש קולי + שתף עם + ‏שתף עם %s + כווץ + יש לבקר בכתובת facebook.com/device</b&gt ולהזין את הקוד המוצג למעלה + שגיאה לא צפויה במהלך הורדת תמונה. + התחברות WebView דורשת הרשאת אינטרנט + שגיאת AndroidManifest + סימנת בלייק + לייק + טוען... + ביטול + התחבר + המשך/המשיכי עם פייסבוק + התחברות באמצעות פייסבוק + התנתק/י + התנתק/י + מחובר/ת בתור: %1$s + מחובר/ת כמשתמש בפייסבוק + שלח/י + שתף/שתפי + כדי לחבר את חשבונך, יש לפתוח את אפליקציית פייסבוק במכשיר הנייד ולבדוק אם יש התראות. + - או - + לא את/ה? + המשך/המשיכי בתור %1$s + אשר/י את ההתחברות + את/ה בשליטה - בחר/י אילו פרטים ברצונך לשתף עם אפליקציות. + חפש + ‎999+‎ + diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml new file mode 100644 index 0000000..72eb597 --- /dev/null +++ b/app/src/main/res/values-ja/strings.xml @@ -0,0 +1,47 @@ + + + ホームへ移動 + %1$s、%2$s + %1$s、%2$s、%3$s + 上へ移動 + その他のオプション + 完了 + すべて表示 + アプリの選択 + OFF + ON + 検索… + 検索キーワードを削除 + 検索キーワード + 検索 + 検索キーワードを送信 + 音声検索 + 共有 + %sと共有 + 折りたたむ + <b>facebook.com/device</b>にアクセスして、上のコードを入力してください。 + 画像のダウンロードで何らかのエラーが発生しました。 + WebViewにログインするには、インターネットへのアクセスが必要です + AndroidManifestエラー + 「いいね!」しました + いいね! + 読み込み中です… + キャンセル + ログイン + Facebookでログイン + Facebookでログイン + ログアウト + ログアウト + %1$sとしてログイン中 + Facebookでログイン中 + 送信 + シェアする + アカウントをリンクするには、モバイル機器でFacebookアプリを開いて、お知らせをご確認ください。 + - または - + 別のアカウントでログイン + %1$sとしてログイン + ログインを実行 + アプリと共有する情報をコントロールすることができます。 + 検索 + 999+ + diff --git a/app/src/main/res/values-ka-rGE/strings.xml b/app/src/main/res/values-ka-rGE/strings.xml new file mode 100644 index 0000000..e7c8e8f --- /dev/null +++ b/app/src/main/res/values-ka-rGE/strings.xml @@ -0,0 +1,24 @@ + + + მთავარზე ნავიგაცია + %1$s, %2$s + %1$s, %2$s, %3$s + ზემოთ ნავიგაცია + მეტი ვარიანტები + დასრულდა + ყველას ნახვა + აპის არჩევა + გამორთულია + ჩართულია + ძიება... + მოთხოვნის გასუფთავება + ძიების მოთხოვნა + ძიება + მოთხოვნის გადაგზავნა + ხმოვანი ძიება + გაზიარება: + %s-თან გაზიარება + აკეცვა + ძიება + 999+ + diff --git a/app/src/main/res/values-ka/strings.xml b/app/src/main/res/values-ka/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-ka/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-kk-rKZ/strings.xml b/app/src/main/res/values-kk-rKZ/strings.xml new file mode 100644 index 0000000..f9d27c5 --- /dev/null +++ b/app/src/main/res/values-kk-rKZ/strings.xml @@ -0,0 +1,24 @@ + + + Негізгі бетте қозғалу + %1$s, %2$s + %1$s, %2$s, %3$s + Жоғары қозғалу + Басқа опциялар + Дайын + Барлығын көру + Қолданбаны таңдау + ӨШІРУЛІ + ҚОСУЛЫ + Іздеу… + Сұрақты жою + Сұрақты іздеу + Іздеу + Сұрақты жіберу + Дауыс арқылы іздеу + Бөлісу + %s бөлісу + Тасалау + Іздеу + 999+ + diff --git a/app/src/main/res/values-kk/strings.xml b/app/src/main/res/values-kk/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-kk/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-km-rKH/strings.xml b/app/src/main/res/values-km-rKH/strings.xml new file mode 100644 index 0000000..15a7754 --- /dev/null +++ b/app/src/main/res/values-km-rKH/strings.xml @@ -0,0 +1,24 @@ + + + រកមើល​ទៅ​ដើម + %1$s, %2$s + %1$s, %2$s, %3$s + រកមើល​ឡើងលើ + ជម្រើស​ច្រើន​ទៀត + រួចរាល់ + មើល​ទាំងអស់ + ជ្រើស​កម្មវិធី​​ + បិទ + បើក + ស្វែងរក… + សម្អាត​សំណួរ + ស្វែងរក​សំណួរ + ស្វែងរក + ដាក់​​​ស្នើ​សំណួរ + ការស្វែងរក​សំឡេង + ចែករំលែក​ជាមួយ + ចែករំលែក​ជាមួយ %s + បង្រួម + ស្វែងរក + 999+ + diff --git a/app/src/main/res/values-km/strings.xml b/app/src/main/res/values-km/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-km/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-kn-rIN/strings.xml b/app/src/main/res/values-kn-rIN/strings.xml new file mode 100644 index 0000000..a3d3248 --- /dev/null +++ b/app/src/main/res/values-kn-rIN/strings.xml @@ -0,0 +1,24 @@ + + + ಮುಖಪುಟವನ್ನು ನ್ಯಾವಿಗೇಟ್ ಮಾಡಿ + %1$s, %2$s + %1$s, %2$s, %3$s + ಮೇಲಕ್ಕೆ ನ್ಯಾವಿಗೇಟ್ ಮಾಡಿ + ಇನ್ನಷ್ಟು ಆಯ್ಕೆಗಳು + ಮುಗಿದಿದೆ + ಎಲ್ಲವನ್ನೂ ನೋಡಿ + ಒಂದು ಅಪ್ಲಿಕೇಶನ್ ಆಯ್ಕೆಮಾಡಿ + ಆಫ್ + ಆನ್ + ಹುಡುಕಿ… + ಪ್ರಶ್ನೆಯನ್ನು ತೆರವುಗೊಳಿಸು + ಪ್ರಶ್ನೆಯನ್ನು ಹುಡುಕಿ + ಹುಡುಕು + ಪ್ರಶ್ನೆಯನ್ನು ಸಲ್ಲಿಸು + ಧ್ವನಿ ಹುಡುಕಾಟ + ಇವರೊಂದಿಗೆ ಹಂಚಿಕೊಳ್ಳಿ + %s ಜೊತೆಗೆ ಹಂಚಿಕೊಳ್ಳಿ + ಸಂಕುಚಿಸು + ಹುಡುಕು + 999+ + diff --git a/app/src/main/res/values-kn/strings.xml b/app/src/main/res/values-kn/strings.xml new file mode 100644 index 0000000..d34cb89 --- /dev/null +++ b/app/src/main/res/values-kn/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> ಗೆ ಭೇಟಿ ನೀಡಿ ಮತ್ತು ಮೇಲೆ ತೋರಿಸಿದ ಕೋಡ್ ಅನ್ನು ನಮೂದಿಸಿ. + ಚಿತ್ರವನ್ನು ಡೌನ್‌ಲೋಡ್ ಮಾಡುವಾಗ ಅನಿರೀಕ್ಷಿತ ದೋಷ. + ವೆಬ್ ವೀಕ್ಷಣೆ ಲಾಗಿನ್‌ಗೆ ಇಂಟರ್ನೆಟ್ ಅನುಮತಿಯ ಅಗತ್ಯವಿದೆ + Android ಮ್ಯಾನಿಫೆಸ್ಟ್ ದೋಷ + ಇಷ್ಟಪಟ್ಟಿದ್ದಾರೆ + ಇಷ್ಟ + ಲೋಡ್ ಆಗುತ್ತಿದೆ... + ರದ್ದುಮಾಡು + ಲಾಗ್ ಇನ್ + Facebook ನೊಂದಿಗೆ ಮುಂದುವರಿಸಿ + Facebook ನೊಂದಿಗೆ ಲಾಗ್ ಇನ್ ಮಾಡಿ + ಲಾಗ್ ಔಟ್ + ಲಾಗ್ ಔಟ್ + %1$s ಎಂದು ಲಾಗಿನ್ ಮಾಡಲಾಗಿದೆ + Facebook ಬಳಸಿ ಲಾಗಿನ್ ಮಾಡಲಾಗಿದೆ + ಕಳುಹಿಸಿ + ಹಂಚಿರಿ + ನಿಮ್ಮ ಖಾತೆಯನ್ನು ಸಂಪರ್ಕಿಸಲು, ನಿಮ್ಮ ಮೊಬೈಲ್ ಸಾಧನದಲ್ಲಿ Facebook ಅಪ್ಲಿಕೇಶನ್ ತೆರೆಯಿರಿ ಮತ್ತು ಅಧಿಸೂಚನೆಗಳಿಗಾಗಿ ಪರಿಶೀಲಿಸಿ. + - ಅಥವಾ - + ನೀವಲ್ಲವೇ? + %1$s ಎಂದು ಮುಂದುವರಿಸಿ + ಲಾಗಿನ್ ಖಚಿತಪಡಿಸಿ + ನೀವು ನಿಯಂತ್ರಣದಲ್ಲಿದ್ದಿರಿ- ಅಪ್ಲಿಕೇಶನ್‌ಗಳೊಂದಿಗೆ ನೀವು ಯಾವ ಮಾಹಿತಿಯನ್ನು ಹಂಚಿಕೊಳ್ಳಬೇಕೆಂದು ಆಯ್ಕೆಮಾಡಿ. + 999+ + diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml new file mode 100644 index 0000000..d07bac1 --- /dev/null +++ b/app/src/main/res/values-ko/strings.xml @@ -0,0 +1,47 @@ + + + 홈 탐색 + %1$s, %2$s + %1$s, %2$s, %3$s + 위로 탐색 + 옵션 더보기 + 완료 + 전체 보기 + 앱 선택 + 사용 안함 + 사용 + 검색... + 검색어 삭제 + 검색어 + 검색 + 검색어 보내기 + 음성 검색 + 공유 대상 + %s와(과) 공유 + 접기 + <b>facebook.com/device</b>에 방문하여 위 코드를 입력하세요. + 이미지를 다운로드하는 중 예기치 않은 오류가 발생했습니다. + WebView 로그인에 인터넷 권한이 필요합니다 + AndroidManifest 오류 + 좋아요 + 좋아요 + 읽어들이는 중... + 취소 + 로그인 + Facebook으로 계속하기 + Facebook으로 로그인 + 로그아웃 + 로그아웃 + 로그인 사용자: %1$s + Facebook을 사용하여 로그인함 + 보내기 + 공유하기 + 계정에 연결하려면 모바일 기기에서 Facebook 앱을 열고 알림을 확인하세요. + - 또는 - + 회원님이 아닌가요? + %1$s님으로 계속 + 로그인 확인 + 앱과 공유할 정보를 자유롭게 선택할 수 있습니다. + 검색 + 999+ + diff --git a/app/src/main/res/values-ky-rKG/strings.xml b/app/src/main/res/values-ky-rKG/strings.xml new file mode 100644 index 0000000..2d1d0f7 --- /dev/null +++ b/app/src/main/res/values-ky-rKG/strings.xml @@ -0,0 +1,24 @@ + + + Үйгө багыттоо + %1$s, %2$s + %1$s, %2$s, %3$s + Жогору + Көбүрөөк мүмкүнчүлүктөр + Даяр + Бардыгын көрүү + Колдонмо тандоо + ӨЧҮК + КҮЙҮК + Издөө… + Талаптарды тазалоо + Издөө талаптары + Издөө + Талап жөнөтүү + Үн аркылуу издөө + Бөлүшүү + %s аркылуу бөлүшүү + Жыйнап коюу + Издөө + 999+ + diff --git a/app/src/main/res/values-ky/strings.xml b/app/src/main/res/values-ky/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-ky/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml new file mode 100644 index 0000000..85b96fd --- /dev/null +++ b/app/src/main/res/values-land/dimens.xml @@ -0,0 +1,7 @@ + + + 48dp + 32dp + 12dp + 14dp + diff --git a/app/src/main/res/values-large/dimens.xml b/app/src/main/res/values-large/dimens.xml new file mode 100644 index 0000000..038fd5f --- /dev/null +++ b/app/src/main/res/values-large/dimens.xml @@ -0,0 +1,10 @@ + + + 440dp + 60% + 90% + 60% + 90% + 55% + 80% + diff --git a/app/src/main/res/values-large/styles.xml b/app/src/main/res/values-large/styles.xml new file mode 100644 index 0000000..e607987 --- /dev/null +++ b/app/src/main/res/values-large/styles.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/app/src/main/res/values-ldltr-v21/styles.xml b/app/src/main/res/values-ldltr-v21/styles.xml new file mode 100644 index 0000000..2073606 --- /dev/null +++ b/app/src/main/res/values-ldltr-v21/styles.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/values-ldpi/drawables.xml b/app/src/main/res/values-ldpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-ldrtl-hdpi-v17/drawables.xml b/app/src/main/res/values-ldrtl-hdpi-v17/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldrtl-hdpi-v17/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-ldrtl-mdpi-v17/drawables.xml b/app/src/main/res/values-ldrtl-mdpi-v17/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldrtl-mdpi-v17/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-ldrtl-xhdpi-v17/drawables.xml b/app/src/main/res/values-ldrtl-xhdpi-v17/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldrtl-xhdpi-v17/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-ldrtl-xxhdpi-v17/drawables.xml b/app/src/main/res/values-ldrtl-xxhdpi-v17/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldrtl-xxhdpi-v17/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-ldrtl-xxxhdpi-v17/drawables.xml b/app/src/main/res/values-ldrtl-xxxhdpi-v17/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-ldrtl-xxxhdpi-v17/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-lo-rLA/strings.xml b/app/src/main/res/values-lo-rLA/strings.xml new file mode 100644 index 0000000..8472351 --- /dev/null +++ b/app/src/main/res/values-lo-rLA/strings.xml @@ -0,0 +1,24 @@ + + + ກັບໄປໜ້າຫຼັກ + %1$s, %2$s + %1$s, %2$s, %3$s + ຂຶ້ນເທິງ + ໂຕເລືອກອື່ນ + ແລ້ວໆ + ເບິ່ງທັງຫມົດ + ເລືອກແອັບຯ + ປິດ + ເປີດ + ຊອກຫາ + ລຶບຂໍ້ຄວາມຊອກຫາ + ຊອກຫາ + ຊອກຫາ + ສົ່ງການຊອກຫາ + ຊອກຫາດ້ວຍສຽງ + ແບ່ງປັນກັບ + ແບ່ງ​ປັນ​ກັບ​ %s + ຫຍໍ້ + ຊອກຫາ + 999+ + diff --git a/app/src/main/res/values-lo/strings.xml b/app/src/main/res/values-lo/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-lo/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml new file mode 100644 index 0000000..0ef9ea3 --- /dev/null +++ b/app/src/main/res/values-lt/strings.xml @@ -0,0 +1,24 @@ + + + Eiti į pagrindinį puslapį + %1$s, %2$s + %1$s, %2$s, %3$s + Eiti į viršų + Daugiau parinkčių + Atlikta + Peržiūrėti viską + Pasirinkti programą + IŠJUNGTA + ĮJUNGTI + Ieškoti... + Išvalyti užklausą + Paieškos užklausa + Paieška + Pateikti užklausą + Paieška balsu + Bendrinti naudojant + Bendrinti naudojant „%s“ + Sutraukti + Paieška + 999+ + diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml new file mode 100644 index 0000000..a341838 --- /dev/null +++ b/app/src/main/res/values-lv/strings.xml @@ -0,0 +1,24 @@ + + + Pārvietoties uz sākuma ekrānu + %1$s: %2$s + %1$s, %2$s: %3$s + Pārvietoties augšup + Vairāk opciju + Gatavs + Skatīt visu + Izvēlieties lietotni + IZSLĒGTS + IESLĒGTS + Meklējiet… + Notīrīt vaicājumu + Meklēšanas vaicājums + Meklēt + Iesniegt vaicājumu + Meklēšana ar balsi + Kopīgot ar: + Kopīgot ar %s + Sakļaut + Meklēt + 999+ + diff --git a/app/src/main/res/values-mdpi/drawables.xml b/app/src/main/res/values-mdpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-mdpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-mk-rMK/strings.xml b/app/src/main/res/values-mk-rMK/strings.xml new file mode 100644 index 0000000..3d8986c --- /dev/null +++ b/app/src/main/res/values-mk-rMK/strings.xml @@ -0,0 +1,22 @@ + + + Движи се кон дома + %1$s, %2$s, %3$s + Движи се нагоре + Повеќе опции + Готово + Види ги сите + Избери апликација + ИСКЛУЧЕНО + ВКЛУЧЕНО + Пребарување… + Исчисти барање + Пребарај барање + Пребарај + Поднеси барање + Гласовно пребарување + Сподели со + Собери + Пребарај + 999+ + diff --git a/app/src/main/res/values-mk/strings.xml b/app/src/main/res/values-mk/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-mk/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-ml-rIN/strings.xml b/app/src/main/res/values-ml-rIN/strings.xml new file mode 100644 index 0000000..b686892 --- /dev/null +++ b/app/src/main/res/values-ml-rIN/strings.xml @@ -0,0 +1,24 @@ + + + ഹോമിലേക്ക് നാവിഗേറ്റുചെയ്യുക + %1$s, %2$s + %1$s, %2$s, %3$s + മുകളിലേക്ക് നാവിഗേറ്റുചെയ്യുക + കൂടുതൽ‍ ഓപ്‌ഷനുകള്‍ + പൂർത്തിയാക്കി + എല്ലാം കാണുക + ഒരു അപ്ലിക്കേഷൻ തിരഞ്ഞെടുക്കുക + ഓഫ് + ഓൺ + തിരയുക… + അന്വേഷണം മായ്‌ക്കുക + തിരയൽ അന്വേഷണം + തിരയൽ + അന്വേഷണം സമർപ്പിക്കുക + ശബ്ദതിരയൽ + ഇവരുമായി പങ്കിടുക + %s എന്നതുമായി പങ്കിടുക + ചുരുക്കുക + തിരയുക + 999+ + diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml new file mode 100644 index 0000000..b2fff7e --- /dev/null +++ b/app/src/main/res/values-ml/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> സന്ദർശിച്ച് മുകളിൽ കാണിച്ചിരിക്കുന്ന കോഡ് നൽകുക. + ഒരു ചിത്രം ഡൗൺലോഡുചെയ്യുമ്പോൾ അജ്ഞാതമായ പിശക് സംഭവിച്ചു. + WebView ലോഗിൻ ചെയ്യാൻ ഇന്റർനെറ്റ് അനുമതി ആവശ്യമാണ് + AndroidManifest പിശക് + ലൈക്കുചെയ്തു + ലൈക്കുചെയ്യുക + ലോഡ് ചെയ്യുന്നു… + റദ്ദാക്കുക + ലോഗിന് ചെയ്യുക + Facebook ഉപയോഗിച്ച് തുടരുക + Facebook ഉപയോഗിച്ച് ലോഗിൻ ചെയ്യുക + ലോഗൗട്ട് ചെയ്യുക + ലോഗൗട്ട് ചെയ്യുക + എന്നയാളായി ലോഗ് ഇൻ ചെയ്‌തു: %1$s + Facebook ഉപയോഗിച്ച് ലോഗിൻ ചെയ്‌തു + അയയ്ക്കുക + പങ്കിടുക + നിങ്ങളുടെ അക്കൗണ്ട് കണക്‌റ്റ്ചെയ്യാൻ, നിങ്ങളുടെ മൊബൈൽ ഉപകരണത്തിലെ Facebook ആപ്പ് തുറന്ന് അറിയിപ്പുകൾ പരിശോധിക്കുക. + - അല്ലെങ്കിൽ - + നിങ്ങള്‍ അല്ലേ? + %1$s എന്നയാളായി തുടരുക + ലോഗിൻ സ്ഥിരീകരിക്കുക + നിങ്ങൾ നിയന്ത്രണത്തിലാണ് - ആപ്പുകൾ ഉപയോഗിച്ച് നിങ്ങൾക്ക് എന്ത് വിവരമാണ് പങ്കിടേണ്ടതെന്ന് തിരഞ്ഞെടുക്കുക. + 999+ + diff --git a/app/src/main/res/values-mn-rMN/strings.xml b/app/src/main/res/values-mn-rMN/strings.xml new file mode 100644 index 0000000..f4d8550 --- /dev/null +++ b/app/src/main/res/values-mn-rMN/strings.xml @@ -0,0 +1,24 @@ + + + Нүүр хуудас руу шилжих + %1$s, %2$s + %1$s, %2$s, %3$s + Дээш шилжих + Нэмэлт сонголтууд + Дууссан + Бүгдийг харах + Апп сонгох + ИДЭВХГҮЙ + ИДЭВХТЭЙ + Хайх... + Асуулгыг цэвэрлэх + Хайх асуулга + Хайх + Асуулгыг илгээх + Дуут хайлт + Хуваалцах + %s-тай хуваалцах + Хумих + Хайлт + 999+ + diff --git a/app/src/main/res/values-mn/strings.xml b/app/src/main/res/values-mn/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-mn/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-mr-rIN/strings.xml b/app/src/main/res/values-mr-rIN/strings.xml new file mode 100644 index 0000000..2d4306c --- /dev/null +++ b/app/src/main/res/values-mr-rIN/strings.xml @@ -0,0 +1,24 @@ + + + मुख्‍यपृष्‍ठ नेव्‍हिगेट करा + %1$s, %2$s + %1$s, %2$s, %3$s + वर नेव्‍हिगेट करा + अधिक पर्याय + पूर्ण झाले + सर्व पहा + एक अ‍ॅप निवडा + बंद + चालू + शोधा… + क्‍वेरी स्‍पष्‍ट करा + शोध क्वेरी + शोध + क्वेरी सबमिट करा + व्हॉइस शोध + यांच्यासह सामायिक करा + %s सह सामायिक करा + संक्षिप्त करा + शोधा + 999+ + diff --git a/app/src/main/res/values-mr/strings.xml b/app/src/main/res/values-mr/strings.xml new file mode 100644 index 0000000..9ebf0fa --- /dev/null +++ b/app/src/main/res/values-mr/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> भेट द्या आणि वरील कोड प्रविष्ट करा. + प्रतिमा डाउनलोड करत असताना अनपेक्षित त्रुटी आली. + WebView लॉग इन ला इंटरनेट परवानगीची आवश्यकता आहे + AndroidManifest त्रुटी + पसंत केले + आवडले + लोड करत आहे… + रद्द करा + लॉग इन करा + Facebook सह चालू ठेवा + Facebook सह लॉग इन करा + लॉग आउट करा + लॉग आउट करा + %1$s म्हणून लॉग इन केले + Facebook वापरून लॉग इन केले + पाठवा + शेअर करा + तुमचे खाते कनेक्ट करण्यासाठी, तुमच्या मोबाईल उपकरणावर Facebook अॅप उघडा आणि सूचना तपासा. + - किंवा - + आपण नाही? + %1$s म्हणून चालू ठेवा + लॉग इन पुष्टी करा + तुम्ही नियंत्रणात आहात - तुम्ही अॅपसह कोणती माहिती सामायिक करू इच्छिता ते निवडा. + 999+ + diff --git a/app/src/main/res/values-ms-rMY/strings.xml b/app/src/main/res/values-ms-rMY/strings.xml new file mode 100644 index 0000000..df14881 --- /dev/null +++ b/app/src/main/res/values-ms-rMY/strings.xml @@ -0,0 +1,24 @@ + + + Navigasi skrin utama + %1$s, %2$s + %1$s, %2$s, %3$s + Navigasi ke atas + Lagi pilihan + Selesai + Lihat semua + Pilih apl + MATI + HIDUP + Cari… + Kosongkan pertanyaan + Pertanyaan carian + Cari + Serah pertanyaan + Carian suara + Kongsi dengan + Kongsi dengan %s + Runtuhkan + Cari + 999+ + diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml new file mode 100644 index 0000000..48cab6f --- /dev/null +++ b/app/src/main/res/values-ms/strings.xml @@ -0,0 +1,27 @@ + + + Lawati <b>facebook.com/device</b> dan masukkan kod yang ditunjukkan di atas. + Ralat tidak dijangka semasa memuat turun imej. + Log masuk WebView memerlukan kebenaran INTERNET + Ralat AndroidManifest + Disukai + Suka + Memuatkan... + Batal + Log masuk + Teruskan dengan Facebook + Log masuk dengan Facebook + Log keluar + Log keluar + Dilog masuk sebagai %1$s + Log masuk menggunakan Facebook + Hantar + Kongsi + Untuk menyambungkan akaun anda, buka aplikasi Facebook pada peranti mudah alih anda, dan semak untuk pemberitahuan. + - ATAU - + Bukan anda? + Teruskan sebagai %1$s + Sahkan Log Masuk + Anda berada dalam kawalan - pilih maklumat yang anda mahu berkongsi dengan aplikasi. + 999+ + diff --git a/app/src/main/res/values-my-rMM/strings.xml b/app/src/main/res/values-my-rMM/strings.xml new file mode 100644 index 0000000..493f41b --- /dev/null +++ b/app/src/main/res/values-my-rMM/strings.xml @@ -0,0 +1,24 @@ + + + မူလနေရာကို သွားရန် + %1$s၊ %2$s + %1$s ၊ %2$s ၊ %3$s + အပေါ်သို့သွားရန် + ပိုမိုရွေးချယ်စရာများ + ပြီးဆုံးပါပြီ + အားလုံးကို ကြည့်ရန် + အက်ပ်တစ်ခုခုကို ရွေးချယ်ပါ + ပိတ် + ဖွင့် + ရှာဖွေပါ... + ရှာစရာ အချက်အလက်များ ဖယ်ရှားရန် + ရှာစရာ အချက်အလက်နေရာ + ရှာဖွေရန် + ရှာဖွေစရာ အချက်အလက်ကို ပေးပို့ရန် + အသံဖြင့် ရှာဖွေခြင်း + မျှဝေဖို့ ရွေးပါ + %s ကို မျှဝေပါရန် + ခေါက်ရန် + ရှာဖွေပါ + ၉၉၉+ + diff --git a/app/src/main/res/values-my/strings.xml b/app/src/main/res/values-my/strings.xml new file mode 100644 index 0000000..a3aa322 --- /dev/null +++ b/app/src/main/res/values-my/strings.xml @@ -0,0 +1,4 @@ + + + ၉၉၉+ + diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml new file mode 100644 index 0000000..4680097 --- /dev/null +++ b/app/src/main/res/values-nb/strings.xml @@ -0,0 +1,46 @@ + + + Gå til startsiden + %1$s – %2$s + %1$s – %2$s – %3$s + Gå opp + Flere alternativer + Ferdig + Se alle + Velg en app + AV + + Søk … + Slett søket + Søkeord + Søk + Utfør søket + Talesøk + Del med + Del med %s + Skjul + Gå til <b>facebook.com/device</b> og skriv inn koden som vises over. + Det oppstod en uvented feil under nedlasting av et bilde. + WebView-innlogging krever INTERNETT-tillatelse + AndroidManifest-feil + Likt + Liker + Laster inn ... + Avbryt + Logg inn + Fortsett med Facebook + Logg inn med Facebook + Logg av + Logg av + Logget inn som %1$s + Innlogget med Facebook + Del + Koble til kontoen din ved å åpne Facebook-appen på mobilenheten din og se etter varsler. + – ELLER – + Ikke deg? + Fortsett som %1$s + Bekreft innlogging + Du bestemmer – velg hvilke opplysninger du vil dele med apper. + Søk + 999+ + diff --git a/app/src/main/res/values-ne-rNP/strings.xml b/app/src/main/res/values-ne-rNP/strings.xml new file mode 100644 index 0000000..d97c8f7 --- /dev/null +++ b/app/src/main/res/values-ne-rNP/strings.xml @@ -0,0 +1,24 @@ + + + गृह खोज्नुहोस् + %1$s, %2$s + %1$s, %2$s, %3$s + माथि खोज्नुहोस् + थप विकल्पहरू + सम्पन्न भयो + सबै हेर्नुहोस् + एउटा अनुप्रयोग छान्नुहोस् + निष्क्रिय पार्नुहोस् + सक्रिय गर्नुहोस् + खोज्नुहोस्... + प्रश्‍न हटाउनुहोस् + जिज्ञासाको खोज गर्नुहोस् + खोज्नुहोस् + जिज्ञासा पेस गर्नुहोस् + भ्वाइस खोजी + साझेदारी गर्नुहोस्... + %s सँग साझेदारी गर्नुहोस् + संक्षिप्त पार्नुहोस् + खोज्नुहोस् + ९९९+ + diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml new file mode 100644 index 0000000..ac06d07 --- /dev/null +++ b/app/src/main/res/values-ne/strings.xml @@ -0,0 +1,4 @@ + + + ९९९+ + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..c32172f --- /dev/null +++ b/app/src/main/res/values-night/styles.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml new file mode 100644 index 0000000..9d92637 --- /dev/null +++ b/app/src/main/res/values-nl/strings.xml @@ -0,0 +1,47 @@ + + + Navigeren naar startpositie + %1$s, %2$s + %1$s, %2$s, %3$s + Omhoog navigeren + Meer opties + Gereed + Alles weergeven + Een app selecteren + UIT + AAN + Zoeken… + Zoekopdracht wissen + Zoekopdracht + Zoeken + Zoekopdracht verzenden + Gesproken zoekopdracht + Delen met + Delen met %s + Samenvouwen + Ga naar <b>facebook.com/device</b> en voer de bovenstaande code in. + Onverwachte fout bij downloaden van afbeelding. + Voor WebView-aanmelding is INTERNET-toestemming vereist + AndroidManifest-fout + Vind ik leuk + Vind ik leuk + Laden... + Annuleren + Aanmelden + Doorgaan met Facebook + Aanmelden met Facebook + Afmelden + Afmelden + Aangemeld als: %1$s + Aangemeld via Facebook + Verzenden + Delen + Als je je account wilt koppelen, open je de Facebook-app op je mobiele apparaat en controleer je je meldingen. + - OF - + Ben jij dit niet? + Doorgaan als %1$s + Aanmelding bevestigen + Jij hebt de controle: bepaal welke informatie je met apps wilt delen. + Zoeken + 999+ + diff --git a/app/src/main/res/values-pa-rIN/strings.xml b/app/src/main/res/values-pa-rIN/strings.xml new file mode 100644 index 0000000..f6bb0d4 --- /dev/null +++ b/app/src/main/res/values-pa-rIN/strings.xml @@ -0,0 +1,24 @@ + + + ਹੋਮ ਨੈਵੀਗੇਟ ਕਰੋ + %1$s, %2$s + %1$s, %2$s, %3$s + ਉੱਪਰ ਨੈਵੀਗੇਟ ਕਰੋ + ਹੋਰ ਚੋਣਾਂ + ਹੋ ਗਿਆ + ਸਭ ਦੇਖੋ + ਇੱਕ ਐਪ ਚੁਣੋ + ਬੰਦ + ਤੇ + ਖੋਜ… + ਸਵਾਲ ਹਟਾਓ + ਸਵਾਲ ਖੋਜੋ + ਖੋਜੋ + ਸਵਾਲ ਪ੍ਰਸਤੁਤ ਕਰੋ + ਵੌਇਸ ਖੋਜ + ਇਸ ਨਾਲ ਸਾਂਝਾ ਕਰੋ + %s ਨਾਲ ਸਾਂਝਾ ਕਰੋ + ਨਸ਼ਟ ਕਰੋ + ਖੋਜ + 999+ + diff --git a/app/src/main/res/values-pa/strings.xml b/app/src/main/res/values-pa/strings.xml new file mode 100644 index 0000000..222b21c --- /dev/null +++ b/app/src/main/res/values-pa/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> \'ਤੇ ਵਿਜਿਟ ਕਰੋ ਅਤੇ ਉੱਪਰ ਦਿੱਤੇ ਕੋਡ ਨੂੰ ਦਾਖ਼ਲ ਕਰੋ। + ਇੱਕ ਚਿੱਤਰ ਡਾਉਨਲੋਡ ਕਰਨ ਦੌਰਾਨ ਅਕਲਪਿਤ ਤਰੁੱਟੀ। + WebView ਵਿੱਚ ਲੌਗ ਇਨ ਕਰਨ ਲਈ ਇੰਟਰਨੈੱਟ ਦੀ ਇਜਾਜ਼ਤ ਦੀ ਲੋੜ ਹੈ + AndroidManifest ਤਰੁੱਟੀ + ਪਸੰਦ ਕੀਤਾ + ਪਸੰਦ ਕਰੋ + ਲੋਡ ਹੋ ਰਿਹਾ ਹੈ... + ਰੱਦ ਕਰੋ + ਲਾਗ ਇਨ + Facebook ਨਾਲ ਜਾਰੀ ਰੱਖੋ + Facebook ਦੇ ਨਾਲ ਲੌਗ ਇਨ ਕਰੋ + ਲੌਗ ਆਉਟ ਕਰੋ + ਲੌਗ ਆਉਟ ਕਰੋ + ਇਸ ਵੱਜੋਂ ਲੌਗ ਇਨ ਕੀਤਾ ਗਿਆ: %1$s + Facebook ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹੋਏ ਲੌਗ ਇਨ ਕਰੋ + ਭੇਜੋ + ਸਾਂਝਾ ਕਰੋ + ਆਪਣੇ ਖਾਤੇ ਨੂੰ ਕਨੈਕਟ ਕਰਨ ਲਈ, ਮੋਬਾਈਲ ਡਿਵਾਈਸ \'ਤੇ Facebook ਐਪ ਖੋਲ੍ਹੋ ਅਤੇ ਸੂਚਨਾਵਾਂ ਦੀ ਜਾਂਚ ਕਰੋ। + - ਜਾਂ - + ਇਹ ਤੁਸੀਂ ਨਹੀਂ ਹੋ? + %1$s ਵਜੋਂ ਜਾਰੀ ਰੱਖੋ + ਲੌਗ ਇਨ ਦੀ ਪੁਸ਼ਟੀ ਕਰੋ + ਤੁਸੀਂ ਨਿਯੰਤਰਣ ਵਿੱਚ ਹੋ - ਇਹ ਚੁਣੋ ਕਿ ਐਪਾਂ ਨਾਲ ਤੁਸੀਂ ਕਿਹੜੀ ਜਾਣਕਾਰੀ ਨੂੰ ਸਾਂਝਾ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ। + 999+ + diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml new file mode 100644 index 0000000..ffc9220 --- /dev/null +++ b/app/src/main/res/values-pl/strings.xml @@ -0,0 +1,47 @@ + + + Przejdź do strony głównej + %1$s, %2$s + %1$s, %2$s, %3$s + Przejdź wyżej + Więcej opcji + Gotowe + Zobacz wszystkie + Wybierz aplikację + WYŁ. + WŁ. + Szukaj… + Wyczyść zapytanie + Wyszukiwane hasło + Szukaj + Wyślij zapytanie + Wyszukiwanie głosowe + Udostępnij dla + Udostępnij dla %s + Zwiń + Odwiedź stronę <b>facebook.com/device</b> i wprowadź powyższy kod. + Nieoczekiwany błąd podczas pobierania obrazu. + Logowanie WebView wymaga uprawnienia INTERNET + Błąd AndroidManifest + Lubisz to + Lubię to! + Ładowanie… + Anuluj + Logowanie się + Kontynuuj za pośrednictwem Facebooka + Zaloguj się przez Facebooka + Wyloguj się + Wyloguj się + Zalogowano jako: %1$s + Zalogowano przy użyciu Facebooka + Wyślij + Udostępnij + Aby połączyć konto, otwórz aplikację Facebook na urządzeniu mobilnym i sprawdź powiadomienia. + - LUB - + To nie Ty? + Kontynuuj jako %1$s + Potwierdź logowanie + Zachowujesz kontrolę — wybierz informacje, które chcesz udostępniać w aplikacjach. + Szukaj + 999+ + diff --git a/app/src/main/res/values-port/bools.xml b/app/src/main/res/values-port/bools.xml new file mode 100644 index 0000000..d0ac80b --- /dev/null +++ b/app/src/main/res/values-port/bools.xml @@ -0,0 +1,4 @@ + + + false + diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000..ce2fe6c --- /dev/null +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -0,0 +1,24 @@ + + + Navegar para a página inicial + %1$s, %2$s + %1$s, %2$s, %3$s + Navegar para cima + Mais opções + Concluído + Ver tudo + Selecione um app + DESATIVAR + ATIVAR + Pesquisar... + Limpar consulta + Consulta de pesquisa + Pesquisar + Enviar consulta + Pesquisa por voz + Compartilhar com + Compartilhar com %s + Recolher + Pesquisar + 999+ + diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml new file mode 100644 index 0000000..5ec0167 --- /dev/null +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -0,0 +1,47 @@ + + + Navegar para a página inicial + %1$s, %2$s + %1$s, %2$s, %3$s + Navegar para cima + Mais opções + Concluído + Ver tudo + Escolher uma aplicação + DESATIVADO + ATIVADO + Pesquisar... + Limpar consulta + Consulta de pesquisa + Pesquisar + Enviar consulta + Pesquisa por voz + Partilhar com + Partilhar com %s + Reduzir + Visita <b>facebook.com/device</b> e insere o código apresentado abaixo. + Ocorreu um erro inesperado ao descarregar uma imagem. + O início de sessão WebView requer a permissão INTERNET + Erro AndroidManifest + Gostaste + Gosto + A carregar... + Cancelar + Iniciar sessão + Continuar com o Facebook + Iniciar sessão com o Facebook + Terminar a sessão + Terminar a sessão + Com sessão iniciada como %1$s + Com sessão iniciada com o Facebook + Enviar + Partilhar + Para associares a tua conta, abre a app Facebook no teu dispositivo móvel e consulta as notificações. + - OU - + Não és tu? + Continuar como %1$s + Confirmar início de sessão + Tens o controlo. Escolhe as informações que queres partilhar com as apps. + Pesquisar + +999 + diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml new file mode 100644 index 0000000..756f3eb --- /dev/null +++ b/app/src/main/res/values-pt/strings.xml @@ -0,0 +1,47 @@ + + + Navegar para a página inicial + %1$s, %2$s + %1$s, %2$s, %3$s + Navegar para cima + Mais opções + Concluído + Ver tudo + Selecione um app + DESATIVAR + ATIVAR + Pesquisar... + Limpar consulta + Consulta de pesquisa + Pesquisar + Enviar consulta + Pesquisa por voz + Compartilhar com + Compartilhar com %s + Recolher + Acesse <b>facebook.com/device</b> e insira o código mostrado acima. + Erro inesperado ao baixar uma imagem. + O login do WebView exige permissão da INTERNET + Erro AndroidManifest + Curtiu + Curtir + Carregando... + Cancelar + Entrar + Continuar com o Facebook + Entrar com o Facebook + Sair + Sair + Conectado como: %1$s + Conectado usando o Facebook + Enviar + Compartilhar + Para conectar sua conta, abra o aplicativo do Facebook no seu dispositivo móvel e verifique se há notificações. + - OU - + Não é você? + Continuar como %1$s + Confirmar login + Você está no controle — escolha quais informações você quer compartilhar com os aplicativos. + Pesquisar + 999+ + diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml new file mode 100644 index 0000000..de6816f --- /dev/null +++ b/app/src/main/res/values-ro/strings.xml @@ -0,0 +1,24 @@ + + + Navigați la ecranul de pornire + %1$s, %2$s + %1$s, %2$s, %3$s + Navigați în sus + Mai multe opțiuni + Terminat + Afișați-le pe toate + Alegeți o aplicație + DEZACTIVAȚI + ACTIVAȚI + Căutați… + Ștergeți interogarea + Interogare de căutare + Căutați + Trimiteți interogarea + Căutare vocală + Trimiteți la + Trimiteți la %s + Restrângeți + Căutați + ˃999 + diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml new file mode 100644 index 0000000..3fcc841 --- /dev/null +++ b/app/src/main/res/values-ru/strings.xml @@ -0,0 +1,47 @@ + + + Перейти на главный экран + %1$s, %2$s + %1$s, %2$s, %3$s + Перейти вверх + Другие параметры + Готово + Показать все + Выбрать приложение + ОТКЛ. + ВКЛ. + Поиск + Удалить запрос + Поисковый запрос + Поиск + Отправить запрос + Голосовой поиск + Открыть доступ + Открыть доступ пользователю %s + Свернуть + Откройте <b>facebook.com/device</b> и введите код, показанный выше. + Неожиданная ошибка при скачивании изображения. + Для входа через WebView необходимо разрешение INTERNET + Ошибка AndroidManifest + Нравится + Нравится + Загрузка... + Отмена + Войти + Продолжить с Facebook + Вход через Facebook + Выйти + Выйти + Вы вошли как %1$s + Выполнен вход через Facebook + Отправить + Поделиться + Чтобы привязать ваш аккаунт, откройте приложение Facebook на своем мобильном устройстве и проверьте уведомления. + - ИЛИ - + Не Вы? + Продолжить как %1$s + Подтвердите вход + Контроль над данными — выберите, какой информацией вы хотите делиться с приложениями. + Поиск + >999 + diff --git a/app/src/main/res/values-si-rLK/strings.xml b/app/src/main/res/values-si-rLK/strings.xml new file mode 100644 index 0000000..35c6b4b --- /dev/null +++ b/app/src/main/res/values-si-rLK/strings.xml @@ -0,0 +1,24 @@ + + + ගෙදරට සංචාලනය කරන්න + %1$s, %2$s + %1$s, %2$s, %3$s + ඉහලට සංචාලනය කරන්න + තවත් විකල්ප + අවසාන වූ + සියල්ල බලන්න + යෙදුමක් තෝරන්න + ක්‍රියාවිරහිතයි + ක්‍රියාත්මකයි + සොයන්න... + විමසුම හිස් කරන්න + සෙවුම් විමසුම + සෙවීම + විමසුම යොමු කරන්න + හඬ සෙවීම + සමඟ බෙදාගන්න + %s සමඟ බෙදාගන්න + හකුළන්න + සොයන්න + 999+ + diff --git a/app/src/main/res/values-si/strings.xml b/app/src/main/res/values-si/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-si/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml new file mode 100644 index 0000000..bff455d --- /dev/null +++ b/app/src/main/res/values-sk/strings.xml @@ -0,0 +1,47 @@ + + + Prejsť na plochu + %1$s, %2$s + %1$s, %2$s, %3$s + Prejsť hore + Ďalšie možnosti + Hotovo + Zobraziť všetko + Zvoľte aplikáciu + VYP. + ZAP. + Vyhľadať… + Vymazať dopyt + Vyhľadávací dopyt + Hľadať + Odoslať dopyt + Hlasové vyhľadávanie + Zdieľať pomocou + Zdieľať pomocou %s + Zbaliť + Navštívte stránku <b>facebook.com/device</b> a zadajte kód zobrazený vyššie. + Pri sťahovaní obrázka sa vyskytla neočakávaná chyba. + Na prihlásenie cez WebView sa vyžaduje povolenie internetu + Chyba AndroidManifest + Páčilo sa mi to + Páči sa mi to + Načítava sa… + Zrušiť + Prihlásiť sa + Pokračovať s Facebookom + Prihlásiť sa cez Facebook + Odhlásiť sa + Odhlásiť sa + Prihlásený/-á ako: %1$s + Prihlásený/-á cez Facebook + Poslať + Zdieľať + Ak si chcete pripojiť účet, vo svojom mobilnom zariadení otvorte aplikáciu Facebook a pozrite si upozornenia. + - ALEBO - + Nie ste to vy? + Pokračovať ako %1$s + Potvrdiť prihlásenie + Máte to pod kontrolou: vy určujete, ktoré informácie chcete zdieľať s aplikáciami. + Vyhľadávanie + 999+ + diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml new file mode 100644 index 0000000..48f4feb --- /dev/null +++ b/app/src/main/res/values-sl/strings.xml @@ -0,0 +1,24 @@ + + + Krmarjenje domov + %1$s, %2$s + %1$s, %2$s, %3$s + Krmarjenje navzgor + Več možnosti + Končano + Pokaži vse + Izbira aplikacije + IZKLOPLJENO + VKLOPLJENO + Iskanje … + Izbris poizvedbe + Iskalna poizvedba + Iskanje + Pošiljanje poizvedbe + Glasovno iskanje + Deljenje z + Deljenje z: + Strni + Iskanje + 999+ + diff --git a/app/src/main/res/values-sq-rAL/strings.xml b/app/src/main/res/values-sq-rAL/strings.xml new file mode 100644 index 0000000..aa2d204 --- /dev/null +++ b/app/src/main/res/values-sq-rAL/strings.xml @@ -0,0 +1,24 @@ + + + Orientohu për në shtëpi + %1$s, %2$s + %1$s, %2$s, %3$s + Ngjitu lart + Opsione të tjera + U krye! + Shikoji të gjitha + Zgjidh një aplikacion + JOAKTIV + AKTIV + Kërko... + Pastro pyetjen + Kërko pyetjen + Kërko + Dërgo pyetjen + Kërkim me zë + Shpërnda publikisht me + Shpërnda publikisht me %s + Shpalos + Kërko + 999+ + diff --git a/app/src/main/res/values-sq/strings.xml b/app/src/main/res/values-sq/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-sq/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml new file mode 100644 index 0000000..a287886 --- /dev/null +++ b/app/src/main/res/values-sr/strings.xml @@ -0,0 +1,24 @@ + + + Одлазак на Почетну + %1$s, %2$s + %1$s, %2$s, %3$s + Кретање нагоре + Још опција + Готово + Прикажи све + Избор апликације + ИСКЉУЧИ + УКЉУЧИ + Претражите... + Брисање упита + Упит за претрагу + Претрага + Слање упита + Гласовна претрага + Дели са + Дели са апликацијом %s + Скупи + Претражи + >999 + diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml new file mode 100644 index 0000000..290e345 --- /dev/null +++ b/app/src/main/res/values-sv/strings.xml @@ -0,0 +1,47 @@ + + + Visa startsidan + %1$s, %2$s + %1$s, %2$s, %3$s + Navigera uppåt + Fler alternativ + Klart + Visa alla + Välj en app + AV + + Sök … + Ta bort frågan + Sökfråga + Sök + Skicka fråga + Röstsökning + Dela med + Dela med %s + Komprimera + Gå till <b>facebook.com/device</b> och skriv in koden som visas ovan. + Ett oväntat fel inträffade när en bild skulle laddas ned. + WebView-inloggning kräver INTERNET-åtkomst + AndroidManifest-fel + Gillat + Gilla + Laddar ... + Avbryt + Logga in + Fortsätt med Facebook + Logga in med Facebook + Logga ut + Logga ut + Inloggad som: %1$s + Inloggad med Facebook + Skicka + Dela + Koppla ditt konto genom att öppna Facebook-appen på din mobila enhet och leta efter aviseringar. + - ELLER - + Inte du? + Fortsätt som %1$s + Bekräfta inloggning + Du bestämmer – välj vilken information du vill dela med appar. + Sök + >999 + diff --git a/app/src/main/res/values-sw/strings.xml b/app/src/main/res/values-sw/strings.xml new file mode 100644 index 0000000..fda5abf --- /dev/null +++ b/app/src/main/res/values-sw/strings.xml @@ -0,0 +1,24 @@ + + + Nenda mwanzo + %1$s, %2$s + %1$s, %2$s, %3$s + Nenda juu + Chaguo zaidi + Nimemaliza + Angalia zote + Chagua programu + IMEZIMWA + IMEWASHWA + Tafuta… + Futa hoja + Hoja ya utafutaji + Tafuta + Wasilisha hoja + Tafuta kwa kutamka + Shiriki na: + Shiriki na %s + Kunja + Tafuta + 999+ + diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..661020b --- /dev/null +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -0,0 +1,11 @@ + + + 24dp + 80dp + 64dp + 8dp + 8dp + 580dp + 16dp + 20dp + diff --git a/app/src/main/res/values-ta-rIN/strings.xml b/app/src/main/res/values-ta-rIN/strings.xml new file mode 100644 index 0000000..963c483 --- /dev/null +++ b/app/src/main/res/values-ta-rIN/strings.xml @@ -0,0 +1,24 @@ + + + முகப்பிற்கு வழிசெலுத்து + %1$s, %2$s + %1$s, %2$s, %3$s + மேலே வழிசெலுத்து + மேலும் விருப்பங்கள் + முடிந்தது + எல்லாம் காட்டு + பயன்பாட்டைத் தேர்வுசெய்க + முடக்கு + இயக்கு + தேடு... + வினவலை அழி + தேடல் வினவல் + தேடு + வினவலைச் சமர்ப்பி + குரல் தேடல் + இதனுடன் பகிர் + %s உடன் பகிர் + சுருக்கு + தேடு + 999+ + diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml new file mode 100644 index 0000000..ab61cad --- /dev/null +++ b/app/src/main/res/values-ta/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b> ஐப் பார்வையிட்டு, மேலே காட்டப்பட்ட குறியீட்டை உள்ளிடவும். + படத்தைப் பதிவிறக்கும்போது எதிர்பாராத பிழை ஏற்பட்டது. + WebView உள்நுழைவுக்கு இணைய அனுமதித் தேவை + AndroidManifest பிழை + விரும்பியவை + பிடித்திருக்கிறது + ஏற்றுகிறது… + ரத்துசெய் + உள்நுழையவும் + Facebook மூலம் தொடரவும் + Facebook மூலம் உள்நுழையவும் + வெளியேறு + வெளியேறு + %1$s ஆக உள்நுழைந்துள்ளீர்கள் + Facebook ஐப் பயன்படுத்தி உள்நுழைந்துள்ளீர்கள் + அனுப்பு + பகிர் + உங்கள் கணக்கை இணைக்க, உங்கள் மொபைல் சாதனத்தில் Facebook பயன்பாட்டைத் திறந்து, அறிவிப்புகளைப் பார்க்கவும். + - அல்லது - + நீங்கள் அல்ல? + %1$s ஆகத் தொடர் + உள்நுழைதலை உறுதிப்படுத்தவும் + கட்டுப்பாடு உங்களிடம் உள்ளது. பயன்பாடுகளுடன் நீங்கள் பகிர விரும்பும் தகவல்களைத் தேர்வுசெய்யவும். + 999+ + diff --git a/app/src/main/res/values-te-rIN/strings.xml b/app/src/main/res/values-te-rIN/strings.xml new file mode 100644 index 0000000..8e0aee0 --- /dev/null +++ b/app/src/main/res/values-te-rIN/strings.xml @@ -0,0 +1,24 @@ + + + హోమ్‌కు నావిగేట్ చేయండి + %1$s, %2$s + %1$s, %2$s, %3$s + పైకి నావిగేట్ చేయండి + మరిన్ని ఎంపికలు + పూర్తయింది + అన్నీ చూడండి + అనువర్తనాన్ని ఎంచుకోండి + ఆఫ్ చేయి + ఆన్ చేయి + శోధించు... + ప్రశ్నను క్లియర్ చేయి + ప్రశ్న శోధించండి + శోధించు + ప్రశ్నని సమర్పించు + వాయిస్ శోధన + వీరితో భాగస్వామ్యం చేయి + %sతో భాగస్వామ్యం చేయి + కుదించండి + శోధించు + 999+ + diff --git a/app/src/main/res/values-te/strings.xml b/app/src/main/res/values-te/strings.xml new file mode 100644 index 0000000..dad12c1 --- /dev/null +++ b/app/src/main/res/values-te/strings.xml @@ -0,0 +1,27 @@ + + + <b>facebook.com/device</b>ని సందర్శించి ఎగువన చూపిన కోడ్‌ను నమోదు చేయండి. + ఒక చిత్రాన్ని డౌన్‌లోడ్ చేయడంలో అనుకోని లోపం సంభవించింది. + WebView లాగిన్ కోసం ఇంటర్నెట్ అనుమతి అవసరమవుతుంది + AndroidManifest లోపం + ఇష్టపడ్డారు + ఇష్టం + లోడ్ చేస్తోంది… + రద్దు చేయి + లాగిన్ + Facebookతో కొనసాగించు + Facebookతో లాగిన్ చేయండి + లాగ్ అవుట్ చేయండి + లాగ్ అవుట్ చేయండి + వీరి వలె లాగిన్ చేసారు: %1$s + Facebookని ఉపయోగించి లాగిన్ చేసారు + పంపండి + భాగస్వామ్యం చేయి + మీ ఖాతాను అనుసంధానించేందుకు, మీ మొబైల్ పరికరంలో Facebook అనువర్తనాన్ని తెరిచి నోటిఫికేషన్‌లను తనిఖీ చేయండి. + - లేదా - + మీరు కాదా? + %1$sగా కొనసాగండి + లాగిన్‌ను నిర్ధారించండి + మీరు నియంత్రణలో ఉన్నారు - మీరు ఏ సమాచారాన్ని అనువర్తనాలతో పంచుకోవాలనుకుంటున్నారో ఎంచుకోండి. + 999+ + diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml new file mode 100644 index 0000000..cbb4326 --- /dev/null +++ b/app/src/main/res/values-th/strings.xml @@ -0,0 +1,47 @@ + + + นำทางไปหน้าแรก + %1$s, %2$s + %1$s, %2$s, %3$s + นำทางขึ้น + ตัวเลือกอื่น + เสร็จสิ้น + ดูทั้งหมด + เลือกแอป + ปิด + เปิด + ค้นหา… + ล้างข้อความค้นหา + ข้อความค้นหา + ค้นหา + ส่งข้อความค้นหา + ค้นหาด้วยเสียง + แชร์กับ + แชร์กับ %s + ยุบ + ไปที่ <b>facebook.com/device</b> แล้วป้อนรหัสที่ปรากฏด้านล่าง + เกิดข้อผิดพลาดที่ไม่คาดคิดขณะดาวน์โหลดภาพ + การเข้าสู่ระบบ WebView ต้องได้รับสิทธิ์การอนุญาตอินเทอร์เน็ต + ข้อผิดพลาด AndroidManifest + ถูกใจแล้ว + ถูกใจ + กำลังโหลด... + ยกเลิก + เข้าสู่ระบบ + ดำเนินการต่อด้วย Facebook + เข้าสู่ระบบด้วย Facebook + ออกจากระบบ + ออกจากระบบ + เข้าสู่ระบบแล้วในชื่อ %1$s + เข้าสู่ระบบแล้วโดยใช้ Facebook + ส่ง + แชร์ + หากต้องการเชื่อมต่อกับบัญชีผู้ใช้ของคุณ ให้เปิดแอพ Facebook บนอุปกรณ์มือถือของคุณแล้วตรวจสอบการแจ้งเตือน + - หรือ - + ไม่ใช่คุณใช่ไหม + ดำเนินการต่อในชื่อ %1$s + ยืนยันการเข้าสู่ระบบ + คุณควบคุมได้ เลือกว่าคุณต้องการแชร์ข้อมูลใดกับแอพ + ค้นหา + 999+ + diff --git a/app/src/main/res/values-tl/strings.xml b/app/src/main/res/values-tl/strings.xml new file mode 100644 index 0000000..e169d9a --- /dev/null +++ b/app/src/main/res/values-tl/strings.xml @@ -0,0 +1,46 @@ + + + Mag-navigate patungo sa home + %1$s, %2$s + %1$s, %2$s, %3$s + Mag-navigate pataas + Higit pang mga opsyon + Tapos na + Tingnan lahat + Pumili ng isang app + I-OFF + I-ON + Maghanap… + I-clear ang query + Query sa paghahanap + Maghanap + Isumite ang query + Paghahanap gamit ang boses + Ibahagi sa/kay + Ibahagi sa/kay %s + I-collapse + Puntahan ang <b>facebook.com/device</b> at ilagay ang code na ipinapakita sa itaas. + Hindi inaasahang error habang dina-download ang larawan. + Ang pag-log in sa WebView ay nangangailangan ng pahintulot sa INTERNET + Nagustuhan + Gusto ko ito + Naglo-load... + Kanselahin + Mag-log in + Magpatuloy gamit ang Facebook + Mag-log in sa Facebook + Mag-log out + Mag-log out + Mag-log-in bilang: %1$s. + Naka-log in gamit ang Facebook + Ipadala + I-share + Para ikonekta ang iyong account, buksan ang Facebook app sa iyong cellphone at tumingin ng mga notification. + - O - + Hindi ikaw? + Magpatuloy bilang %1$s + I-confirm ang Pag-log in + Ikaw ang may kontrol - piliin anong impormasyon ang gusto mong i-share sa mga app. + Maghanap + 999+ + diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml new file mode 100644 index 0000000..5cbac7a --- /dev/null +++ b/app/src/main/res/values-tr/strings.xml @@ -0,0 +1,47 @@ + + + Ana ekrana git + %1$s, %2$s + %1$s, %2$s, %3$s + Yukarı git + Diğer seçenekler + Bitti + Tümünü göster + Bir uygulama seçin + KAPAT + + Ara… + Sorguyu temizle + Arama sorgusu + Ara + Sorguyu gönder + Sesli arama + Şununla paylaş + %s ile paylaş + Daralt + <b>facebook.com/device</b> adresine git ve yukarıda gösterilen kodu gir. + Görüntü indirilirken beklenmedik bir hata oluştu. + WebView girişi için İNTERNET izni gerekiyor + AndroidManifest Hatası + Beğendin + Beğen + Yükleniyor... + İptal + Giriş yap + Facebook ile Devam Et + Facebook ile Giriş Yap + Çıkış Yap + Çıkış Yap + %1$s olarak giriş yapıldı + Facebook ile giriş yapıldı + Gönder + Paylaş + Hesabını bağlamak için, mobil cihazında Facebook uygulamasını aç ve bildirimleri kontrol et. + - VEYA - + Siz değil misiniz? + %1$s olarak devam et + Girişi Onayla + Kontrol sende - uygulamalarla paylaşmak istediğin bilgileri seç. + Ara + 999+ + diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml new file mode 100644 index 0000000..7bca0e7 --- /dev/null +++ b/app/src/main/res/values-uk/strings.xml @@ -0,0 +1,24 @@ + + + Перейти на головний + %1$s, %2$s + %1$s, %2$s, %3$s + Перейти вгору + Інші опції + Готово + Переглянути всі + Вибрати програму + ВИМК. + УВІМК. + Пошук… + Очистити запит + Пошуковий запит + Пошук + Надіслати запит + Голосовий пошук + Надіслати через + Надіслати через %s + Згорнути + Пошук + 999+ + diff --git a/app/src/main/res/values-ur-rPK/strings.xml b/app/src/main/res/values-ur-rPK/strings.xml new file mode 100644 index 0000000..b02b892 --- /dev/null +++ b/app/src/main/res/values-ur-rPK/strings.xml @@ -0,0 +1,24 @@ + + + ہوم پر نیویگیٹ کریں + %1$s, %2$s + %1$s, %2$s, %3$s + اوپر نیویگیٹ کریں + مزید اختیارات + ہو گیا + سبھی دیکھیں + ایک ایپ منتخب کریں + آف + آن + تلاش کریں… + استفسار صاف کریں + استفسار تلاش کریں + تلاش کریں + استفسار جمع کرائیں + صوتی تلاش + اشتراک کریں مع + ‏%s کے ساتھ اشتراک کریں + سکیڑیں + تلاش + ‎999+‎ + diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml new file mode 100644 index 0000000..f287466 --- /dev/null +++ b/app/src/main/res/values-ur/strings.xml @@ -0,0 +1,4 @@ + + + ‎999+‎ + diff --git a/app/src/main/res/values-uz-rUZ/strings.xml b/app/src/main/res/values-uz-rUZ/strings.xml new file mode 100644 index 0000000..0d8a232 --- /dev/null +++ b/app/src/main/res/values-uz-rUZ/strings.xml @@ -0,0 +1,24 @@ + + + Boshiga o‘tish + %1$s, %2$s + %1$s, %2$s, %3$s + Yuqoriga o‘tish + Boshqa parametrlar + Tayyor + Barchasini ko‘rish + Dastur tanlang + O‘CHIQ + YONIQ + Qidirish… + So‘rovni tozalash + So‘rovni izlash + Qidirish + So‘rov yaratish + Ovozli qidiruv + Ruxsat berish + %sga ruxsat berish + Yig‘ish + Qidirish + 999+ + diff --git a/app/src/main/res/values-uz/strings.xml b/app/src/main/res/values-uz/strings.xml new file mode 100644 index 0000000..e256ab8 --- /dev/null +++ b/app/src/main/res/values-uz/strings.xml @@ -0,0 +1,4 @@ + + + 999+ + diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml new file mode 100644 index 0000000..472103e --- /dev/null +++ b/app/src/main/res/values-vi/strings.xml @@ -0,0 +1,47 @@ + + + Điều hướng về trang chủ + %1$s, %2$s + %1$s, %2$s, %3$s + Điều hướng lên trên + Thêm tùy chọn + Xong + Xem tất cả + Chọn một ứng dụng + TẮT + BẬT + Tìm kiếm… + Xóa truy vấn + Tìm kiếm truy vấn + Tìm kiếm + Gửi truy vấn + Tìm kiếm bằng giọng nói + Chia sẻ với + Chia sẻ với %s + Thu gọn + Truy cập <b>facebook.com/device</b> và nhập mã được hiển thị bên trên. + Lỗi không mong muốn khi tải hình ảnh xuống. + Đăng nhập chế độ xem web yêu cầu quyền INTERNET + Lỗi AndroidManifest + Đã thích + Thích + Đang tải… + Hủy + Đăng nhập + Tiếp tục với Facebook + Đăng nhập bằng Facebook + Đăng xuất + Đăng xuất + Đã đăng nhập với tên: %1$s + Đã đăng nhập bằng Facebook + Gửi + Chia sẻ + Để kết nối tài khoản của bạn, hãy mở ứng dụng Facebook trên thiết bị di động và kiểm tra thông báo. + - HOẶC - + Không phải bạn? + Tiếp tục với tư cách %1$s + Xác nhận đăng nhập + Bạn nắm quyền kiểm soát - chọn thông tin bạn muốn chia sẻ với ứng dụng. + Tìm kiếm + 999+ + diff --git a/app/src/main/res/values-xhdpi/drawables.xml b/app/src/main/res/values-xhdpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-xhdpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-xlarge/dimens.xml b/app/src/main/res/values-xlarge/dimens.xml new file mode 100644 index 0000000..1fd0d37 --- /dev/null +++ b/app/src/main/res/values-xlarge/dimens.xml @@ -0,0 +1,7 @@ + + + 50% + 70% + 45% + 72% + diff --git a/app/src/main/res/values-xxhdpi/drawables.xml b/app/src/main/res/values-xxhdpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-xxhdpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-xxxhdpi/drawables.xml b/app/src/main/res/values-xxxhdpi/drawables.xml new file mode 100644 index 0000000..045e125 --- /dev/null +++ b/app/src/main/res/values-xxxhdpi/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000..d8c7f9e --- /dev/null +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,47 @@ + + + 转到主屏幕 + %1$s:%2$s + %1$s - %2$s:%3$s + 转到上一层级 + 更多选项 + 完成 + 查看全部 + 选择应用 + 关闭 + 开启 + 搜索… + 清除查询 + 搜索查询 + 搜索 + 提交查询 + 语音搜索 + 分享方式 + 通过%s分享 + 收起 + 请访问<b>facebook.com/device</b>并输入以上验证码。 + 下载图片时出现意外错误。 + WebView 登录需要访问网络 + AndroidManifest 错误 + 赞了 + + 正在加载... + 取消 + 登录 + 前往 Facebook + 使用 Facebook 登录 + 退出 + 退出 + 登录身份:%1$s + 已通过 Facebook 登录 + 发送 + 分享 + 要关联帐户,请在移动设备上打开 Facebook 应用并查看通知。 + - 或 - + 不是你? + 以%1$s的身份继续 + 确认登录 + 应用分享内容由你掌控。 + 搜索 + 999+ + diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml new file mode 100644 index 0000000..5bf63d7 --- /dev/null +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -0,0 +1,47 @@ + + + 瀏覽主頁 + %1$s:%2$s + %1$s (%2$s):%3$s + 向上瀏覽 + 更多選項 + 完成 + 顯示全部 + 選擇應用程式 + 關閉 + 開啟 + 搜尋… + 清除查詢 + 搜尋查詢 + 搜尋 + 提交查詢 + 語音搜尋 + 分享對象 + 與「%s」分享 + 收合 + 前往<b>facebook.com/device</b&gt,並輸入上方顯示的代碼。 + 下載圖像時發生沒有預期的錯誤。 + WebView 登入需要網絡使用權限 + AndroidManifest 錯誤 + 已讚好 + 讚好 + 載入中...... + 取消 + 登入 + 繼續使用 Facebook 帳戶 + 使用 Facebook 登入 + 登出 + 登出 + 以%1$s身分登入 + 已使用 Facebook 登入 + 送出 + 分享 + 若要連結帳戶,請在流動裝置上開啟 Facebook 應用程式,然後查看通知。 + - 或 - + 不是你嗎? + 以%1$s的身分繼續 + 確認登入 + 一切由你掌握:自行選擇要分享給應用程式的資訊種類。 + 搜尋 + 999 + + diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml new file mode 100644 index 0000000..2f24188 --- /dev/null +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -0,0 +1,47 @@ + + + 瀏覽首頁 + %1$s:%2$s + %1$s - %2$s:%3$s + 向上瀏覽 + 更多選項 + 完成 + 查看全部 + 選擇應用程式 + 關閉 + 開啟 + 搜尋… + 清除查詢 + 搜尋查詢 + 搜尋 + 提交查詢 + 語音搜尋 + 選擇分享對象 + 與「%s」分享 + 收合 + 前往<b>facebook.com/device</b&gt,並輸入上方顯示的代碼。 + 下載圖像時無預警發生錯誤。 + WebView 登入需要網路使用權限 + AndroidManifest 錯誤 + 已說讚 + + 載入中...... + 取消 + 登入 + 以 Facebook 帳號繼續 + 使用 Facebook 帳號登入 + 登出 + 登出 + 以%1$s身分登入 + 已使用 Facebook 登入 + 送出 + 分享 + 若要連結帳號,請在行動裝置上開啟 Facebook 應用程式,然後查看通知。 + - 或 - + 不是你? + 以%1$s的身分繼續 + 確認登入 + 一切操之在你:自行選擇要分享給應用程式的資訊種類。 + 搜尋 + 999+ + diff --git a/app/src/main/res/values-zu/strings.xml b/app/src/main/res/values-zu/strings.xml new file mode 100644 index 0000000..0269f3f --- /dev/null +++ b/app/src/main/res/values-zu/strings.xml @@ -0,0 +1,24 @@ + + + Zulazulela ekhaya + %1$s, %2$s + %1$s, %2$s, %3$s + Zulazulela phezulu + Izinketho eziningi + Kwenziwe + Buka konke + Khetha uhlelo lokusebenza + VALIWE + VULIWE + Iyasesha... + Sula inkinga + Umbuzo wosesho + Sesha + Hambisa umbuzo + Ukusesha ngezwi + Yabelana no- + Yabelana no-%s + Goqa + Sesha + 999+ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..f22c481 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,113 @@ + + + Cancel + OK + Please accept all permission requests to run this game or press Cancel to close the application. + Navigate home + %1$s, %2$s + %1$s, %2$s, %3$s + Navigate up + More options + Done + See all + Choose an app + OFF + ON + sans-serif + sans-serif-medium + sans-serif-medium + sans-serif + sans-serif + sans-serif + sans-serif + sans-serif-light + sans-serif + sans-serif + sans-serif + sans-serif-medium + Search… + Clear query + Search query + Search + Submit query + Voice search + Share with + Share with %s + Collapse + NFS Most Wanted + 301771293238871 + NFS Most Wanted + Visit <b>facebook.com/device</b> and enter the code shown above. + Unexpected error while downloading an image. + WebView login requires INTERNET permission + AndroidManifest Error + Liked + Like + Loading… + Cancel + Log in + Continue with Facebook + Log in with Facebook + Log out + Log out + Logged in as: %1$s + Logged in using Facebook + Send + Share + To connect your account, open the Facebook app on your mobile device and check for notifications. + - OR - + Not you? + Continue as %1$s + Confirm Login + You\'re in control - choose what info you want to share with apps. + The game need to download resources to play. The resources total %s. + You are connected using 3G network. Data charges applicable. + Wi-fi is disabled, it is recommended that you enable Wi-Fi for the download. + Continue + Pause + Quit + Resume + Retry + Start + The downloaded assets were corrupted + Verifying uncompressed assets + + dev + @drawable/icon + @drawable/icon_round + %1$s KB/s + You are not authorized to play this game + Send + live + Download complete + Download unsuccessful + Play Now! + Search + Download finished. + Connecting to the download server... + Downloading resources... + Download failed. + Download cancelled. + Could not connect to Google Play to download resources. Check internet connection and Google Play setup. + Download failed because the external storage is full. + Download failed because you\'re not signed into Google Play or the game could not be validated by Google Play. + Looking for resources to download... + Waiting for download to start... + Download paused. + Download paused. Test a website in browser. + Download paused because no network is available. + Download paused because you are roaming. + Download paused because the external storage is unavailable. + Download paused because Wi-Fi is disabled. + Download paused because Wi-Fi is unavailable. + Unknown error. Please try again later... + 999+ + Preparing tyres + Start your engine! + Checking engine + Polishing optics + Girls waving race flags + Cancel Verification + Time remaining: %1$s + %1$s left + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..bf40a51 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/components.xml b/app/src/main/res/xml/components.xml new file mode 100644 index 0000000..4be7087 --- /dev/null +++ b/app/src/main/res/xml/components.xml @@ -0,0 +1,35 @@ + + + com.ea.nimble.tracking.Tracking + + com.ea.nimble.tracking.NimbleTrackingSynergyComponent + + com.ea.nimble.tracking.NimbleTrackingS2SComponent + + com.ea.nimble.tracking.TrackingEventWrangler + + com.ea.nimble.origin.Origin + + com.ea.nimble.inappmessage.InAppMessage + + com.ea.nimble.pushnotificationgoogle.PushNotification + + com.ea.nimble.mtx.googleplay.GooglePlay + + com.ea.nimble.mtx.amazon.AmazonStore + + com.ea.nimble.crashreporter.CrashTrapper + + com.ea.nimble.identity.NimbleIdentityImpl + + com.ea.nimble.identity.AuthenticatorOrigin + + com.ea.nimble.identity.AuthenticatorFacebook + + com.ea.nimble.identity.AuthenticatorAnonymous + + com.ea.nimble.friends.NimbleFriendsImpl + + com.ea.nimble.friends.NimbleOriginFriendsServiceImpl + + diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..e84eeb3 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,17 @@ + + + + eamobile.com + + ea.com + + tnt-ea.com + + j2play.net + + origin.com + + apple.com + + + diff --git a/app/src/main/res/xml/nimble_log.xml b/app/src/main/res/xml/nimble_log.xml new file mode 100644 index 0000000..faa6926 --- /dev/null +++ b/app/src/main/res/xml/nimble_log.xml @@ -0,0 +1,7 @@ + + + error + + Nimble.log + +