delete some trash
This commit is contained in:
+1
-11
@@ -87,19 +87,9 @@ dependencies {
|
|||||||
androidTestImplementation(libs.ui.test.junit4)
|
androidTestImplementation(libs.ui.test.junit4)
|
||||||
debugImplementation(libs.ui.tooling)
|
debugImplementation(libs.ui.tooling)
|
||||||
debugImplementation(libs.ui.test.manifest)
|
debugImplementation(libs.ui.test.manifest)
|
||||||
|
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
|
|
||||||
val google_ver = "7.0.0"
|
|
||||||
implementation ("org.apache.httpcomponents:httpclient:4.5")
|
|
||||||
implementation ("com.google.android.gms:play-services:$google_ver")
|
|
||||||
implementation ("com.google.android.gms:play-services-base:$google_ver")
|
|
||||||
|
|
||||||
implementation ("com.google.android.gms:play-services-ads:$google_ver")
|
|
||||||
implementation ("com.google.android.gms:play-services-drive:$google_ver")
|
|
||||||
|
|
||||||
implementation ("commons-codec:commons-codec:1.15")
|
implementation ("commons-codec:commons-codec:1.15")
|
||||||
implementation ("com.google.code.gson:gson:2.7")
|
|
||||||
implementation ("com.facebook.android:facebook-android-sdk:3.21.0")
|
|
||||||
|
|
||||||
val fragment_version = "1.6.1"
|
val fragment_version = "1.6.1"
|
||||||
implementation("androidx.fragment:fragment:$fragment_version")
|
implementation("androidx.fragment:fragment:$fragment_version")
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="com.ea.games.nfs13_na"
|
|
||||||
android:installLocation="auto" >
|
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
@@ -11,24 +9,13 @@
|
|||||||
android:smallScreens="true"
|
android:smallScreens="true"
|
||||||
android:xlargeScreens="true" />
|
android:xlargeScreens="true" />
|
||||||
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.MANAGE_ACCOUNTS"
|
|
||||||
android:maxSdkVersion="22" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
|
|
||||||
<uses-permission android:name="com.ea.games.nfs13_na.permission.C2D_MESSAGE" />
|
|
||||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.START_BACKGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.sensor.accelerometer"
|
android:name="android.hardware.sensor.accelerometer"
|
||||||
@@ -37,10 +24,6 @@
|
|||||||
android:glEsVersion="0x00020000"
|
android:glEsVersion="0x00020000"
|
||||||
android:required="true" />
|
android:required="true" />
|
||||||
|
|
||||||
<permission
|
|
||||||
android:name="com.ea.games.nfs13_na.permission.C2D_MESSAGE"
|
|
||||||
android:protectionLevel="signature" />
|
|
||||||
|
|
||||||
<uses-configuration android:reqTouchScreen="finger" />
|
<uses-configuration android:reqTouchScreen="finger" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
@@ -74,51 +57,10 @@
|
|||||||
android:name="foo"
|
android:name="foo"
|
||||||
android:value="bar" />
|
android:value="bar" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name="com.ea.ironmonkey.WebActivity"
|
|
||||||
android:configChanges="keyboardHidden|locale"
|
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
|
|
||||||
<activity android:name="com.ea.ironmonkey.devmenu.RecoverListActivity" />
|
<activity android:name="com.ea.ironmonkey.devmenu.RecoverListActivity" />
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="com.facebook.sdk.ApplicationId"
|
|
||||||
android:value="@string/app_id" />
|
|
||||||
<meta-data
|
|
||||||
android:name="com.ea.nimble.configuration"
|
|
||||||
android:value="@string/nimble_configuration" />
|
|
||||||
<meta-data
|
|
||||||
android:name="xperiaplayoptimized_content"
|
|
||||||
android:resource="@drawable/icon" />
|
|
||||||
<meta-data
|
|
||||||
android:name="game_display_name"
|
|
||||||
android:resource="@string/app_name" />
|
|
||||||
<meta-data
|
|
||||||
android:name="game_icon"
|
|
||||||
android:resource="@drawable/icon" />
|
|
||||||
|
|
||||||
<service android:name="com.ea.easp.mtx.market.android.AndroidBillingService" />
|
|
||||||
|
|
||||||
<receiver android:name="com.ea.easp.mtx.market.android.BillingReceiver"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
|
|
||||||
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
|
|
||||||
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
<receiver
|
|
||||||
android:name="com.ea.nimble.pushnotificationgoogle.NimbleBroadcastReceiver"
|
|
||||||
android:permission="com.google.android.c2dm.permission.SEND"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
|
||||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
|
||||||
|
|
||||||
<category android:name="com.ea.games.nfs13_na" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<service android:name="com.ea.nimble.pushnotificationgoogle.GCMIntentService" />
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
package com.android.vending.billing;
|
|
||||||
|
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.IInterface;
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IInAppBillingService.class */
|
|
||||||
public interface IInAppBillingService extends IInterface {
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IInAppBillingService$Stub.class */
|
|
||||||
public static abstract class Stub extends Binder implements IInAppBillingService {
|
|
||||||
private static final String DESCRIPTOR = "com.android.vending.billing.IInAppBillingService";
|
|
||||||
static final int TRANSACTION_consumePurchase = 5;
|
|
||||||
static final int TRANSACTION_getBuyIntent = 3;
|
|
||||||
static final int TRANSACTION_getPurchases = 4;
|
|
||||||
static final int TRANSACTION_getSkuDetails = 2;
|
|
||||||
static final int TRANSACTION_isBillingSupported = 1;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IInAppBillingService$Stub$Proxy.class */
|
|
||||||
private static class Proxy implements IInAppBillingService {
|
|
||||||
private IBinder mRemote;
|
|
||||||
|
|
||||||
Proxy(IBinder iBinder) {
|
|
||||||
this.mRemote = iBinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.IInterface
|
|
||||||
public IBinder asBinder() {
|
|
||||||
return this.mRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IInAppBillingService
|
|
||||||
public int consumePurchase(int i, String str, String str2) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
obtain.writeInt(i);
|
|
||||||
obtain.writeString(str);
|
|
||||||
obtain.writeString(str2);
|
|
||||||
this.mRemote.transact(5, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt();
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IInAppBillingService
|
|
||||||
public Bundle getBuyIntent(int i, String str, String str2, String str3, String str4) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
obtain.writeInt(i);
|
|
||||||
obtain.writeString(str);
|
|
||||||
obtain.writeString(str2);
|
|
||||||
obtain.writeString(str3);
|
|
||||||
obtain.writeString(str4);
|
|
||||||
this.mRemote.transact(3, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(obtain2) : null;
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInterfaceDescriptor() {
|
|
||||||
return Stub.DESCRIPTOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IInAppBillingService
|
|
||||||
public Bundle getPurchases(int i, String str, String str2, String str3) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
obtain.writeInt(i);
|
|
||||||
obtain.writeString(str);
|
|
||||||
obtain.writeString(str2);
|
|
||||||
obtain.writeString(str3);
|
|
||||||
this.mRemote.transact(4, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(obtain2) : null;
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IInAppBillingService
|
|
||||||
public Bundle getSkuDetails(int i, String str, String str2, Bundle bundle) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
obtain.writeInt(i);
|
|
||||||
obtain.writeString(str);
|
|
||||||
obtain.writeString(str2);
|
|
||||||
if (bundle != null) {
|
|
||||||
obtain.writeInt(1);
|
|
||||||
bundle.writeToParcel(obtain, 0);
|
|
||||||
} else {
|
|
||||||
obtain.writeInt(0);
|
|
||||||
}
|
|
||||||
this.mRemote.transact(2, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(obtain2) : null;
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IInAppBillingService
|
|
||||||
public int isBillingSupported(int i, String str, String str2) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
obtain.writeInt(i);
|
|
||||||
obtain.writeString(str);
|
|
||||||
obtain.writeString(str2);
|
|
||||||
this.mRemote.transact(1, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt();
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Stub() {
|
|
||||||
attachInterface(this, DESCRIPTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IInAppBillingService asInterface(IBinder iBinder) {
|
|
||||||
if (iBinder == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR);
|
|
||||||
return (queryLocalInterface == null || !(queryLocalInterface instanceof IInAppBillingService)) ? new Proxy(iBinder) : (IInAppBillingService) queryLocalInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.IInterface
|
|
||||||
public IBinder asBinder() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.Binder
|
|
||||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
|
||||||
switch (i) {
|
|
||||||
case 1:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
int isBillingSupported = isBillingSupported(parcel.readInt(), parcel.readString(), parcel.readString());
|
|
||||||
parcel2.writeNoException();
|
|
||||||
parcel2.writeInt(isBillingSupported);
|
|
||||||
return true;
|
|
||||||
case 2:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
Bundle skuDetails = getSkuDetails(parcel.readInt(), parcel.readString(), parcel.readString(), parcel.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(parcel) : null);
|
|
||||||
parcel2.writeNoException();
|
|
||||||
if (skuDetails != null) {
|
|
||||||
parcel2.writeInt(1);
|
|
||||||
skuDetails.writeToParcel(parcel2, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
parcel2.writeInt(0);
|
|
||||||
return true;
|
|
||||||
case 3:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
Bundle buyIntent = getBuyIntent(parcel.readInt(), parcel.readString(), parcel.readString(), parcel.readString(), parcel.readString());
|
|
||||||
parcel2.writeNoException();
|
|
||||||
if (buyIntent != null) {
|
|
||||||
parcel2.writeInt(1);
|
|
||||||
buyIntent.writeToParcel(parcel2, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
parcel2.writeInt(0);
|
|
||||||
return true;
|
|
||||||
case 4:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
Bundle purchases = getPurchases(parcel.readInt(), parcel.readString(), parcel.readString(), parcel.readString());
|
|
||||||
parcel2.writeNoException();
|
|
||||||
if (purchases != null) {
|
|
||||||
parcel2.writeInt(1);
|
|
||||||
purchases.writeToParcel(parcel2, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
parcel2.writeInt(0);
|
|
||||||
return true;
|
|
||||||
case 5:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
int consumePurchase = consumePurchase(parcel.readInt(), parcel.readString(), parcel.readString());
|
|
||||||
parcel2.writeNoException();
|
|
||||||
parcel2.writeInt(consumePurchase);
|
|
||||||
return true;
|
|
||||||
case 1598968902:
|
|
||||||
parcel2.writeString(DESCRIPTOR);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onTransact(i, parcel, parcel2, i2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int consumePurchase(int i, String str, String str2) throws RemoteException;
|
|
||||||
|
|
||||||
Bundle getBuyIntent(int i, String str, String str2, String str3, String str4) throws RemoteException;
|
|
||||||
|
|
||||||
Bundle getPurchases(int i, String str, String str2, String str3) throws RemoteException;
|
|
||||||
|
|
||||||
Bundle getSkuDetails(int i, String str, String str2, Bundle bundle) throws RemoteException;
|
|
||||||
|
|
||||||
int isBillingSupported(int i, String str, String str2) throws RemoteException;
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
package com.android.vending.billing;
|
|
||||||
|
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.IInterface;
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IMarketBillingService.class */
|
|
||||||
public interface IMarketBillingService extends IInterface {
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IMarketBillingService$Stub.class */
|
|
||||||
public static abstract class Stub extends Binder implements IMarketBillingService {
|
|
||||||
private static final String DESCRIPTOR = "com.android.vending.billing.IMarketBillingService";
|
|
||||||
static final int TRANSACTION_sendBillingRequest = 1;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/android/vending/billing/IMarketBillingService$Stub$Proxy.class */
|
|
||||||
private static class Proxy implements IMarketBillingService {
|
|
||||||
private IBinder mRemote;
|
|
||||||
|
|
||||||
Proxy(IBinder iBinder) {
|
|
||||||
this.mRemote = iBinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.IInterface
|
|
||||||
public IBinder asBinder() {
|
|
||||||
return this.mRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInterfaceDescriptor() {
|
|
||||||
return Stub.DESCRIPTOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.android.vending.billing.IMarketBillingService
|
|
||||||
public Bundle sendBillingRequest(Bundle bundle) throws RemoteException {
|
|
||||||
Parcel obtain = Parcel.obtain();
|
|
||||||
Parcel obtain2 = Parcel.obtain();
|
|
||||||
try {
|
|
||||||
obtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
|
||||||
if (bundle != null) {
|
|
||||||
obtain.writeInt(1);
|
|
||||||
bundle.writeToParcel(obtain, 0);
|
|
||||||
} else {
|
|
||||||
obtain.writeInt(0);
|
|
||||||
}
|
|
||||||
this.mRemote.transact(1, obtain, obtain2, 0);
|
|
||||||
obtain2.readException();
|
|
||||||
return obtain2.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(obtain2) : null;
|
|
||||||
} finally {
|
|
||||||
obtain2.recycle();
|
|
||||||
obtain.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Stub() {
|
|
||||||
attachInterface(this, DESCRIPTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IMarketBillingService asInterface(IBinder iBinder) {
|
|
||||||
if (iBinder == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR);
|
|
||||||
return (queryLocalInterface == null || !(queryLocalInterface instanceof IMarketBillingService)) ? new Proxy(iBinder) : (IMarketBillingService) queryLocalInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.IInterface
|
|
||||||
public IBinder asBinder() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.os.Binder
|
|
||||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
|
||||||
switch (i) {
|
|
||||||
case 1:
|
|
||||||
parcel.enforceInterface(DESCRIPTOR);
|
|
||||||
Bundle sendBillingRequest = sendBillingRequest(parcel.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(parcel) : null);
|
|
||||||
parcel2.writeNoException();
|
|
||||||
if (sendBillingRequest != null) {
|
|
||||||
parcel2.writeInt(1);
|
|
||||||
sendBillingRequest.writeToParcel(parcel2, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
parcel2.writeInt(0);
|
|
||||||
return true;
|
|
||||||
case 1598968902:
|
|
||||||
parcel2.writeString(DESCRIPTOR);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onTransact(i, parcel, parcel2, i2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle sendBillingRequest(Bundle bundle) throws RemoteException;
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
package com.ea.EAMIO
|
package com.ea.EAMIO
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
//На методы есть ссылка из нативного кода но они не вызываются и не несут полезной нагрузки
|
||||||
import android.app.Activity
|
|
||||||
import android.os.Environment
|
|
||||||
import android.util.Log
|
|
||||||
import com.ea.games.nfs13_na.BuildConfig
|
|
||||||
|
|
||||||
|
|
||||||
object StorageDirectory {
|
object StorageDirectory {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun GetDedicatedDirectory() = ""
|
fun GetDedicatedDirectory() = ""
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ea.easp;
|
package com.ea.easp;
|
||||||
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import com.eamobile.Language;
|
|
||||||
|
|
||||||
public abstract class KeyboardAndroid {
|
public abstract class KeyboardAndroid {
|
||||||
KeyboardAndroid() {
|
KeyboardAndroid() {
|
||||||
@@ -13,9 +12,9 @@ public abstract class KeyboardAndroid {
|
|||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case Language.NETWORK_WARNING_TXT /*{ENCODED_INT: 24}*/:
|
case 24:
|
||||||
case Language.UPDATES_FOUND_TITLE /*{ENCODED_INT: 25}*/:
|
case 25:
|
||||||
case Language.UPDATES_FOUND_TXT /*{ENCODED_INT: 26}*/:
|
case 26:
|
||||||
case 91:
|
case 91:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import android.widget.EditText;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.ea.nimble.Log;
|
import com.ea.nimble.Log;
|
||||||
import com.google.android.gms.drive.DriveFile;
|
|
||||||
|
|
||||||
public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid {
|
public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid {
|
||||||
private static final boolean DEBUG_LOG_ENABLED = true;
|
private static final boolean DEBUG_LOG_ENABLED = true;
|
||||||
@@ -89,12 +88,10 @@ public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private void Show() {
|
private void Show() {
|
||||||
VirtualKeyboardAndroidDelegate.Log("Show() from UiThread");
|
VirtualKeyboardAndroidDelegate.Log("Show() from UiThread");
|
||||||
setInputType(GetInputType());
|
setInputType(GetInputType());
|
||||||
setImeOptions(VirtualKeyboardAndroidDelegate.this.mEnterkeyLabel | VirtualKeyboardAndroidDelegate.IME_FLAG_NO_FULLSCREEN | DriveFile.MODE_READ_ONLY);
|
setImeOptions(VirtualKeyboardAndroidDelegate.this.mEnterkeyLabel | VirtualKeyboardAndroidDelegate.IME_FLAG_NO_FULLSCREEN);
|
||||||
setFilters(new InputFilter[]{new InputFilter.LengthFilter(VirtualKeyboardAndroidDelegate.this.mMaxTextLength)});
|
setFilters(new InputFilter[]{new InputFilter.LengthFilter(VirtualKeyboardAndroidDelegate.this.mMaxTextLength)});
|
||||||
try {
|
try {
|
||||||
VirtualKeyboardAndroidDelegate.this.mMainViewGroup.addView(VirtualKeyboardAndroidDelegate.this.mRelativeLayout);
|
VirtualKeyboardAndroidDelegate.this.mMainViewGroup.addView(VirtualKeyboardAndroidDelegate.this.mRelativeLayout);
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
|
|
||||||
public class BillingReceiver extends BroadcastReceiver {
|
|
||||||
private static final String TAG = "BillingReceiver";
|
|
||||||
|
|
||||||
private void checkResponseCode(Context context, long j, int i) {
|
|
||||||
Intent intent = new Intent(Consts.ACTION_RESPONSE_CODE);
|
|
||||||
intent.setClass(context, BillingService.class);
|
|
||||||
intent.putExtra(Consts.INAPP_REQUEST_ID, j);
|
|
||||||
intent.putExtra(Consts.INAPP_RESPONSE_CODE, i);
|
|
||||||
context.startService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notify(Context context, String str) {
|
|
||||||
Intent intent = new Intent(Consts.ACTION_GET_PURCHASE_INFORMATION);
|
|
||||||
intent.setClass(context, BillingService.class);
|
|
||||||
intent.putExtra(Consts.NOTIFICATION_ID, str);
|
|
||||||
context.startService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void purchaseStateChanged(Context context, String str, String str2) {
|
|
||||||
Debug.Log.d(TAG, "purchaseStateChanged()...");
|
|
||||||
if (str != null) {
|
|
||||||
Debug.Log.d(TAG, "signedData is \"" + str + "\"");
|
|
||||||
}
|
|
||||||
Intent intent = new Intent(Consts.ACTION_PURCHASE_STATE_CHANGED);
|
|
||||||
intent.setClass(context, BillingService.class);
|
|
||||||
intent.putExtra(Consts.INAPP_SIGNED_DATA, str);
|
|
||||||
intent.putExtra(Consts.INAPP_SIGNATURE, str2);
|
|
||||||
context.startService(intent);
|
|
||||||
Debug.Log.d(TAG, "...purchaseStateChanged()");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
|
|
||||||
purchaseStateChanged(context, intent.getStringExtra(Consts.INAPP_SIGNED_DATA), intent.getStringExtra(Consts.INAPP_SIGNATURE));
|
|
||||||
} else if (Consts.ACTION_NOTIFY.equals(action)) {
|
|
||||||
String stringExtra = intent.getStringExtra(Consts.NOTIFICATION_ID);
|
|
||||||
Debug.Log.i(TAG, "notifyId: " + stringExtra);
|
|
||||||
notify(context, stringExtra);
|
|
||||||
} else if (Consts.ACTION_RESPONSE_CODE.equals(action)) {
|
|
||||||
checkResponseCode(context, intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1), intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, Consts.ResponseCode.RESULT_ERROR.ordinal()));
|
|
||||||
} else {
|
|
||||||
Debug.Log.w(TAG, "unexpected action: " + action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public interface BillingService {
|
|
||||||
|
|
||||||
public interface IRequestPurchase {
|
|
||||||
String getProductId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IRestoreTransactions {
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnNonceSucceed(long j, Object obj);
|
|
||||||
|
|
||||||
void OnVerifyMarketResponse(boolean z, String str, String str2, int i);
|
|
||||||
|
|
||||||
void checkBillingSupported(Runnable runnable);
|
|
||||||
|
|
||||||
void requestPurchase(String str, String str2, String str3, Runnable runnable);
|
|
||||||
|
|
||||||
void restoreTransactions(long j, Runnable runnable);
|
|
||||||
|
|
||||||
void setContext(Context context);
|
|
||||||
|
|
||||||
void shutdown();
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
public class Consts {
|
|
||||||
public static final String ACTION_CONFIRM_NOTIFICATION = "com.ea.easp.mtx.market.CONFIRM_NOTIFICATION";
|
|
||||||
public static final String ACTION_GET_PURCHASE_INFORMATION = "com.ea.easp.mtx.market.GET_PURCHASE_INFORMATION";
|
|
||||||
public static final String ACTION_NOTIFY = "com.android.vending.billing.IN_APP_NOTIFY";
|
|
||||||
public static final String ACTION_PURCHASE_STATE_CHANGED = "com.android.vending.billing.PURCHASE_STATE_CHANGED";
|
|
||||||
public static final String ACTION_RESPONSE_CODE = "com.android.vending.billing.RESPONSE_CODE";
|
|
||||||
public static final String ACTION_RESTORE_TRANSACTIONS = "com.ea.easp.mtx.market.RESTORE_TRANSACTIONS";
|
|
||||||
public static final String BILLING_REQUEST_API_VERSION = "API_VERSION";
|
|
||||||
public static final String BILLING_REQUEST_DEVELOPER_PAYLOAD = "DEVELOPER_PAYLOAD";
|
|
||||||
public static final String BILLING_REQUEST_ITEM_ID = "ITEM_ID";
|
|
||||||
public static final String BILLING_REQUEST_METHOD = "BILLING_REQUEST";
|
|
||||||
public static final String BILLING_REQUEST_NONCE = "NONCE";
|
|
||||||
public static final String BILLING_REQUEST_NOTIFY_IDS = "NOTIFY_IDS";
|
|
||||||
public static final String BILLING_REQUEST_PACKAGE_NAME = "PACKAGE_NAME";
|
|
||||||
public static long BILLING_RESPONSE_INVALID_REQUEST_ID = -1;
|
|
||||||
public static final String BILLING_RESPONSE_PURCHASE_INTENT = "PURCHASE_INTENT";
|
|
||||||
public static final String BILLING_RESPONSE_REQUEST_ID = "REQUEST_ID";
|
|
||||||
public static final String BILLING_RESPONSE_RESPONSE_CODE = "RESPONSE_CODE";
|
|
||||||
public static final String INAPP_REQUEST_ID = "request_id";
|
|
||||||
public static final String INAPP_RESPONSE_CODE = "response_code";
|
|
||||||
public static final String INAPP_SIGNATURE = "inapp_signature";
|
|
||||||
public static final String INAPP_SIGNED_DATA = "inapp_signed_data";
|
|
||||||
public static final String MARKET_BILLING_SERVICE_ACTION = "com.android.vending.billing.MarketBillingService.BIND";
|
|
||||||
public static final String NOTIFICATION_ID = "notification_id";
|
|
||||||
public static int STORE_AMAZON = 2;
|
|
||||||
public static int STORE_ANDROID = 1;
|
|
||||||
public static int STORE_UNKNOWN = 0;
|
|
||||||
public static int STORE_VERIZON = 3;
|
|
||||||
|
|
||||||
public enum PurchaseState {
|
|
||||||
PURCHASED,
|
|
||||||
CANCELED,
|
|
||||||
REFUNDED;
|
|
||||||
|
|
||||||
public static PurchaseState valueOf(int i) {
|
|
||||||
PurchaseState[] values = values();
|
|
||||||
return (i < 0 || i >= values.length) ? CANCELED : values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ResponseCode {
|
|
||||||
RESULT_OK,
|
|
||||||
RESULT_USER_CANCELED,
|
|
||||||
RESULT_SERVICE_UNAVAILABLE,
|
|
||||||
RESULT_BILLING_UNAVAILABLE,
|
|
||||||
RESULT_ITEM_UNAVAILABLE,
|
|
||||||
RESULT_DEVELOPER_ERROR,
|
|
||||||
RESULT_ERROR;
|
|
||||||
|
|
||||||
public static ResponseCode valueOf(int i) {
|
|
||||||
ResponseCode[] values = values();
|
|
||||||
return (i < 0 || i >= values.length) ? RESULT_ERROR : values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,339 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.TaskLauncher;
|
|
||||||
import com.ea.easp.mtx.market.amazon.AmazonBillingService;
|
|
||||||
import com.ea.easp.mtx.market.android.AndroidBillingService;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
public class MarketJNI {
|
|
||||||
static final int REQUEST_BILLING_SURRORTED = 0;
|
|
||||||
static final int REQUEST_PURCHASE = 1;
|
|
||||||
static final int REQUEST_RESTORE = 2;
|
|
||||||
private static final String TAG = "MarketJNI";
|
|
||||||
private ActiveRequest mActiveRequest = ActiveRequest.NONE;
|
|
||||||
private Activity mActivity;
|
|
||||||
private BillingService mBillingService;
|
|
||||||
private MarketJNIPurchaseObserver mMarketJNIPurchaseObserver;
|
|
||||||
private int mNonceRequestNextID = 0;
|
|
||||||
private HashMap<Integer, Object> mSentNonceRequests = new HashMap<>();
|
|
||||||
private StoreType mStoreType = StoreType.UNKNOWN;
|
|
||||||
private TaskLauncher mTaskLauncher;
|
|
||||||
|
|
||||||
private enum ActiveRequest {
|
|
||||||
NONE,
|
|
||||||
PURCHASE,
|
|
||||||
RESTORE
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
public class MarketJNIPurchaseObserver extends PurchaseObserver {
|
|
||||||
public MarketJNIPurchaseObserver() {
|
|
||||||
super(MarketJNI.this.mActivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyJNIAboutFailInGLThread(final int ErrorCode, final int RequestID, final String ErrorDescription) {
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.onRequestFailJNI(ErrorCode, RequestID, ErrorDescription);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingSupported(final boolean mSupported) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "supported: " + mSupported);
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.onBillingSupportedSucceedJNI(mSupported);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseStateChange(final ArrayList<Security.VerifiedPurchase> mPurchases,
|
|
||||||
final boolean mVerified,
|
|
||||||
final String mSignedData,
|
|
||||||
final String mSignature) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "onPurchaseStateChange() purchases size: " + mPurchases.size());
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (mPurchases.size() != 0) {
|
|
||||||
MarketJNI.this.purchasesListSizeJNI(mPurchases.size(), mSignedData, mSignature);
|
|
||||||
Iterator<Security.VerifiedPurchase> it = mPurchases.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Security.VerifiedPurchase next = it.next();
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "purchaseState: " + next.purchaseState);
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "notificationId:" + next.notificationId);
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "productId:" + next.productId);
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "orderId:" + next.orderId);
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "developerPayload:" + next.developerPayload);
|
|
||||||
MarketJNI.this.onPurchaseStateChangeJNI(next.purchaseState.ordinal(), next.productId, next.purchaseTime, next.developerPayload);
|
|
||||||
}
|
|
||||||
} else if (!mVerified) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "onPurchaseStateChange() purchases list is empty: treat it as error");
|
|
||||||
MarketJNI.this.onRequestFailJNI(1, -999998, "purchase transaction signature were not verified, so list of purchases is empty.");
|
|
||||||
} else {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "onPurchaseStateChange() purchases list is empty, but transaction is verified, treat as success restoring.");
|
|
||||||
MarketJNI.this.purchasesListSizeJNI(-1, mSignedData, mSignature);
|
|
||||||
MarketJNI.this.onPurchaseStateChangeJNI(0, null, 0, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPurchaseResponse(BillingService.IRequestPurchase iRequestPurchase, Consts.ResponseCode responseCode) {
|
|
||||||
Debug.Log.d(MarketJNI.TAG, iRequestPurchase.getProductId() + ": " + responseCode);
|
|
||||||
if (responseCode == Consts.ResponseCode.RESULT_OK) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "purchase request response is RESULT_OK");
|
|
||||||
} else if (responseCode == Consts.ResponseCode.RESULT_USER_CANCELED) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "user canceled purchase");
|
|
||||||
notifyJNIAboutFailInGLThread(1, -999997, "dismissed purchase dialog");
|
|
||||||
} else {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "purchase error: " + responseCode);
|
|
||||||
notifyJNIAboutFailInGLThread(1, -999996, "purchase error: " + responseCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.PurchaseObserver
|
|
||||||
public void onRestoreTransactionsResponse(BillingService.IRestoreTransactions iRestoreTransactions, Consts.ResponseCode responseCode) {
|
|
||||||
if (responseCode == Consts.ResponseCode.RESULT_OK) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "restore request was successfully sent to server");
|
|
||||||
} else if (responseCode == Consts.ResponseCode.RESULT_USER_CANCELED) {
|
|
||||||
Debug.Log.i(MarketJNI.TAG, "user canceled restore");
|
|
||||||
notifyJNIAboutFailInGLThread(2, -999994, "user canceled restore");
|
|
||||||
} else {
|
|
||||||
Debug.Log.d(MarketJNI.TAG, "RestoreTransactions error: " + responseCode);
|
|
||||||
notifyJNIAboutFailInGLThread(2, -999994, "RestoreTransactions error: " + responseCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum StoreType {
|
|
||||||
UNKNOWN,
|
|
||||||
ANDROID,
|
|
||||||
AMAZON,
|
|
||||||
VERIZON
|
|
||||||
}
|
|
||||||
|
|
||||||
public MarketJNI(Activity activity, TaskLauncher taskLauncher, StoreType storeType) {
|
|
||||||
this.mActivity = activity;
|
|
||||||
this.mTaskLauncher = taskLauncher;
|
|
||||||
this.mStoreType = storeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public int getNextNonceRequestID() {
|
|
||||||
int i = this.mNonceRequestNextID;
|
|
||||||
this.mNonceRequestNextID++;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getNonce(Object obj) {
|
|
||||||
final int nextNonceRequestID = getNextNonceRequestID();
|
|
||||||
this.mSentNonceRequests.put(nextNonceRequestID, obj);
|
|
||||||
|
|
||||||
this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.getNonceJNI(nextNonceRequestID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void getNonceJNI(int i);
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
Debug.Log.i(TAG, "init(): MarketJNI init.");
|
|
||||||
initEASPMTXJNI();
|
|
||||||
this.mMarketJNIPurchaseObserver = new MarketJNIPurchaseObserver();
|
|
||||||
if (this.mStoreType == StoreType.AMAZON) {
|
|
||||||
Debug.Log.i(TAG, "init(): Creating AmazonBillingService.");
|
|
||||||
this.mBillingService = new AmazonBillingService(new SecurityJNI(this), this.mActivity);
|
|
||||||
} else if (this.mStoreType == StoreType.VERIZON) {
|
|
||||||
Debug.Log.i(TAG, "init(): Verizon billing not supported.");
|
|
||||||
} else if (this.mStoreType == StoreType.ANDROID) {
|
|
||||||
this.mBillingService = new AndroidBillingService(new SecurityJNI(this));
|
|
||||||
} else {
|
|
||||||
Debug.Log.i(TAG, "init(): StoreType not set at MarketJNI initialization. Delaying instantiation.");
|
|
||||||
this.mBillingService = null;
|
|
||||||
}
|
|
||||||
if (this.mBillingService != null) {
|
|
||||||
this.mBillingService.setContext(this.mActivity);
|
|
||||||
}
|
|
||||||
ResponseHandler.register(this.mMarketJNIPurchaseObserver);
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void initEASPMTXJNI();
|
|
||||||
|
|
||||||
public void isBillingSupported() {
|
|
||||||
this.mTaskLauncher.runInUIThread(new Runnable() {
|
|
||||||
/* class com.ea.easp.mtx.market.MarketJNI.AnonymousClass1 */
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public Runnable makeErrorHandler() {
|
|
||||||
return new Runnable() {
|
|
||||||
/* class com.ea.easp.mtx.market.MarketJNI.AnonymousClass1.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
Debug.Log.e(MarketJNI.TAG, "checkBillingSupported(): fail to connect to billing service");
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
/* class com.ea.easp.mtx.market.MarketJNI.AnonymousClass1.AnonymousClass1.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.onRequestFailJNI(0, -999998, "fail to connect to Android Market");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
if (MarketJNI.this.mBillingService == null) {
|
|
||||||
throw new RuntimeException("Android billing service not set. Set with SetStoreType.");
|
|
||||||
}
|
|
||||||
MarketJNI.this.mBillingService.checkBillingSupported(makeErrorHandler());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void onBillingSupportedSucceedJNI(boolean z);
|
|
||||||
|
|
||||||
public void onNonceResult(boolean z, final long mNonce, final int mRequestDataKey) {
|
|
||||||
if (z) {
|
|
||||||
final Object mRequestData = this.mSentNonceRequests.get(mRequestDataKey);
|
|
||||||
this.mTaskLauncher.runInUIThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (MarketJNI.this.mBillingService == null) {
|
|
||||||
throw new RuntimeException("Android billing service not set. Set with SetStoreType.");
|
|
||||||
}
|
|
||||||
MarketJNI.this.mBillingService.OnNonceSucceed(mNonce, mRequestData);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
onRequestFailJNI(1, -999993, "fail to get nonce");
|
|
||||||
}
|
|
||||||
this.mSentNonceRequests.remove(Integer.valueOf(mRequestDataKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void onPurchaseStateChangeJNI(int i, String str, long j, String str2);
|
|
||||||
|
|
||||||
public native void onRequestFailJNI(int i, int i2, String str);
|
|
||||||
|
|
||||||
public void onVerify(final boolean mVerified, final String mSignedData, final String mSignature, final int mRequestID) {
|
|
||||||
this.mTaskLauncher.runInUIThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (MarketJNI.this.mBillingService == null) {
|
|
||||||
throw new RuntimeException("Android billing service not set. Set with SetStoreType.");
|
|
||||||
}
|
|
||||||
MarketJNI.this.mBillingService.OnVerifyMarketResponse(mVerified, mSignedData, mSignature, mRequestID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void purchase(final String mProductID, final String mExtraParams, final String mPayload) {
|
|
||||||
this.mTaskLauncher.runInUIThread(new Runnable() {
|
|
||||||
|
|
||||||
public Runnable makeErrorHandler() {
|
|
||||||
return () -> {
|
|
||||||
Debug.Log.e(MarketJNI.TAG, "purchase(): fail to connect to Market");
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(() -> MarketJNI.this.onRequestFailJNI(1, -999998, "fail to connect to Android Market"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (MarketJNI.this.mBillingService == null) {
|
|
||||||
throw new RuntimeException("Android billing service not set. Set with SetStoreType.");
|
|
||||||
}
|
|
||||||
MarketJNI.this.mBillingService.requestPurchase(mProductID, mExtraParams, mPayload, makeErrorHandler());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void purchasesListSizeJNI(int i, String str, String str2);
|
|
||||||
|
|
||||||
public void restoreTransactions(final long mNonce) {
|
|
||||||
this.mTaskLauncher.runInUIThread(new Runnable() {
|
|
||||||
|
|
||||||
public Runnable makeErrorHandler() {
|
|
||||||
return new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Debug.Log.e(MarketJNI.TAG, "restoreTransactions(): fail to connect to Market");
|
|
||||||
MarketJNI.this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
/* class com.ea.easp.mtx.market.MarketJNI.AnonymousClass5R.AnonymousClass1.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.onRequestFailJNI(2, -999998, "fail to connect to Android Market");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (MarketJNI.this.mBillingService == null) {
|
|
||||||
throw new RuntimeException("Android billing service not set. Set with SetStoreType.");
|
|
||||||
}
|
|
||||||
MarketJNI.this.mBillingService.restoreTransactions(mNonce, makeErrorHandler());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStoreType(int i) {
|
|
||||||
if (this.mStoreType != StoreType.UNKNOWN) {
|
|
||||||
Debug.Log.i(TAG, "setStoreType: StoreType already set!");
|
|
||||||
} else if (this.mBillingService != null) {
|
|
||||||
Debug.Log.i(TAG, "setStoreType: BillingService already created!");
|
|
||||||
} else {
|
|
||||||
if (StoreType.values()[i] == StoreType.AMAZON) {
|
|
||||||
Debug.Log.i(TAG, "setStoreType: Creating Amazon Billing Service.");
|
|
||||||
this.mBillingService = new AmazonBillingService(new SecurityJNI(this), this.mActivity);
|
|
||||||
} else if (StoreType.values()[i] == StoreType.ANDROID) {
|
|
||||||
Debug.Log.i(TAG, "setStoreType: Creating Android Billing Service.");
|
|
||||||
this.mBillingService = new AndroidBillingService(new SecurityJNI(this));
|
|
||||||
} else {
|
|
||||||
Debug.Log.i(TAG, "setStoreType: StoreType not supported!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.mStoreType = StoreType.values()[i];
|
|
||||||
this.mBillingService.setContext(this.mActivity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
ResponseHandler.unregister(this.mMarketJNIPurchaseObserver);
|
|
||||||
if (this.mBillingService != null) {
|
|
||||||
this.mBillingService.shutdown();
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setClass(this.mActivity, this.mBillingService.getClass());
|
|
||||||
this.mActivity.stopService(intent);
|
|
||||||
}
|
|
||||||
shutdownEASPMTXJNI();
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void shutdownEASPMTXJNI();
|
|
||||||
|
|
||||||
public void verify(final String mSignedData, final String mSignature, final int mRequestID, final int mStoreType) {
|
|
||||||
this.mTaskLauncher.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MarketJNI.this.verifyJNI(mSignedData, mSignature, mRequestID, mStoreType);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public native void verifyJNI(String SignedData, String Signature, int RequestID, int StoreType);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
public class MarketJNIConsts {
|
|
||||||
static final int STORE_BUSY = -1000000;
|
|
||||||
static final int STORE_GENERAL_ERROR = -999999;
|
|
||||||
static final int STORE_MARKET_CONNECT_FAILED = -999998;
|
|
||||||
static final int STORE_MARKET_PURCHASE_CANCELED = -999997;
|
|
||||||
static final int STORE_MARKET_PURCHASE_FAILED = -999996;
|
|
||||||
static final int STORE_MARKET_PURCHASE_NONCE_GENERATION_FAILED = -999993;
|
|
||||||
static final int STORE_MARKET_RESTORE_CANCELLED = -999995;
|
|
||||||
static final int STORE_MARKET_RESTORE_FAILED = -999994;
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentSender;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.BillingService;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
import com.ea.easp.mtx.market.Security;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public abstract class PurchaseObserver {
|
|
||||||
private static final Class[] START_INTENT_SENDER_SIG = {IntentSender.class, Intent.class, Integer.TYPE, Integer.TYPE, Integer.TYPE};
|
|
||||||
private static final String TAG = "PurchaseObserver";
|
|
||||||
private final Activity mActivity;
|
|
||||||
private Method mStartIntentSender;
|
|
||||||
private Object[] mStartIntentSenderArgs = new Object[5];
|
|
||||||
|
|
||||||
public PurchaseObserver(Activity activity) {
|
|
||||||
this.mActivity = activity;
|
|
||||||
initCompatibilityLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initCompatibilityLayer() {
|
|
||||||
try {
|
|
||||||
this.mStartIntentSender = this.mActivity.getClass().getMethod("startIntentSender", START_INTENT_SENDER_SIG);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
this.mStartIntentSender = null;
|
|
||||||
} catch (NoSuchMethodException e2) {
|
|
||||||
this.mStartIntentSender = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void onBillingSupported(boolean z);
|
|
||||||
|
|
||||||
public abstract void onPurchaseStateChange(ArrayList<Security.VerifiedPurchase> arrayList, boolean z, String str, String str2);
|
|
||||||
|
|
||||||
public abstract void onRequestPurchaseResponse(BillingService.IRequestPurchase iRequestPurchase, Consts.ResponseCode responseCode);
|
|
||||||
|
|
||||||
public abstract void onRestoreTransactionsResponse(BillingService.IRestoreTransactions iRestoreTransactions, Consts.ResponseCode responseCode);
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public void startBuyPageActivity(PendingIntent pendingIntent, Intent intent) {
|
|
||||||
if (this.mStartIntentSender != null) {
|
|
||||||
try {
|
|
||||||
this.mStartIntentSenderArgs[0] = pendingIntent.getIntentSender();
|
|
||||||
this.mStartIntentSenderArgs[1] = intent;
|
|
||||||
this.mStartIntentSenderArgs[2] = 0;
|
|
||||||
this.mStartIntentSenderArgs[3] = 0;
|
|
||||||
this.mStartIntentSenderArgs[4] = 0;
|
|
||||||
this.mStartIntentSender.invoke(this.mActivity, this.mStartIntentSenderArgs);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Debug.Log.e(TAG, "error starting activity", e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
pendingIntent.send(this.mActivity, 0, intent);
|
|
||||||
} catch (PendingIntent.CanceledException e2) {
|
|
||||||
Debug.Log.e(TAG, "error starting activity", e2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Intent;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.BillingService;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
import com.ea.easp.mtx.market.Security;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ResponseHandler {
|
|
||||||
private static final String TAG = "ResponseHandler";
|
|
||||||
private static PurchaseObserver sPurchaseObserver;
|
|
||||||
|
|
||||||
public static void buyPageIntentResponse(PendingIntent pendingIntent, Intent intent) {
|
|
||||||
if (sPurchaseObserver == null) {
|
|
||||||
Debug.Log.w(TAG, "buyPageIntentResponse(): UI is not running");
|
|
||||||
} else {
|
|
||||||
sPurchaseObserver.startBuyPageActivity(pendingIntent, intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkBillingSupportedResponse(boolean z) {
|
|
||||||
if (sPurchaseObserver != null) {
|
|
||||||
sPurchaseObserver.onBillingSupported(z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void purchaseResponse(ArrayList<Security.VerifiedPurchase> arrayList, boolean z, String str, String str2) {
|
|
||||||
if (sPurchaseObserver != null) {
|
|
||||||
sPurchaseObserver.onPurchaseStateChange(arrayList, z, str, str2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized void register(PurchaseObserver purchaseObserver) {
|
|
||||||
synchronized (ResponseHandler.class) {
|
|
||||||
sPurchaseObserver = purchaseObserver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void responseCodeReceived(BillingService.IRequestPurchase iRequestPurchase, Consts.ResponseCode responseCode) {
|
|
||||||
if (sPurchaseObserver != null) {
|
|
||||||
sPurchaseObserver.onRequestPurchaseResponse(iRequestPurchase, responseCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void responseCodeReceived(BillingService.IRestoreTransactions iRestoreTransactions, Consts.ResponseCode responseCode) {
|
|
||||||
if (sPurchaseObserver != null) {
|
|
||||||
sPurchaseObserver.onRestoreTransactionsResponse(iRestoreTransactions, responseCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized void unregister(PurchaseObserver purchaseObserver) {
|
|
||||||
synchronized (ResponseHandler.class) {
|
|
||||||
sPurchaseObserver = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
import com.ea.easp.mtx.market.util.Base64;
|
|
||||||
import com.ea.easp.mtx.market.util.Base64DecoderException;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.KeyFactory;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.security.Signature;
|
|
||||||
import java.security.SignatureException;
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.security.spec.X509EncodedKeySpec;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
public class Security {
|
|
||||||
private static final String KEY_FACTORY_ALGORITHM = "RSA";
|
|
||||||
private static final SecureRandom RANDOM = new SecureRandom();
|
|
||||||
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
|
|
||||||
private static final String TAG = "Security";
|
|
||||||
private static HashSet<Long> sKnownNonces = new HashSet<>();
|
|
||||||
|
|
||||||
public static class VerifiedPurchase {
|
|
||||||
public String developerPayload;
|
|
||||||
public String notificationId;
|
|
||||||
public String orderId;
|
|
||||||
public String productId;
|
|
||||||
public Consts.PurchaseState purchaseState;
|
|
||||||
public long purchaseTime;
|
|
||||||
|
|
||||||
public VerifiedPurchase(Consts.PurchaseState purchaseState2, String str, String str2, String str3, long j, String str4) {
|
|
||||||
this.purchaseState = purchaseState2;
|
|
||||||
this.notificationId = str;
|
|
||||||
this.productId = str2;
|
|
||||||
this.orderId = str3;
|
|
||||||
this.purchaseTime = j;
|
|
||||||
this.developerPayload = str4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long addNonce(long j) {
|
|
||||||
sKnownNonces.add(Long.valueOf(j));
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<VerifiedPurchase> createVerifiedPurchasesList(String str, boolean z) {
|
|
||||||
if (str == null) {
|
|
||||||
Debug.Log.e(TAG, "data is null");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Debug.Log.i(TAG, "signedData: " + str + ", verified " + z);
|
|
||||||
int i = 0;
|
|
||||||
try {
|
|
||||||
JSONObject jSONObject = new JSONObject(str);
|
|
||||||
long optLong = jSONObject.optLong("nonce");
|
|
||||||
JSONArray optJSONArray = jSONObject.optJSONArray("orders");
|
|
||||||
if (optJSONArray != null) {
|
|
||||||
i = optJSONArray.length();
|
|
||||||
}
|
|
||||||
if (!isNonceKnown(optLong)) {
|
|
||||||
Debug.Log.w(TAG, "createVerifiedPurchasesList(): Nonce not found: " + optLong);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
ArrayList<VerifiedPurchase> arrayList = new ArrayList<>();
|
|
||||||
for (int i2 = 0; i2 < i; i2++) {
|
|
||||||
try {
|
|
||||||
JSONObject jSONObject2 = optJSONArray.getJSONObject(i2);
|
|
||||||
Consts.PurchaseState valueOf = Consts.PurchaseState.valueOf(jSONObject2.getInt("purchaseState"));
|
|
||||||
String string = jSONObject2.getString("productId");
|
|
||||||
jSONObject2.getString("packageName");
|
|
||||||
long j = jSONObject2.getLong("purchaseTime");
|
|
||||||
String optString = jSONObject2.optString("orderId", "");
|
|
||||||
String optString2 = jSONObject2.optString("notificationId", null);
|
|
||||||
String optString3 = jSONObject2.optString("developerPayload", null);
|
|
||||||
if (valueOf != Consts.PurchaseState.PURCHASED || z) {
|
|
||||||
arrayList.add(new VerifiedPurchase(valueOf, optString2, string, optString, j, optString3));
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Debug.Log.e(TAG, "createVerifiedPurchasesList(): JSON exception: ", e);
|
|
||||||
arrayList = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
removeNonce(optLong);
|
|
||||||
return arrayList;
|
|
||||||
} catch (JSONException e2) {
|
|
||||||
Debug.Log.e(TAG, "createVerifiedPurchasesList(): JSON malformed. Reason: " + e2.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PublicKey generatePublicKey(String str) {
|
|
||||||
try {
|
|
||||||
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str)));
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (InvalidKeySpecException e2) {
|
|
||||||
Debug.Log.e(TAG, "Invalid key specification.");
|
|
||||||
throw new IllegalArgumentException(e2);
|
|
||||||
} catch (Base64DecoderException e3) {
|
|
||||||
Debug.Log.e(TAG, "Base64 decoding failed.");
|
|
||||||
throw new IllegalArgumentException(e3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isNonceKnown(long j) {
|
|
||||||
return sKnownNonces.contains(Long.valueOf(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeNonce(long j) {
|
|
||||||
sKnownNonces.remove(Long.valueOf(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean verify(PublicKey publicKey, String str, String str2) {
|
|
||||||
Debug.Log.i(TAG, "signature: " + str2);
|
|
||||||
try {
|
|
||||||
Signature instance = Signature.getInstance(SIGNATURE_ALGORITHM);
|
|
||||||
instance.initVerify(publicKey);
|
|
||||||
instance.update(str.getBytes());
|
|
||||||
if (instance.verify(Base64.decode(str2))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Debug.Log.e(TAG, "Signature verification failed.");
|
|
||||||
return false;
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
Debug.Log.e(TAG, "NoSuchAlgorithmException.");
|
|
||||||
return false;
|
|
||||||
} catch (InvalidKeyException e2) {
|
|
||||||
Debug.Log.e(TAG, "Invalid key specification.");
|
|
||||||
return false;
|
|
||||||
} catch (SignatureException e3) {
|
|
||||||
Debug.Log.e(TAG, "Signature exception.");
|
|
||||||
return false;
|
|
||||||
} catch (Base64DecoderException e4) {
|
|
||||||
Debug.Log.e(TAG, "Base64 decoding failed.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market;
|
|
||||||
|
|
||||||
public class SecurityJNI {
|
|
||||||
private static final String TAG = "SecurityJNI";
|
|
||||||
private MarketJNI mMarketJNI;
|
|
||||||
|
|
||||||
SecurityJNI(MarketJNI marketJNI) {
|
|
||||||
this.mMarketJNI = marketJNI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getNonce(Object obj) {
|
|
||||||
this.mMarketJNI.getNonce(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void verify(String str, String str2, int i, int i2) {
|
|
||||||
this.mMarketJNI.verify(str, str2, i, i2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.amazon;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.BillingService;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
import com.ea.easp.mtx.market.ResponseHandler;
|
|
||||||
import com.ea.easp.mtx.market.Security;
|
|
||||||
import com.ea.easp.mtx.market.SecurityJNI;
|
|
||||||
import com.ea.nimble.Global;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class AmazonBillingService implements BillingService, AmazonPurchasingObserver.AmazonPurchasingEventHandler {
|
|
||||||
private static final String TAG = "AmazonBillingService";
|
|
||||||
private static SecurityJNI mSecurityJNI;
|
|
||||||
private static HashMap<String, BillingRequest> mSentRequests = new HashMap<>();
|
|
||||||
private Context mContext = null;
|
|
||||||
private AmazonPurchasingObserver mObserver = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemDataResponse(Object itemDataResponse) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseResponse(Object purchaseResponse) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseUpdatesResponse(Object purchaseUpdatesResponse) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public abstract class BillingRequest {
|
|
||||||
protected Runnable mErrorHandler = null;
|
|
||||||
protected String mRequestId;
|
|
||||||
|
|
||||||
public BillingRequest(Runnable runnable) {
|
|
||||||
this.mErrorHandler = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AmazonBillingService.TAG, getClass() + " failed.", exc);
|
|
||||||
if (this.mErrorHandler == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.mErrorHandler.run();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void logResponseCode(String str, Bundle bundle) {
|
|
||||||
Debug.Log.i(AmazonBillingService.TAG, str + " received " + Consts.ResponseCode.valueOf(bundle.getInt("RESPONSE_CODE")).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void onRemoteException(RemoteException remoteException) {
|
|
||||||
Debug.Log.w(AmazonBillingService.TAG, "remote billing service crashed");
|
|
||||||
AmazonBillingService.this.mObserver = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public abstract String run() throws RemoteException;
|
|
||||||
|
|
||||||
public boolean runRequest() {
|
|
||||||
try {
|
|
||||||
this.mRequestId = run();
|
|
||||||
Debug.Log.d(AmazonBillingService.TAG, "request id: " + this.mRequestId);
|
|
||||||
if (this.mRequestId != null && !this.mRequestId.equals("")) {
|
|
||||||
AmazonBillingService.mSentRequests.put(this.mRequestId, this);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Debug.Log.e(AmazonBillingService.TAG, "Exception : " + e);
|
|
||||||
handleRunErrorWhenConnected(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CheckBillingSupported extends BillingRequest {
|
|
||||||
public CheckBillingSupported(Runnable runnable) {
|
|
||||||
super(runnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public String run() throws RemoteException {
|
|
||||||
ResponseHandler.checkBillingSupportedResponse(true);
|
|
||||||
return Global.NOTIFICATION_DICTIONARY_RESULT_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class RequestPurchase extends BillingRequest implements BillingService.IRequestPurchase {
|
|
||||||
private final String mDeveloperPayload;
|
|
||||||
private final String mProductId;
|
|
||||||
|
|
||||||
public RequestPurchase(AmazonBillingService amazonBillingService, String str, Runnable runnable) {
|
|
||||||
this(str, null, runnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequestPurchase(String str, String str2, Runnable runnable) {
|
|
||||||
super(runnable);
|
|
||||||
this.mProductId = AmazonBillingService.this.mContext.getPackageName() + "." + str;
|
|
||||||
this.mDeveloperPayload = str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeveloperPayload() {
|
|
||||||
return this.mDeveloperPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService.IRequestPurchase
|
|
||||||
public String getProductId() {
|
|
||||||
return this.mProductId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
ResponseHandler.responseCodeReceived(this, responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public String run() throws RemoteException {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RestoreTransactions extends BillingRequest implements BillingService.IRestoreTransactions {
|
|
||||||
public RestoreTransactions(Runnable runnable) {
|
|
||||||
super(runnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public void onRemoteException(RemoteException remoteException) {
|
|
||||||
super.onRemoteException(remoteException);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
ResponseHandler.responseCodeReceived(this, responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.amazon.AmazonBillingService.BillingRequest
|
|
||||||
public String run() throws RemoteException {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmazonBillingService(SecurityJNI securityJNI, Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
this.mObserver = new AmazonPurchasingObserver((Activity) context, this);
|
|
||||||
mSecurityJNI = securityJNI;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendPurchases(String str, boolean z) {
|
|
||||||
try {
|
|
||||||
JSONObject jSONObject = new JSONObject(str);
|
|
||||||
String string = jSONObject.getString("requestId");
|
|
||||||
jSONObject.getString("userId");
|
|
||||||
JSONArray jSONArray = jSONObject.getJSONArray("receipts");
|
|
||||||
BillingRequest billingRequest = mSentRequests.get(string);
|
|
||||||
ArrayList arrayList = new ArrayList();
|
|
||||||
String str2 = "";
|
|
||||||
if (billingRequest instanceof RequestPurchase) {
|
|
||||||
str2 = ((RequestPurchase) billingRequest).getDeveloperPayload();
|
|
||||||
}
|
|
||||||
for (int i = 0; i < jSONArray.length(); i++) {
|
|
||||||
arrayList.add(new Security.VerifiedPurchase(Consts.PurchaseState.PURCHASED, "", jSONArray.getJSONObject(i).getString("sku").substring(this.mContext.getPackageName().length() + 1), "", 0, str2));
|
|
||||||
}
|
|
||||||
ResponseHandler.purchaseResponse(arrayList, z, "", "");
|
|
||||||
} catch (Exception e) {
|
|
||||||
ResponseHandler.purchaseResponse(null, false, "", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void verifyReceipts(String str, String str2, Collection<Integer> collection) {
|
|
||||||
try {
|
|
||||||
JSONObject jSONObject = new JSONObject();
|
|
||||||
jSONObject.put("requestId", str);
|
|
||||||
jSONObject.put("userId", str2);
|
|
||||||
JSONArray jSONArray = new JSONArray();
|
|
||||||
|
|
||||||
jSONObject.put("receipts", jSONArray);
|
|
||||||
mSecurityJNI.verify(jSONObject.toString(), "", -1, Consts.STORE_AMAZON);
|
|
||||||
} catch (Exception e) {
|
|
||||||
ResponseHandler.purchaseResponse(null, false, "", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void OnNonceSucceed(long j, Object obj) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void OnVerifyMarketResponse(boolean z, String str, String str2, int i) {
|
|
||||||
Debug.Log.w(TAG, "OnVerifyMarketResponse, verified=" + z + " signature=" + str2 + " startId=" + i);
|
|
||||||
Debug.Log.w(TAG, "OnVerifyMarketResponse, signedData=" + str);
|
|
||||||
sendPurchases(str, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void checkBillingSupported(Runnable runnable) {
|
|
||||||
new CheckBillingSupported(runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void requestPurchase(String str, String str2, String str3, Runnable runnable) {
|
|
||||||
new RequestPurchase(str, str3, runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void restoreTransactions(long j, Runnable runnable) {
|
|
||||||
new RestoreTransactions(runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void setContext(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void shutdown() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.amazon;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class AmazonPurchasingObserver {
|
|
||||||
private AmazonPurchasingEventHandler mEventHandler = null;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public interface AmazonPurchasingEventHandler {
|
|
||||||
void onItemDataResponse(Object itemDataResponse);
|
|
||||||
|
|
||||||
void onPurchaseResponse(Object purchaseResponse);
|
|
||||||
|
|
||||||
void onPurchaseUpdatesResponse(Object purchaseUpdatesResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmazonPurchasingObserver(Activity activity, AmazonPurchasingEventHandler amazonPurchasingEventHandler) {
|
|
||||||
this.mEventHandler = amazonPurchasingEventHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onItemDataResponse(Object itemDataResponse) {
|
|
||||||
if (this.mEventHandler != null) {
|
|
||||||
this.mEventHandler.onItemDataResponse(itemDataResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// com.amazon.inapp.purchasing.PurchasingObserver, com.amazon.inapp.purchasing.BasePurchasingObserver
|
|
||||||
public void onPurchaseResponse(Object purchaseResponse) {
|
|
||||||
if (this.mEventHandler != null) {
|
|
||||||
this.mEventHandler.onPurchaseResponse(purchaseResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// com.amazon.inapp.purchasing.PurchasingObserver, com.amazon.inapp.purchasing.BasePurchasingObserver
|
|
||||||
public void onPurchaseUpdatesResponse(Object purchaseUpdatesResponse) {
|
|
||||||
if (this.mEventHandler != null) {
|
|
||||||
this.mEventHandler.onPurchaseUpdatesResponse(purchaseUpdatesResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// com.amazon.inapp.purchasing.PurchasingObserver, com.amazon.inapp.purchasing.BasePurchasingObserver
|
|
||||||
public void onSdkAvailable(boolean z) {
|
|
||||||
System.out.println((z ? "sandbox" : "production") + " mode");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,539 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.android;
|
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import com.android.vending.billing.IMarketBillingService;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.BillingService;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
import com.ea.easp.mtx.market.ResponseHandler;
|
|
||||||
import com.ea.easp.mtx.market.Security;
|
|
||||||
import com.ea.easp.mtx.market.SecurityJNI;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
public class AndroidBillingService extends Service implements ServiceConnection, BillingService {
|
|
||||||
private static final String TAG = "AndroidBillingService";
|
|
||||||
private static LinkedList<BillingRequest> mPendingRequests = new LinkedList<>();
|
|
||||||
private static SecurityJNI mSecurityJNI;
|
|
||||||
private static HashMap<Long, BillingRequest> mSentRequests = new HashMap<>();
|
|
||||||
private static IMarketBillingService mService;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public abstract class BillingRequest {
|
|
||||||
protected boolean mAddRequestToPendingQueue;
|
|
||||||
protected long mRequestId;
|
|
||||||
private final int mStartId;
|
|
||||||
|
|
||||||
public BillingRequest(int i) {
|
|
||||||
this.mStartId = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getNeedAddRequestToPendingQueue() {
|
|
||||||
return this.mAddRequestToPendingQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStartId() {
|
|
||||||
return this.mStartId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public abstract boolean handleRunErrorWhenConnected(Exception exc);
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void logResponseCode(String str, Bundle bundle) {
|
|
||||||
Debug.Log.i(AndroidBillingService.TAG, str + " received " + Consts.ResponseCode.valueOf(bundle.getInt("RESPONSE_CODE")).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public Bundle makeRequestBundle(String str) {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putString(Consts.BILLING_REQUEST_METHOD, str);
|
|
||||||
bundle.putInt(Consts.BILLING_REQUEST_API_VERSION, 1);
|
|
||||||
bundle.putString(Consts.BILLING_REQUEST_PACKAGE_NAME, AndroidBillingService.this.getPackageName());
|
|
||||||
return bundle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void onRemoteException(RemoteException remoteException) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "remote billing service crashed.", remoteException);
|
|
||||||
IMarketBillingService unused = AndroidBillingService.mService = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public abstract long run() throws Exception;
|
|
||||||
|
|
||||||
public boolean runIfConnected() {
|
|
||||||
Debug.Log.d(AndroidBillingService.TAG, "runIfConnected(): " + getClass().getSimpleName());
|
|
||||||
if (AndroidBillingService.mService != null) {
|
|
||||||
try {
|
|
||||||
this.mRequestId = run();
|
|
||||||
Debug.Log.d(AndroidBillingService.TAG, "request id: " + this.mRequestId);
|
|
||||||
if (this.mRequestId >= 0) {
|
|
||||||
AndroidBillingService.mSentRequests.put(Long.valueOf(this.mRequestId), this);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
this.mAddRequestToPendingQueue = handleRunErrorWhenConnected(e);
|
|
||||||
onRemoteException(e);
|
|
||||||
} catch (Exception e2) {
|
|
||||||
this.mAddRequestToPendingQueue = handleRunErrorWhenConnected(e2);
|
|
||||||
Debug.Log.i(AndroidBillingService.TAG, "unbind service");
|
|
||||||
AndroidBillingService.this.unbind();
|
|
||||||
Debug.Log.i(AndroidBillingService.TAG, "set service pointer to null to be able rebind.");
|
|
||||||
IMarketBillingService unused = AndroidBillingService.mService = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean runRequest() {
|
|
||||||
this.mAddRequestToPendingQueue = true;
|
|
||||||
if (runIfConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!this.mAddRequestToPendingQueue || !AndroidBillingService.this.bindToMarketBillingService()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
AndroidBillingService.mPendingRequests.add(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CheckBillingSupported extends BillingRequest {
|
|
||||||
Runnable mErrorHandler;
|
|
||||||
|
|
||||||
public CheckBillingSupported(Runnable runnable) {
|
|
||||||
super(-1);
|
|
||||||
this.mErrorHandler = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "CheckBillingSupported failed.", exc);
|
|
||||||
if (this.mErrorHandler == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.mErrorHandler.run();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public long run() throws RemoteException {
|
|
||||||
int i = AndroidBillingService.mService.sendBillingRequest(makeRequestBundle("CHECK_BILLING_SUPPORTED")).getInt("RESPONSE_CODE", -1);
|
|
||||||
Debug.Log.i(AndroidBillingService.TAG, "CheckBillingSupported response code: " + Consts.ResponseCode.valueOf(i));
|
|
||||||
ResponseHandler.checkBillingSupportedResponse(i == Consts.ResponseCode.RESULT_OK.ordinal());
|
|
||||||
return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class ConfirmNotifications extends BillingRequest {
|
|
||||||
final String[] mNotifyIds;
|
|
||||||
|
|
||||||
public ConfirmNotifications(int i, String[] strArr) {
|
|
||||||
super(i);
|
|
||||||
this.mNotifyIds = strArr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "ConfirmNotifications failed.", exc);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public long run() throws RemoteException {
|
|
||||||
Bundle makeRequestBundle = makeRequestBundle("CONFIRM_NOTIFICATIONS");
|
|
||||||
makeRequestBundle.putStringArray(Consts.BILLING_REQUEST_NOTIFY_IDS, this.mNotifyIds);
|
|
||||||
Bundle sendBillingRequest = AndroidBillingService.mService.sendBillingRequest(makeRequestBundle);
|
|
||||||
logResponseCode("confirmNotifications", sendBillingRequest);
|
|
||||||
return sendBillingRequest.getLong(Consts.BILLING_RESPONSE_REQUEST_ID, Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class GetPurchaseInformation extends BillingRequest {
|
|
||||||
long mNonce;
|
|
||||||
final String[] mNotifyIds;
|
|
||||||
|
|
||||||
public GetPurchaseInformation(long j, int i, String[] strArr) {
|
|
||||||
super(i);
|
|
||||||
this.mNotifyIds = strArr;
|
|
||||||
this.mNonce = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "GetPurchaseInformation failed.", exc);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public void onRemoteException(RemoteException remoteException) {
|
|
||||||
super.onRemoteException(remoteException);
|
|
||||||
Security.removeNonce(this.mNonce);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public long run() throws RemoteException {
|
|
||||||
Security.addNonce(this.mNonce);
|
|
||||||
Bundle makeRequestBundle = makeRequestBundle("GET_PURCHASE_INFORMATION");
|
|
||||||
makeRequestBundle.putLong(Consts.BILLING_REQUEST_NONCE, this.mNonce);
|
|
||||||
makeRequestBundle.putStringArray(Consts.BILLING_REQUEST_NOTIFY_IDS, this.mNotifyIds);
|
|
||||||
Bundle sendBillingRequest = AndroidBillingService.mService.sendBillingRequest(makeRequestBundle);
|
|
||||||
logResponseCode("getPurchaseInformation", sendBillingRequest);
|
|
||||||
return sendBillingRequest.getLong(Consts.BILLING_RESPONSE_REQUEST_ID, Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
public class NonceRequestDataGetPurchaseInformation {
|
|
||||||
public String mNotifyId;
|
|
||||||
public int mStartId;
|
|
||||||
|
|
||||||
public NonceRequestDataGetPurchaseInformation(int i, String str) {
|
|
||||||
this.mStartId = i;
|
|
||||||
this.mNotifyId = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RequestPurchase extends BillingRequest implements BillingService.IRequestPurchase {
|
|
||||||
public final String mDeveloperPayload;
|
|
||||||
Runnable mErrorHandler;
|
|
||||||
public final String mProductId;
|
|
||||||
|
|
||||||
public RequestPurchase(AndroidBillingService androidBillingService, String str, Runnable runnable) {
|
|
||||||
this(str, null, runnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequestPurchase(String str, String str2, Runnable runnable) {
|
|
||||||
super(-1);
|
|
||||||
this.mProductId = str;
|
|
||||||
this.mDeveloperPayload = str2;
|
|
||||||
this.mErrorHandler = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeveloperPayload() {
|
|
||||||
return this.mDeveloperPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService.IRequestPurchase
|
|
||||||
public String getProductId() {
|
|
||||||
return this.mProductId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "RequestPurchase failed.", exc);
|
|
||||||
if (this.mErrorHandler == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.mErrorHandler.run();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
ResponseHandler.responseCodeReceived(this, responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public long run() throws Exception {
|
|
||||||
Bundle makeRequestBundle = makeRequestBundle("REQUEST_PURCHASE");
|
|
||||||
makeRequestBundle.putString(Consts.BILLING_REQUEST_ITEM_ID, this.mProductId);
|
|
||||||
if (this.mDeveloperPayload != null) {
|
|
||||||
makeRequestBundle.putString(Consts.BILLING_REQUEST_DEVELOPER_PAYLOAD, this.mDeveloperPayload);
|
|
||||||
}
|
|
||||||
Bundle sendBillingRequest = AndroidBillingService.mService.sendBillingRequest(makeRequestBundle);
|
|
||||||
PendingIntent pendingIntent = (PendingIntent) sendBillingRequest.getParcelable(Consts.BILLING_RESPONSE_PURCHASE_INTENT);
|
|
||||||
if (pendingIntent == null) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "Error with requestPurchase");
|
|
||||||
throw new Exception("sendBillingRequest(): PURCHASE INTENT is null.");
|
|
||||||
}
|
|
||||||
ResponseHandler.buyPageIntentResponse(pendingIntent, new Intent());
|
|
||||||
long j = sendBillingRequest.getLong(Consts.BILLING_RESPONSE_REQUEST_ID, Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
|
|
||||||
if (j >= 0) {
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
throw new Exception("sendBillingRequest(): invalid request ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RestoreTransactions extends BillingRequest implements BillingService.IRestoreTransactions {
|
|
||||||
Runnable mErrorHandler;
|
|
||||||
long mNonce;
|
|
||||||
|
|
||||||
public RestoreTransactions(long j, Runnable runnable) {
|
|
||||||
super(-1);
|
|
||||||
this.mNonce = j;
|
|
||||||
this.mErrorHandler = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public boolean handleRunErrorWhenConnected(Exception exc) {
|
|
||||||
Debug.Log.e(AndroidBillingService.TAG, "RestoreTransactions failed.", exc);
|
|
||||||
if (this.mErrorHandler == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.mErrorHandler.run();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public void onRemoteException(RemoteException remoteException) {
|
|
||||||
super.onRemoteException(remoteException);
|
|
||||||
Security.removeNonce(this.mNonce);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public void responseCodeReceived(Consts.ResponseCode responseCode) {
|
|
||||||
ResponseHandler.responseCodeReceived(this, responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.easp.mtx.market.android.AndroidBillingService.BillingRequest
|
|
||||||
public long run() throws Exception {
|
|
||||||
Security.addNonce(this.mNonce);
|
|
||||||
Bundle makeRequestBundle = makeRequestBundle("RESTORE_TRANSACTIONS");
|
|
||||||
makeRequestBundle.putLong(Consts.BILLING_REQUEST_NONCE, this.mNonce);
|
|
||||||
Bundle sendBillingRequest = AndroidBillingService.mService.sendBillingRequest(makeRequestBundle);
|
|
||||||
logResponseCode("restoreTransactions", sendBillingRequest);
|
|
||||||
long j = sendBillingRequest.getLong(Consts.BILLING_RESPONSE_REQUEST_ID, Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);
|
|
||||||
if (j >= 0) {
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
throw new Exception("sendBillingRequest(): invalid request ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AndroidBillingService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public AndroidBillingService(SecurityJNI securityJNI) {
|
|
||||||
mSecurityJNI = securityJNI;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean bindToMarketBillingService() {
|
|
||||||
try {
|
|
||||||
Debug.Log.i(TAG, "binding to Market billing service");
|
|
||||||
if (bindService(new Intent(Consts.MARKET_BILLING_SERVICE_ACTION), this, Context.BIND_AUTO_CREATE)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Debug.Log.e(TAG, "Could not bind to service.");
|
|
||||||
return false;
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
Debug.Log.e(TAG, "Security exception: " + e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkResponseCode(long j, Consts.ResponseCode responseCode) {
|
|
||||||
BillingRequest billingRequest = mSentRequests.get(Long.valueOf(j));
|
|
||||||
if (billingRequest != null) {
|
|
||||||
Debug.Log.d(TAG, billingRequest.getClass().getSimpleName() + ": " + responseCode);
|
|
||||||
billingRequest.responseCodeReceived(responseCode);
|
|
||||||
}
|
|
||||||
mSentRequests.remove(Long.valueOf(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean confirmNotifications(int i, String[] strArr) {
|
|
||||||
return new ConfirmNotifications(i, strArr).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createPurchasesFromJsonAndSendThemToHandler(boolean z, String str, String str2, int i) {
|
|
||||||
Debug.Log.d(TAG, "createPurchasesFromJsonAndSendThemToHandler()");
|
|
||||||
ArrayList<Security.VerifiedPurchase> createVerifiedPurchasesList = Security.createVerifiedPurchasesList(str, z);
|
|
||||||
if (createVerifiedPurchasesList == null) {
|
|
||||||
Debug.Log.d(TAG, "...createPurchasesFromJsonAndSendThemToHandler(): purchases is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ArrayList arrayList = new ArrayList();
|
|
||||||
Iterator<Security.VerifiedPurchase> it = createVerifiedPurchasesList.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Security.VerifiedPurchase next = it.next();
|
|
||||||
if (next.notificationId != null) {
|
|
||||||
arrayList.add(next.notificationId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ResponseHandler.purchaseResponse(createVerifiedPurchasesList, z, str, str2);
|
|
||||||
if (!arrayList.isEmpty()) {
|
|
||||||
Debug.Log.d(TAG, "sending confirmation of receiving of " + arrayList.size() + " notifications()");
|
|
||||||
confirmNotifications(i, (String[]) arrayList.toArray(new String[arrayList.size()]));
|
|
||||||
}
|
|
||||||
Debug.Log.d(TAG, "...createPurchasesFromJsonAndSendThemToHandler()");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getNonce(Object obj) {
|
|
||||||
if (mSecurityJNI != null) {
|
|
||||||
mSecurityJNI.getNonce(obj);
|
|
||||||
} else {
|
|
||||||
Debug.Log.e(TAG, "getNonce(): fail to send 'get nonce' request.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean getPurchaseInformation(long j, int i, String[] strArr) {
|
|
||||||
return new GetPurchaseInformation(j, i, strArr).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void purchaseStateChanged(int i, String str, String str2) {
|
|
||||||
Debug.Log.d(TAG, "purchaseStateChanged()");
|
|
||||||
if (str == null) {
|
|
||||||
Debug.Log.e(TAG, "purchaseStateChanged(): signedData is null");
|
|
||||||
} else if (!TextUtils.isEmpty(str2)) {
|
|
||||||
verifyMarketResponse(str, str2, i);
|
|
||||||
} else {
|
|
||||||
Debug.Log.d(TAG, "signature is empty: \"" + str2 + "\"");
|
|
||||||
createPurchasesFromJsonAndSendThemToHandler(false, str, str2, i);
|
|
||||||
}
|
|
||||||
Debug.Log.d(TAG, "...purchaseStateChanged()");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void runPendingRequests() {
|
|
||||||
int i = -1;
|
|
||||||
while (true) {
|
|
||||||
BillingRequest peek = mPendingRequests.peek();
|
|
||||||
if (peek != null) {
|
|
||||||
if (peek.runIfConnected()) {
|
|
||||||
mPendingRequests.remove();
|
|
||||||
if (i < peek.getStartId()) {
|
|
||||||
i = peek.getStartId();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bindToMarketBillingService();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (i >= 0) {
|
|
||||||
Debug.Log.i(TAG, "stopping service, startId: " + i);
|
|
||||||
stopSelf(i);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void verifyMarketResponse(String str, String str2, int i) {
|
|
||||||
if (mSecurityJNI != null) {
|
|
||||||
mSecurityJNI.verify(str, str2, i, Consts.STORE_ANDROID);
|
|
||||||
} else {
|
|
||||||
Debug.Log.e(TAG, "verifyMarketResponse(): fail to send transaction verification request.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void OnNonceSucceed(long j, Object obj) {
|
|
||||||
if (obj instanceof NonceRequestDataGetPurchaseInformation) {
|
|
||||||
NonceRequestDataGetPurchaseInformation nonceRequestDataGetPurchaseInformation = (NonceRequestDataGetPurchaseInformation) obj;
|
|
||||||
getPurchaseInformation(j, nonceRequestDataGetPurchaseInformation.mStartId, new String[]{nonceRequestDataGetPurchaseInformation.mNotifyId});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Debug.Log.e(TAG, "OnNonceSucceed(): unknown type of requestData");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void OnVerifyMarketResponse(boolean z, String str, String str2, int i) {
|
|
||||||
createPurchasesFromJsonAndSendThemToHandler(z, str, str2, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void checkBillingSupported(Runnable runnable) {
|
|
||||||
new CheckBillingSupported(runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleCommand(Intent intent, int i) {
|
|
||||||
if (intent == null) {
|
|
||||||
Debug.Log.d(TAG, "handleCommand() null intent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String action = intent.getAction();
|
|
||||||
Debug.Log.i(TAG, "handleCommand() action: " + action);
|
|
||||||
if (Consts.ACTION_CONFIRM_NOTIFICATION.equals(action)) {
|
|
||||||
String[] stringArrayExtra = intent.getStringArrayExtra(Consts.NOTIFICATION_ID);
|
|
||||||
Debug.Log.w(TAG, "Confirm notifications called from BillingService.handleCommand()");
|
|
||||||
confirmNotifications(i, stringArrayExtra);
|
|
||||||
} else if (Consts.ACTION_GET_PURCHASE_INFORMATION.equals(action)) {
|
|
||||||
getNonce(new NonceRequestDataGetPurchaseInformation(i, intent.getStringExtra(Consts.NOTIFICATION_ID)));
|
|
||||||
} else if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
|
|
||||||
purchaseStateChanged(i, intent.getStringExtra(Consts.INAPP_SIGNED_DATA), intent.getStringExtra(Consts.INAPP_SIGNATURE));
|
|
||||||
} else if (Consts.ACTION_RESPONSE_CODE.equals(action)) {
|
|
||||||
checkResponseCode(intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1), Consts.ResponseCode.valueOf(intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, Consts.ResponseCode.RESULT_ERROR.ordinal())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
||||||
Debug.Log.d(TAG, "Billing service connected");
|
|
||||||
mService = IMarketBillingService.Stub.asInterface(iBinder);
|
|
||||||
runPendingRequests();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServiceDisconnected(ComponentName componentName) {
|
|
||||||
Debug.Log.w(TAG, "Billing service disconnected");
|
|
||||||
mService = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStart(Intent intent, int i) {
|
|
||||||
handleCommand(intent, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void requestPurchase(String str, String str2, String str3, Runnable runnable) {
|
|
||||||
new RequestPurchase(str, str3, runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void restoreTransactions(long j, Runnable runnable) {
|
|
||||||
new RestoreTransactions(j, runnable).runRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void setContext(Context context) {
|
|
||||||
attachBaseContext(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.ea.easp.mtx.market.BillingService
|
|
||||||
public void shutdown() {
|
|
||||||
Debug.Log.d(TAG, "shutdown()");
|
|
||||||
unbind();
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unbind() {
|
|
||||||
try {
|
|
||||||
unbindService(this);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Debug.Log.d(TAG, "Billing service: unbind() failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.android;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import com.ea.easp.Debug;
|
|
||||||
import com.ea.easp.mtx.market.Consts;
|
|
||||||
|
|
||||||
public class BillingReceiver extends BroadcastReceiver {
|
|
||||||
private static final String TAG = "BillingReceiver";
|
|
||||||
|
|
||||||
private void checkResponseCode(Context context, long j, int i) {
|
|
||||||
Intent intent = new Intent(Consts.ACTION_RESPONSE_CODE);
|
|
||||||
intent.setClass(context, AndroidBillingService.class);
|
|
||||||
intent.putExtra(Consts.INAPP_REQUEST_ID, j);
|
|
||||||
intent.putExtra(Consts.INAPP_RESPONSE_CODE, i);
|
|
||||||
context.startService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notify(Context context, String str) {
|
|
||||||
Intent intent = new Intent(Consts.ACTION_GET_PURCHASE_INFORMATION);
|
|
||||||
intent.setClass(context, AndroidBillingService.class);
|
|
||||||
intent.putExtra(Consts.NOTIFICATION_ID, str);
|
|
||||||
context.startService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void purchaseStateChanged(Context context, String str, String str2) {
|
|
||||||
Debug.Log.d(TAG, "purchaseStateChanged()...");
|
|
||||||
if (str != null) {
|
|
||||||
Debug.Log.d(TAG, "signedData is \"" + str + "\"");
|
|
||||||
}
|
|
||||||
Intent intent = new Intent(Consts.ACTION_PURCHASE_STATE_CHANGED);
|
|
||||||
intent.setClass(context, AndroidBillingService.class);
|
|
||||||
intent.putExtra(Consts.INAPP_SIGNED_DATA, str);
|
|
||||||
intent.putExtra(Consts.INAPP_SIGNATURE, str2);
|
|
||||||
context.startService(intent);
|
|
||||||
Debug.Log.d(TAG, "...purchaseStateChanged()");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
|
|
||||||
purchaseStateChanged(context, intent.getStringExtra(Consts.INAPP_SIGNED_DATA), intent.getStringExtra(Consts.INAPP_SIGNATURE));
|
|
||||||
} else if (Consts.ACTION_NOTIFY.equals(action)) {
|
|
||||||
String stringExtra = intent.getStringExtra(Consts.NOTIFICATION_ID);
|
|
||||||
Debug.Log.i(TAG, "notifyId: " + stringExtra);
|
|
||||||
notify(context, stringExtra);
|
|
||||||
} else if (Consts.ACTION_RESPONSE_CODE.equals(action)) {
|
|
||||||
checkResponseCode(context, intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1), intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, Consts.ResponseCode.RESULT_ERROR.ordinal()));
|
|
||||||
} else {
|
|
||||||
Debug.Log.w(TAG, "unexpected action: " + action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.util;
|
|
||||||
|
|
||||||
public class Base64 {
|
|
||||||
static final boolean $assertionsDisabled = (!Base64.class.desiredAssertionStatus());
|
|
||||||
private static final byte EQUALS_SIGN = 61;
|
|
||||||
private static final byte WHITE_SPACE_ENC = -5;
|
|
||||||
private static final byte EQUALS_SIGN_ENC = -1;
|
|
||||||
private static final byte NEW_LINE = 10;
|
|
||||||
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[] 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};
|
|
||||||
public static final boolean DECODE = false;
|
|
||||||
public static final boolean ENCODE = true;
|
|
||||||
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[] 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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decode(String str) throws Base64DecoderException {
|
|
||||||
byte[] bytes = str.getBytes();
|
|
||||||
return decode(bytes, 0, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decode(byte[] bArr) throws Base64DecoderException {
|
|
||||||
return decode(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[] decode(byte[] bArr, int i, int i2, byte[] bArr2) throws Base64DecoderException {
|
|
||||||
byte[] bArr3 = new byte[(((i2 * 3) / 4) + 2)];
|
|
||||||
int i3 = 0;
|
|
||||||
byte[] bArr4 = new byte[4];
|
|
||||||
int i4 = 0;
|
|
||||||
int i5 = 0;
|
|
||||||
while (true) {
|
|
||||||
if (i5 >= i2) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
byte b = (byte) (bArr[i5 + i] & Byte.MAX_VALUE);
|
|
||||||
byte b2 = bArr2[b];
|
|
||||||
if (b2 >= -5) {
|
|
||||||
if (b2 < -1) {
|
|
||||||
i4 = i4;
|
|
||||||
} else if (b == 61) {
|
|
||||||
int i6 = i2 - i5;
|
|
||||||
byte b3 = (byte) (bArr[(i2 - 1) + i] & Byte.MAX_VALUE);
|
|
||||||
if (i4 == 0 || i4 == 1) {
|
|
||||||
throw new Base64DecoderException("invalid padding byte '=' at byte offset " + i5);
|
|
||||||
} else if ((i4 == 3 && i6 > 2) || (i4 == 4 && i6 > 1)) {
|
|
||||||
throw new Base64DecoderException("padding byte '=' falsely signals end of encoded value at offset " + i5);
|
|
||||||
} else if (b3 != 61 && b3 != 10) {
|
|
||||||
throw new Base64DecoderException("encoded value has invalid trailing byte");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
i4++;
|
|
||||||
bArr4[i4] = b;
|
|
||||||
if (i4 == 4) {
|
|
||||||
i3 += decode4to3(bArr4, 0, bArr3, i3, bArr2);
|
|
||||||
i4 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i5++;
|
|
||||||
} else {
|
|
||||||
throw new Base64DecoderException("Bad Base64 input character at " + i5 + ": " + ((int) bArr[i5 + i]) + "(decimal)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i4 != 0) {
|
|
||||||
if (i4 == 1) {
|
|
||||||
throw new Base64DecoderException("single trailing character at offset " + (i2 - 1));
|
|
||||||
}
|
|
||||||
int i7 = i4 + 1;
|
|
||||||
bArr4[i4] = EQUALS_SIGN;
|
|
||||||
i3 += decode4to3(bArr4, 0, bArr3, i3, bArr2);
|
|
||||||
}
|
|
||||||
byte[] bArr5 = new byte[i3];
|
|
||||||
System.arraycopy(bArr3, 0, bArr5, 0, i3);
|
|
||||||
return bArr5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int decode4to3(byte[] bArr, int i, byte[] bArr2, int i2, byte[] bArr3) {
|
|
||||||
if (bArr[i + 2] == 61) {
|
|
||||||
bArr2[i2] = (byte) ((((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12)) >>> 16);
|
|
||||||
return 1;
|
|
||||||
} else if (bArr[i + 3] == 61) {
|
|
||||||
int i3 = ((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i + 2]] << 24) >>> 18);
|
|
||||||
bArr2[i2] = (byte) (i3 >>> 16);
|
|
||||||
bArr2[i2 + 1] = (byte) (i3 >>> 8);
|
|
||||||
return 2;
|
|
||||||
} else {
|
|
||||||
int i4 = ((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i + 2]] << 24) >>> 18) | ((bArr3[bArr[i + 3]] << 24) >>> 24);
|
|
||||||
bArr2[i2] = (byte) (i4 >> 16);
|
|
||||||
bArr2[i2 + 1] = (byte) (i4 >> 8);
|
|
||||||
bArr2[i2 + 2] = (byte) i4;
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(String str) throws Base64DecoderException {
|
|
||||||
byte[] bytes = str.getBytes();
|
|
||||||
return decodeWebSafe(bytes, 0, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(byte[] bArr) throws Base64DecoderException {
|
|
||||||
return decodeWebSafe(bArr, 0, bArr.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(byte[] bArr, int i, int i2) throws Base64DecoderException {
|
|
||||||
return decode(bArr, i, i2, WEBSAFE_DECODABET);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encode(byte[] bArr) {
|
|
||||||
return encode(bArr, 0, bArr.length, ALPHABET, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encode(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
|
|
||||||
byte[] encode = encode(bArr, i, i2, bArr2, Integer.MAX_VALUE);
|
|
||||||
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 / i3) + i4)];
|
|
||||||
int i5 = 0;
|
|
||||||
int i6 = 0;
|
|
||||||
int i7 = i2 - 2;
|
|
||||||
int i8 = 0;
|
|
||||||
while (i5 < i7) {
|
|
||||||
int i9 = ((bArr[i5 + i] << 24) >>> 8) | ((bArr[(i5 + 1) + i] << 24) >>> 16) | ((bArr[(i5 + 2) + i] << 24) >>> 24);
|
|
||||||
bArr3[i6] = bArr2[i9 >>> 18];
|
|
||||||
bArr3[i6 + 1] = bArr2[(i9 >>> 12) & 63];
|
|
||||||
bArr3[i6 + 2] = bArr2[(i9 >>> 6) & 63];
|
|
||||||
bArr3[i6 + 3] = bArr2[i9 & 63];
|
|
||||||
i8 += 4;
|
|
||||||
if (i8 == i3) {
|
|
||||||
bArr3[i6 + 4] = NEW_LINE;
|
|
||||||
i6++;
|
|
||||||
i8 = 0;
|
|
||||||
}
|
|
||||||
i5 += 3;
|
|
||||||
i6 += 4;
|
|
||||||
}
|
|
||||||
if (i5 < i2) {
|
|
||||||
encode3to4(bArr, i5 + i, i2 - i5, bArr3, i6, bArr2);
|
|
||||||
if (i8 + 4 == i3) {
|
|
||||||
bArr3[i6 + 4] = NEW_LINE;
|
|
||||||
i6++;
|
|
||||||
}
|
|
||||||
i6 += 4;
|
|
||||||
}
|
|
||||||
if ($assertionsDisabled || i6 == bArr3.length) {
|
|
||||||
return bArr3;
|
|
||||||
}
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] encode3to4(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
|
|
||||||
int i4 = 0;
|
|
||||||
int i5 = (i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0) | (i2 > 0 ? (bArr[i] << 24) >>> 8 : 0);
|
|
||||||
if (i2 > 2) {
|
|
||||||
i4 = (bArr[i + 2] << 24) >>> 24;
|
|
||||||
}
|
|
||||||
int i6 = i5 | i4;
|
|
||||||
switch (i2) {
|
|
||||||
case 1:
|
|
||||||
bArr2[i3] = bArr3[i6 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i6 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = EQUALS_SIGN;
|
|
||||||
bArr2[i3 + 3] = EQUALS_SIGN;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
bArr2[i3] = bArr3[i6 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i6 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = bArr3[(i6 >>> 6) & 63];
|
|
||||||
bArr2[i3 + 3] = EQUALS_SIGN;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
bArr2[i3] = bArr3[i6 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i6 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = bArr3[(i6 >>> 6) & 63];
|
|
||||||
bArr2[i3 + 3] = bArr3[i6 & 63];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return bArr2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encodeWebSafe(byte[] bArr, boolean z) {
|
|
||||||
return encode(bArr, 0, bArr.length, WEBSAFE_ALPHABET, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.ea.easp.mtx.market.util;
|
|
||||||
|
|
||||||
public class Base64DecoderException extends Exception {
|
|
||||||
private static final long serialVersionUID = 1;
|
|
||||||
|
|
||||||
public Base64DecoderException() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Base64DecoderException(String str) {
|
|
||||||
super(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.ea.games.nfs13_na;
|
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.ea.ironmonkey.C2DMConstants;
|
|
||||||
import com.google.android.c2dm.C2DMBaseReceiver;
|
|
||||||
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class C2DMReceiver extends C2DMBaseReceiver {
|
|
||||||
private static final String TAG = "C2DMReceiver";
|
|
||||||
public static List<Bundle> unhandledMessages = new ArrayList();
|
|
||||||
|
|
||||||
public C2DMReceiver() {
|
|
||||||
super(C2DMConstants.SENDER_EMAIL);
|
|
||||||
Log.i(TAG, "C2DMReceiver Constuctor()");
|
|
||||||
}
|
|
||||||
|
|
||||||
private String extractPayload(Bundle bundle) {
|
|
||||||
for (String str : bundle.keySet()) {
|
|
||||||
if (str.startsWith("eamobile-message")) {
|
|
||||||
try {
|
|
||||||
return URLDecoder.decode(bundle.getString(str), "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void generateNotification(Context context, String str, String str2) {
|
|
||||||
int i = Build.VERSION.SDK_INT;
|
|
||||||
Log.i("Vj", "Vj:: osVersion - " + i);
|
|
||||||
Notification notification = new Notification(i < 10 ? R.drawable.iconb : R.drawable.iconw, str, System.currentTimeMillis());
|
|
||||||
Intent intent = new Intent("android.intent.action.MAIN");
|
|
||||||
intent.setClassName(C2DMConstants.SYSTEM_MSG_PACKAGE_RECIPIENT, C2DMConstants.SYSTEM_MSG_CLASS_RECIPIENT);
|
|
||||||
//notification.setLatestEventInfo(context, str, str2, PendingIntent.getActivity(context, 0, intent, 0));
|
|
||||||
notification.flags |= 16;
|
|
||||||
((NotificationManager) context.getSystemService("notification")).notify(0, notification);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.c2dm.C2DMBaseReceiver
|
|
||||||
public void onError(Context context, String str) {
|
|
||||||
Log.e(TAG, "C2DMReceiver onError() " + str);
|
|
||||||
Intent intent = new Intent(C2DMConstants.ACTION_ERROR);
|
|
||||||
intent.putExtra(C2DMConstants.EXTRA_ERROR_ID, str);
|
|
||||||
context.sendBroadcast(intent, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.c2dm.C2DMBaseReceiver
|
|
||||||
public void onMessage(Context context, Intent intent) {
|
|
||||||
Log.i(TAG, "C2DMReceiver onMessage()");
|
|
||||||
Bundle extras = intent.getExtras();
|
|
||||||
unhandledMessages.add(extras);
|
|
||||||
Intent intent2 = new Intent(C2DMConstants.ACTION_MESSAGE);
|
|
||||||
intent2.putExtras(extras);
|
|
||||||
context.sendBroadcast(intent2, null);
|
|
||||||
generateNotification(context, C2DMConstants.SYSTEM_MSG_TITLE, extractPayload(intent.getExtras()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.c2dm.C2DMBaseReceiver
|
|
||||||
public void onRegistered(Context context, String str) {
|
|
||||||
Log.i(TAG, " onRegistered()");
|
|
||||||
Intent intent = new Intent(C2DMConstants.ACTION_REGISTER);
|
|
||||||
intent.putExtra(C2DMConstants.EXTRA_REGISTRATION_ID, str);
|
|
||||||
context.sendBroadcast(intent, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.c2dm.C2DMBaseReceiver
|
|
||||||
public void onUnregistered(Context context) {
|
|
||||||
Log.i(TAG, "C2DMReceiver onUnregistered()");
|
|
||||||
context.sendBroadcast(new Intent(C2DMConstants.ACTION_UNREGISTER), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import android.hardware.Sensor;
|
|||||||
import android.hardware.SensorEvent;
|
import android.hardware.SensorEvent;
|
||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
|
|
||||||
public class Accelerometer implements SensorEventListener {
|
public class Accelerometer implements SensorEventListener {
|
||||||
private int bufferReadIndex;
|
private int bufferReadIndex;
|
||||||
@@ -30,10 +29,10 @@ public class Accelerometer implements SensorEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void register() {
|
private void register() {
|
||||||
if (!this.registered && this.samplesPerSecond > BitmapDescriptorFactory.HUE_RED) {
|
if (!this.registered && this.samplesPerSecond > 0) {
|
||||||
this.sensorManager.registerListener(this, this.sensor, getSensorDelay());
|
this.sensorManager.registerListener(this, this.sensor, getSensorDelay());
|
||||||
this.registered = true;
|
this.registered = true;
|
||||||
} else if (this.registered && this.samplesPerSecond == BitmapDescriptorFactory.HUE_RED) {
|
} else if (this.registered && this.samplesPerSecond == 0) {
|
||||||
this.sensorManager.unregisterListener(this);
|
this.sensorManager.unregisterListener(this);
|
||||||
this.registered = false;
|
this.registered = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,51 @@
|
|||||||
package com.ea.ironmonkey;
|
package com.ea.ironmonkey
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface
|
||||||
|
|
||||||
public class BitmapGraphics {
|
//Весь текст в игре отрисовывается от сюда
|
||||||
private Bitmap bitmap;
|
class BitmapGraphics(width: Int, height: Int) {
|
||||||
private Canvas canvas = new Canvas();
|
|
||||||
|
|
||||||
public BitmapGraphics(int i, int i2) {
|
private val bitmap: Bitmap
|
||||||
this.bitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
|
private val canvas = Canvas()
|
||||||
this.canvas.setBitmap(this.bitmap);
|
|
||||||
|
// get метод сам не создается, его нужно указывать явно
|
||||||
|
fun getBitmap(): Bitmap = bitmap
|
||||||
|
init {
|
||||||
|
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||||
|
canvas.setBitmap(bitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Paint createPaint(Typeface typeface, float f) {
|
fun clear() = canvas.drawColor(0, PorterDuff.Mode.CLEAR)
|
||||||
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);
|
fun drawString(paint: Paint, text: String, x: Int, y: Int) =
|
||||||
}
|
canvas.drawText(text, x.toFloat(), y.toFloat(), paint)
|
||||||
|
|
||||||
public static Paint createPaintFromFile(String str, float f) {
|
companion object {
|
||||||
return createPaint(Typeface.createFromFile(str), f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
private infix fun Typeface.withSize(textSize: Float): Paint{
|
||||||
this.canvas.drawColor(0, PorterDuff.Mode.CLEAR);
|
val paint = Paint()
|
||||||
}
|
paint.setTypeface(this)
|
||||||
|
paint.textSize = textSize
|
||||||
|
paint.setColor(-1)
|
||||||
|
paint.isAntiAlias = true
|
||||||
|
return paint
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void drawString(Paint paint, String str, int i, int i2) {
|
@JvmStatic
|
||||||
this.canvas.drawText(str, (float) i, (float) i2, paint);
|
fun createPaintFromFamilyName(familyName: String, textSize: Float): Paint {
|
||||||
}
|
return Typeface.create(familyName, Typeface.BOLD_ITALIC) withSize textSize
|
||||||
|
}
|
||||||
|
|
||||||
public Bitmap getBitmap() {
|
@JvmStatic
|
||||||
return this.bitmap;
|
fun createPaintFromFile(path: String, textSize: Float): Paint {
|
||||||
}
|
return Typeface.createFromFile(path) withSize textSize
|
||||||
|
}
|
||||||
public Canvas getCanvas() {
|
|
||||||
return this.canvas;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.ea.ironmonkey;
|
|
||||||
|
|
||||||
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.GameActivity";
|
|
||||||
public static final String SYSTEM_MSG_PACKAGE_RECIPIENT = "com.ea.games.nfs13_na";
|
|
||||||
public static final String SYSTEM_MSG_TITLE = "NFS Most Wanted";
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ea.ironmonkey;
|
package com.ea.ironmonkey
|
||||||
|
|
||||||
import javax.microedition.khronos.opengles.GL10;
|
import javax.microedition.khronos.opengles.GL10
|
||||||
|
|
||||||
public interface DrawFrameListener {
|
interface DrawFrameListener {
|
||||||
void onDrawFrame(GL10 gl10);
|
fun onDrawFrame(gl10: GL10)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ import com.ea.EAMIO.StorageDirectory
|
|||||||
import com.ea.easp.EASPHandler
|
import com.ea.easp.EASPHandler
|
||||||
import com.ea.games.nfs13_na.BuildConfig
|
import com.ea.games.nfs13_na.BuildConfig
|
||||||
import com.ea.nimble.ApplicationLifecycle
|
import com.ea.nimble.ApplicationLifecycle
|
||||||
import com.eamobile.IDeviceData
|
|
||||||
import com.eamobile.IDownloadActivity
|
|
||||||
import com.eamobile.Language
|
|
||||||
import com.eamobile.download.DeviceData
|
|
||||||
import java.io.BufferedReader
|
import java.io.BufferedReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileReader
|
import java.io.FileReader
|
||||||
@@ -41,7 +37,7 @@ import kotlin.math.sqrt
|
|||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownloadActivity {
|
class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
System.loadLibrary("nimble")
|
System.loadLibrary("nimble")
|
||||||
@@ -144,20 +140,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IsSystemKey(key: Int): Boolean {
|
fun IsSystemKey(key: Int) = false
|
||||||
val systemKeys = intArrayOf(
|
|
||||||
Language.SPACE_UNAVAIL_TITLE,
|
|
||||||
Language.BTN_DOWNLOAD,
|
|
||||||
Language.BTN_EXIT,
|
|
||||||
Language.NETWORK_WARNING_TXT,
|
|
||||||
Language.UPDATES_FOUND_TITLE,
|
|
||||||
Language.UPDATES_FOUND_TXT,
|
|
||||||
Language.UNSUPPORTED_DEVICE_TITLE,
|
|
||||||
91
|
|
||||||
)
|
|
||||||
for (systemKey: Int in systemKeys) if (key == systemKey) return false
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ShowMessage(message: String, strArr: Array<String?>, finish: Boolean) {
|
fun ShowMessage(message: String, strArr: Array<String?>, finish: Boolean) {
|
||||||
Log.d(this.localClassName, "ShowMessage msg = $message finish = $finish")
|
Log.d(this.localClassName, "ShowMessage msg = $message finish = $finish")
|
||||||
@@ -351,7 +334,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl
|
|||||||
gameRenderer = GameRenderer(this)
|
gameRenderer = GameRenderer(this)
|
||||||
gameRenderer!!.setDrawFrameListener(this)
|
gameRenderer!!.setDrawFrameListener(this)
|
||||||
gameGLSurfaceView!!.setRenderer(gameRenderer)
|
gameGLSurfaceView!!.setRenderer(gameRenderer)
|
||||||
runLoop = RunLoop(gameGLSurfaceView)
|
runLoop = RunLoop(gameGLSurfaceView!!)
|
||||||
mFrameLayout = FrameLayout(this)
|
mFrameLayout = FrameLayout(this)
|
||||||
mFrameLayout!!.addView(gameGLSurfaceView)
|
mFrameLayout!!.addView(gameGLSurfaceView)
|
||||||
val view = ComposeFrameLayout(this)
|
val view = ComposeFrameLayout(this)
|
||||||
@@ -392,11 +375,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl
|
|||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onDownloadEvent(i: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDrawFrame(gl10: GL10) {
|
override fun onDrawFrame(gl10: GL10) {
|
||||||
Log.i("state_in", "state = $state")
|
Log.i("state_in", "state = $state")
|
||||||
if (state != laststate) {
|
if (state != laststate) {
|
||||||
@@ -507,25 +485,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl
|
|||||||
nativeOnRestart()
|
nativeOnRestart()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResult(str: String, i: Int) {
|
|
||||||
Log.i("Debug", "onResult")
|
|
||||||
Log.w(this.localClassName, "onResult($str,$i)")
|
|
||||||
if (i != -1) {
|
|
||||||
finish()
|
|
||||||
Process.killProcess(Process.myPid())
|
|
||||||
} else {
|
|
||||||
val file = File(File(str).getParent() + "/.nomedia")
|
|
||||||
if (!file.exists()) file.createNewFile()
|
|
||||||
handler!!.postDelayed({ this@GameActivity.setContentView((gameGLSurfaceView)!!) }, 20)
|
|
||||||
if (hasWindowFocus()) {
|
|
||||||
state = 8
|
|
||||||
return
|
|
||||||
}
|
|
||||||
oldState = 8
|
|
||||||
state = 8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onResume() {
|
public override fun onResume() {
|
||||||
Log.i("Debug", "onResume")
|
Log.i("Debug", "onResume")
|
||||||
Log.i(this.localClassName, "onResume")
|
Log.i(this.localClassName, "onResume")
|
||||||
@@ -548,10 +507,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl
|
|||||||
nativeOnResume()
|
nativeOnResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRetrievedDeviceData(deviceData: DeviceData) {
|
|
||||||
deviceData.setResolution(480, 800)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onSaveInstanceState(bundle: Bundle) {
|
public override fun onSaveInstanceState(bundle: Bundle) {
|
||||||
super.onSaveInstanceState(bundle)
|
super.onSaveInstanceState(bundle)
|
||||||
ApplicationLifecycle.onActivitySaveInstanceState(bundle, this)
|
ApplicationLifecycle.onActivitySaveInstanceState(bundle, this)
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
package com.ea.ironmonkey;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import com.ea.easp.TaskLauncher;
|
|
||||||
import com.ea.games.nfs13_na.C2DMReceiver;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class Receiver extends BroadcastReceiver {
|
|
||||||
private static final String TAG = "Receiver";
|
|
||||||
private TaskLauncher taskLauncher_;
|
|
||||||
|
|
||||||
public Receiver(TaskLauncher taskLauncher) {
|
|
||||||
Log.i(TAG, "Constuctor()");
|
|
||||||
this.taskLauncher_ = taskLauncher;
|
|
||||||
initC2DMJNI();
|
|
||||||
while (!C2DMReceiver.unhandledMessages.isEmpty()) {
|
|
||||||
handleMessage(C2DMReceiver.unhandledMessages.get(0));
|
|
||||||
}
|
|
||||||
C2DMReceiver.unhandledMessages.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleError(final String errorID) {
|
|
||||||
this.taskLauncher_.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Receiver.this.onErrorJNI(errorID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleMessage(final Bundle messageParts) {
|
|
||||||
C2DMReceiver.unhandledMessages.remove(messageParts);
|
|
||||||
this.taskLauncher_.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
String str;
|
|
||||||
if (messageParts != null) {
|
|
||||||
Set<String> keySet = messageParts.keySet();
|
|
||||||
Receiver.this.onMessagePartsCountJNI(messageParts.size());
|
|
||||||
for (String str2 : keySet) {
|
|
||||||
try {
|
|
||||||
str = URLDecoder.decode(messageParts.getString(str2), "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
str = "";
|
|
||||||
Log.w(Receiver.TAG, "Receiver ERROR in DECODING the message");
|
|
||||||
}
|
|
||||||
Receiver.this.onMessagePartJNI(str2, str);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.w(Receiver.TAG, "C2DM MESSAGE HAS NO EXTRAS");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleRegistrationID(final String registrationID) {
|
|
||||||
this.taskLauncher_.runInGLThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Receiver.this.onRegisterJNI(registrationID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void initC2DMJNI();
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private native void onErrorJNI(String str);
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private native void onMessagePartJNI(String str, String str2);
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private native void onMessagePartsCountJNI(int i);
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private native void onRegisterJNI(String str);
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private native void onUnRegisterJNI();
|
|
||||||
|
|
||||||
private native void shutdownC2DMJNI();
|
|
||||||
|
|
||||||
public void onDestroy() {
|
|
||||||
shutdownC2DMJNI();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Log.i(TAG, "onReceive()..." + intent.getAction());
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (C2DMConstants.ACTION_REGISTER.equals(action)) {
|
|
||||||
handleRegistrationID(intent.getStringExtra(C2DMConstants.EXTRA_REGISTRATION_ID));
|
|
||||||
} else if (C2DMConstants.ACTION_UNREGISTER.equals(action)) {
|
|
||||||
this.taskLauncher_.runInGLThread(new Runnable() {
|
|
||||||
/* class com.ea.ironmonkey.Receiver.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
Receiver.this.onUnRegisterJNI();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (C2DMConstants.ACTION_MESSAGE.equals(action)) {
|
|
||||||
handleMessage(intent.getExtras());
|
|
||||||
} else if (C2DMConstants.ACTION_ERROR.equals(action)) {
|
|
||||||
handleError(intent.getStringExtra(C2DMConstants.EXTRA_ERROR_ID));
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "unexpected action: " + action);
|
|
||||||
}
|
|
||||||
Log.i(TAG, "...onReceive()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +1,36 @@
|
|||||||
package com.ea.ironmonkey;
|
package com.ea.ironmonkey
|
||||||
|
|
||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView
|
||||||
|
|
||||||
public class RunLoop {
|
class RunLoop(private val glSurfaceView: GLSurfaceView) {
|
||||||
public static final int STATE_RUNNING = 1;
|
private var state = 0
|
||||||
public static final int STATE_STOPPED = 0;
|
|
||||||
private GLSurfaceView glSurfaceView;
|
|
||||||
private int state;
|
|
||||||
|
|
||||||
public RunLoop(GLSurfaceView gLSurfaceView) {
|
init { updateRenderMode() }
|
||||||
this.glSurfaceView = gLSurfaceView;
|
|
||||||
updateRenderMode();
|
private external fun nativeOnRunLoopTick()
|
||||||
|
private fun setState(state: Int) {
|
||||||
|
this.state = state
|
||||||
|
updateRenderMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void nativeOnRunLoopTick();
|
private fun updateRenderMode() {
|
||||||
|
Log.v("RunLoop", "RunLoop.state = $state")
|
||||||
private void setState(int i) {
|
if (state == STATE_STOPPED) glSurfaceView.renderMode = STATE_STOPPED
|
||||||
this.state = i;
|
if (state == STATE_RUNNING) glSurfaceView.renderMode = STATE_RUNNING
|
||||||
updateRenderMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRenderMode() {
|
fun join() = setState(STATE_STOPPED)
|
||||||
Log.v("RunLoop", "RunLoop.state = " + this.state);
|
|
||||||
if(state == STATE_STOPPED) glSurfaceView.setRenderMode(STATE_STOPPED);
|
fun onRunLoopTick() {
|
||||||
if(state == STATE_RUNNING) glSurfaceView.setRenderMode(STATE_RUNNING);
|
if (state == STATE_RUNNING) nativeOnRunLoopTick()
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getState() {
|
fun start() = setState(STATE_RUNNING)
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void join() {
|
fun stop() = setState(STATE_STOPPED)
|
||||||
setState(STATE_STOPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onRunLoopTick() {
|
companion object {
|
||||||
if (state == STATE_RUNNING) nativeOnRunLoopTick();
|
const val STATE_RUNNING = 1
|
||||||
}
|
const val STATE_STOPPED = 0
|
||||||
|
|
||||||
public void start() {
|
|
||||||
setState(STATE_RUNNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
setState(STATE_STOPPED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
package com.ea.ironmonkey;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
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_na.R;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class WebActivity extends Activity {
|
|
||||||
public static String m_Language;
|
|
||||||
private static volatile Runnable m_RunnableBuildAndShowHTML = null;
|
|
||||||
public static String m_URL;
|
|
||||||
public static boolean m_bWorkingState = false;
|
|
||||||
private Bitmap backButton;
|
|
||||||
private Bitmap backButtonPressed;
|
|
||||||
private ImageView backImage;
|
|
||||||
private String m_PageURL = null;
|
|
||||||
private ProgressBar m_progressBar = null;
|
|
||||||
final Handler progressHandler = new Handler() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
WebActivity.this.setProgress(message.arg1);
|
|
||||||
WebActivity.this.m_progressBar.setProgress(message.arg1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private WebView webview;
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
/* access modifiers changed from: public */
|
|
||||||
private void BuildAndShowHTML() {
|
|
||||||
if (this.m_PageURL != null) {
|
|
||||||
this.webview.loadUrl(this.m_PageURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass2 */
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
||||||
if (motionEvent.getAction() == 0) {
|
|
||||||
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButtonPressed);
|
|
||||||
return false;
|
|
||||||
} else if (motionEvent.getAction() != 1) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButton);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.backImage.setOnClickListener(new View.OnClickListener() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass3 */
|
|
||||||
|
|
||||||
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 th) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.webview.setWebChromeClient(new WebChromeClient() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass4 */
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass5 */
|
|
||||||
|
|
||||||
public void onPageFinished(WebView webView, String str) {
|
|
||||||
WebActivity.this.m_progressBar.setVisibility(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceivedError(WebView webView, int i, String str, String str2) {
|
|
||||||
Toast.makeText(WebActivity.this, "Error ! " + str, 0).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
m_RunnableBuildAndShowHTML = new Runnable() {
|
|
||||||
/* class com.ea.ironmonkey.WebActivity.AnonymousClass6 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
WebActivity.this.BuildAndShowHTML();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
runOnUiThread(m_RunnableBuildAndShowHTML);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
|
||||||
if (i != 4) {
|
|
||||||
return super.onKeyDown(i, keyEvent);
|
|
||||||
}
|
|
||||||
this.backImage.setImageBitmap(this.backButtonPressed);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
|
||||||
if (i != 4) {
|
|
||||||
return super.onKeyUp(i, keyEvent);
|
|
||||||
}
|
|
||||||
this.backImage.setImageBitmap(this.backButton);
|
|
||||||
m_bWorkingState = false;
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +1,3 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* android.accounts.Account
|
|
||||||
* android.accounts.AccountManager
|
|
||||||
* android.app.Activity
|
|
||||||
* android.content.Context
|
|
||||||
* android.content.pm.PackageManager$NameNotFoundException
|
|
||||||
* android.net.wifi.WifiManager
|
|
||||||
* android.os.Build
|
|
||||||
* android.os.Build$VERSION
|
|
||||||
* android.telephony.TelephonyManager
|
|
||||||
* android.util.Log
|
|
||||||
* android.util.Patterns
|
|
||||||
*/
|
|
||||||
package com.ea.nimble;
|
package com.ea.nimble;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
@@ -29,9 +13,6 @@ import android.util.Log;
|
|||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
|
|
||||||
import com.ea.nimble.Log.Helper;
|
import com.ea.nimble.Log.Helper;
|
||||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
|
||||||
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|
||||||
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -143,67 +124,7 @@ LogSource {
|
|||||||
* Enabled unnecessary exception pruning
|
* Enabled unnecessary exception pruning
|
||||||
*/
|
*/
|
||||||
private void retrieveGoogleAdvertiserId() {
|
private void retrieveGoogleAdvertiserId() {
|
||||||
synchronized (this) {
|
|
||||||
this.m_googleAdvertiserInfoLoaded = false;
|
|
||||||
Thread thread = new Thread(new Runnable(){
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enabled unnecessary exception pruning
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
block12: {
|
|
||||||
Helper.LOGV(this, "APP_ENV: Running thread to get Google Advertising ID");
|
|
||||||
if (ApplicationEnvironment.getCurrentActivity() != null) {
|
|
||||||
AdvertisingIdClient.Info info2 = null;
|
|
||||||
try {
|
|
||||||
if (ApplicationEnvironment.isMainApplicationRunning()) {
|
|
||||||
info2 = null;
|
|
||||||
info2 = AdvertisingIdClient.getAdvertisingIdInfo(ApplicationEnvironment.getCurrentActivity());
|
|
||||||
}
|
|
||||||
if (info2 != null) {
|
|
||||||
Helper.LOGD(this, "APP_ENV: Setting values for Google Advertising ID and isLimitAdTrackingEnabled flag");
|
|
||||||
ApplicationEnvironmentImpl.access$002(ApplicationEnvironmentImpl.this, info2.getId());
|
|
||||||
ApplicationEnvironmentImpl.access$102(ApplicationEnvironmentImpl.this, info2.isLimitAdTrackingEnabled());
|
|
||||||
break block12;
|
|
||||||
}
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - AdvertisingIdInfo is null");
|
|
||||||
}
|
|
||||||
catch (IOException iOException) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - Unrecoverable error connecting to Google Play Services");
|
|
||||||
}
|
|
||||||
catch (GooglePlayServicesRepairableException googlePlayServicesRepairableException) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - Recoverable error connecting to Google Play Services");
|
|
||||||
}
|
|
||||||
catch (GooglePlayServicesNotAvailableException googlePlayServicesNotAvailableException) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - Google Play Services not available on this device");
|
|
||||||
}
|
|
||||||
catch (IllegalStateException illegalStateException) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - Illegal State Exception " + illegalStateException.getMessage());
|
|
||||||
}
|
|
||||||
catch (Exception exception) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID - General Exception " + exception.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because there is no current activity");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApplicationEnvironmentImpl.access$202(ApplicationEnvironmentImpl.this, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
thread.start();
|
|
||||||
}
|
|
||||||
catch (VerifyError verifyError) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported");
|
|
||||||
this.m_googleAdvertiserInfoLoaded = true;
|
|
||||||
}
|
|
||||||
catch (Throwable throwable) {
|
|
||||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported");
|
|
||||||
this.m_googleAdvertiserInfoLoaded = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setApplicationLanguageCode(String object, boolean bl2) {
|
private void setApplicationLanguageCode(String object, boolean bl2) {
|
||||||
|
|||||||
@@ -6,22 +6,6 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
import com.facebook.AccessToken;
|
|
||||||
import com.facebook.AccessTokenSource;
|
|
||||||
import com.facebook.FacebookException;
|
|
||||||
import com.facebook.FacebookOperationCanceledException;
|
|
||||||
import com.facebook.HttpMethod;
|
|
||||||
import com.facebook.Request;
|
|
||||||
import com.facebook.Response;
|
|
||||||
import com.facebook.Session;
|
|
||||||
import com.facebook.SessionState;
|
|
||||||
import com.facebook.UiLifecycleHelper;
|
|
||||||
import com.facebook.internal.Utility;
|
|
||||||
import com.facebook.model.GraphObject;
|
|
||||||
import com.facebook.model.GraphUser;
|
|
||||||
import com.facebook.widget.WebDialog;
|
|
||||||
import com.google.android.gms.plus.PlusShare;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -31,11 +15,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/FacebookImpl.class */
|
|
||||||
class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEventCallbacks, IApplicationLifecycle.ActivityLifecycleCallbacks, IFacebook, LogSource {
|
class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEventCallbacks, IApplicationLifecycle.ActivityLifecycleCallbacks, IFacebook, LogSource {
|
||||||
static boolean bHasSeenOpening;
|
static boolean bHasSeenOpening;
|
||||||
private static Session.StatusCallback m_sessionCallback;
|
|
||||||
private HashMap<Activity, UiLifecycleHelper> m_fbHelpers;
|
|
||||||
private static String TAG = "Facebook";
|
private static String TAG = "Facebook";
|
||||||
private static List<IFacebook.FacebookCallback> m_callbackQueue = new ArrayList();
|
private static List<IFacebook.FacebookCallback> m_callbackQueue = new ArrayList();
|
||||||
private Map<String, Object> userInfo = null;
|
private Map<String, Object> userInfo = null;
|
||||||
@@ -68,19 +49,11 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv
|
|||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public String getAccessToken() {
|
public String getAccessToken() {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
return activeSession.getAccessToken();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public String getApplicationId() {
|
public String getApplicationId() {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
return activeSession.getApplicationId();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +64,6 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv
|
|||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public Date getExpirationDate() {
|
public Date getExpirationDate() {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
return activeSession.getExpirationDate();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,102 +82,46 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv
|
|||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public boolean hasOpenSession() {
|
public boolean hasOpenSession() {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
return activeSession.isOpened();
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public void login(List<String> list, IFacebook.FacebookCallback facebookCallback) {
|
public void login(List<String> list, IFacebook.FacebookCallback facebookCallback) {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
if (!activeSession.isOpened() || !Utility.isSubset(list, activeSession.getPermissions())) {
|
|
||||||
activeSession.removeCallback(m_sessionCallback);
|
|
||||||
} else {
|
|
||||||
facebookCallback.callback(this, true, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
|
|
||||||
Session session = new Session(currentActivity);
|
|
||||||
Session.setActiveSession(session);
|
|
||||||
Session.OpenRequest openRequest = new Session.OpenRequest(currentActivity);
|
|
||||||
openRequest.setPermissions(list);
|
|
||||||
if (facebookCallback != null) {
|
|
||||||
m_callbackQueue.add(facebookCallback);
|
|
||||||
}
|
|
||||||
openRequest.setCallback(m_sessionCallback);
|
|
||||||
session.openForRead(openRequest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public void logout() {
|
public void logout() {
|
||||||
Session activeSession = Session.getActiveSession();
|
|
||||||
if (activeSession != null) {
|
|
||||||
activeSession.closeAndClearTokenInformation();
|
|
||||||
Session.setActiveSession((Session) null);
|
|
||||||
}
|
|
||||||
this.userInfo = null;
|
|
||||||
this.isUserGraphReady.set(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
UiLifecycleHelper uiLifecycleHelper2 = uiLifecycleHelper;
|
|
||||||
if (uiLifecycleHelper == null) {
|
|
||||||
uiLifecycleHelper2 = new UiLifecycleHelper(activity, m_sessionCallback);
|
|
||||||
this.m_fbHelpers.put(activity, uiLifecycleHelper2);
|
|
||||||
}
|
|
||||||
uiLifecycleHelper2.onCreate(bundle);
|
|
||||||
if (!Utility.isNullOrEmpty(getAccessToken()) && !hasOpenSession()) {
|
|
||||||
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
|
|
||||||
Session session = new Session(currentActivity);
|
|
||||||
Session.setActiveSession(session);
|
|
||||||
session.openForRead(new Session.OpenRequest(currentActivity));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
public void onActivityDestroyed(Activity activity) {
|
public void onActivityDestroyed(Activity activity) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
if (uiLifecycleHelper != null) {
|
|
||||||
uiLifecycleHelper.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
public void onActivityPaused(Activity activity) {
|
public void onActivityPaused(Activity activity) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
if (uiLifecycleHelper != null) {
|
|
||||||
uiLifecycleHelper.onPause();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
||||||
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
|
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
if (uiLifecycleHelper != null) {
|
|
||||||
uiLifecycleHelper.onActivityResult(i, i2, intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
public void onActivityResumed(Activity activity) {
|
public void onActivityResumed(Activity activity) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
if (uiLifecycleHelper != null) {
|
|
||||||
uiLifecycleHelper.onResume();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||||
UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity);
|
|
||||||
if (uiLifecycleHelper != null) {
|
|
||||||
uiLifecycleHelper.onSaveInstanceState(bundle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||||
@@ -230,19 +143,7 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv
|
|||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public void refreshSession(final String str, Date date) {
|
public void refreshSession(final String str, Date date) {
|
||||||
if (!str.equals(getAccessToken()) || (date != null && date.after(getExpirationDate()))) {
|
|
||||||
Log.Helper.LOGI(this, "Refresh Facebook token from %s to %s", getAccessToken(), str);
|
|
||||||
new Session(ApplicationEnvironment.getCurrentActivity()).open(AccessToken.createFromExistingAccessToken(str, date, new Date(), AccessTokenSource.CLIENT_TOKEN, Session.getActiveSession().getPermissions()), new Session.StatusCallback() { // from class: com.ea.nimble.FacebookImpl.2
|
|
||||||
public void call(Session session, SessionState sessionState, Exception exc) {
|
|
||||||
if (exc == null && (sessionState == SessionState.OPENED || sessionState == SessionState.OPENED_TOKEN_UPDATED)) {
|
|
||||||
Session.getActiveSession().close();
|
|
||||||
Session.setActiveSession(session);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.Helper.LOGE(this, "Invalid Facebook accessToken " + str + " from Origin");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -256,125 +157,17 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv
|
|||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public void retrieveFriends(final int i, final int i2, final IFacebook.FacebookFriendsCallback facebookFriendsCallback) {
|
public void retrieveFriends(final int i, final int i2, final IFacebook.FacebookFriendsCallback facebookFriendsCallback) {
|
||||||
if (facebookFriendsCallback != null) {
|
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.ea.nimble.FacebookImpl.4
|
|
||||||
@Override // java.lang.Runnable
|
|
||||||
public void run() {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putInt("offset", i);
|
|
||||||
bundle.putInt("limit", i2);
|
|
||||||
bundle.putString("fields", "name,id,picture.type(normal)");
|
|
||||||
Request.executeBatchAsync(new Request[]{new Request(Session.getActiveSession(), "me/friends", bundle, HttpMethod.GET, new Request.Callback() { // from class: com.ea.nimble.FacebookImpl.4.1
|
|
||||||
public void onCompleted(Response response) {
|
|
||||||
Log.Helper.LOGD(this, response.toString());
|
|
||||||
if (response.getError() != null) {
|
|
||||||
facebookFriendsCallback.callback(Facebook.getComponent(), null, new NimbleFacebookError(NimbleFacebookError.Code.FBSERVER_ERROR, response.getError().toString()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GraphObject graphObject = response.getGraphObject();
|
|
||||||
if (graphObject != null) {
|
|
||||||
try {
|
|
||||||
facebookFriendsCallback.callback(Facebook.getComponent(), graphObject.getInnerJSONObject().getJSONArray("data"), null);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.Helper.LOGE(this, "JSON Exception encountered when parsing the facebook FQL query");
|
|
||||||
facebookFriendsCallback.callback(Facebook.getComponent(), null, new NimbleFacebookError(NimbleFacebookError.Code.RESPONSE_PARSE_ERROR.intValue(), e.toString()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
facebookFriendsCallback.callback(Facebook.getComponent(), null, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // com.ea.nimble.IFacebook
|
@Override // com.ea.nimble.IFacebook
|
||||||
public void sendAppRequest(final String str, final String str2, final String str3, final IFacebook.FacebookCallback facebookCallback) {
|
public void sendAppRequest(final String str, final String str2, final String str3, final IFacebook.FacebookCallback facebookCallback) {
|
||||||
ApplicationEnvironment.getCurrentActivity().runOnUiThread(new Runnable() { // from class: com.ea.nimble.FacebookImpl.3
|
|
||||||
@Override // java.lang.Runnable
|
|
||||||
public void run() {
|
|
||||||
Activity currentActivity = ApplicationEnvironment.getCurrentActivity();
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putString(PlusShare.KEY_CONTENT_DEEP_LINK_METADATA_TITLE, str2);
|
|
||||||
bundle.putString("message", str3);
|
|
||||||
bundle.putString("to", str);
|
|
||||||
WebDialog.Builder builder = new WebDialog.Builder(currentActivity, Session.getActiveSession(), "apprequests", bundle);
|
|
||||||
builder.setOnCompleteListener(new WebDialog.OnCompleteListener() { // from class: com.ea.nimble.FacebookImpl.3.1
|
|
||||||
public void onComplete(Bundle bundle2, FacebookException facebookException) {
|
|
||||||
IFacebook.FacebookCallback facebookCallback2 = facebookCallback;
|
|
||||||
FacebookImpl facebookImpl = FacebookImpl.this;
|
|
||||||
boolean z = facebookException == null;
|
|
||||||
if (facebookException == null || (facebookException instanceof FacebookOperationCanceledException)) {
|
|
||||||
facebookException = null;
|
|
||||||
}
|
|
||||||
facebookCallback2.callback(facebookImpl, z, facebookException);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
WebDialog build = builder.build();
|
|
||||||
build.getWindow().setFlags(1024, 1024);
|
|
||||||
build.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JADX INFO: Access modifiers changed from: protected */
|
|
||||||
@Override // com.ea.nimble.Component
|
@Override // com.ea.nimble.Component
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Log.Helper.LOGV(TAG, "Currently using FB SDK version " + getFacebookSDKVersion() + ".");
|
|
||||||
try {
|
|
||||||
Class.forName("android.os.AsyncTask");
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
}
|
|
||||||
this.m_fbHelpers = new HashMap<>();
|
|
||||||
bHasSeenOpening = false;
|
|
||||||
m_sessionCallback = new Session.StatusCallback() { // from class: com.ea.nimble.FacebookImpl.1
|
|
||||||
public void call(Session session, SessionState sessionState, Exception exc) {
|
|
||||||
IFacebook.FacebookCallback facebookCallback;
|
|
||||||
boolean z;
|
|
||||||
if (sessionState == SessionState.OPENED || sessionState == SessionState.OPENED_TOKEN_UPDATED) {
|
|
||||||
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() { // from class: com.ea.nimble.FacebookImpl.1.1
|
|
||||||
public void onCompleted(GraphUser graphUser, Response response) {
|
|
||||||
Log.Helper.LOGI(this, "Facebook GraphUser data received");
|
|
||||||
if (response.getError() != null || graphUser == null) {
|
|
||||||
Log.Helper.LOGE(this, "Failed to retrieve graph user info");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.Helper.LOGI(this, "Facebook graph user info successfully retrieved");
|
|
||||||
FacebookImpl.this.userInfo = graphUser.asMap();
|
|
||||||
try {
|
|
||||||
FacebookImpl.this.userInfo.put("avatar", "https://graph.facebook.com/" + FacebookImpl.this.userInfo.get("id").toString() + "/picture");
|
|
||||||
FacebookImpl.this.isUserGraphReady.set(true);
|
|
||||||
} catch (Exception e2) {
|
|
||||||
Log.Helper.LOGE(this, "Failed to get facebook user id");
|
|
||||||
FacebookImpl.this.isUserGraphReady.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (sessionState == SessionState.CLOSED || sessionState == SessionState.OPENED || sessionState == SessionState.OPENED_TOKEN_UPDATED) {
|
|
||||||
com.ea.nimble.Utility.sendBroadcast(IFacebook.NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED, null);
|
|
||||||
}
|
|
||||||
if (sessionState == SessionState.OPENING || sessionState == SessionState.CLOSED) {
|
|
||||||
FacebookImpl.bHasSeenOpening = true;
|
|
||||||
} else if ((sessionState != SessionState.CLOSED_LOGIN_FAILED || FacebookImpl.bHasSeenOpening) && FacebookImpl.m_callbackQueue != null) {
|
|
||||||
if (FacebookImpl.m_callbackQueue.size() >= 1 && FacebookImpl.m_callbackQueue.size() <= 1 && (facebookCallback = (IFacebook.FacebookCallback) FacebookImpl.m_callbackQueue.get(0)) != null) {
|
|
||||||
FacebookImpl facebookImpl = FacebookImpl.this;
|
|
||||||
if (exc == null) {
|
|
||||||
z = true;
|
|
||||||
if (sessionState != SessionState.OPENED) {
|
|
||||||
if (sessionState == SessionState.OPENED_TOKEN_UPDATED) {
|
|
||||||
z = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
facebookCallback.callback(facebookImpl, z, exc);
|
|
||||||
}
|
|
||||||
z = false;
|
|
||||||
facebookCallback.callback(facebookImpl, z, exc);
|
|
||||||
}
|
|
||||||
FacebookImpl.m_callbackQueue.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ package com.ea.nimble;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.ea.ironmonkey.devmenu.util.Observer;
|
import com.ea.ironmonkey.devmenu.util.Observer;
|
||||||
import com.google.ads.AdSize;
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.json.JSONTokener;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -64,82 +67,14 @@ public class NetworkConnection implements LogSource, NetworkConnectionHandle, Ru
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String beautifyJSONString(String str) {
|
private String beautifyJSONString(String jsonString) {
|
||||||
if (str == null || str.length() <= 0) {
|
try {
|
||||||
return str;
|
JSONTokener tokener = new JSONTokener(jsonString);
|
||||||
|
JSONObject jsonObject = new JSONObject(tokener);
|
||||||
|
return jsonObject.toString(4);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
return jsonString;
|
||||||
}
|
}
|
||||||
String property = System.getProperty("line.separator");
|
|
||||||
StringBuilder sb = new StringBuilder(str.length() + 2048);
|
|
||||||
Stack stack = new Stack();
|
|
||||||
int i = 0;
|
|
||||||
boolean z = false;
|
|
||||||
boolean z2 = true;
|
|
||||||
for (int i2 = 0; i2 < str.length(); i2++) {
|
|
||||||
char charAt = str.charAt(i2);
|
|
||||||
z2 = z2;
|
|
||||||
i = i;
|
|
||||||
z = z;
|
|
||||||
switch (charAt) {
|
|
||||||
case '\t':
|
|
||||||
case AdSize.LANDSCAPE_AD_HEIGHT /* 32 */:
|
|
||||||
z2 = z2;
|
|
||||||
i = i;
|
|
||||||
z = z;
|
|
||||||
if (!z) {
|
|
||||||
sb.append(charAt);
|
|
||||||
z2 = z2;
|
|
||||||
i = i;
|
|
||||||
z = z;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '\n':
|
|
||||||
case 13 /* 13 */:
|
|
||||||
break;
|
|
||||||
case ',':
|
|
||||||
sb.append(charAt).append(property).append(multiplyStringNTimes("\t", i));
|
|
||||||
z = true;
|
|
||||||
z2 = true;
|
|
||||||
i = i;
|
|
||||||
break;
|
|
||||||
case '[':
|
|
||||||
case '{':
|
|
||||||
if (!z2) {
|
|
||||||
sb.append(property).append(multiplyStringNTimes("\t", i));
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
stack.push(Character.valueOf(charAt));
|
|
||||||
sb.append(charAt).append(property).append(multiplyStringNTimes("\t", i));
|
|
||||||
z = true;
|
|
||||||
z2 = true;
|
|
||||||
break;
|
|
||||||
case ']':
|
|
||||||
case '}':
|
|
||||||
i--;
|
|
||||||
char charValue = ((Character) stack.pop()).charValue();
|
|
||||||
if ((charAt != '}' || charValue == '{') && (charAt != ']' || charValue == '[')) {
|
|
||||||
sb.append(property).append(multiplyStringNTimes("\t", i)).append(charAt);
|
|
||||||
z = true;
|
|
||||||
z2 = z2;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
Log.Helper.LOGE(this, "JSONString expect valid closing brackets but found none");
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
sb.append(charAt);
|
|
||||||
z = false;
|
|
||||||
z2 = false;
|
|
||||||
i = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
Log.Helper.LOGE(this, "JSONString did not close it's brackets, invalid json");
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.XmlResourceParser;
|
import android.content.res.XmlResourceParser;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -127,7 +126,7 @@ public final class Utility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String convertObjectToJSONString(Object object) {
|
public static String convertObjectToJSONString(Object object) {
|
||||||
return new GsonBuilder().disableHtmlEscaping().create().toJson(object);
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getTestResult() {
|
public static boolean getTestResult() {
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
package com.ea.nimble.friends;
|
package com.ea.nimble.friends;
|
||||||
|
|
||||||
import com.ea.nimble.Global;
|
import com.ea.nimble.Global;
|
||||||
import com.ea.nimble.friends.NimbleUser;
|
|
||||||
import com.google.android.gms.plus.PlusShare;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/friends/NimbleFacebookUser.class */
|
|
||||||
class NimbleFacebookUser extends NimbleUser {
|
class NimbleFacebookUser extends NimbleUser {
|
||||||
/* JADX INFO: Access modifiers changed from: package-private */
|
|
||||||
public NimbleFacebookUser(JSONObject jSONObject) {
|
public NimbleFacebookUser(JSONObject jSONObject) {
|
||||||
this.authenticatorId = Global.NIMBLE_AUTHENTICATOR_FACEBOOK;
|
this.authenticatorId = Global.NIMBLE_AUTHENTICATOR_FACEBOOK;
|
||||||
this.userId = jSONObject.optString("id");
|
this.userId = jSONObject.optString("id");
|
||||||
this.displayName = jSONObject.optString("name");
|
this.displayName = jSONObject.optString("name");
|
||||||
this.imageUrl = jSONObject.optJSONObject("picture").optJSONObject("data").optString(PlusShare.KEY_CALL_TO_ACTION_URL);
|
this.imageUrl = jSONObject.optJSONObject("picture").optJSONObject("data").optString("");
|
||||||
this.refreshTimestamp = new Date();
|
this.refreshTimestamp = new Date();
|
||||||
setPlayedCurrentGame(NimbleUser.PlayedCurrentGameFlag.PLAYED);
|
setPlayedCurrentGame(NimbleUser.PlayedCurrentGameFlag.PLAYED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.ea.nimble.friends;
|
package com.ea.nimble.friends;
|
||||||
|
|
||||||
import com.ea.nimble.Error;
|
import com.ea.nimble.Error;
|
||||||
import com.google.android.gms.games.GamesActivityResultCodes;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/friends/NimbleFriendsError.class */
|
|
||||||
public class NimbleFriendsError extends Error {
|
public class NimbleFriendsError extends Error {
|
||||||
public static final String NIMBLE_FRIENDS_ERROR_DOMAIN = "NimbleFriendsError";
|
public static final String NIMBLE_FRIENDS_ERROR_DOMAIN = "NimbleFriendsError";
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
@@ -20,11 +18,11 @@ public class NimbleFriendsError extends Error {
|
|||||||
NIMBLE_FRIENDS_SMS_NOT_SENT_OUT(90007),
|
NIMBLE_FRIENDS_SMS_NOT_SENT_OUT(90007),
|
||||||
NIMBLE_FRIENDS_NO_TARGETS_PROVIDED(90008),
|
NIMBLE_FRIENDS_NO_TARGETS_PROVIDED(90008),
|
||||||
NIMBLE_FRIENDS_SERVER_RETURNED_ERROR(90009),
|
NIMBLE_FRIENDS_SERVER_RETURNED_ERROR(90009),
|
||||||
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED),
|
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(10001),
|
||||||
NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(GamesActivityResultCodes.RESULT_SIGN_IN_FAILED),
|
NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(10002),
|
||||||
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(GamesActivityResultCodes.RESULT_LICENSE_FAILED),
|
NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(10003),
|
||||||
NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(GamesActivityResultCodes.RESULT_APP_MISCONFIGURED),
|
NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(10004),
|
||||||
NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(GamesActivityResultCodes.RESULT_LEFT_ROOM),
|
NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(10005),
|
||||||
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR(10006),
|
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR(10006),
|
||||||
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE(10007),
|
NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE(10007),
|
||||||
NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY(10008),
|
NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY(10008),
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.ea.nimble.friends;
|
|||||||
import com.ea.nimble.Base;
|
import com.ea.nimble.Base;
|
||||||
import com.ea.nimble.Error;
|
import com.ea.nimble.Error;
|
||||||
import com.ea.nimble.NetworkConnectionHandle;
|
import com.ea.nimble.NetworkConnectionHandle;
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -13,7 +11,6 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/friends/NimbleFriendsUtility.class */
|
|
||||||
class NimbleFriendsUtility {
|
class NimbleFriendsUtility {
|
||||||
NimbleFriendsUtility() {
|
NimbleFriendsUtility() {
|
||||||
}
|
}
|
||||||
@@ -31,25 +28,7 @@ class NimbleFriendsUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, Object> parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error {
|
public static HashMap<String, Object> parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error {
|
||||||
InputStream dataStream = networkConnectionHandle.getResponse().getDataStream();
|
return null;
|
||||||
if (dataStream == null || dataStream.toString().length() == 0) {
|
|
||||||
throw new NimbleFriendsError(networkConnectionHandle.getResponse().getStatusCode(), networkConnectionHandle.getResponse().getError().getMessage());
|
|
||||||
}
|
|
||||||
Scanner useDelimiter = new Scanner(dataStream).useDelimiter("\\A");
|
|
||||||
String str = "";
|
|
||||||
if (useDelimiter.hasNext()) {
|
|
||||||
str = useDelimiter.next();
|
|
||||||
}
|
|
||||||
useDelimiter.close();
|
|
||||||
HashMap<String, Object> hashMap = null;
|
|
||||||
if (str != null) {
|
|
||||||
hashMap = null;
|
|
||||||
if (str.length() > 0) {
|
|
||||||
hashMap = (HashMap) new GsonBuilder().serializeNulls().create().fromJson(str, new TypeToken<HashMap<String, Object>>() { // from class: com.ea.nimble.friends.NimbleFriendsUtility.1
|
|
||||||
}.getType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hashMap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JADX INFO: Access modifiers changed from: protected */
|
/* JADX INFO: Access modifiers changed from: protected */
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ import com.ea.nimble.Network;
|
|||||||
import com.ea.nimble.NetworkConnectionCallback;
|
import com.ea.nimble.NetworkConnectionCallback;
|
||||||
import com.ea.nimble.NetworkConnectionHandle;
|
import com.ea.nimble.NetworkConnectionHandle;
|
||||||
import com.ea.nimble.Utility;
|
import com.ea.nimble.Utility;
|
||||||
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
|
||||||
import com.ea.nimble.identity.NimbleIdentityError;
|
|
||||||
import com.ea.nimble.identity.NimbleIdentityLoginParams;
|
|
||||||
import com.facebook.FacebookOperationCanceledException;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -73,26 +69,7 @@ class AuthenticatorFacebook extends AuthenticatorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loginFacebook(IFacebook iFacebook, List<String> list, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
|
private void loginFacebook(IFacebook iFacebook, List<String> list, INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback nimbleIdentityAuthenticatorCallback) {
|
||||||
synchronized (this) {
|
|
||||||
setState(INimbleIdentityAuthenticator.NimbleIdentityAuthenticationState.NIMBLE_IDENTITY_AUTHENTICATION_GOING);
|
|
||||||
if (nimbleIdentityAuthenticatorCallback != null) {
|
|
||||||
this.m_authenticateCallbacks.add(nimbleIdentityAuthenticatorCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iFacebook.login(list, new IFacebook.FacebookCallback() { // from class: com.ea.nimble.identity.AuthenticatorFacebook.1
|
|
||||||
@Override // com.ea.nimble.IFacebook.FacebookCallback
|
|
||||||
public void callback(IFacebook iFacebook2, boolean z, Exception exc) {
|
|
||||||
if (!z) {
|
|
||||||
AuthenticatorFacebook.this.closeAuthentication((exc == null || (exc instanceof FacebookOperationCanceledException)) ? new NimbleIdentityError(NimbleIdentityError.NimbleIdentityErrorCode.NIMBLE_IDENTITY_ERROR_USER_CANCELLED, "Facebook login is cancelled by user") : exc instanceof Error ? (Error) exc : new Error(Error.Code.UNKNOWN, "Unknown error type from Facebook", exc));
|
|
||||||
} else if (!Utility.validString(iFacebook2.getAccessToken())) {
|
|
||||||
AuthenticatorFacebook.this.closeAuthentication(new Error(Error.Code.SYSTEM_UNEXPECTED, "Facebook SDK gives login success without a valid Facebook token"));
|
|
||||||
} else {
|
|
||||||
synchronized (this) {
|
|
||||||
AuthenticatorFacebook.this.exchangeFacebookAccessTokenForAuthCode(iFacebook2.getAccessToken());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JADX INFO: Access modifiers changed from: package-private */
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import android.annotation.SuppressLint;
|
|||||||
import com.ea.nimble.Error;
|
import com.ea.nimble.Error;
|
||||||
import com.ea.nimble.NetworkConnectionHandle;
|
import com.ea.nimble.NetworkConnectionHandle;
|
||||||
import com.ea.nimble.Utility;
|
import com.ea.nimble.Utility;
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -89,29 +87,6 @@ class NimbleIdentityUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ByteArrayOutputStream toJSONString(HashMap<String, Object> hashMap) {
|
public static ByteArrayOutputStream toJSONString(HashMap<String, Object> hashMap) {
|
||||||
IOException e;
|
return null;
|
||||||
UnsupportedEncodingException e2;
|
|
||||||
ByteArrayOutputStream byteArrayOutputStream = null;
|
|
||||||
if (hashMap != null) {
|
|
||||||
try {
|
|
||||||
byte[] bytes = new GsonBuilder().serializeNulls().create().toJson(hashMap, new TypeToken<HashMap<String, Object>>() { // from class: com.ea.nimble.identity.NimbleIdentityUtility.1
|
|
||||||
}.getType()).getBytes("UTF-8");
|
|
||||||
byteArrayOutputStream = new ByteArrayOutputStream(bytes.length);
|
|
||||||
try {
|
|
||||||
byteArrayOutputStream.write(bytes);
|
|
||||||
} catch (UnsupportedEncodingException e3) {
|
|
||||||
e2 = e3;
|
|
||||||
e2.printStackTrace();
|
|
||||||
return null;
|
|
||||||
} catch (IOException e4) {
|
|
||||||
e = e4;
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (UnsupportedEncodingException e5) {
|
|
||||||
e2 = e5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return byteArrayOutputStream;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class InAppMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
Log.Helper.LOGDS("IAM", "IAM initialize", new Object[0]);
|
Log.Helper.LOGDS("IAM", "IAM initialize");
|
||||||
Base.registerComponent(new InAppMessageImpl(), COMPONENT_ID);
|
Base.registerComponent(new InAppMessageImpl(), COMPONENT_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay;
|
|
||||||
|
|
||||||
import com.ea.nimble.mtx.NimbleCatalogItem;
|
|
||||||
import java.io.Externalizable;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectInput;
|
|
||||||
import java.io.ObjectOutput;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GooglePlayCatalogItem
|
|
||||||
extends NimbleCatalogItem
|
|
||||||
implements Externalizable {
|
|
||||||
Map<String, Object> mAdditionalInfo;
|
|
||||||
String mDescription;
|
|
||||||
boolean mIsFree;
|
|
||||||
NimbleCatalogItem.ItemType mItemType;
|
|
||||||
float mPriceDecimal;
|
|
||||||
String mPriceWithCurrencyAndFormat;
|
|
||||||
String mSku;
|
|
||||||
String mTitle;
|
|
||||||
String mUrl;
|
|
||||||
|
|
||||||
public GooglePlayCatalogItem() {
|
|
||||||
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<String, Object>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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<String, Object>(googlePlayCatalogItem.mAdditionalInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getAdditionalInfo() {
|
|
||||||
return this.mAdditionalInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return this.mDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NimbleCatalogItem.ItemType getItemType() {
|
|
||||||
return this.mItemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMetaDataUrl() {
|
|
||||||
return this.mUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getPriceDecimal() {
|
|
||||||
return this.mPriceDecimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPriceWithCurrencyAndFormat() {
|
|
||||||
return this.mPriceWithCurrencyAndFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSku() {
|
|
||||||
return this.mSku;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTitle() {
|
|
||||||
return this.mTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFree() {
|
|
||||||
return this.mIsFree;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
|
|
||||||
this.mSku = objectInput.readUTF();
|
|
||||||
this.mTitle = objectInput.readUTF();
|
|
||||||
this.mDescription = objectInput.readUTF();
|
|
||||||
this.mPriceDecimal = objectInput.readFloat();
|
|
||||||
this.mPriceWithCurrencyAndFormat = objectInput.readUTF();
|
|
||||||
this.mItemType = (NimbleCatalogItem.ItemType)((Object)objectInput.readObject());
|
|
||||||
this.mIsFree = objectInput.readBoolean();
|
|
||||||
this.mAdditionalInfo = (Map)objectInput.readObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "SKU(" + this.mSku + ") Title(" + this.mTitle + ") Price(" + this.mPriceDecimal + ") Currency(" + this.mAdditionalInfo.get("localCurrency") + ") PriceStr(" + this.mPriceWithCurrencyAndFormat + ") ItemType(" + (Object)((Object)this.mItemType) + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeExternal(ObjectOutput objectOutput) throws IOException {
|
|
||||||
objectOutput.writeUTF(this.mSku);
|
|
||||||
objectOutput.writeUTF(this.mTitle);
|
|
||||||
objectOutput.writeUTF(this.mDescription);
|
|
||||||
objectOutput.writeFloat(this.mPriceDecimal);
|
|
||||||
objectOutput.writeUTF(this.mPriceWithCurrencyAndFormat);
|
|
||||||
objectOutput.writeObject((Object)this.mItemType);
|
|
||||||
objectOutput.writeBoolean(this.mIsFree);
|
|
||||||
objectOutput.writeObject(this.mAdditionalInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay;
|
|
||||||
|
|
||||||
import com.ea.nimble.Error;
|
|
||||||
|
|
||||||
class GooglePlayError
|
|
||||||
extends Error {
|
|
||||||
public static final String ERROR_DOMAIN = "GooglePlayError";
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public GooglePlayError() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public GooglePlayError(Code code, String string2) {
|
|
||||||
super(ERROR_DOMAIN, code.intValue(), string2, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GooglePlayError(Code code, String string2, Throwable throwable) {
|
|
||||||
super(ERROR_DOMAIN, code.intValue(), string2, throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static 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(-1001),
|
|
||||||
IABHELPER_BAD_RESPONSE(-1002),
|
|
||||||
IABHELPER_VERIFICATION_FAILED(-1003),
|
|
||||||
IABHELPER_SEND_INTENT_FAILED(-1004),
|
|
||||||
IABHELPER_USER_CANCELLED(-1005),
|
|
||||||
IABHELPER_UNKNOWN_PURCHASE_RESPONSE(-1006),
|
|
||||||
IABHELPER_MISSING_TOKEN(-1007),
|
|
||||||
IABHELPER_BAD_STATE_ERROR(-1008),
|
|
||||||
IABHELPER_UNKNOWN_ERROR(-1009),
|
|
||||||
UNKNOWN(10003);
|
|
||||||
|
|
||||||
private int m_value;
|
|
||||||
|
|
||||||
private Code(int n3) {
|
|
||||||
this.m_value = n3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int intValue() {
|
|
||||||
return this.m_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay;
|
|
||||||
|
|
||||||
import com.ea.nimble.NetworkConnectionCallback;
|
|
||||||
import com.ea.nimble.NetworkConnectionHandle;
|
|
||||||
import com.ea.nimble.mtx.googleplay.GooglePlay;
|
|
||||||
|
|
||||||
public abstract class GooglePlayNetworkConnectionCallback
|
|
||||||
implements NetworkConnectionCallback {
|
|
||||||
String mParameter;
|
|
||||||
GooglePlay mParentGooglePlay;
|
|
||||||
String mTransactionId;
|
|
||||||
|
|
||||||
public GooglePlayNetworkConnectionCallback(GooglePlay googlePlay, String string2, String string3) {
|
|
||||||
this.mParentGooglePlay = googlePlay;
|
|
||||||
this.mTransactionId = string2;
|
|
||||||
this.mParameter = string3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract void callback(NetworkConnectionHandle var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay;
|
|
||||||
|
|
||||||
import com.ea.nimble.Error;
|
|
||||||
import com.ea.nimble.Utility;
|
|
||||||
import com.ea.nimble.mtx.INimbleMTX;
|
|
||||||
import com.ea.nimble.mtx.NimbleMTXTransaction;
|
|
||||||
|
|
||||||
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.Map;
|
|
||||||
|
|
||||||
public class GooglePlayTransaction
|
|
||||||
implements NimbleMTXTransaction,
|
|
||||||
Externalizable {
|
|
||||||
Map<String, Serializable> mAdditionalInfo;
|
|
||||||
GooglePlayCatalogItem mCatalogItem = null;
|
|
||||||
String mDeveloperPayload = "";
|
|
||||||
Exception mError = null;
|
|
||||||
GooglePlayTransactionState mFailedState = null;
|
|
||||||
INimbleMTX.FinalizeTransactionCallback mFinalizeCallback = null;
|
|
||||||
GooglePlayTransactionState mGooglePlayTransactionState = GooglePlayTransactionState.UNDEFINED;
|
|
||||||
boolean mIsRecorded = false;
|
|
||||||
INimbleMTX.ItemGrantedCallback mItemGrantedCallback = null;
|
|
||||||
String mItemSku = "";
|
|
||||||
String mNonce = "";
|
|
||||||
float mPriceDecimal = 0.0f;
|
|
||||||
INimbleMTX.PurchaseTransactionCallback mPurchaseCallback = null;
|
|
||||||
String mReceipt = "";
|
|
||||||
Date mTimeStamp = null;
|
|
||||||
String mTransactionId = "";
|
|
||||||
NimbleMTXTransaction.TransactionType mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE;
|
|
||||||
|
|
||||||
public GooglePlayTransaction() {
|
|
||||||
this.mAdditionalInfo = new HashMap<String, Serializable>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getAdditionalInfo() {
|
|
||||||
return new HashMap<String, Object>(this.mAdditionalInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GooglePlayCatalogItem getCatalogItem() {
|
|
||||||
return this.mCatalogItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeveloperPayload() {
|
|
||||||
return this.mDeveloperPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Exception getError() {
|
|
||||||
return this.mError;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemSku() {
|
|
||||||
return this.mItemSku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNonce() {
|
|
||||||
return this.mNonce;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getPriceDecimal() {
|
|
||||||
return this.mPriceDecimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReceipt() {
|
|
||||||
return this.mReceipt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getTimeStamp() {
|
|
||||||
return this.mTimeStamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransactionId() {
|
|
||||||
return this.mTransactionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NimbleMTXTransaction.TransactionState getTransactionState() {
|
|
||||||
switch (this.mGooglePlayTransactionState.ordinal()) {
|
|
||||||
default: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.UNDEFINED;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.USER_INITIATED;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.WAITING_FOR_PREPURCHASE_INFO;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.WAITING_FOR_PLATFORM_RESPONSE;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.WAITING_FOR_VERIFICATION;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT;
|
|
||||||
}
|
|
||||||
case 6: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.WAITING_FOR_PLATFORM_CONSUMPTION;
|
|
||||||
}
|
|
||||||
case 7: {
|
|
||||||
return NimbleMTXTransaction.TransactionState.COMPLETE;
|
|
||||||
}
|
|
||||||
case 8:
|
|
||||||
}
|
|
||||||
return NimbleMTXTransaction.TransactionState.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NimbleMTXTransaction.TransactionType getTransactionType() {
|
|
||||||
return this.mTransactionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
|
|
||||||
this.mTransactionId = objectInput.readUTF();
|
|
||||||
this.mItemSku = objectInput.readUTF();
|
|
||||||
this.mGooglePlayTransactionState = (GooglePlayTransactionState)((Object)objectInput.readObject());
|
|
||||||
this.mTransactionType = (NimbleMTXTransaction.TransactionType)((Object)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)((Object)objectInput.readObject());
|
|
||||||
this.mIsRecorded = objectInput.readBoolean();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (IOException iOException) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "GooglePlayTransaction: SKU(" + this.getItemSku() + ") " + "State(" + this.mGooglePlayTransactionState.toString() + ") " + "Receipt(" + this.getReceipt() + ") " + "TimeStamp(" + this.getTimeStamp() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeExternal(ObjectOutput objectOutput) throws IOException {
|
|
||||||
objectOutput.writeUTF(Utility.safeString(this.mTransactionId));
|
|
||||||
objectOutput.writeUTF(Utility.safeString(this.mItemSku));
|
|
||||||
objectOutput.writeObject((Object)this.mGooglePlayTransactionState);
|
|
||||||
objectOutput.writeObject((Object)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((Object)this.mFailedState);
|
|
||||||
objectOutput.writeBoolean(this.mIsRecorded);
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum GooglePlayTransactionState {
|
|
||||||
UNDEFINED("UNDEFINED"),
|
|
||||||
USER_INITIATED("USER_INITIATED"),
|
|
||||||
WAITING_FOR_NONCE("WAITING_FOR_NONCE"),
|
|
||||||
WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE("WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE"),
|
|
||||||
WAITING_FOR_SYNERGY_VERIFICATION("WAITING_FOR_SYNERGY_VERIFICATION"),
|
|
||||||
WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT("WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT"),
|
|
||||||
WAITING_FOR_GOOGLEPLAY_CONSUMPTION("WAITING_FOR_GOOGLEPLAY_CONSUMPTION"),
|
|
||||||
COMPLETE("COMPLETE");
|
|
||||||
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
GooglePlayTransactionState(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/util/Base64.class */
|
|
||||||
public class Base64 {
|
|
||||||
static final /* synthetic */ boolean $assertionsDisabled;
|
|
||||||
private static final byte[] ALPHABET;
|
|
||||||
private static final byte[] DECODABET;
|
|
||||||
public static final boolean DECODE = false;
|
|
||||||
public static final boolean ENCODE = true;
|
|
||||||
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[] WEBSAFE_ALPHABET;
|
|
||||||
private static final byte[] WEBSAFE_DECODABET;
|
|
||||||
private static final byte WHITE_SPACE_ENC = -5;
|
|
||||||
|
|
||||||
static {
|
|
||||||
$assertionsDisabled = !Base64.class.desiredAssertionStatus();
|
|
||||||
ALPHABET = new byte[]{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};
|
|
||||||
WEBSAFE_ALPHABET = new byte[]{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};
|
|
||||||
DECODABET = new byte[]{-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, -1, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 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};
|
|
||||||
WEBSAFE_DECODABET = new byte[]{-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, -1, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decode(String str) throws Base64DecoderException {
|
|
||||||
byte[] bytes = str.getBytes();
|
|
||||||
return decode(bytes, 0, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decode(byte[] bArr) throws Base64DecoderException {
|
|
||||||
return decode(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[] decode(byte[] bArr, int i, int i2, byte[] bArr2) throws Base64DecoderException {
|
|
||||||
byte[] bArr3 = new byte[((i2 * 3) / 4) + 2];
|
|
||||||
int i3 = 0;
|
|
||||||
byte[] bArr4 = new byte[4];
|
|
||||||
int i4 = 0;
|
|
||||||
int i5 = 0;
|
|
||||||
while (i4 < i2) {
|
|
||||||
byte b = (byte) (bArr[i4 + i] & Byte.MAX_VALUE);
|
|
||||||
byte b2 = bArr2[b];
|
|
||||||
if (b2 >= WHITE_SPACE_ENC) {
|
|
||||||
if (b2 < -1) {
|
|
||||||
i3 = i3;
|
|
||||||
} else if (b == EQUALS_SIGN) {
|
|
||||||
int i6 = i2 - i4;
|
|
||||||
byte b3 = (byte) (bArr[(i2 - 1) + i] & Byte.MAX_VALUE);
|
|
||||||
if (i5 == 0 || i5 == 1) {
|
|
||||||
throw new Base64DecoderException("invalid padding byte '=' at byte offset " + i4);
|
|
||||||
} else if (i5 == 3 && i6 > 2) {
|
|
||||||
throw new Base64DecoderException("padding byte '=' falsely signals end of encoded value at offset " + i4);
|
|
||||||
} else if (b3 != EQUALS_SIGN && b3 != 10) {
|
|
||||||
throw new Base64DecoderException("encoded value has invalid trailing byte");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int i7 = i5 + 1;
|
|
||||||
bArr4[i5] = b;
|
|
||||||
i5 = i7;
|
|
||||||
i3 = i3;
|
|
||||||
if (i7 == 4) {
|
|
||||||
i3 += decode4to3(bArr4, 0, bArr3, i3, bArr2);
|
|
||||||
i5 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i4++;
|
|
||||||
} else {
|
|
||||||
throw new Base64DecoderException("Bad Base64 input character at " + i4 + ": " + ((int) bArr[i4 + i]) + "(decimal)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i5 != 0) {
|
|
||||||
if (i5 == 1) {
|
|
||||||
throw new Base64DecoderException("single trailing character at offset " + (i2 - 1));
|
|
||||||
}
|
|
||||||
bArr4[i5] = EQUALS_SIGN;
|
|
||||||
i3 += decode4to3(bArr4, 0, bArr3, i3, bArr2);
|
|
||||||
}
|
|
||||||
byte[] bArr5 = new byte[i3];
|
|
||||||
System.arraycopy(bArr3, 0, bArr5, 0, i3);
|
|
||||||
return bArr5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int decode4to3(byte[] bArr, int i, byte[] bArr2, int i2, byte[] bArr3) {
|
|
||||||
if (bArr[i + 2] == EQUALS_SIGN) {
|
|
||||||
bArr2[i2] = (byte) ((((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12)) >>> 16);
|
|
||||||
return 1;
|
|
||||||
} else if (bArr[i + 3] == EQUALS_SIGN) {
|
|
||||||
int i3 = ((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i + 2]] << 24) >>> 18);
|
|
||||||
bArr2[i2] = (byte) (i3 >>> 16);
|
|
||||||
bArr2[i2 + 1] = (byte) (i3 >>> 8);
|
|
||||||
return 2;
|
|
||||||
} else {
|
|
||||||
int i4 = ((bArr3[bArr[i]] << 24) >>> 6) | ((bArr3[bArr[i + 1]] << 24) >>> 12) | ((bArr3[bArr[i + 2]] << 24) >>> 18) | ((bArr3[bArr[i + 3]] << 24) >>> 24);
|
|
||||||
bArr2[i2] = (byte) (i4 >> 16);
|
|
||||||
bArr2[i2 + 1] = (byte) (i4 >> 8);
|
|
||||||
bArr2[i2 + 2] = (byte) i4;
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(String str) throws Base64DecoderException {
|
|
||||||
byte[] bytes = str.getBytes();
|
|
||||||
return decodeWebSafe(bytes, 0, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(byte[] bArr) throws Base64DecoderException {
|
|
||||||
return decodeWebSafe(bArr, 0, bArr.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] decodeWebSafe(byte[] bArr, int i, int i2) throws Base64DecoderException {
|
|
||||||
return decode(bArr, i, i2, WEBSAFE_DECODABET);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encode(byte[] bArr) {
|
|
||||||
return encode(bArr, 0, bArr.length, ALPHABET, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encode(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
|
|
||||||
byte[] encode = encode(bArr, i, i2, bArr2, Integer.MAX_VALUE);
|
|
||||||
int length = encode.length;
|
|
||||||
while (!z && length > 0 && encode[length - 1] == EQUALS_SIGN) {
|
|
||||||
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 / i3) + i4];
|
|
||||||
int i5 = 0;
|
|
||||||
int i6 = 0;
|
|
||||||
int i7 = 0;
|
|
||||||
while (i5 < i2 - 2) {
|
|
||||||
int i8 = ((bArr[i5 + i] << 24) >>> 8) | ((bArr[(i5 + 1) + i] << 24) >>> 16) | ((bArr[(i5 + 2) + i] << 24) >>> 24);
|
|
||||||
bArr3[i6] = bArr2[i8 >>> 18];
|
|
||||||
bArr3[i6 + 1] = bArr2[(i8 >>> 12) & 63];
|
|
||||||
bArr3[i6 + 2] = bArr2[(i8 >>> 6) & 63];
|
|
||||||
bArr3[i6 + 3] = bArr2[i8 & 63];
|
|
||||||
int i9 = i7 + 4;
|
|
||||||
int i10 = i6;
|
|
||||||
i7 = i9;
|
|
||||||
if (i9 == i3) {
|
|
||||||
bArr3[i6 + 4] = 10;
|
|
||||||
i10 = i6 + 1;
|
|
||||||
i7 = 0;
|
|
||||||
}
|
|
||||||
i5 += 3;
|
|
||||||
i6 = i10 + 4;
|
|
||||||
}
|
|
||||||
int i11 = i6;
|
|
||||||
if (i5 < i2) {
|
|
||||||
encode3to4(bArr, i5 + i, i2 - i5, bArr3, i6, bArr2);
|
|
||||||
int i12 = i6;
|
|
||||||
if (i7 + 4 == i3) {
|
|
||||||
bArr3[i6 + 4] = 10;
|
|
||||||
i12 = i6 + 1;
|
|
||||||
}
|
|
||||||
i11 = i12 + 4;
|
|
||||||
}
|
|
||||||
if ($assertionsDisabled || i11 == bArr3.length) {
|
|
||||||
return bArr3;
|
|
||||||
}
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] encode3to4(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
|
|
||||||
int i4 = 0;
|
|
||||||
int i5 = i2 > 0 ? (bArr[i] << 24) >>> 8 : 0;
|
|
||||||
int i6 = i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0;
|
|
||||||
if (i2 > 2) {
|
|
||||||
i4 = (bArr[i + 2] << 24) >>> 24;
|
|
||||||
}
|
|
||||||
int i7 = i6 | i5 | i4;
|
|
||||||
switch (i2) {
|
|
||||||
case 1:
|
|
||||||
bArr2[i3] = bArr3[i7 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i7 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = EQUALS_SIGN;
|
|
||||||
bArr2[i3 + 3] = EQUALS_SIGN;
|
|
||||||
return bArr2;
|
|
||||||
case 2:
|
|
||||||
bArr2[i3] = bArr3[i7 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i7 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = bArr3[(i7 >>> 6) & 63];
|
|
||||||
bArr2[i3 + 3] = EQUALS_SIGN;
|
|
||||||
return bArr2;
|
|
||||||
case 3:
|
|
||||||
bArr2[i3] = bArr3[i7 >>> 18];
|
|
||||||
bArr2[i3 + 1] = bArr3[(i7 >>> 12) & 63];
|
|
||||||
bArr2[i3 + 2] = bArr3[(i7 >>> 6) & 63];
|
|
||||||
bArr2[i3 + 3] = bArr3[i7 & 63];
|
|
||||||
return bArr2;
|
|
||||||
default:
|
|
||||||
return bArr2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encodeWebSafe(byte[] bArr, boolean z) {
|
|
||||||
return encode(bArr, 0, bArr.length, WEBSAFE_ALPHABET, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
public class Base64DecoderException
|
|
||||||
extends Exception {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public Base64DecoderException() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Base64DecoderException(String string2) {
|
|
||||||
super(string2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
import com.ea.nimble.mtx.googleplay.util.IabResult;
|
|
||||||
|
|
||||||
public class IabException
|
|
||||||
extends Exception {
|
|
||||||
private static final long serialVersionUID = 5626567164828265535L;
|
|
||||||
IabResult mResult;
|
|
||||||
|
|
||||||
public IabException(int n2, String string2) {
|
|
||||||
this(new IabResult(n2, string2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IabException(int n2, String string2, Exception exception) {
|
|
||||||
this(new IabResult(n2, string2), exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IabException(IabResult iabResult) {
|
|
||||||
this(iabResult, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IabException(IabResult iabResult, Exception exception) {
|
|
||||||
super(iabResult.getMessage(), exception);
|
|
||||||
this.mResult = iabResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IabResult getResult() {
|
|
||||||
return this.mResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,574 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* android.app.Activity
|
|
||||||
* android.app.PendingIntent
|
|
||||||
* android.content.BroadcastReceiver
|
|
||||||
* android.content.ComponentName
|
|
||||||
* android.content.Context
|
|
||||||
* android.content.Intent
|
|
||||||
* android.content.IntentFilter
|
|
||||||
* android.content.IntentSender$SendIntentException
|
|
||||||
* android.content.ServiceConnection
|
|
||||||
* android.content.pm.ResolveInfo
|
|
||||||
* android.os.Bundle
|
|
||||||
* android.os.Handler
|
|
||||||
* android.os.IBinder
|
|
||||||
* android.os.Looper
|
|
||||||
* android.os.RemoteException
|
|
||||||
* android.text.TextUtils
|
|
||||||
* org.json.JSONException
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
import com.ea.ironmonkey.devmenu.util.Observer;
|
|
||||||
import com.ea.nimble.Log;
|
|
||||||
import com.ea.nimble.LogSource;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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_BAD_STATE_ERROR = -1008;
|
|
||||||
public static final int IABHELPER_ERROR_BASE = -1000;
|
|
||||||
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_UNKNOWN_ERROR = -1009;
|
|
||||||
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 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";
|
|
||||||
boolean mAsyncInProgress = false;
|
|
||||||
AsyncOperation mAsyncOperation;
|
|
||||||
LinkedList<AsyncOperation> mAsyncRequestQueue;
|
|
||||||
Context mContext;
|
|
||||||
boolean mDebugLog = false;
|
|
||||||
String mDebugTag = "IabHelper";
|
|
||||||
OnIabPurchaseFinishedListener mPurchaseListener;
|
|
||||||
IabPurchaseUpdateReceiver mPurchaseUpdateReceiver = null;
|
|
||||||
int mRequestCode;
|
|
||||||
ServiceConnection mServiceConn;
|
|
||||||
boolean mSetupDone = false;
|
|
||||||
String mSignatureBase64 = null;
|
|
||||||
|
|
||||||
public IabHelper(Context context, String string2) {
|
|
||||||
this.mContext = context.getApplicationContext();
|
|
||||||
if (this.mContext == null) {
|
|
||||||
this.logError("IabHelper initializing with null application context!");
|
|
||||||
}
|
|
||||||
this.mSignatureBase64 = string2;
|
|
||||||
this.logDebug("IAB helper created.");
|
|
||||||
this.mAsyncRequestQueue = new LinkedList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkAndPopAsyncQueue() {
|
|
||||||
if (this.mAsyncRequestQueue.size() <= 0) return;
|
|
||||||
AsyncOperation asyncOperation = this.mAsyncRequestQueue.removeFirst();
|
|
||||||
this.flagStartAsync(asyncOperation);
|
|
||||||
asyncOperation.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enqueueOperation(AsyncOperation asyncOperation) {
|
|
||||||
this.logDebug("Enqueuing operation " + asyncOperation.getName() + " to execute after current async op, " + this.mAsyncOperation.getName() + ", is finished.");
|
|
||||||
this.mAsyncRequestQueue.add(asyncOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getResponseDesc(int n2) {
|
|
||||||
String[] stringArray = "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[] stringArray2 = "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".split("/");
|
|
||||||
if (n2 <= -1000) {
|
|
||||||
int n3 = -1000 - n2;
|
|
||||||
if (n3 < 0) return String.valueOf(n2) + ":Unknown IAB Helper Error";
|
|
||||||
if (n3 >= stringArray2.length) return String.valueOf(n2) + ":Unknown IAB Helper Error";
|
|
||||||
return stringArray2[n3];
|
|
||||||
}
|
|
||||||
if (n2 < 0) return String.valueOf(n2) + ":Unknown";
|
|
||||||
if (n2 < stringArray.length) return stringArray[n2];
|
|
||||||
return String.valueOf(n2) + ":Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startOrQueueRunnable(AsyncOperation asyncOperation) {
|
|
||||||
synchronized (this) {
|
|
||||||
if (this.isAsyncInProgress()) {
|
|
||||||
this.enqueueOperation(asyncOperation);
|
|
||||||
} else {
|
|
||||||
this.flagStartAsync(asyncOperation);
|
|
||||||
asyncOperation.run();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkSetupDone(String string2) {
|
|
||||||
if (this.mSetupDone) return;
|
|
||||||
this.logError("Illegal state for operation (" + string2 + "): IAB helper is not set up.");
|
|
||||||
throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void consume(Purchase purchase) throws IabException {
|
|
||||||
String string2;
|
|
||||||
String string3;
|
|
||||||
this.checkSetupDone("consume");
|
|
||||||
string3 = purchase.getToken();
|
|
||||||
string2 = purchase.getSku();
|
|
||||||
if (string3 == null || string3.equals("")) {
|
|
||||||
this.logError("Can't consume " + string2 + ". No token.");
|
|
||||||
throw new IabException(-1007, "PurchaseInfo is missing token for sku: " + string2 + " " + purchase);
|
|
||||||
}
|
|
||||||
this.logDebug("Consuming sku: " + string2 + ", token: " + string3);
|
|
||||||
int n2 = 0;
|
|
||||||
this.logDebug("Successfully consumed sku: " + string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void consumeAsync(Purchase purchase, OnConsumeFinishedListener onConsumeFinishedListener) {
|
|
||||||
ArrayList<Purchase> arrayList = new ArrayList<Purchase>();
|
|
||||||
arrayList.add(purchase);
|
|
||||||
this.consumeAsyncInternal(arrayList, onConsumeFinishedListener, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void consumeAsync(List<Purchase> list, OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) {
|
|
||||||
this.consumeAsyncInternal(list, null, onConsumeMultiFinishedListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
void consumeAsyncInternal(final List<Purchase> list, final OnConsumeFinishedListener onConsumeFinishedListener, OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) {
|
|
||||||
Looper looper;
|
|
||||||
Looper looper2 = looper = Looper.myLooper();
|
|
||||||
if (looper == null) {
|
|
||||||
looper2 = Looper.getMainLooper();
|
|
||||||
}
|
|
||||||
final Handler h = new Handler(looper2);
|
|
||||||
this.startOrQueueRunnable(new AsyncOperation("consume", true, new Runnable(){
|
|
||||||
final /* synthetic */ Handler handler = h;
|
|
||||||
/* synthetic */ final OnConsumeMultiFinishedListener val$multiListener = onConsumeMultiFinishedListener;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
final ArrayList<IabResult> arrayList = new ArrayList<IabResult>();
|
|
||||||
for (Purchase purchase : list) {
|
|
||||||
try {
|
|
||||||
IabHelper.this.consume(purchase);
|
|
||||||
arrayList.add(new IabResult(0, "Successful consume of sku " + purchase.getSku()));
|
|
||||||
}
|
|
||||||
catch (IabException iabException) {
|
|
||||||
arrayList.add(iabException.getResult());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IabHelper.this.flagEndAsync();
|
|
||||||
if (onConsumeFinishedListener != null) {
|
|
||||||
this.handler.post(() -> onConsumeFinishedListener.onConsumeFinished((Purchase)list.get(0), (IabResult)arrayList.get(0)));
|
|
||||||
}
|
|
||||||
if (this.val$multiListener == null) return;
|
|
||||||
this.handler.post(() -> val$multiListener.onConsumeMultiFinished(list, arrayList));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose() {
|
|
||||||
this.logDebug("Disposing.");
|
|
||||||
this.mSetupDone = false;
|
|
||||||
if (this.mServiceConn == null) return;
|
|
||||||
this.logDebug("Unbinding from service.");
|
|
||||||
if (this.mContext != null) {
|
|
||||||
this.mContext.unbindService(this.mServiceConn);
|
|
||||||
}
|
|
||||||
this.mServiceConn = null;
|
|
||||||
this.mPurchaseListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableDebugLogging(boolean bl2) {
|
|
||||||
this.mDebugLog = bl2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableDebugLogging(boolean bl2, String string2) {
|
|
||||||
this.mDebugLog = bl2;
|
|
||||||
this.mDebugTag = string2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void flagEndAsync() {
|
|
||||||
synchronized (this) {
|
|
||||||
this.logDebug("Ending async operation: " + this.mAsyncOperation.getName());
|
|
||||||
this.mAsyncOperation = null;
|
|
||||||
this.mAsyncInProgress = false;
|
|
||||||
this.checkAndPopAsyncQueue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
this.logDebug("Starting async operation: " + asyncOperation.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLogSourceTitle() {
|
|
||||||
return "MTX Google IABHelper";
|
|
||||||
}
|
|
||||||
|
|
||||||
int getResponseCodeFromBundle(Bundle object) {
|
|
||||||
if (object.get(RESPONSE_CODE) == null) {
|
|
||||||
this.logDebug("Bundle with null response code, assuming OK (known issue)");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
this.logError("Unexpected type for bundle response code.");
|
|
||||||
this.logError(object.getClass().getName());
|
|
||||||
throw new RuntimeException("Unexpected type for bundle response code: " + object.getClass().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
int getResponseCodeFromIntent(Intent object) {
|
|
||||||
if (object.getExtras().get(RESPONSE_CODE) == null) {
|
|
||||||
this.logError("Intent with no response code, assuming OK (known issue)");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
this.logError("Unexpected type for intent response code.");
|
|
||||||
this.logError(object.getClass().getName());
|
|
||||||
throw new RuntimeException("Unexpected type for intent response code: " + object.getClass().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean handleActivityResult(int n2, int n3, Intent object) {
|
|
||||||
this.logDebug("handleActivityResult...");
|
|
||||||
if (n2 != this.mRequestCode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.checkSetupDone("handleActivityResult");
|
|
||||||
this.flagEndAsync();
|
|
||||||
if (object == null) {
|
|
||||||
this.logError("Null data in IAB activity result.");
|
|
||||||
IabResult result = new IabResult(-1002, "Null data in IAB result");
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(result, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
n2 = this.getResponseCodeFromIntent((Intent)object);
|
|
||||||
String string2 = object.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
|
|
||||||
String string3 = object.getStringExtra(RESPONSE_INAPP_SIGNATURE);
|
|
||||||
if (n3 == -1 && n2 == 0) {
|
|
||||||
this.logDebug("Successful resultcode from purchase activity.");
|
|
||||||
this.logDebug("Purchase data: " + string2);
|
|
||||||
this.logDebug("Data signature: " + string3);
|
|
||||||
this.logDebug("Extras: " + object.getExtras());
|
|
||||||
if (string2 == null || string3 == null) {
|
|
||||||
this.logError("BUG: either purchaseData or dataSignature is null.");
|
|
||||||
this.logDebug("Extras: " + object.getExtras().toString());
|
|
||||||
IabResult iabResult = new IabResult(-1009, "IAB returned null purchaseData or dataSignature");
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Purchase purchase = new Purchase(string2, string3);
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(new IabResult(0, "Success"), purchase);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (JSONException jSONException) {
|
|
||||||
this.logError("Failed to parse purchase data.");
|
|
||||||
jSONException.printStackTrace();
|
|
||||||
IabResult iabResult = new IabResult(-1002, "Failed to parse purchase data.");
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (n3 == -1) {
|
|
||||||
this.logDebug("Result code was OK but in-app billing response was not OK: " + IabHelper.getResponseDesc(n2));
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
IabResult iabResult = new IabResult(n2, "Problem purchashing item.");
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (n3 == 0) {
|
|
||||||
this.logDebug("Google Play Activity canceled - Response: " + IabHelper.getResponseDesc(n2));
|
|
||||||
IabResult iabResult = new IabResult(n2, "Problem purchashing item.");
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
this.logError("Purchase failed. Result code: " + Integer.toString(n3) + ". Response: " + IabHelper.getResponseDesc(n2));
|
|
||||||
IabResult iabResult = new IabResult(-1006, "Unknown purchase response.");
|
|
||||||
if (this.mPurchaseListener == null) return true;
|
|
||||||
this.mPurchaseListener.onIabPurchaseFinished(iabResult, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isAsyncInProgress() {
|
|
||||||
return this.mAsyncInProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isServiceAvailable() {
|
|
||||||
return this.mSetupDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void launchPurchaseFlow(Activity activity, String string2, int n2, OnIabPurchaseFinishedListener onIabPurchaseFinishedListener) {
|
|
||||||
this.launchPurchaseFlow(activity, string2, n2, onIabPurchaseFinishedListener, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void launchPurchaseFlow(final Activity activity, final String string2, final int n2, final OnIabPurchaseFinishedListener onIabPurchaseFinishedListener, final String string3) {
|
|
||||||
synchronized (this) {
|
|
||||||
this.startOrQueueRunnable(new AsyncOperation("launchPurchaseFlow", false, new Runnable(){
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
|
||||||
* Enabled unnecessary exception pruning
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Object object = new Object();
|
|
||||||
IabHelper.this.logDebug("Constructing buy intent for " + string2);
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
int n22 = IabHelper.this.getResponseCodeFromBundle(bundle);
|
|
||||||
if (n22 != 0) {
|
|
||||||
IabHelper.this.logDebug("BuyIntent Bundle: " + object);
|
|
||||||
IabHelper.this.logError("Unable to buy item, Error response: " + IabHelper.getResponseDesc(n22));
|
|
||||||
IabHelper.this.flagEndAsync();
|
|
||||||
object = new IabResult(n22, "Unable to buy item");
|
|
||||||
OnIabPurchaseFinishedListener onIabPurchaseFinishedListener2 = onIabPurchaseFinishedListener;
|
|
||||||
if (onIabPurchaseFinishedListener2 == null) return;
|
|
||||||
try {
|
|
||||||
onIabPurchaseFinishedListener.onIabPurchaseFinished((IabResult) object, null);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
IabHelper.this.logError("Uncaught exception in listener's onIabPurchaseFinished: " + exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void logDebug(String string2) {
|
|
||||||
Log.Helper.LOGD(this, string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void logError(String string2) {
|
|
||||||
Log.Helper.LOGE(this, string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void logWarn(String string2) {
|
|
||||||
Log.Helper.LOGW(this, string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
|
||||||
* Enabled unnecessary exception pruning
|
|
||||||
*/
|
|
||||||
public Inventory queryInventory(boolean bl2, boolean bl3, List<String> list) throws IabException {
|
|
||||||
int n2 = 0;
|
|
||||||
Inventory inventory;
|
|
||||||
try {
|
|
||||||
this.checkSetupDone("queryInventory");
|
|
||||||
inventory = new Inventory();
|
|
||||||
if (bl2 && (n2 = this.queryPurchases(inventory)) != 0) {
|
|
||||||
throw new IabException(n2, "Error refreshing inventory (querying owned items).");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (RemoteException remoteException) {
|
|
||||||
throw new IabException(-1001, "Remote exception while refreshing inventory.", remoteException);
|
|
||||||
}
|
|
||||||
catch (JSONException jSONException) {
|
|
||||||
throw new IabException(-1002, "Error parsing JSON response while refreshing inventory.", jSONException);
|
|
||||||
}
|
|
||||||
catch (IllegalStateException illegalStateException) {
|
|
||||||
throw new IabException(-1008, "IabHelper in a bad state (billing service not connected, application context is null, etc.", illegalStateException);
|
|
||||||
}
|
|
||||||
if (!bl3) return inventory;
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
n2 = this.querySkuDetails(inventory, list);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (n2 == 0) return inventory;
|
|
||||||
throw new IabException(n2, "Error refreshing inventory (querying prices of items).");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queryInventoryAsync(QueryInventoryFinishedListener queryInventoryFinishedListener) {
|
|
||||||
this.queryInventoryAsync(true, true, null, queryInventoryFinishedListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queryInventoryAsync(boolean bl2, boolean bl3, QueryInventoryFinishedListener queryInventoryFinishedListener) {
|
|
||||||
this.queryInventoryAsync(bl2, bl3, null, queryInventoryFinishedListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queryInventoryAsync(final boolean bl2, final boolean bl3, final List<String> list, QueryInventoryFinishedListener queryInventoryFinishedListener) {
|
|
||||||
Looper looper;
|
|
||||||
Looper looper2 = looper = Looper.myLooper();
|
|
||||||
if (looper == null) {
|
|
||||||
looper2 = Looper.getMainLooper();
|
|
||||||
}
|
|
||||||
final Handler handler = new Handler(looper2);
|
|
||||||
final QueryInventoryFinishedListener queryInventoryFinishedListener1 = queryInventoryFinishedListener;
|
|
||||||
this.startOrQueueRunnable(new AsyncOperation("queryInventory", true, new Runnable(){
|
|
||||||
final Handler handler2 = handler;
|
|
||||||
final QueryInventoryFinishedListener listener = queryInventoryFinishedListener1;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
IabResult iabResult = new IabResult(0, "Inventory refresh successful."); // var2_1
|
|
||||||
Inventory inventory = null;
|
|
||||||
try {
|
|
||||||
inventory = IabHelper.this.queryInventory(bl2, bl3, list);
|
|
||||||
IabHelper.this.flagEndAsync();
|
|
||||||
}
|
|
||||||
catch (IabException var2_2) {
|
|
||||||
iabResult = var2_2.getResult();
|
|
||||||
}
|
|
||||||
IabResult finalIabResult = iabResult;
|
|
||||||
Inventory finalInventory = inventory;
|
|
||||||
this.handler2.post(() -> listener.onQueryInventoryFinished(finalIabResult, finalInventory));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
int queryPurchases(Inventory inventory) throws JSONException, RemoteException, IllegalStateException {
|
|
||||||
Observer.onCallingMethod();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int querySkuDetails(Inventory inventory, List<String> object) throws RemoteException, JSONException, IllegalStateException {
|
|
||||||
Observer.onCallingMethod();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplicationPublicKey(String string2) {
|
|
||||||
this.mSignatureBase64 = string2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startSetup(final OnIabSetupFinishedListener onIabSetupFinishedListener, final OnIabBroadcastListener onIabBroadcastListener) {
|
|
||||||
if (this.mSetupDone) {
|
|
||||||
throw new IllegalStateException("IAB helper is already set up.");
|
|
||||||
}
|
|
||||||
this.logDebug("Starting in-app billing setup.");
|
|
||||||
this.mServiceConn = new ServiceConnection(){
|
|
||||||
public void onServiceConnected(ComponentName var1_1, IBinder var2_3) {
|
|
||||||
Observer.onCallingMethod();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServiceDisconnected(ComponentName componentName) {
|
|
||||||
Observer.onCallingMethod();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.logDebug("...Starting in-app billing setup.");
|
|
||||||
this.logDebug("Binding service...");
|
|
||||||
if (onIabBroadcastListener == null) {
|
|
||||||
this.logError("Unable to get ResolveInfo for InAppBillingService intent. Cannot bind to InAppBillinbService");
|
|
||||||
this.mServiceConn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//this.logDebug("PackageName = " + ((ResolveInfo)onIabBroadcastListener).serviceInfo.packageName);
|
|
||||||
//this.logDebug("ClassName = " + ((ResolveInfo)onIabBroadcastListener).serviceInfo.name);
|
|
||||||
/*if (this.mContext.bindService((Intent)onIabSetupFinishedListener, this.mServiceConn, Context.BIND_AUTO_CREATE)) {
|
|
||||||
this.logDebug("Success - Bind to InAppBillingService");
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
this.logError("Failed to Bind to InAppBillingService");
|
|
||||||
this.mServiceConn = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AsyncOperation {
|
|
||||||
private String m_name;
|
|
||||||
private Runnable m_operation;
|
|
||||||
private boolean m_runInNewThread;
|
|
||||||
|
|
||||||
public AsyncOperation(String string2, boolean bl2, Runnable runnable) {
|
|
||||||
this.m_name = string2;
|
|
||||||
this.m_runInNewThread = bl2;
|
|
||||||
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();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.m_operation.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class IabPurchaseUpdateReceiver
|
|
||||||
extends BroadcastReceiver {
|
|
||||||
private final OnIabBroadcastListener mListener;
|
|
||||||
|
|
||||||
public IabPurchaseUpdateReceiver(OnIabBroadcastListener onIabBroadcastListener) {
|
|
||||||
this.mListener = onIabBroadcastListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (this.mListener == null) return;
|
|
||||||
this.mListener.receivedBroadcast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface OnConsumeFinishedListener {
|
|
||||||
public void onConsumeFinished(Purchase var1, IabResult var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface OnConsumeMultiFinishedListener {
|
|
||||||
public void onConsumeMultiFinished(List<Purchase> var1, List<IabResult> var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface OnIabBroadcastListener {
|
|
||||||
public void receivedBroadcast();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface OnIabPurchaseFinishedListener {
|
|
||||||
public void onIabPurchaseFinished(IabResult var1, Purchase var2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface OnIabSetupFinishedListener {
|
|
||||||
public void onIabSetupFinished(IabResult var1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface QueryInventoryFinishedListener {
|
|
||||||
public void onQueryInventoryFinished(IabResult var1, Inventory var2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
import com.ea.nimble.mtx.googleplay.util.IabHelper;
|
|
||||||
|
|
||||||
public class IabResult {
|
|
||||||
String mMessage;
|
|
||||||
int mResponse;
|
|
||||||
|
|
||||||
public IabResult(int n2, String string2) {
|
|
||||||
this.mResponse = n2;
|
|
||||||
if (string2 != null && string2.trim().length() != 0) {
|
|
||||||
this.mMessage = string2 + " (response: " + IabHelper.getResponseDesc(n2) + ")";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.mMessage = IabHelper.getResponseDesc(n2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return this.mMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getResponse() {
|
|
||||||
return this.mResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFailure() {
|
|
||||||
if (this.isSuccess()) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
if (this.mResponse != 0) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "IabResult: " + this.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
import com.ea.nimble.mtx.googleplay.util.Purchase;
|
|
||||||
import com.ea.nimble.mtx.googleplay.util.SkuDetails;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Inventory {
|
|
||||||
Map<String, Purchase> mPurchaseMap;
|
|
||||||
Map<String, SkuDetails> mSkuMap = new HashMap<String, SkuDetails>();
|
|
||||||
|
|
||||||
Inventory() {
|
|
||||||
this.mPurchaseMap = new HashMap<String, Purchase>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPurchase(Purchase purchase) {
|
|
||||||
this.mPurchaseMap.put(purchase.getSku(), purchase);
|
|
||||||
}
|
|
||||||
|
|
||||||
void addSkuDetails(SkuDetails skuDetails) {
|
|
||||||
this.mSkuMap.put(skuDetails.getSku(), skuDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void erasePurchase(String string2) {
|
|
||||||
if (!this.mPurchaseMap.containsKey(string2)) return;
|
|
||||||
this.mPurchaseMap.remove(string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAllOwnedSkus() {
|
|
||||||
return new ArrayList<String>(this.mPurchaseMap.keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Purchase> getAllPurchases() {
|
|
||||||
return new ArrayList<Purchase>(this.mPurchaseMap.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SkuDetails> getAllSkuDetails() {
|
|
||||||
return new ArrayList<SkuDetails>(this.mSkuMap.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Purchase getPurchase(String string2) {
|
|
||||||
return this.mPurchaseMap.get(string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkuDetails getSkuDetails(String string2) {
|
|
||||||
return this.mSkuMap.get(string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasDetails(String string2) {
|
|
||||||
return this.mSkuMap.containsKey(string2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPurchase(String string2) {
|
|
||||||
return this.mPurchaseMap.containsKey(string2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* org.json.JSONException
|
|
||||||
* org.json.JSONObject
|
|
||||||
*/
|
|
||||||
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 org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Purchase {
|
|
||||||
String mDeveloperPayload;
|
|
||||||
String mNimbleMTXTransactionId;
|
|
||||||
String mOrderId;
|
|
||||||
String mOriginalJson;
|
|
||||||
String mPackageName;
|
|
||||||
int mPurchaseState;
|
|
||||||
long mPurchaseTime;
|
|
||||||
String mSignature;
|
|
||||||
String mSku;
|
|
||||||
String mToken;
|
|
||||||
|
|
||||||
public Purchase(GooglePlayTransaction googlePlayTransaction) throws IllegalArgumentException {
|
|
||||||
Map<String, Object> object = googlePlayTransaction.getAdditionalInfo();
|
|
||||||
if (object == null) {
|
|
||||||
throw new IllegalArgumentException("Can't construct Purchase from GooglePlayTransaction without additional info bundle");
|
|
||||||
}
|
|
||||||
String string2 = (String)object.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID);
|
|
||||||
String string3 = ApplicationEnvironment.getComponent().getApplicationBundleId();
|
|
||||||
String string4 = googlePlayTransaction.getItemSku();
|
|
||||||
long l2 = (Long)object.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME);
|
|
||||||
int n2 = (Integer)object.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE);
|
|
||||||
String string5 = googlePlayTransaction.getNonce();
|
|
||||||
Object o = object.get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN);
|
|
||||||
String string6 = googlePlayTransaction.getReceipt();
|
|
||||||
if (string2 == null) throw new IllegalArgumentException("Missing data to construct a Purchase object.");
|
|
||||||
if (string3 == null) throw new IllegalArgumentException("Missing data to construct a Purchase object.");
|
|
||||||
if (string4 == null) throw new IllegalArgumentException("Missing data to construct a Purchase object.");
|
|
||||||
if (string5 == null) throw new IllegalArgumentException("Missing data to construct a Purchase object.");
|
|
||||||
if (string6 == null) {
|
|
||||||
throw new IllegalArgumentException("Missing data to construct a Purchase object.");
|
|
||||||
}
|
|
||||||
this.mOrderId = string2;
|
|
||||||
this.mPackageName = string3;
|
|
||||||
this.mSku = string4;
|
|
||||||
this.mPurchaseTime = l2;
|
|
||||||
this.mPurchaseState = n2;
|
|
||||||
this.mDeveloperPayload = string5;
|
|
||||||
this.mToken = (String)o;
|
|
||||||
this.mSignature = string6;
|
|
||||||
this.mOriginalJson = "{\"constructedFromTransaction\":1}";
|
|
||||||
this.mNimbleMTXTransactionId = googlePlayTransaction.getTransactionId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Purchase(String string2, String string3) throws JSONException {
|
|
||||||
this.mOriginalJson = string2;
|
|
||||||
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.mSignature = string3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeveloperPayload() {
|
|
||||||
return this.mDeveloperPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNimbleMTXTransactionId() {
|
|
||||||
return this.mNimbleMTXTransactionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderId() {
|
|
||||||
return this.mOrderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginalJson() {
|
|
||||||
return this.mOriginalJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackageName() {
|
|
||||||
return this.mPackageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPurchaseState() {
|
|
||||||
return this.mPurchaseState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPurchaseTime() {
|
|
||||||
return this.mPurchaseTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignature() {
|
|
||||||
return this.mSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSku() {
|
|
||||||
return this.mSku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getToken() {
|
|
||||||
return this.mToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "PurchaseInfo:" + this.mOriginalJson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* android.text.TextUtils
|
|
||||||
* android.util.Log
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
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 PublicKey generatePublicKey(String object) {
|
|
||||||
try {
|
|
||||||
byte[] decode = Base64.decode(object);
|
|
||||||
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(decode));
|
|
||||||
}
|
|
||||||
catch (NoSuchAlgorithmException noSuchAlgorithmException) {
|
|
||||||
throw new RuntimeException(noSuchAlgorithmException);
|
|
||||||
}
|
|
||||||
catch (InvalidKeySpecException invalidKeySpecException) {
|
|
||||||
Log.e((String)TAG, (String)"Invalid key specification.");
|
|
||||||
throw new IllegalArgumentException(invalidKeySpecException);
|
|
||||||
}
|
|
||||||
catch (Base64DecoderException base64DecoderException) {
|
|
||||||
Log.e((String)TAG, (String)"Base64 decoding failed.");
|
|
||||||
throw new IllegalArgumentException(base64DecoderException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean verify(PublicKey publicKey, String string2, String string3) {
|
|
||||||
try {
|
|
||||||
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
|
|
||||||
signature.initVerify(publicKey);
|
|
||||||
signature.update(string2.getBytes());
|
|
||||||
if (signature.verify(Base64.decode(string3))) return true;
|
|
||||||
Log.e((String)TAG, (String)"Signature verification failed.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (NoSuchAlgorithmException noSuchAlgorithmException) {
|
|
||||||
Log.e((String)TAG, (String)"NoSuchAlgorithmException.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (InvalidKeyException invalidKeyException) {
|
|
||||||
Log.e((String)TAG, (String)"Invalid key specification.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (SignatureException signatureException) {
|
|
||||||
Log.e((String)TAG, (String)"Signature exception.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (Base64DecoderException base64DecoderException) {
|
|
||||||
Log.e((String)TAG, (String)"Base64 decoding failed.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean verifyPurchase(String string2, String string3, String string4) {
|
|
||||||
if (string3 == null) {
|
|
||||||
Log.e((String)TAG, (String)"data is null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty((CharSequence)string4)) return true;
|
|
||||||
if (Security.verify(Security.generatePublicKey(string2), string3, string4)) return true;
|
|
||||||
Log.w((String)TAG, (String)"signature does not match data.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* org.json.JSONException
|
|
||||||
* org.json.JSONObject
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.mtx.googleplay.util;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
public class SkuDetails {
|
|
||||||
String mCurrencyCode;
|
|
||||||
String mDescription;
|
|
||||||
String mJson;
|
|
||||||
String mPrice;
|
|
||||||
String mPriceMicros;
|
|
||||||
String mSku;
|
|
||||||
String mTitle;
|
|
||||||
String mType;
|
|
||||||
|
|
||||||
public SkuDetails(String string2) throws JSONException {
|
|
||||||
this.mJson = string2;
|
|
||||||
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 getCurrencyCode() {
|
|
||||||
return this.mCurrencyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.mDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrice() {
|
|
||||||
return this.mPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPriceMicros() {
|
|
||||||
return this.mPriceMicros;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSku() {
|
|
||||||
return this.mSku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.mTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.mType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "SkuDetails:" + this.mJson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
package com.ea.nimble.pushnotificationgoogle;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import com.ea.nimble.Log.Helper;
|
|
||||||
import com.ea.nimble.ApplicationEnvironment;
|
|
||||||
import com.ea.nimble.Base;
|
|
||||||
import com.ea.nimble.Persistence;
|
|
||||||
import com.ea.nimble.PersistenceService;
|
|
||||||
import com.ea.nimble.tracking.ITracking;
|
|
||||||
import com.ea.nimble.tracking.Tracking;
|
|
||||||
import com.google.android.gcm.GCMBaseIntentService;
|
|
||||||
import com.google.android.gcm.GCMRegistrar;
|
|
||||||
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/* loaded from: stdlib.jar:com/ea/nimble/pushnotificationgoogle/GCMIntentService.class */
|
|
||||||
public class GCMIntentService extends GCMBaseIntentService {
|
|
||||||
public static final String GCMPersistentMessageID = "GCMMessageId";
|
|
||||||
public static final String TAG = "GCMIntentService";
|
|
||||||
|
|
||||||
public GCMIntentService() {
|
|
||||||
super("927779459434");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void generateNotification(Context context, String str, String str2, String str3, Bundle bundle) {
|
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
String str4 = (String) context.getPackageManager().getApplicationLabel(context.getApplicationInfo());
|
|
||||||
int identifier = context.getResources().getIdentifier("icon_pushnotification_custom", "drawable", context.getPackageName());
|
|
||||||
int i = identifier;
|
|
||||||
if (identifier == 0) {
|
|
||||||
i = context.getApplicationContext().getApplicationInfo().icon;
|
|
||||||
}
|
|
||||||
Context applicationContext = context.getApplicationContext();
|
|
||||||
Intent launchIntentForPackage = applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName());
|
|
||||||
if (bundle != null) {
|
|
||||||
launchIntentForPackage.putExtras(bundle);
|
|
||||||
}
|
|
||||||
launchIntentForPackage.putExtra("PushNotification", "true");
|
|
||||||
if (str2 != null && str2.length() > 0) {
|
|
||||||
launchIntentForPackage.putExtra("messageId", str2);
|
|
||||||
}
|
|
||||||
launchIntentForPackage.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
PendingIntent activity = PendingIntent.getActivity(context, 0, launchIntentForPackage, PendingIntent.FLAG_ONE_SHOT);
|
|
||||||
Notification notification = new Notification(i, str, currentTimeMillis);
|
|
||||||
if (str3 != null && str3.length() > 0) {
|
|
||||||
if (applicationContext.getResources().getIdentifier(str3, "raw", applicationContext.getPackageName()) != 0) {
|
|
||||||
notification.sound = Uri.parse("android.resource://" + context.getPackageName() + "/raw/" + str3);
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Attempt to play sound file " + str3 + " but the resource was not found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//notification.setLatestEventInfo(context, str4, str, activity);
|
|
||||||
notification.flags |= 16;
|
|
||||||
notificationManager.notify(0, notification);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
protected void onDeletedMessages(Context context, int i) {
|
|
||||||
Log.i(TAG, "Received deleted messages notification");
|
|
||||||
generateNotification(context, "Message deleted", null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
protected void onError(Context context, String str) {
|
|
||||||
Log.i(TAG, "Received error: " + str);
|
|
||||||
if (str.equals("ACCOUNT_MISSING") && Base.getComponent(PushNotification.COMPONENT_ID) != null) {
|
|
||||||
((IPushNotification) Base.getComponent(PushNotification.COMPONENT_ID)).cleanup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
protected void onMessage(Context context, Intent intent) {
|
|
||||||
Log.v(TAG, "Real - onMessage start");
|
|
||||||
String str = "";
|
|
||||||
String str2 = "";
|
|
||||||
String str3 = "";
|
|
||||||
Bundle extras = intent.getExtras();
|
|
||||||
Log.v(TAG, "Real - message stuff: " + extras.toString());
|
|
||||||
String str4 = "eamobile-message_" + (ApplicationEnvironment.isMainApplicationRunning() ? ApplicationEnvironment.getComponent().getShortApplicationLanguageCode() : Locale.getDefault().getLanguage());
|
|
||||||
for (String str5 : extras.keySet()) {
|
|
||||||
String str6 = str;
|
|
||||||
if (str5.startsWith(str4)) {
|
|
||||||
try {
|
|
||||||
str6 = URLDecoder.decode(extras.getString(str5), "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
str6 = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String str7 = str2;
|
|
||||||
if (str5.startsWith("messageId")) {
|
|
||||||
Log.v(TAG, "message id is " + extras.getString("messageId"));
|
|
||||||
str7 = extras.getString("messageId");
|
|
||||||
}
|
|
||||||
str = str6;
|
|
||||||
str2 = str7;
|
|
||||||
if (str5.startsWith("eamobile-song")) {
|
|
||||||
str3 = extras.getString("eamobile-song");
|
|
||||||
Log.v(TAG, "sound file to play is " + str3);
|
|
||||||
str = str6;
|
|
||||||
str2 = str7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (str.length() == 0) {
|
|
||||||
Log.v(TAG, "*****Recieved PN but message payload did not match app selected language. Suppressing PN*****");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (ApplicationEnvironment.isMainApplicationRunning()) {
|
|
||||||
Log.v(TAG, "Attempting to save PN details to persistent cache. Assumption is that the application is running");
|
|
||||||
if (str2 != null && str2.length() > 0) {
|
|
||||||
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(TAG, Persistence.Storage.CACHE);
|
|
||||||
ArrayList arrayList = (ArrayList) persistenceForNimbleComponent.getValue(GCMPersistentMessageID);
|
|
||||||
ArrayList arrayList2 = arrayList;
|
|
||||||
if (arrayList == null) {
|
|
||||||
arrayList2 = new ArrayList();
|
|
||||||
}
|
|
||||||
arrayList2.add(str2);
|
|
||||||
persistenceForNimbleComponent.setValue(GCMPersistentMessageID, arrayList2);
|
|
||||||
persistenceForNimbleComponent.synchronize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e2) {
|
|
||||||
Helper.LOGD(this, "GCM failed to save campaign ID to persistent. App was probably killed.", new Object[0]);
|
|
||||||
e2.printStackTrace();
|
|
||||||
}
|
|
||||||
processIncomingMessage(context, str, str2, str3, extras);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* JADX INFO: Access modifiers changed from: protected */
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
public boolean onRecoverableError(Context context, String str) {
|
|
||||||
android.util.Log.i(TAG, "Received recoverable error: " + str);
|
|
||||||
return super.onRecoverableError(context, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
protected void onRegistered(Context context, String str) {
|
|
||||||
android.util.Log.i(TAG, "Real - Device registered: regId = " + str);
|
|
||||||
PushNotification.register(context, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.google.android.gcm.GCMBaseIntentService
|
|
||||||
protected void onUnregistered(Context context, String str) {
|
|
||||||
android.util.Log.i(TAG, "Device unregistered");
|
|
||||||
if (GCMRegistrar.isRegisteredOnServer(context)) {
|
|
||||||
PushNotification.unregister(context, str);
|
|
||||||
} else {
|
|
||||||
android.util.Log.i(TAG, "Ignoring unregister callback");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void processIncomingMessage(Context context, String str, String str2, String str3, Bundle bundle) {
|
|
||||||
if (!ApplicationEnvironment.isMainApplicationRunning() || ApplicationEnvironment.getCurrentActivity() == null) {
|
|
||||||
generateNotification(context, str, str2, str3, bundle);
|
|
||||||
} else {
|
|
||||||
showMessage(str, str2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void showMessage(String str, final String str2) {
|
|
||||||
if (str != null && ApplicationEnvironment.isMainApplicationRunning()) {
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(ApplicationEnvironment.getCurrentActivity());
|
|
||||||
builder.setTitle("");
|
|
||||||
builder.setMessage(str);
|
|
||||||
builder.setNegativeButton("OK", new DialogInterface.OnClickListener() { // from class: com.ea.nimble.pushnotificationgoogle.GCMIntentService.1
|
|
||||||
@Override // android.content.DialogInterface.OnClickListener
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
ITracking iTracking;
|
|
||||||
if (!(Base.getComponent(Tracking.COMPONENT_ID) == null || (iTracking = (ITracking) Base.getComponent(Tracking.COMPONENT_ID)) == null)) {
|
|
||||||
HashMap hashMap = new HashMap();
|
|
||||||
if (str2 != null) {
|
|
||||||
hashMap.put("NIMBLESTANDARD::KEY_PN_MESSAGE_ID", str2);
|
|
||||||
}
|
|
||||||
iTracking.logEvent(Tracking.EVENT_PN_USER_CLICKED_OK, hashMap);
|
|
||||||
}
|
|
||||||
dialogInterface.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ApplicationEnvironment.getCurrentActivity().runOnUiThread(new Runnable() { // from class: com.ea.nimble.pushnotificationgoogle.GCMIntentService.2
|
|
||||||
@Override // java.lang.Runnable
|
|
||||||
public void run() {
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* android.content.Context
|
|
||||||
*/
|
|
||||||
package com.ea.nimble.pushnotificationgoogle;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import com.ea.nimble.pushnotificationgoogle.GCMIntentService;
|
|
||||||
import com.google.android.gcm.GCMBroadcastReceiver;
|
|
||||||
|
|
||||||
public class NimbleBroadcastReceiver
|
|
||||||
extends GCMBroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
protected String getGCMIntentServiceClassName(Context context) {
|
|
||||||
return GCMIntentService.class.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -28,7 +28,6 @@ import com.ea.nimble.SynergyNetworkConnectionHandle;
|
|||||||
import com.ea.nimble.Utility;
|
import com.ea.nimble.Utility;
|
||||||
import com.ea.nimble.identity.INimbleIdentity;
|
import com.ea.nimble.identity.INimbleIdentity;
|
||||||
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
||||||
import com.google.android.gcm.GCMRegistrar;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -37,8 +36,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
public class PushNotification {
|
public class PushNotification {
|
||||||
public static final String COMPONENT_ID = "com.ea.nimble.pushnotificationgoogle";
|
public static final String COMPONENT_ID = "com.ea.nimble.pushnotificationgoogle";
|
||||||
static final String DISPLAY_MESSAGE_ACTION = "com.ea.nimble.pushnotificationgoogle.DISPLAY_MESSAGE";
|
|
||||||
static final String SENDER_ID = "927779459434";
|
|
||||||
static String s_registerId = null;
|
static String s_registerId = null;
|
||||||
|
|
||||||
static void callSynergyRevokePushTokenByPid(String string2) {
|
static void callSynergyRevokePushTokenByPid(String string2) {
|
||||||
@@ -180,7 +177,6 @@ public class PushNotification {
|
|||||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||||
if (synergyNetworkConnectionHandle.getResponse().getError() != null) return;
|
if (synergyNetworkConnectionHandle.getResponse().getError() != null) return;
|
||||||
Helper.LOGD(this, "GCM Push Token registered with synergy. Status code: " + synergyNetworkConnectionHandle.getResponse().getHttpResponse().getStatusCode());
|
Helper.LOGD(this, "GCM Push Token registered with synergy. Status code: " + synergyNetworkConnectionHandle.getResponse().getHttpResponse().getStatusCode());
|
||||||
GCMRegistrar.setRegisteredOnServer(context, true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -228,7 +224,6 @@ public class PushNotification {
|
|||||||
SynergyNetwork.getComponent().sendGetRequest(SynergyEnvironment.getComponent().getServerUrlWithKey("synergy.m2u"), "/m2u/api/android/revokePushRegistrationId", object5, synergyNetworkConnectionHandle -> {
|
SynergyNetwork.getComponent().sendGetRequest(SynergyEnvironment.getComponent().getServerUrlWithKey("synergy.m2u"), "/m2u/api/android/revokePushRegistrationId", object5, synergyNetworkConnectionHandle -> {
|
||||||
if (synergyNetworkConnectionHandle.getResponse().getError() != null) return;
|
if (synergyNetworkConnectionHandle.getResponse().getError() != null) return;
|
||||||
d("GCM", "GCM Push Token unregistered with synergy. Status code: " + synergyNetworkConnectionHandle.getResponse().getHttpResponse().getStatusCode());
|
d("GCM", "GCM Push Token unregistered with synergy. Status code: " + synergyNetworkConnectionHandle.getResponse().getHttpResponse().getStatusCode());
|
||||||
GCMRegistrar.setRegisteredOnServer(finalContext, false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import com.ea.nimble.SynergyNetworkConnectionHandle;
|
|||||||
import com.ea.nimble.Utility;
|
import com.ea.nimble.Utility;
|
||||||
import com.ea.nimble.identity.INimbleIdentity;
|
import com.ea.nimble.identity.INimbleIdentity;
|
||||||
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
||||||
import com.google.android.gcm.GCMRegistrar;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@@ -133,7 +132,6 @@ IPushNotification {
|
|||||||
if (this.m_handleMessageReceiver != null) {
|
if (this.m_handleMessageReceiver != null) {
|
||||||
context.unregisterReceiver(this.m_handleMessageReceiver);
|
context.unregisterReceiver(this.m_handleMessageReceiver);
|
||||||
}
|
}
|
||||||
GCMRegistrar.onDestroy(context);
|
|
||||||
Utility.unregisterReceiver(this.m_synergyIdChangedReceiver);
|
Utility.unregisterReceiver(this.m_synergyIdChangedReceiver);
|
||||||
Utility.unregisterReceiver(this.m_IdentityChangedReceiver);
|
Utility.unregisterReceiver(this.m_IdentityChangedReceiver);
|
||||||
}
|
}
|
||||||
@@ -150,48 +148,7 @@ IPushNotification {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
this.trackStuff();
|
|
||||||
this.checkNotNull("927779459434", "SENDER_ID");
|
|
||||||
Log.Helper.LOGD(this, "Nimble PN Component is attempting to register this application for push notifications with the GCM service");
|
|
||||||
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
|
|
||||||
try {
|
|
||||||
GCMRegistrar.checkDevice(applicationContext);
|
|
||||||
GCMRegistrar.checkManifest(applicationContext);
|
|
||||||
}
|
|
||||||
catch (Exception exception) {
|
|
||||||
Log.Helper.LOGD(this, "Nimble PN Component reports that GCMRegistrar checks have failed. PN service will not be available");
|
|
||||||
this.m_handleMessageReceiver = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.Helper.LOGD(this, "Nimble PN Component has passed GCMRegistrar checks and will now attempt to get a valid push token");
|
|
||||||
new IntentFilter("com.ea.nimble.pushnotificationgoogle.intent.RETRY").addCategory("com.ea.nimble.pushnotificationgoogle");
|
|
||||||
applicationContext.registerReceiver(this.m_handleMessageReceiver, new IntentFilter("com.ea.nimble.pushnotificationgoogle.DISPLAY_MESSAGE"));
|
|
||||||
|
|
||||||
final String string2 = GCMRegistrar.getRegistrationId(applicationContext);
|
|
||||||
if (string2.equals("")) {
|
|
||||||
Log.Helper.LOGV(this, "GCM - attempting to register with google");
|
|
||||||
GCMRegistrar.register(applicationContext, "927779459434");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.Helper.LOGV(this, "GCM - Already registered");
|
|
||||||
if (SynergyEnvironment.getComponent().getServerUrlWithKey("synergy.m2u") != null) {
|
|
||||||
if (ApplicationEnvironment.getComponent() == null) return;
|
|
||||||
if (!SynergyEnvironment.getComponent().isDataAvailable()) return;
|
|
||||||
PushNotification.registerTokenWithSynergy(applicationContext, string2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.Helper.LOGD(this, "GCM - Already registered but nimble does not have synergy URL so we can not store token yet... waiting...");
|
|
||||||
BroadcastReceiver br = new BroadcastReceiver(){
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (intent.getExtras() == null) return;
|
|
||||||
if (!intent.getStringExtra("result").equals("1")) return;
|
|
||||||
Log.Helper.LOGD((Object)this, "GCM - received notification that environment is online. Sending token to synergy");
|
|
||||||
PushNotification.registerTokenWithSynergy(context, string2);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Utility.registerReceiver("nimble.environment.notification.startup_requests_finished", br);
|
|
||||||
Utility.registerReceiver("nimble.environment.notification.restored_from_persistent", br);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,307 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
import android.os.Build;
|
|
||||||
import com.eamobile.download.Logging;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.apache.http.HttpEntity;
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.methods.HttpPost;
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
|
||||||
import org.apache.http.params.HttpConnectionParams;
|
|
||||||
import org.apache.http.params.HttpParams;
|
|
||||||
import org.apache.http.util.EntityUtils;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
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 = null;
|
|
||||||
private DownloadActivityInternal downloadActivityInternal;
|
|
||||||
private boolean downloadStarted;
|
|
||||||
private Queue<TelemetryQueueElement> eventQueue;
|
|
||||||
private String pathToQueue;
|
|
||||||
private TelemetryQueueThread queueThread;
|
|
||||||
private String uniqueToken;
|
|
||||||
|
|
||||||
/* access modifiers changed from: private */
|
|
||||||
public class TelemetryQueueElement {
|
|
||||||
public String jsonEvent;
|
|
||||||
public int nrOfRetries;
|
|
||||||
|
|
||||||
public TelemetryQueueElement(int i, String str) {
|
|
||||||
this.nrOfRetries = i;
|
|
||||||
this.jsonEvent = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TelemetryQueueThread extends Thread {
|
|
||||||
private boolean running = true;
|
|
||||||
|
|
||||||
private TelemetryQueueThread() {
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
new TelemetrySendThread(telemetryQueueElement.jsonEvent, telemetryQueueElement.nrOfRetries).start();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
sleep(1000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
} catch (Exception e2) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - TelemetryQueueThread " + e2.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void stopThread() {
|
|
||||||
this.running = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TelemetrySendThread extends Thread {
|
|
||||||
private String jsonEvent = null;
|
|
||||||
private String message;
|
|
||||||
private int retries;
|
|
||||||
private int state;
|
|
||||||
|
|
||||||
public TelemetrySendThread(int i, String str) {
|
|
||||||
this.state = i;
|
|
||||||
this.message = new Date(System.currentTimeMillis()).toString() + " : " + str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TelemetrySendThread(String str, int i) {
|
|
||||||
this.jsonEvent = str;
|
|
||||||
this.retries = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 e) {
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - The following JSON will be send: " + jSONObject.toString());
|
|
||||||
return jSONObject.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String createURL() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
DownloadActivityInternal unused = ADCTelemetry.this.downloadActivityInternal;
|
|
||||||
String sb2 = sb.append(DownloadActivityInternal.DOWNLOAD_URL).append("androidContentWS/cms/android/gameasset/application/telemetry?").append(UUID.randomUUID().toString()).toString();
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Web service url: " + sb2);
|
|
||||||
return sb2;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendHttpPost(String str, int i) {
|
|
||||||
boolean z = false;
|
|
||||||
try {
|
|
||||||
DefaultHttpClient 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("Accept", "text/plain");
|
|
||||||
httpPost.setHeader("Content-type", "application/json");
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Calling web service.");
|
|
||||||
HttpResponse execute = defaultHttpClient.execute(httpPost);
|
|
||||||
int statusCode = execute.getStatusLine().getStatusCode();
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received status code " + Integer.toString(statusCode));
|
|
||||||
if (statusCode != 200) {
|
|
||||||
z = true;
|
|
||||||
} else {
|
|
||||||
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 = true;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received empty body string");
|
|
||||||
z = true;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!z || i >= 5) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Telemetry was send with success");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Send failed. Adding event to the queue.");
|
|
||||||
try {
|
|
||||||
ADCTelemetry.this.eventQueue.add(new TelemetryQueueElement(i, str));
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received exception " + e.toString());
|
|
||||||
}
|
|
||||||
} catch (Exception e2) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received exception " + e2.toString());
|
|
||||||
if (1 == 0 || i >= 5) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Telemetry was send with success");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Send failed. Adding event to the queue.");
|
|
||||||
try {
|
|
||||||
ADCTelemetry.this.eventQueue.add(new TelemetryQueueElement(i, str));
|
|
||||||
} catch (Exception e3) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received exception " + e3.toString());
|
|
||||||
}
|
|
||||||
} catch (Throwable th) {
|
|
||||||
if (0 == 0 || i >= 5) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Telemetry was send with success");
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Send failed. Adding event to the queue.");
|
|
||||||
try {
|
|
||||||
ADCTelemetry.this.eventQueue.add(new TelemetryQueueElement(i, str));
|
|
||||||
} catch (Exception e4) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Received exception " + e4.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw th;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ADCTelemetry() {
|
|
||||||
this.eventQueue = null;
|
|
||||||
this.queueThread = null;
|
|
||||||
this.downloadActivityInternal = null;
|
|
||||||
this.downloadStarted = false;
|
|
||||||
this.downloadActivityInternal = DownloadActivityInternal.getMainActivity();
|
|
||||||
this.uniqueToken = UUID.randomUUID().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized ADCTelemetry getInstance() {
|
|
||||||
ADCTelemetry aDCTelemetry;
|
|
||||||
synchronized (ADCTelemetry.class) {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new ADCTelemetry();
|
|
||||||
}
|
|
||||||
aDCTelemetry = instance;
|
|
||||||
}
|
|
||||||
return aDCTelemetry;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getQueueFileName(String str) {
|
|
||||||
return str + "/queue.file";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadQueue(String str, Queue<TelemetryQueueElement> queue) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Loading queue.");
|
|
||||||
File file = new File(getQueueFileName(str));
|
|
||||||
if (file.exists()) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Found queue file!.");
|
|
||||||
try {
|
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
|
|
||||||
while (true) {
|
|
||||||
String readLine = bufferedReader.readLine();
|
|
||||||
if (readLine != null) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - New queue line: " + readLine);
|
|
||||||
queue.add(new TelemetryQueueElement(Integer.parseInt(readLine.substring(0, 1)), readLine.substring(1)));
|
|
||||||
} else {
|
|
||||||
bufferedReader.close();
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Done loading queue file!.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Queue file doesn't exists.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveQueue(String str, Queue<TelemetryQueueElement> queue) {
|
|
||||||
File file = new File(getQueueFileName(str));
|
|
||||||
if (file.exists()) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Deleting queue file before saving the updated version.");
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(getQueueFileName(str), true), 8192);
|
|
||||||
TelemetryQueueElement poll = queue.poll();
|
|
||||||
if (poll == null) {
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - No events to save to the queue file");
|
|
||||||
}
|
|
||||||
while (poll != null) {
|
|
||||||
String str2 = Integer.toString(poll.nrOfRetries) + poll.jsonEvent + "\n";
|
|
||||||
Logging.DEBUG_OUT("ADCTelemetry - Saving line in queue file : " + str2);
|
|
||||||
bufferedWriter.write(str2);
|
|
||||||
poll = queue.poll();
|
|
||||||
}
|
|
||||||
bufferedWriter.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCreate(String str) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDestroy() {
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
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 destroyDownloadActvity() {
|
|
||||||
this.mDownloadActivityInternal.destroyDownloadActvity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Activity activity, IDownloadActivity iDownloadActivity, Context context, Object obj) {
|
|
||||||
this.mDownloadActivityInternal.init(activity, iDownloadActivity, context, obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDestroy() {
|
|
||||||
this.mDownloadActivityInternal.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPause() {
|
|
||||||
this.mDownloadActivityInternal.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onResume() {
|
|
||||||
this.mDownloadActivityInternal.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onWindowFocusChanged(boolean z) {
|
|
||||||
this.mDownloadActivityInternal.onWindowFocusChanged(z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssetPath(String str) {
|
|
||||||
this.mDownloadActivityInternal.setAssetPath(str, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssetPath(String str, boolean z) {
|
|
||||||
this.mDownloadActivityInternal.setAssetPath(str, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
import com.eamobile.download.DeviceData;
|
|
||||||
|
|
||||||
public interface IDeviceData {
|
|
||||||
void onRetrievedDeviceData(DeviceData deviceData);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
public interface IDownloadActivity {
|
|
||||||
void onDownloadEvent(int i);
|
|
||||||
|
|
||||||
void onResult(String str, int i);
|
|
||||||
}
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
|
|
||||||
import com.eamobile.download.Logging;
|
|
||||||
|
|
||||||
import java.io.DataInput;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
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[NB_STRINGS];
|
|
||||||
public final int BUFFER_SIZE = 8096;
|
|
||||||
private String curLanguage;
|
|
||||||
|
|
||||||
public static int determineFileType(String str) {
|
|
||||||
int i = 1;
|
|
||||||
DataInputStream dataInputStream = null;
|
|
||||||
try {
|
|
||||||
DataInputStream dataInputStream2 = new DataInputStream(DownloadActivityInternal.getInstance().getAssets().open(str));
|
|
||||||
try {
|
|
||||||
if (dataInputStream2.readUnsignedShort() == 65534) {
|
|
||||||
i = 2;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
dataInputStream2.close();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
} catch (IOException e2) {
|
|
||||||
dataInputStream = dataInputStream2;
|
|
||||||
try {
|
|
||||||
dataInputStream.close();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
} catch (Throwable th2) {
|
|
||||||
dataInputStream = dataInputStream2;
|
|
||||||
try {
|
|
||||||
dataInputStream.close();
|
|
||||||
} catch (Exception e4) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e5) {
|
|
||||||
try {
|
|
||||||
dataInputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(int i) {
|
|
||||||
return getString(i, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(int i, String[] strArr) {
|
|
||||||
int i2 = 0;
|
|
||||||
String str = strings[i];
|
|
||||||
if (strArr != null) {
|
|
||||||
try {
|
|
||||||
if (strArr.length > 0) {
|
|
||||||
while (str.indexOf("%%") != -1 && i2 < strArr.length) {
|
|
||||||
int indexOf = str.indexOf("%%");
|
|
||||||
str = str.substring(0, indexOf) + strArr[i2] + str.substring(indexOf + 2);
|
|
||||||
i2++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("Exception e:" + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static char readChar(DataInput dataInput) throws IOException {
|
|
||||||
if (fileType != 2) {
|
|
||||||
return (char) dataInput.readUnsignedByte();
|
|
||||||
}
|
|
||||||
int readUnsignedShort = dataInput.readUnsignedShort();
|
|
||||||
return (char) ((readUnsignedShort >> 8) | ((readUnsignedShort & MotionEventCompat.ACTION_MASK) << 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
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 String getCurrentLanguage() {
|
|
||||||
return this.curLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean loadStrings(String param) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
/*
|
|
||||||
String path;
|
|
||||||
String pSVar2;
|
|
||||||
Activity ref;
|
|
||||||
AssetManager ref_00;
|
|
||||||
InputStream fileStream = null;
|
|
||||||
int iVar4;
|
|
||||||
DataInput ref_01;
|
|
||||||
Vector ref_02;
|
|
||||||
StringBuilder pSVar5;
|
|
||||||
|
|
||||||
Logging.DEBUG_OUT("\tloadString(" + param + ")");
|
|
||||||
|
|
||||||
if (param != null) {
|
|
||||||
|
|
||||||
path = DownloadActivityInternal.getResourcesPath() + param + ".txt";
|
|
||||||
Logging.DEBUG_OUT("\tOpening file: " + path);
|
|
||||||
|
|
||||||
ref = DownloadActivityInternal.getInstance();
|
|
||||||
ref_00 = ref.getAssets();
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileStream = ref_00.open(path);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("Lang", e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileStream != null) {
|
|
||||||
ref_02 = new Vector();
|
|
||||||
|
|
||||||
ref_01 = new DataInput(fileStream);
|
|
||||||
iVar4 = Language.determineFileType(path);
|
|
||||||
Language.fileType = iVar4;
|
|
||||||
if (Language.fileType == 2) {
|
|
||||||
ref_01.skipBytes(2);
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
path = Language.readTo(ref_01,'\n',true);
|
|
||||||
ref_02.addElement(path);
|
|
||||||
} while( true );
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("\tCouldn't find file: " + path);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
package com.eamobile;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.wifi.WifiInfo;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import com.eamobile.download.Logging;
|
|
||||||
|
|
||||||
public class WifiReceiver extends BroadcastReceiver {
|
|
||||||
private int wifiLevel = 0;
|
|
||||||
private WifiManager wifiManager;
|
|
||||||
private String wifiName = "";
|
|
||||||
|
|
||||||
public WifiReceiver() {
|
|
||||||
setWifiManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setWifiManager() {
|
|
||||||
Logging.DEBUG_OUT("Calling setWifiManager...");
|
|
||||||
try {
|
|
||||||
if (DownloadActivityInternal.getInstance() != null) {
|
|
||||||
this.wifiManager = (WifiManager) DownloadActivityInternal.getInstance().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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWifiLevel() {
|
|
||||||
return this.wifiLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWifiName() {
|
|
||||||
return this.wifiName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
updateWifiInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateWifiInfo() {
|
|
||||||
if (this.wifiManager == null) {
|
|
||||||
setWifiManager();
|
|
||||||
}
|
|
||||||
if (this.wifiManager != null && this.wifiManager.isWifiEnabled()) {
|
|
||||||
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)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,520 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
private boolean belongsToADC(File file, ArrayList<File> arrayList) {
|
|
||||||
return arrayList.contains(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkFiles(ArrayList<String> arrayList) {
|
|
||||||
Logging.DEBUG_OUT("[checkFiles]");
|
|
||||||
for (int i = 0; i < arrayList.size(); i++) {
|
|
||||||
String filePath = getFilePath(arrayList.get(i));
|
|
||||||
if (!new File(filePath).exists()) {
|
|
||||||
Logging.DEBUG_OUT("\tChecking file: " + filePath + " (NOT FOUND)");
|
|
||||||
new File(getFilePath(DOWNLOAD_CONTROL_FILE1)).delete();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("\tChecking file: " + filePath + " (OK)");
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT(" ");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteEmptyDirs(String str, ArrayList<File> arrayList) {
|
|
||||||
try {
|
|
||||||
File file = new File(str);
|
|
||||||
File[] listFiles = file.listFiles();
|
|
||||||
if (listFiles == null) {
|
|
||||||
Logging.DEBUG_OUT("Error listing files for directory: " + file.getAbsolutePath());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < listFiles.length; i++) {
|
|
||||||
if (listFiles[i].isDirectory()) {
|
|
||||||
deleteEmptyDirs(listFiles[i].getAbsolutePath(), arrayList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File[] listFiles2 = file.listFiles();
|
|
||||||
String absolutePath = file.getAbsolutePath();
|
|
||||||
if (listFiles2.length != 0) {
|
|
||||||
Logging.DEBUG_OUT(absolutePath + " (NOT EMPTY)");
|
|
||||||
} else if (belongsToADC(file, arrayList)) {
|
|
||||||
if (file.delete()) {
|
|
||||||
Logging.DEBUG_OUT(absolutePath + " (DELETED)");
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT(absolutePath + " (UNKNOWN ERROR WHILE DELETING)");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Logging.DEBUG_OUT_STACK(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT(absolutePath + " (DOES NOT BELONG TO ADC)");
|
|
||||||
}
|
|
||||||
} catch (SecurityException e2) {
|
|
||||||
Logging.DEBUG_OUT_STACK(e2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 e) {
|
|
||||||
}
|
|
||||||
return str3.contains(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<File> getDirList() {
|
|
||||||
try {
|
|
||||||
ArrayList<File> arrayList = new ArrayList<>();
|
|
||||||
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
|
|
||||||
if (!file.exists()) {
|
|
||||||
return arrayList;
|
|
||||||
}
|
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file), 8192);
|
|
||||||
TreeSet treeSet = new TreeSet();
|
|
||||||
while (true) {
|
|
||||||
String readLine = bufferedReader.readLine();
|
|
||||||
if (readLine == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
String[] split = readLine.split("/");
|
|
||||||
String str = "";
|
|
||||||
for (int i = 0; i < split.length - 1; i++) {
|
|
||||||
str = str + split[i] + "/";
|
|
||||||
treeSet.add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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: ");
|
|
||||||
for (int i2 = 0; i2 < arrayList.size(); i2++) {
|
|
||||||
Logging.DEBUG_OUT(arrayList.get(i2).getAbsolutePath());
|
|
||||||
}
|
|
||||||
bufferedReader.close();
|
|
||||||
return arrayList;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* JADX WARNING: Removed duplicated region for block: B:28:0x008a A[SYNTHETIC, Splitter:B:28:0x008a] */
|
|
||||||
/* JADX WARNING: Removed duplicated region for block: B:34:0x009d A[SYNTHETIC, Splitter:B:34:0x009d] */
|
|
||||||
/* Code decompiled incorrectly, please refer to instructions dump. */
|
|
||||||
private java.lang.String getFileList(com.eamobile.download.DownloadFileData r14) {
|
|
||||||
/*
|
|
||||||
// Method dump skipped, instructions count: 187
|
|
||||||
*/
|
|
||||||
throw new UnsupportedOperationException("Method not decompiled: com.eamobile.download.AssetManager.getFileList(com.eamobile.download.DownloadFileData):java.lang.String");
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean assetsFoundLocally() {
|
|
||||||
File file = new File(getAssetPath());
|
|
||||||
if (!file.exists()) {
|
|
||||||
file.mkdir();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
File file2 = new File(getFilePath(DOWNLOAD_CONTROL_FILE1));
|
|
||||||
if (!file2.exists()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file2), 8192);
|
|
||||||
String str = "";
|
|
||||||
while (true) {
|
|
||||||
String readLine = bufferedReader.readLine();
|
|
||||||
if (readLine == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
str = str + readLine + "\n";
|
|
||||||
}
|
|
||||||
bufferedReader.close();
|
|
||||||
if (!str.contains(INDICATE_FINISHED)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
File file3 = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
|
|
||||||
if (!file3.exists()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
BufferedReader bufferedReader2 = new BufferedReader(new FileReader(file3), 8192);
|
|
||||||
ArrayList<String> arrayList = new ArrayList<>();
|
|
||||||
while (true) {
|
|
||||||
String readLine2 = bufferedReader2.readLine();
|
|
||||||
if (readLine2 != null) {
|
|
||||||
arrayList.add(readLine2);
|
|
||||||
} else {
|
|
||||||
bufferedReader2.close();
|
|
||||||
return checkFiles(arrayList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkForUpdates(DownloadFileData[] downloadFileDataArr) {
|
|
||||||
Logging.DEBUG_OUT("Calling: AssetManager checkForUpdates()");
|
|
||||||
boolean z = false;
|
|
||||||
if (downloadFileDataArr != null && downloadFileDataArr.length > 0) {
|
|
||||||
try {
|
|
||||||
if (isVersionLower(getLocalAssetVersion(), downloadFileDataArr[0].getVersion())) {
|
|
||||||
z = true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("[ERROR] An exception occurred while checking for updates: " + e);
|
|
||||||
Logging.DEBUG_OUT_STACK(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearDownloadDir() {
|
|
||||||
String[] list;
|
|
||||||
File file = new File(getAssetPath());
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
for (String str : file.list()) {
|
|
||||||
new File(file, str).delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteAssets() {
|
|
||||||
try {
|
|
||||||
File file = new File(getFilePath(DOWNLOAD_CONTROL_FILE2));
|
|
||||||
if (file.exists()) {
|
|
||||||
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()) {
|
|
||||||
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (NOT FOUND)");
|
|
||||||
} else if (file2.delete()) {
|
|
||||||
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (OK)");
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("\tDeleting file: " + filePath + " (FAILED)");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bufferedReader.close();
|
|
||||||
deleteEmptyDirs(getAssetPath(), getDirList());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("Exception while deleting assets:");
|
|
||||||
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 String getAssetPath() {
|
|
||||||
return !this.mUseAlternativeAssetPath ? this.mAssetPath : this.mAlternativeAssetPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFilePath(String str) {
|
|
||||||
return !this.mUseAlternativeAssetPath ? this.mAssetPath + "/" + str : this.mAlternativeAssetPath + "/" + str;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} else 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 long getTotalSize(String str) {
|
|
||||||
String[] split;
|
|
||||||
long j = 0;
|
|
||||||
for (String str2 : str.split("\n")) {
|
|
||||||
j += getFileSize(str2);
|
|
||||||
}
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 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 e) {
|
|
||||||
Logging.DEBUG_OUT(str + " is not downloaded.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVersionLower(String str, String str2) {
|
|
||||||
int compareTo = normalisedVersion(str2).compareTo(normalisedVersion(str));
|
|
||||||
return compareTo >= 0 && compareTo > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 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 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 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();
|
|
||||||
String replaceAll = str2 != null ? str3.replaceAll(str, str2) : !exists(str, filePath) ? str3 + str : str;
|
|
||||||
if (!exists(replaceAll, filePath)) {
|
|
||||||
File file2 = new File(filePath);
|
|
||||||
if (file2.exists()) {
|
|
||||||
file2.delete();
|
|
||||||
}
|
|
||||||
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath, true), 8192);
|
|
||||||
bufferedWriter.write(replaceAll + "\n");
|
|
||||||
bufferedWriter.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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 saveStateDownloadFinished() {
|
|
||||||
saveState(INDICATE_PROGRESS, INDICATE_FINISHED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveStateDownloadStarted() {
|
|
||||||
saveState(INDICATE_PROGRESS, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlternativeAssetPath(String str) {
|
|
||||||
this.mAlternativeAssetPath = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssetPath(String str) {
|
|
||||||
this.mAssetPath = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.zip.CRC32;
|
|
||||||
import java.util.zip.CheckedInputStream;
|
|
||||||
|
|
||||||
public class ChecksumValidator {
|
|
||||||
public static boolean validate(String str, String str2, long j) {
|
|
||||||
String str3 = str;
|
|
||||||
if (str3.contains(str2)) {
|
|
||||||
str3 = str3.substring(str3.lastIndexOf(str2) + (str2.charAt(str2.length() + -1) == '/' ? str2.length() : str2.length() + 1));
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("Validating checksum for " + str3);
|
|
||||||
try {
|
|
||||||
CheckedInputStream checkedInputStream = new CheckedInputStream(new FileInputStream(str), new CRC32());
|
|
||||||
try {
|
|
||||||
do {
|
|
||||||
} while (checkedInputStream.read(new byte[8192]) != -1);
|
|
||||||
long value = checkedInputStream.getChecksum().getValue();
|
|
||||||
checkedInputStream.close();
|
|
||||||
boolean z = value == j;
|
|
||||||
if (z) {
|
|
||||||
Logging.DEBUG_OUT("Checksums match: " + j);
|
|
||||||
Logging.DEBUG_OUT("File " + str3 + " downloaded successfully");
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
Logging.DEBUG_OUT("[ERROR] Checksums do not match FileChecksum:" + value + ", Server Checksums:" + j);
|
|
||||||
Logging.DEBUG_OUT("File " + str3 + " failed to download");
|
|
||||||
return z;
|
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (IOException e2) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
public class Constants {
|
|
||||||
public static final String ADC_BUILD_LOCAL = "@ADC_BUILD_LOCAL_DYNAMIC_VALUE@";
|
|
||||||
public static final String ADC_BUILD_TIME = "@ADC_BUILD_TIME_DYNAMIC_VALUE@";
|
|
||||||
public static final String ADC_BUILD_VERSION = "@ADC_BUILD_VERSION_DYNAMIC_VALUE@";
|
|
||||||
public static final int DEFAULT_BUFFER_SIZE = 8192;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
public class Device {
|
|
||||||
private int height = 0;
|
|
||||||
private String name = "";
|
|
||||||
private int width = 0;
|
|
||||||
|
|
||||||
public Device(String str, int i, int i2) {
|
|
||||||
this.name = str;
|
|
||||||
this.width = i;
|
|
||||||
this.height = i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return this.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResolutionString() {
|
|
||||||
return this.width + "x" + this.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return this.width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
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 void forceTexture(Set<TextureType> set) {
|
|
||||||
this.glExtensions = "";
|
|
||||||
if (set.contains(TextureType.PVR)) {
|
|
||||||
this.glExtensions += "GL_IMG_texture_compression_pvrtc ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.ATI)) {
|
|
||||||
this.glExtensions += "GL_ATI_compressed_texture_atitc ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.DXT)) {
|
|
||||||
this.glExtensions += "GL_EXT_texture_compression_dxt1 ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.ETC)) {
|
|
||||||
this.glExtensions += "GL_OES_compressed_ETC1_RGB8_texture ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.S3TC)) {
|
|
||||||
this.glExtensions += "GL_OES_texture_compression_S3TC ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType._3DC)) {
|
|
||||||
this.glExtensions += "GL_AMD_compressed_3DC_texture ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.PALETTED)) {
|
|
||||||
this.glExtensions += "GL_OES_compressed_paletted_texture ";
|
|
||||||
}
|
|
||||||
if (set.contains(TextureType.LATC)) {
|
|
||||||
this.glExtensions += "GL_EXT_texture_compression_latc ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBrandName() {
|
|
||||||
return this.brandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceName() {
|
|
||||||
return this.deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGlExtensions() {
|
|
||||||
return this.glExtensions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return this.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumSet<TextureType> getSupportedTextureTypes() {
|
|
||||||
EnumSet<TextureType> of = EnumSet.of(TextureType.UNCOMPRESSED);
|
|
||||||
if (this.glExtensions.contains("GL_IMG_texture_compression_pvrtc")) {
|
|
||||||
of.add(TextureType.PVR);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_ATI_compressed_texture_atitc") || this.glExtensions.contains("GL_AMD_compressed_ATC_texture") || this.glExtensions.contains("GL_ATI_texture_compression_atitc")) {
|
|
||||||
of.add(TextureType.ATI);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_EXT_texture_compression_dxt1") || this.glExtensions.contains("GL_EXT_texture_compression_dxt3") || this.glExtensions.contains("GL_EXT_texture_compression_dxt5")) {
|
|
||||||
of.add(TextureType.DXT);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_OES_compressed_ETC1_RGB8_texture")) {
|
|
||||||
of.add(TextureType.ETC);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_OES_texture_compression_S3TC") || this.glExtensions.contains("GL_EXT_texture_compression_s3tc")) {
|
|
||||||
of.add(TextureType.S3TC);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_AMD_compressed_3DC_texture")) {
|
|
||||||
of.add(TextureType._3DC);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_OES_compressed_paletted_texture")) {
|
|
||||||
of.add(TextureType.PALETTED);
|
|
||||||
}
|
|
||||||
if (this.glExtensions.contains("GL_EXT_texture_compression_latc")) {
|
|
||||||
of.add(TextureType.LATC);
|
|
||||||
}
|
|
||||||
return of;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return this.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrandName(String str) {
|
|
||||||
this.brandName = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceName(String str) {
|
|
||||||
this.deviceName = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGlExtensions(String str) {
|
|
||||||
this.glExtensions = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResolution(int i, int i2) {
|
|
||||||
this.width = i;
|
|
||||||
this.height = i2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
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 String getFileURL() {
|
|
||||||
return this.fileURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return this.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSize() {
|
|
||||||
return this.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileName(String str) {
|
|
||||||
this.fileName = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileURL(String str) {
|
|
||||||
this.fileURL = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String str) {
|
|
||||||
this.language = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSize(int i) {
|
|
||||||
this.size = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(int i) {
|
|
||||||
this.type = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVersion(String str) {
|
|
||||||
this.version = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return this.fileName + " " + this.size + " " + this.version + " " + this.language + " " + this.fileURL + " " + this.type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class DownloadProgress {
|
|
||||||
private FileProgress currentFileProgress = null;
|
|
||||||
private boolean isLastReportDownload = true;
|
|
||||||
private HashMap<String, FileProgress> progressMap = new HashMap<>();
|
|
||||||
private long realDownloaded = 0;
|
|
||||||
private long sizeDownloaded = 0;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
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 boolean getFlagLastReportDownload() {
|
|
||||||
return this.isLastReportDownload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRealDownloaded() {
|
|
||||||
return this.realDownloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSizeDownloaded() {
|
|
||||||
return this.sizeDownloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 reportTotalDownloaded(long j) {
|
|
||||||
this.realDownloaded += j;
|
|
||||||
}
|
|
||||||
|
|
||||||
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(0, j);
|
|
||||||
this.progressMap.put(str, this.currentFileProgress);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.currentFileProgress = fileProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlagLastReportDownload(boolean z) {
|
|
||||||
this.isLastReportDownload = z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
public interface IZipExtractorEvent {
|
|
||||||
void onExtractEntryFinish();
|
|
||||||
|
|
||||||
void onExtractEntryStart(String str, long j);
|
|
||||||
|
|
||||||
void onReportDownload(int i);
|
|
||||||
|
|
||||||
void onReportProgress(int i);
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
public class LocalZipExtractorEvent implements IZipExtractorEvent {
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onExtractEntryFinish() {
|
|
||||||
Logging.DEBUG_OUT("LocalZipExtractorEvent.onExtractEntryFinish");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onExtractEntryStart(String str, long j) {
|
|
||||||
Logging.DEBUG_OUT("LocalZipExtractorEvent.onExtractEntryStart");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onReportDownload(int i) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onReportProgress(int i) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.os.PowerManager;
|
|
||||||
|
|
||||||
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 PowerManager powerManager = null;
|
|
||||||
private PowerManager.WakeLock wakeLock = null;
|
|
||||||
private WifiManager.WifiLock wifiLock;
|
|
||||||
private WifiManager wifiManager = null;
|
|
||||||
|
|
||||||
public LockManager(Context context2) {
|
|
||||||
this.context = context2;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
Logging.DEBUG_OUT("[ERROR] While acquiring WakeLock (LockManager.acquireWakeLock()).");
|
|
||||||
return false;
|
|
||||||
} else if (!this.wakeLock.isHeld()) {
|
|
||||||
this.wakeLock.acquire();
|
|
||||||
Logging.DEBUG_OUT("LockManager.acquireWakeLock() successfully called.");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("LockManager.acquireWakeLock() - wakeLock already acquired.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("[ERROR] An exception occurred in LockManager.acquireWakeLock().");
|
|
||||||
Logging.DEBUG_OUT_STACK(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
Logging.DEBUG_OUT("[ERROR] While acquiring WifiLock (LockManager.acquireWifiLock()).");
|
|
||||||
return false;
|
|
||||||
} else if (!this.wifiLock.isHeld()) {
|
|
||||||
this.wifiLock.acquire();
|
|
||||||
Logging.DEBUG_OUT("LockManager.acquireWifiLock() successfully called.");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
Logging.DEBUG_OUT("LockManager.acquireWifiLock() - wifiLock already acquired.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.DEBUG_OUT("[ERROR] An exception occurred in LockManager.acquireWifiLock().");
|
|
||||||
Logging.DEBUG_OUT_STACK(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void releaseWakeLock() {
|
|
||||||
if (this.wakeLock != null && this.wakeLock.isHeld()) {
|
|
||||||
this.wakeLock.release();
|
|
||||||
this.wakeLock = null;
|
|
||||||
Logging.DEBUG_OUT("LockManager.releaseWakeLock() successfully called.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void releaseWifiLock() {
|
|
||||||
if (this.wifiLock != null && this.wifiLock.isHeld()) {
|
|
||||||
this.wifiLock.release();
|
|
||||||
this.wifiLock = null;
|
|
||||||
Logging.DEBUG_OUT("LockManager.releaseWifiLock() successfully called.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.util.Log;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
|
|
||||||
public class Logging {
|
|
||||||
public static boolean DEBUG_ON = false;
|
|
||||||
static OutputStream out = null;
|
|
||||||
|
|
||||||
public static void DEBUG_CLOSE() {
|
|
||||||
if (DEBUG_ON) {
|
|
||||||
try {
|
|
||||||
out.flush();
|
|
||||||
out.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DEBUG_OUT_STACK(Exception exc) {
|
|
||||||
StringWriter stringWriter = new StringWriter();
|
|
||||||
exc.printStackTrace(new PrintWriter(stringWriter));
|
|
||||||
DEBUG_OUT(stringWriter.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.StatFs;
|
|
||||||
|
|
||||||
public final class MemoryStatus {
|
|
||||||
static final int ERROR = -1;
|
|
||||||
|
|
||||||
public static boolean externalMemoryAvailable() {
|
|
||||||
return Environment.getExternalStorageState().equals("mounted");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String formatSize(long j) {
|
|
||||||
String str = null;
|
|
||||||
if (j >= 1024) {
|
|
||||||
str = "KiB";
|
|
||||||
j /= 1024;
|
|
||||||
if (j >= 1024) {
|
|
||||||
str = "MiB";
|
|
||||||
j /= 1024;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getAvailableExternalMemorySize() {
|
|
||||||
if (!externalMemoryAvailable()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
||||||
return ((long) statFs.getAvailableBlocks()) * ((long) statFs.getBlockSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getAvailableInternalMemorySize() {
|
|
||||||
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
|
|
||||||
return ((long) statFs.getAvailableBlocks()) * ((long) statFs.getBlockSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getTotalExternalMemorySize() {
|
|
||||||
if (!externalMemoryAvailable()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
||||||
return ((long) statFs.getBlockCount()) * ((long) statFs.getBlockSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getTotalInternalMemorySize() {
|
|
||||||
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
|
|
||||||
return ((long) statFs.getBlockCount()) * ((long) statFs.getBlockSize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
|
|
||||||
public class RandomAccessFileReadThread extends Thread {
|
|
||||||
private byte[] buffer = new byte[8192];
|
|
||||||
public int currentFileSize = 0;
|
|
||||||
private DownloadProgress downloadProgress;
|
|
||||||
private RandomAccessFile file;
|
|
||||||
private InputStream in;
|
|
||||||
public boolean killMe = false;
|
|
||||||
public boolean reading = true;
|
|
||||||
public int sizeDownloaded = 0;
|
|
||||||
public long timestamp = System.currentTimeMillis();
|
|
||||||
|
|
||||||
public RandomAccessFileReadThread(InputStream inputStream, RandomAccessFile randomAccessFile, DownloadProgress downloadProgress2) {
|
|
||||||
this.in = inputStream;
|
|
||||||
this.file = randomAccessFile;
|
|
||||||
this.downloadProgress = downloadProgress2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
int i = 0;
|
|
||||||
while (i != -1) {
|
|
||||||
if (i != 0) {
|
|
||||||
this.timestamp = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
i = this.in.read(this.buffer);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (this.killMe) {
|
|
||||||
break;
|
|
||||||
} else if (i == 0) {
|
|
||||||
Logging.DEBUG_OUT("0 BYTES READ>>>");
|
|
||||||
} else if (i > 0) {
|
|
||||||
try {
|
|
||||||
this.file.write(this.buffer, 0, i);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.sizeDownloaded += i;
|
|
||||||
this.downloadProgress.reportTotalDownloaded((long) i);
|
|
||||||
try {
|
|
||||||
this.currentFileSize = ((int) this.file.getFilePointer()) - 1;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (this.currentFileSize < 0) {
|
|
||||||
this.currentFileSize = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.reading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
/* compiled from: ZipExtractor */
|
|
||||||
public class ReadThread extends Thread {
|
|
||||||
private byte[] buffer = new byte[8192];
|
|
||||||
private float compRatio = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private InputStream in;
|
|
||||||
public boolean killMe = false;
|
|
||||||
private OutputStream out;
|
|
||||||
public volatile boolean pause = false;
|
|
||||||
public boolean reading = true;
|
|
||||||
public int sizeDownloaded = 0;
|
|
||||||
public long timestamp = System.currentTimeMillis();
|
|
||||||
private IZipExtractorEvent zipExtractorEvent;
|
|
||||||
|
|
||||||
public ReadThread(InputStream inputStream, OutputStream outputStream, float f, IZipExtractorEvent iZipExtractorEvent) {
|
|
||||||
this.in = inputStream;
|
|
||||||
this.out = outputStream;
|
|
||||||
this.compRatio = f;
|
|
||||||
this.zipExtractorEvent = iZipExtractorEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
int i = 0;
|
|
||||||
while (i != -1) {
|
|
||||||
if (i != 0) {
|
|
||||||
this.timestamp = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
if (this.killMe) {
|
|
||||||
break;
|
|
||||||
} else if (!this.pause) {
|
|
||||||
try {
|
|
||||||
i = this.in.read(this.buffer);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (i == 0) {
|
|
||||||
Logging.DEBUG_OUT("0 BYTES READ>>>");
|
|
||||||
} else if (i > 0) {
|
|
||||||
try {
|
|
||||||
this.out.write(this.buffer, 0, i);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.sizeDownloaded += i;
|
|
||||||
this.zipExtractorEvent.onReportDownload(Math.round(((float) i) * this.compRatio));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.reading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
public class RemoteZipExtractorEvent implements IZipExtractorEvent {
|
|
||||||
private DownloadProgress downloadProgress;
|
|
||||||
private DownloadFileData zipFileData;
|
|
||||||
|
|
||||||
public RemoteZipExtractorEvent(DownloadProgress downloadProgress2, DownloadFileData downloadFileData) {
|
|
||||||
this.downloadProgress = downloadProgress2;
|
|
||||||
this.zipFileData = downloadFileData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onExtractEntryFinish() {
|
|
||||||
Logging.DEBUG_OUT("RemoteZipExtractorEvent.onExtractEntryFinish");
|
|
||||||
this.downloadProgress.fillCurrentFileDownload(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 onReportDownload(int i) {
|
|
||||||
this.downloadProgress.reportTotalDownloaded((long) i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.download.IZipExtractorEvent
|
|
||||||
public void onReportProgress(int i) {
|
|
||||||
this.downloadProgress.reportProgress((long) i, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
|
|
||||||
public class SpeedCalculator {
|
|
||||||
private float averageSpeed = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float currentAmount = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float currentSpeed = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float currentTime = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float previousAmount = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float previousTime = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private float smoothingFactor = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
|
|
||||||
public SpeedCalculator(float f) {
|
|
||||||
this.smoothingFactor = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void forceAmount(float f) {
|
|
||||||
this.previousAmount = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getCurrentSpeed() {
|
|
||||||
return this.averageSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.eamobile.download;
|
|
||||||
|
|
||||||
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 = false;
|
|
||||||
private static boolean pauseDirty = false;
|
|
||||||
private IZipExtractorEvent zipExtractorEvent;
|
|
||||||
|
|
||||||
public static void setPause(boolean z) {
|
|
||||||
pause = z;
|
|
||||||
pauseDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:104:?, code lost:
|
|
||||||
return -1;
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:11:0x0020, code lost:
|
|
||||||
if (r18 <= 0) goto L_0x0054;
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:14:0x0026, code lost:
|
|
||||||
if (r36.isEmpty() == false) goto L_0x0054;
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:15:0x0028, code lost:
|
|
||||||
com.eamobile.download.Logging.DEBUG_OUT("Read all the files from Zip Stream");
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:20:0x0054, code lost:
|
|
||||||
com.eamobile.download.Logging.DEBUG_OUT("[ERROR] Bad Zip, contained " + r18 + " Files");
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:78:0x0331, code lost:
|
|
||||||
r8 = move-exception;
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:79:0x0332, code lost:
|
|
||||||
com.eamobile.download.Logging.DEBUG_OUT("Exception: downloadAndValidateZipFile():" + r8);
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:93:?, code lost:
|
|
||||||
return 1;
|
|
||||||
*/
|
|
||||||
/* JADX WARNING: Code restructure failed: missing block: B:96:?, code lost:
|
|
||||||
return -2;
|
|
||||||
*/
|
|
||||||
/* Code decompiled incorrectly, please refer to instructions dump. */
|
|
||||||
public int extractFiles(java.io.InputStream r35, java.util.Hashtable<java.lang.String, java.lang.Long> r36, java.lang.String r37, int r38, com.eamobile.download.IZipExtractorEvent r39) {
|
|
||||||
/*
|
|
||||||
// Method dump skipped, instructions count: 853
|
|
||||||
*/
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*/
|
|
||||||
package com.eamobile.licensing;
|
|
||||||
|
|
||||||
public interface ILicenseServerActivityCallback {
|
|
||||||
void onLicenseResultEnd();
|
|
||||||
void onLicenseResultStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
/*
|
|
||||||
* Decompiled with CFR 0.152.
|
|
||||||
*
|
|
||||||
* Could not load the following classes:
|
|
||||||
* android.app.Activity
|
|
||||||
* android.content.Context
|
|
||||||
* android.os.Handler
|
|
||||||
* android.os.HandlerThread
|
|
||||||
*/
|
|
||||||
package com.eamobile.licensing;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.HandlerThread;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class LicenseServerActivity {
|
|
||||||
private static boolean G;
|
|
||||||
private static Activity H;
|
|
||||||
private static int M = 0;
|
|
||||||
private static int N = 0;
|
|
||||||
public static final String a = "com.android.vending.licensing.eapref";
|
|
||||||
static final int k = -1;
|
|
||||||
static final int l = 13;
|
|
||||||
static final int m = 14;
|
|
||||||
static final int n = 15;
|
|
||||||
static final int o = 16;
|
|
||||||
static final int p = 17;
|
|
||||||
static final int q = 18;
|
|
||||||
static final int r = 19;
|
|
||||||
static final int s = 20;
|
|
||||||
static final int t = 21;
|
|
||||||
protected static final String u = "licenseserver/";
|
|
||||||
protected static Object v;
|
|
||||||
private static LicenseServerActivity y;
|
|
||||||
private Object A;
|
|
||||||
private String B;
|
|
||||||
private Context C;
|
|
||||||
private String D;
|
|
||||||
private Handler E = null;
|
|
||||||
private boolean F = false;
|
|
||||||
private Object I;
|
|
||||||
private Object J;
|
|
||||||
private Object K;
|
|
||||||
private String L;
|
|
||||||
private String O = "en";
|
|
||||||
public Object b;
|
|
||||||
public Object c;
|
|
||||||
byte[] d;
|
|
||||||
String e;
|
|
||||||
public Handler f = null;
|
|
||||||
Handler g = null;
|
|
||||||
public Handler h = null;
|
|
||||||
public Handler i = null;
|
|
||||||
public String j;
|
|
||||||
ILicenseServerActivityCallback w = null;
|
|
||||||
ArrayList x = new ArrayList();
|
|
||||||
private Object z;
|
|
||||||
|
|
||||||
static {
|
|
||||||
y = null;
|
|
||||||
G = false;
|
|
||||||
M = -1;
|
|
||||||
N = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LicenseServerActivity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ Handler a(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.E;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ Object a(LicenseServerActivity licenseServerActivity, Object as2) {
|
|
||||||
licenseServerActivity.A = as2;
|
|
||||||
return as2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ String a(LicenseServerActivity licenseServerActivity, String string2) {
|
|
||||||
licenseServerActivity.D = string2;
|
|
||||||
return string2;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static Activity b() {
|
|
||||||
return H;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ String b(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.L;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ Object c(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ String d(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.D;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ Context e(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.C;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ String f(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.B;
|
|
||||||
}
|
|
||||||
|
|
||||||
static /* synthetic */ Object g(LicenseServerActivity licenseServerActivity) {
|
|
||||||
return licenseServerActivity.A;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void g() {
|
|
||||||
if (this.A != null) {
|
|
||||||
this.A = null;
|
|
||||||
}
|
|
||||||
H = null;
|
|
||||||
y = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LicenseServerActivity getInstance() {
|
|
||||||
if (y != null) return y;
|
|
||||||
y = new LicenseServerActivity();
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void h() {
|
|
||||||
if (this.J == null) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean LastCheckPointCheck() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exception decompiling
|
|
||||||
*/
|
|
||||||
public void a(int var1_1) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void a(Context context) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void c() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public int d() {
|
|
||||||
return M;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroyLicenseServerActvity() {
|
|
||||||
this.h();
|
|
||||||
G = false;
|
|
||||||
M = -1;
|
|
||||||
this.g();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int e() {
|
|
||||||
return N;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void f() {
|
|
||||||
this.h();
|
|
||||||
G = false;
|
|
||||||
M = -1;
|
|
||||||
this.g();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initLicenseServerActivity(Activity object, ILicenseServerActivityCallback iLicenseServerActivityCallback, Context context, byte[] object2, String string2, String string3, String string4) {
|
|
||||||
if (this.F) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.F = true;
|
|
||||||
this.L = string4;
|
|
||||||
if (this.L == null) {
|
|
||||||
this.L = "001";
|
|
||||||
}
|
|
||||||
this.B = string3;
|
|
||||||
this.C = context;
|
|
||||||
this.d = object2;
|
|
||||||
this.e = string2;
|
|
||||||
HandlerThread waitting_thread = new HandlerThread("waitting thread");
|
|
||||||
waitting_thread.start();
|
|
||||||
this.f = new Handler(waitting_thread.getLooper());
|
|
||||||
if (H == null) {
|
|
||||||
H = object;
|
|
||||||
this.w = iLicenseServerActivityCallback;
|
|
||||||
}
|
|
||||||
if (v == null) {
|
|
||||||
this.O = context.getResources().getConfiguration().locale.toString();
|
|
||||||
}
|
|
||||||
this.a(context);
|
|
||||||
if (G) return;
|
|
||||||
G = true;
|
|
||||||
this.a(20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
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 = new Handler() {
|
|
||||||
/* class com.eamobile.views.CheckUpdatesView.AnonymousClass3 */
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
} else if (message.what == 0) {
|
|
||||||
Logging.DEBUG_OUT("No updates found");
|
|
||||||
CheckUpdatesView.this.dialog.dismiss();
|
|
||||||
if (DownloadActivityInternal.getMainActivity() != null) {
|
|
||||||
DownloadActivityInternal.getMainActivity().setState(11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
boolean updateFound = false;
|
|
||||||
|
|
||||||
public CheckUpdatesView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showContent(View view) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@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, 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() {
|
|
||||||
/* class com.eamobile.views.CheckUpdatesView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
new Thread() {
|
|
||||||
/* class com.eamobile.views.CheckUpdatesView.AnonymousClass2 */
|
|
||||||
|
|
||||||
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(0);
|
|
||||||
} else {
|
|
||||||
CheckUpdatesView.this.handler.sendEmptyMessage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView
|
|
||||||
public void resume() {
|
|
||||||
if (this.dialog != null) {
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.eamobile.views;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
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 clean() {
|
|
||||||
super.clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView
|
|
||||||
public void init() {
|
|
||||||
super.init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class ContactingServerView extends CustomView {
|
|
||||||
protected static final int MSG_DONE = 1;
|
|
||||||
Dialog dialog;
|
|
||||||
public Handler handler = new Handler() {
|
|
||||||
/* class com.eamobile.views.ContactingServerView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
ContactingServerView.this.dialog.dismiss();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public ContactingServerView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showContent(View view) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@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, 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() {
|
|
||||||
/* class com.eamobile.views.ContactingServerView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
new Thread() {
|
|
||||||
/* class com.eamobile.views.ContactingServerView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
DownloadActivityInternal.getMainActivity().checkServerContent(true);
|
|
||||||
ContactingServerView.this.handler.sendEmptyMessage(1);
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView
|
|
||||||
public void resume() {
|
|
||||||
if (this.dialog != null) {
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.eamobile.views;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.view.View;
|
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
|
|
||||||
public class CustomProgressBar extends View {
|
|
||||||
private Paint paint = new Paint();
|
|
||||||
private float progress = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
|
|
||||||
public CustomProgressBar(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDraw(Canvas canvas) {
|
|
||||||
this.paint.setColor(-1);
|
|
||||||
this.paint.setStrokeWidth(BitmapDescriptorFactory.HUE_RED);
|
|
||||||
this.paint.setAntiAlias(true);
|
|
||||||
this.paint.setStyle(Paint.Style.FILL);
|
|
||||||
this.paint.setARGB(180, 120, 120, 120);
|
|
||||||
int width = getWidth() - 10;
|
|
||||||
canvas.drawRect(new RectF(10.0f, 1.0f, (float) width, 33.0f), this.paint);
|
|
||||||
this.paint.setStyle(Paint.Style.FILL);
|
|
||||||
this.paint.setColor(-256);
|
|
||||||
canvas.drawRect(new RectF((float) 11, 2.0f, (float) (11 + ((int) Math.floor((double) (((float) ((width - 1) - 11)) * this.progress)))), 32.0f), this.paint);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void onMeasure(int i, int i2) {
|
|
||||||
super.onMeasure(i, i2);
|
|
||||||
setMeasuredDimension(View.MeasureSpec.getSize(i), 34);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProgress(float f) {
|
|
||||||
if (f < BitmapDescriptorFactory.HUE_RED) {
|
|
||||||
f = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
}
|
|
||||||
if (f > 1.0f) {
|
|
||||||
f = 1.0f;
|
|
||||||
}
|
|
||||||
this.progress = f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,338 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
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 = null;
|
|
||||||
private int[] connectionType = new int[1];
|
|
||||||
private CustomProgressBar customProgressBar;
|
|
||||||
private Dialog dialog;
|
|
||||||
private boolean exitConfirmation = false;
|
|
||||||
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.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 e) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateWifiInfo() {
|
|
||||||
if (((LinearLayout) this.dialog.findViewById(90)) != null && DownloadActivityInternal.getMainActivity() != null) {
|
|
||||||
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(WIFI_LAYOUT_WIFI_VIEW_ID)).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(WIFI_LAYOUT_WIFI_VIEW_ID)).setImageBitmap(this.bmpWifi[0]);
|
|
||||||
}
|
|
||||||
this.wifiTextView.setText(Language.getString(16) + ": " + Language.getString(40));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 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(WIFI_LAYOUT_WIFI_VIEW_ID);
|
|
||||||
imageView.setPadding(10, 0, 10, 10);
|
|
||||||
imageView.setImageBitmap(null);
|
|
||||||
imageView.setClickable(false);
|
|
||||||
linearLayout2.addView(imageView);
|
|
||||||
}
|
|
||||||
this.wifiTextView = new TextView(this.context);
|
|
||||||
this.wifiTextView.setId(WIFI_LAYOUT_WIFI_TEXTVIEW_ID);
|
|
||||||
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 boolean isDialogValid() {
|
|
||||||
return this.dialog != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadMax(int i) {
|
|
||||||
this.max = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadProgress(int i) {
|
|
||||||
this.progress = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadSpeed(float f) {
|
|
||||||
this.speed = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass1 */
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass2 */
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass4 */
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass5 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass6 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
String string = Language.getString(41);
|
|
||||||
String string2 = Language.getString(17);
|
|
||||||
String string3 = 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(string);
|
|
||||||
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, string2, new DialogInterface.OnClickListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass6.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomProgressDialog.this.alertDialog.setButton(-2, string3, new DialogInterface.OnClickListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass6.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
CustomProgressDialog.this.alertDialog.dismiss();
|
|
||||||
CustomProgressDialog.this.alertDialog = null;
|
|
||||||
CustomProgressDialog.this.exitConfirmation = false;
|
|
||||||
CustomProgressDialog.this.showDialogContent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomProgressDialog.this.alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass6.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
CustomProgressDialog.this.alertDialog.dismiss();
|
|
||||||
CustomProgressDialog.this.alertDialog = null;
|
|
||||||
CustomProgressDialog.this.exitConfirmation = false;
|
|
||||||
CustomProgressDialog.this.showDialogContent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomProgressDialog.this.alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.CustomProgressDialog.AnonymousClass6.AnonymousClass4 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomProgressDialog.this.alertDialog.show();
|
|
||||||
CustomProgressDialog.this.exitConfirmation = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.alertDialog != null && this.exitConfirmation) {
|
|
||||||
this.alertDialog.show();
|
|
||||||
this.dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void updateDialog() {
|
|
||||||
if (this.max > 0) {
|
|
||||||
float f = ((float) this.progress) / ((float) this.max);
|
|
||||||
this.customProgressBar.setProgress(f);
|
|
||||||
this.customProgressBar.invalidate();
|
|
||||||
String replace = (((int) Math.floor((double) (100.0f * f))) + "% " + Language.getString(36)).replace("%1", "" + this.progress).replace("%2", "" + this.max).replace("%3", "" + String.format("%.0f", Float.valueOf(this.speed)));
|
|
||||||
updateWifiInfo();
|
|
||||||
((TextView) this.dialog.findViewById(1)).setText(replace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class BackGround extends Drawable {
|
|
||||||
BackGround() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Canvas canvas) {
|
|
||||||
if (DownloadActivityInternal.getMainActivity() != null && DownloadActivityInternal.getMainActivity().getBackgroundBitmap() != null) {
|
|
||||||
canvas.drawBitmap(DownloadActivityInternal.getMainActivity().getBackgroundBitmap(), (float) ((canvas.getWidth() - DownloadActivityInternal.getMainActivity().getBackgroundBitmap().getWidth()) >> 1), (float) ((canvas.getHeight() - DownloadActivityInternal.getMainActivity().getBackgroundBitmap().getHeight()) >> 1), (Paint) null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOpacity() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlpha(int i) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColorFilter(ColorFilter colorFilter) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomView(Context context2) {
|
|
||||||
super(context2);
|
|
||||||
this.context = context2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Button addButton(Context context2, LinearLayout linearLayout, String str) {
|
|
||||||
Button button = new Button(context2);
|
|
||||||
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 context2, LinearLayout linearLayout, String str) {
|
|
||||||
TextView textView = new TextView(context2);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IDownloadView
|
|
||||||
public void clean() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IDownloadView
|
|
||||||
public void init() {
|
|
||||||
showBackground();
|
|
||||||
((Activity) this.context).getWindow().getDecorView().setSystemUiVisibility(5894);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void pause() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resume() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* access modifiers changed from: protected */
|
|
||||||
public void showBackground() {
|
|
||||||
setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
|
|
||||||
setOrientation(1);
|
|
||||||
setGravity(48);
|
|
||||||
setBackgroundDrawable(new BackGround());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class DefaultProgressDialog extends CustomView implements IProgressDialog {
|
|
||||||
private static Method mSetProgressNumberFormat;
|
|
||||||
private ProgressDialog dialog = null;
|
|
||||||
private int max = 0;
|
|
||||||
private int progress = 0;
|
|
||||||
private float speed;
|
|
||||||
|
|
||||||
public DefaultProgressDialog(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
mSetProgressNumberFormat = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void dismissDialog() {
|
|
||||||
this.dialog.dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void initDialog() {
|
|
||||||
try {
|
|
||||||
mSetProgressNumberFormat = ProgressDialog.class.getMethod("setProgressNumberFormat", String.class);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
}
|
|
||||||
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 boolean isDialogValid() {
|
|
||||||
return this.dialog != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadMax(int i) {
|
|
||||||
this.max = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadProgress(int i) {
|
|
||||||
this.progress = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void setDownloadSpeed(float f) {
|
|
||||||
this.speed = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.IProgressDialog
|
|
||||||
public void showDialogContent() {
|
|
||||||
if (this.dialog != null) {
|
|
||||||
this.dialog.show();
|
|
||||||
this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.DefaultProgressDialog.AnonymousClass1 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
/* class com.eamobile.views.DefaultProgressDialog.AnonymousClass2 */
|
|
||||||
|
|
||||||
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 e) {
|
|
||||||
this.dialog.setProgress(DownloadActivityInternal.getMainActivity().getPercentDownloaded());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e2) {
|
|
||||||
Logging.DEBUG_OUT("Exception here:" + e2);
|
|
||||||
this.dialog.setProgress(DownloadActivityInternal.getMainActivity().getPercentDownloaded());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class DeletingAssetsView extends CustomView {
|
|
||||||
Dialog dialog;
|
|
||||||
public Handler handler = new Handler() {
|
|
||||||
/* class com.eamobile.views.DeletingAssetsView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
DeletingAssetsView.this.dialog.dismiss();
|
|
||||||
if (DownloadActivityInternal.getMainActivity() != null) {
|
|
||||||
DownloadActivityInternal.getMainActivity().setState(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
boolean updateFound = false;
|
|
||||||
|
|
||||||
public DeletingAssetsView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showContent(View view) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@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, 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() {
|
|
||||||
/* class com.eamobile.views.DeletingAssetsView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
new Thread() {
|
|
||||||
/* class com.eamobile.views.DeletingAssetsView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(300);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Logging.DEBUG_OUT_STACK(e);
|
|
||||||
}
|
|
||||||
DownloadActivityInternal.getMainActivity().deleteAssets();
|
|
||||||
DeletingAssetsView.this.handler.sendEmptyMessage(0);
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView
|
|
||||||
public void resume() {
|
|
||||||
if (this.dialog != null) {
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class DownloadFailedView extends CustomView {
|
|
||||||
Dialog dialog;
|
|
||||||
int errorCode = 0;
|
|
||||||
Button lskBtn;
|
|
||||||
LinearLayout mainLayout;
|
|
||||||
|
|
||||||
public DownloadFailedView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.DownloadFailedView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.lskBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
/* class com.eamobile.views.DownloadFailedView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
DownloadFailedView.this.dialog.dismiss();
|
|
||||||
ADCTelemetry.getInstance().sendTelemetry(2);
|
|
||||||
DownloadActivityInternal.getMainActivity().setState(2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.DownloadFailedView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setContentView(this.mainLayout);
|
|
||||||
this.dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView
|
|
||||||
public void clean() {
|
|
||||||
super.clean();
|
|
||||||
try {
|
|
||||||
this.dialog.dismiss();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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() {
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorCode(int i) {
|
|
||||||
this.errorCode = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class DownloadMsgView extends CustomView {
|
|
||||||
Dialog dialog;
|
|
||||||
Button lskBtn;
|
|
||||||
LinearLayout mainLayout;
|
|
||||||
int spaceRequiredMB = 0;
|
|
||||||
|
|
||||||
public DownloadMsgView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.DownloadMsgView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.lskBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
/* class com.eamobile.views.DownloadMsgView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
DownloadMsgView.this.dialog.dismiss();
|
|
||||||
if (!DownloadActivityInternal.getMainActivity().chooseAvailableMemory()) {
|
|
||||||
DownloadActivityInternal.getMainActivity().setState(4);
|
|
||||||
} else {
|
|
||||||
DownloadActivityInternal.getMainActivity().startWifiDownload(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.DownloadMsgView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setContentView(this.mainLayout);
|
|
||||||
this.dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView
|
|
||||||
public void clean() {
|
|
||||||
super.clean();
|
|
||||||
try {
|
|
||||||
this.dialog.dismiss();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
package com.eamobile.views;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
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.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
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 = false;
|
|
||||||
private static Timer t;
|
|
||||||
private LockManager lockManager;
|
|
||||||
private IProgressDialog progressDialog;
|
|
||||||
public Handler progressHandler = new Handler() {
|
|
||||||
/* class com.eamobile.views.DownloadProgressView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
try {
|
|
||||||
if (DownloadActivityInternal.getMainActivity() != null && DownloadActivityInternal.isInitialized()) {
|
|
||||||
int totalDownloadSizeMB = DownloadActivityInternal.getTotalDownloadSizeMB();
|
|
||||||
int sizeDownloaded = (int) ((DownloadActivityInternal.getSizeDownloaded() / 1024) / 1024);
|
|
||||||
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 = ((float) SystemClock.uptimeMillis()) / 1000.0f;
|
|
||||||
} else {
|
|
||||||
DownloadProgressView.this.speedCalculator.reportAmount(((float) DownloadActivityInternal.getRealDownloaded()) / 1024.0f, (((float) 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 = new RetryTimerTask();
|
|
||||||
DownloadProgressView.t.schedule(DownloadProgressView.this.timerTask, 0, 5000);
|
|
||||||
} else 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private SpeedCalculator speedCalculator = null;
|
|
||||||
private float timeSeconds = BitmapDescriptorFactory.HUE_RED;
|
|
||||||
private RetryTimerTask timerTask;
|
|
||||||
|
|
||||||
/* access modifiers changed from: package-private */
|
|
||||||
public class RetryTimerTask extends TimerTask {
|
|
||||||
static final int QTY_RETRY = 10;
|
|
||||||
int numTries = 10;
|
|
||||||
|
|
||||||
RetryTimerTask() {
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DownloadProgressView(Context context) {
|
|
||||||
super(context);
|
|
||||||
Logging.DEBUG_OUT("DownloadProgressView constructor");
|
|
||||||
this.context = context;
|
|
||||||
this.lockManager = new LockManager(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
this.lockManager.acquireWakeLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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) {
|
|
||||||
this.lockManager.releaseWakeLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean encounteredFatalDownloadError() {
|
|
||||||
int state = DownloadActivityInternal.getMainActivity().getState();
|
|
||||||
return state == 12 || state == 13;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 DefaultProgressDialog(this.context);
|
|
||||||
} else {
|
|
||||||
this.progressDialog = new CustomProgressDialog(this.context);
|
|
||||||
}
|
|
||||||
this.progressDialog.initDialog();
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
/* class com.eamobile.views.DownloadProgressView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
DownloadProgressView.downloaded = false;
|
|
||||||
new Thread() {
|
|
||||||
/* class com.eamobile.views.DownloadProgressView.AnonymousClass1.AnonymousClass1 */
|
|
||||||
|
|
||||||
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) {
|
|
||||||
Logging.DEBUG_OUT("Failed to download assets. Internal state: " + DownloadActivityInternal.getMainActivity().getStateName());
|
|
||||||
if (!DownloadProgressView.this.encounteredFatalDownloadError()) {
|
|
||||||
DownloadProgressView.this.progressHandler.sendEmptyMessage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
Logging.DEBUG_OUT("DownloadProgressView before background loop downloaded=" + DownloadProgressView.downloaded);
|
|
||||||
while (!DownloadProgressView.downloaded && DownloadActivityInternal.isInitialized()) {
|
|
||||||
Thread.sleep(100);
|
|
||||||
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
|
|
||||||
public void pause() {
|
|
||||||
Logging.DEBUG_OUT("DownloadProgressView pause");
|
|
||||||
if (DownloadActivityInternal.getForceWakeDuringDownload() && this.lockManager != null) {
|
|
||||||
this.lockManager.releaseWakeLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView
|
|
||||||
public void resume() {
|
|
||||||
Logging.DEBUG_OUT("DownloadProgressView resume");
|
|
||||||
if (this.progressDialog != null && this.progressDialog.isDialogValid()) {
|
|
||||||
showContent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.eamobile.views;
|
|
||||||
|
|
||||||
public interface IDownloadView {
|
|
||||||
void clean();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.eamobile.views;
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class InvalidAssetVersionView extends CustomView {
|
|
||||||
Dialog dialog;
|
|
||||||
Button exitBtn;
|
|
||||||
LinearLayout mainLayout;
|
|
||||||
|
|
||||||
public InvalidAssetVersionView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.InvalidAssetVersionView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
InvalidAssetVersionView.this.dialog.dismiss();
|
|
||||||
try {
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
} catch (Throwable th) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.InvalidAssetVersionView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
/* class com.eamobile.views.InvalidAssetVersionView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setContentView(this.mainLayout);
|
|
||||||
this.dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView
|
|
||||||
public void clean() {
|
|
||||||
super.clean();
|
|
||||||
try {
|
|
||||||
this.dialog.dismiss();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class NetworkUnavailableView extends CustomView {
|
|
||||||
Dialog dialog;
|
|
||||||
Button lskBtn;
|
|
||||||
LinearLayout mainLayout;
|
|
||||||
Button rskBtn;
|
|
||||||
|
|
||||||
public NetworkUnavailableView(Context context) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.NetworkUnavailableView.AnonymousClass1 */
|
|
||||||
|
|
||||||
public void onCancel(DialogInterface dialogInterface) {
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.lskBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
/* class com.eamobile.views.NetworkUnavailableView.AnonymousClass2 */
|
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
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() {
|
|
||||||
/* class com.eamobile.views.NetworkUnavailableView.AnonymousClass3 */
|
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
NetworkUnavailableView.this.dialog.dismiss();
|
|
||||||
DownloadActivityInternal.getMainActivity().startGameActivity(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
||||||
/* class com.eamobile.views.NetworkUnavailableView.AnonymousClass4 */
|
|
||||||
|
|
||||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
||||||
return i == 82 || i == 84;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dialog.setContentView(this.mainLayout);
|
|
||||||
this.dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // com.eamobile.views.CustomView, com.eamobile.views.IDownloadView
|
|
||||||
public void clean() {
|
|
||||||
super.clean();
|
|
||||||
try {
|
|
||||||
this.dialog.dismiss();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user