From d896f8d30eabefab0b6acb1c4fcfabdc9742a916 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 17 Oct 2023 00:37:17 +0300 Subject: [PATCH] delete some trash --- app/build.gradle.kts | 12 +- app/src/main/AndroidManifest.xml | 68 +- .../vending/billing/IInAppBillingService.java | 222 -- .../billing/IMarketBillingService.java | 98 - .../java/com/ea/EAMIO/StorageDirectory.kt | 8 +- .../java/com/ea/easp/KeyboardAndroid.java | 7 +- .../easp/VirtualKeyboardAndroidDelegate.java | 5 +- .../ea/easp/mtx/market/BillingReceiver.java | 54 - .../ea/easp/mtx/market/BillingService.java | 27 - .../java/com/ea/easp/mtx/market/Consts.java | 57 - .../com/ea/easp/mtx/market/MarketJNI.java | 339 --- .../ea/easp/mtx/market/MarketJNIConsts.java | 12 - .../ea/easp/mtx/market/PurchaseObserver.java | 65 - .../ea/easp/mtx/market/ResponseHandler.java | 58 - .../java/com/ea/easp/mtx/market/Security.java | 144 - .../com/ea/easp/mtx/market/SecurityJNI.java | 18 - .../market/amazon/AmazonBillingService.java | 249 -- .../amazon/AmazonPurchasingObserver.java | 46 - .../market/android/AndroidBillingService.java | 539 ---- .../mtx/market/android/BillingReceiver.java | 54 - .../com/ea/easp/mtx/market/util/Base64.java | 196 -- .../market/util/Base64DecoderException.java | 12 - .../com/ea/games/nfs13_na/C2DMReceiver.java | 84 - .../java/com/ea/ironmonkey/Accelerometer.java | 5 +- .../java/com/ea/ironmonkey/BitmapGraphics.kt | 77 +- .../java/com/ea/ironmonkey/C2DMConstants.java | 15 - .../com/ea/ironmonkey/DrawFrameListener.kt | 8 +- .../java/com/ea/ironmonkey/GameActivity.kt | 51 +- .../main/java/com/ea/ironmonkey/Receiver.java | 119 - .../main/java/com/ea/ironmonkey/RunLoop.kt | 58 +- .../java/com/ea/ironmonkey/WebActivity.java | 153 -- .../ea/nimble/ApplicationEnvironmentImpl.java | 79 - .../main/java/com/ea/nimble/FacebookImpl.java | 231 +- .../java/com/ea/nimble/NetworkConnection.java | 87 +- app/src/main/java/com/ea/nimble/Utility.java | 3 +- .../ea/nimble/friends/NimbleFacebookUser.java | 7 +- .../ea/nimble/friends/NimbleFriendsError.java | 12 +- .../nimble/friends/NimbleFriendsUtility.java | 23 +- .../identity/AuthenticatorFacebook.java | 25 +- .../identity/NimbleIdentityUtility.java | 27 +- .../ea/nimble/inappmessage/InAppMessage.java | 2 +- .../ea/nimble/mtx/googleplay/GooglePlay.java | 1634 ------------ .../mtx/googleplay/GooglePlayCatalogItem.java | 123 - .../mtx/googleplay/GooglePlayError.java | 55 - .../GooglePlayNetworkConnectionCallback.java | 25 - .../mtx/googleplay/GooglePlayTransaction.java | 192 -- .../ea/nimble/mtx/googleplay/util/Base64.java | 208 -- .../util/Base64DecoderException.java | 17 - .../mtx/googleplay/util/IabException.java | 34 - .../nimble/mtx/googleplay/util/IabHelper.java | 574 ---- .../nimble/mtx/googleplay/util/IabResult.java | 43 - .../nimble/mtx/googleplay/util/Inventory.java | 62 - .../nimble/mtx/googleplay/util/Purchase.java | 119 - .../nimble/mtx/googleplay/util/Security.java | 83 - .../mtx/googleplay/util/SkuDetails.java | 67 - .../GCMIntentService.java | 200 -- .../NimbleBroadcastReceiver.java | 20 - .../PushNotification.java | 5 - .../PushNotificationImpl.java | 43 - .../main/java/com/eamobile/ADCTelemetry.java | 307 --- .../java/com/eamobile/DownloadActivity.java | 48 - .../eamobile/DownloadActivityInternal.java | 2307 ----------------- .../main/java/com/eamobile/IDeviceData.java | 7 - .../java/com/eamobile/IDownloadActivity.java | 7 - app/src/main/java/com/eamobile/Language.java | 211 -- .../main/java/com/eamobile/WifiReceiver.java | 60 - .../com/eamobile/download/AssetManager.java | 520 ---- .../eamobile/download/ChecksumValidator.java | 38 - .../java/com/eamobile/download/Constants.java | 8 - .../java/com/eamobile/download/Device.java | 29 - .../com/eamobile/download/DeviceData.java | 118 - .../eamobile/download/DownloadFileData.java | 74 - .../eamobile/download/DownloadProgress.java | 86 - .../eamobile/download/IZipExtractorEvent.java | 11 - .../download/LocalZipExtractorEvent.java | 21 - .../com/eamobile/download/LockManager.java | 87 - .../java/com/eamobile/download/Logging.java | 59 - .../com/eamobile/download/MemoryStatus.java | 58 - .../download/RandomAccessFileReadThread.java | 59 - .../com/eamobile/download/ReadThread.java | 58 - .../download/RemoteZipExtractorEvent.java | 33 - .../eamobile/download/SpeedCalculator.java | 41 - .../com/eamobile/download/ZipExtractor.java | 52 - .../ILicenseServerActivityCallback.java | 10 - .../licensing/LicenseServerActivity.java | 203 -- .../com/eamobile/views/CheckUpdatesView.java | 94 - .../eamobile/views/CheckingHostIpView.java | 20 - .../eamobile/views/ContactingServerView.java | 74 - .../com/eamobile/views/CustomProgressBar.java | 46 - .../eamobile/views/CustomProgressDialog.java | 338 --- .../java/com/eamobile/views/CustomView.java | 94 - .../eamobile/views/DefaultProgressDialog.java | 104 - .../eamobile/views/DeletingAssetsView.java | 82 - .../eamobile/views/DownloadFailedView.java | 115 - .../com/eamobile/views/DownloadMsgView.java | 118 - .../eamobile/views/DownloadProgressView.java | 203 -- .../com/eamobile/views/IDownloadView.java | 7 - .../com/eamobile/views/IProgressDialog.java | 19 - .../views/InvalidAssetVersionView.java | 113 - .../views/NetworkUnavailableView.java | 125 - .../com/eamobile/views/ServerErrorView.java | 115 - .../java/com/eamobile/views/Show3GView.java | 126 - .../java/com/eamobile/views/ShowBGView.java | 47 - .../java/com/eamobile/views/ShowWifiView.java | 144 - .../eamobile/views/SpaceUnavailableView.java | 130 - .../eamobile/views/UnSupportedDeviceView.java | 110 - .../com/eamobile/views/UpdatesFoundView.java | 135 - .../facebook/android/BaseRequestListener.java | 36 - .../com/facebook/android/SessionEvents.java | 146 -- .../google/android/c2dm/C2DMBaseReceiver.java | 106 - .../android/c2dm/C2DMBroadcastReceiver.java | 23 - .../com/google/android/c2dm/C2DMessaging.java | 75 - .../android/gcm/GCMBaseIntentService.java | 145 -- .../android/gcm/GCMBroadcastReceiver.java | 48 - .../com/google/android/gcm/GCMConstants.java | 33 - .../com/google/android/gcm/GCMRegistrar.java | 307 --- .../java/com/savegame/SavesRestoring.java | 189 -- .../java/com/verizon/vcast/apps/APIUtils.java | 137 - .../verizon/vcast/apps/DatabaseHelper.java | 101 - .../vcast/apps/DiscoveryParameters.java | 54 - .../vcast/apps/IVCastAppsLicenseService.java | 136 - .../vcast/apps/IVCastInAppService.java | 225 -- .../com/verizon/vcast/apps/InAppActivity.java | 84 - .../vcast/apps/InAppContentOffers.java | 54 - .../com/verizon/vcast/apps/InAppContents.java | 50 - .../verizon/vcast/apps/InAppPurchasor.java | 754 ------ .../vcast/apps/InAppPurchasorInternal.java | 33 - .../java/com/verizon/vcast/apps/Item.java | 53 - .../vcast/apps/LicenseAuthenticator.java | 147 -- .../apps/LicenseAuthenticatorInternal.java | 606 ----- .../java/com/verizon/vcast/apps/Offer.java | 59 - .../java/com/verizon/vcast/apps/Purchase.java | 70 - .../apps/PurchaseInAppContentResult.java | 46 - .../vcast/apps/PurchaseParameters.java | 67 - .../vcast/apps/PurchasedInAppContents.java | 54 - .../vcast/apps/RemoteServiceManager.java | 111 - .../verizon/vcast/apps/VzwAsymBlkCipher.java | 12 - .../com/verizon/vcast/apps/VzwBigInt.java | 1905 -------------- .../com/verizon/vcast/apps/VzwDigest.java | 18 - .../com/verizon/vcast/apps/VzwGenDigest.java | 87 - .../com/verizon/vcast/apps/VzwPKCS1Encd.java | 72 - .../java/com/verizon/vcast/apps/VzwPack.java | 30 - .../com/verizon/vcast/apps/VzwRSACreEng.java | 69 - .../com/verizon/vcast/apps/VzwRSAEng.java | 35 - .../com/verizon/vcast/apps/VzwRSAKyParam.java | 26 - .../java/com/verizon/vcast/apps/VzwSHA.java | 210 -- 146 files changed, 117 insertions(+), 20027 deletions(-) delete mode 100644 app/src/main/java/com/android/vending/billing/IInAppBillingService.java delete mode 100644 app/src/main/java/com/android/vending/billing/IMarketBillingService.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/BillingReceiver.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/BillingService.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/Consts.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/MarketJNI.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/MarketJNIConsts.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/PurchaseObserver.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/ResponseHandler.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/Security.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/SecurityJNI.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonBillingService.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonPurchasingObserver.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/android/AndroidBillingService.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/android/BillingReceiver.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/util/Base64.java delete mode 100644 app/src/main/java/com/ea/easp/mtx/market/util/Base64DecoderException.java delete mode 100644 app/src/main/java/com/ea/games/nfs13_na/C2DMReceiver.java delete mode 100644 app/src/main/java/com/ea/ironmonkey/C2DMConstants.java delete mode 100644 app/src/main/java/com/ea/ironmonkey/Receiver.java delete mode 100644 app/src/main/java/com/ea/ironmonkey/WebActivity.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java delete mode 100644 app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java delete mode 100644 app/src/main/java/com/ea/nimble/pushnotificationgoogle/GCMIntentService.java delete mode 100644 app/src/main/java/com/ea/nimble/pushnotificationgoogle/NimbleBroadcastReceiver.java delete mode 100644 app/src/main/java/com/eamobile/ADCTelemetry.java delete mode 100644 app/src/main/java/com/eamobile/DownloadActivity.java delete mode 100644 app/src/main/java/com/eamobile/DownloadActivityInternal.java delete mode 100644 app/src/main/java/com/eamobile/IDeviceData.java delete mode 100644 app/src/main/java/com/eamobile/IDownloadActivity.java delete mode 100644 app/src/main/java/com/eamobile/Language.java delete mode 100644 app/src/main/java/com/eamobile/WifiReceiver.java delete mode 100644 app/src/main/java/com/eamobile/download/AssetManager.java delete mode 100644 app/src/main/java/com/eamobile/download/ChecksumValidator.java delete mode 100644 app/src/main/java/com/eamobile/download/Constants.java delete mode 100644 app/src/main/java/com/eamobile/download/Device.java delete mode 100644 app/src/main/java/com/eamobile/download/DeviceData.java delete mode 100644 app/src/main/java/com/eamobile/download/DownloadFileData.java delete mode 100644 app/src/main/java/com/eamobile/download/DownloadProgress.java delete mode 100644 app/src/main/java/com/eamobile/download/IZipExtractorEvent.java delete mode 100644 app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java delete mode 100644 app/src/main/java/com/eamobile/download/LockManager.java delete mode 100644 app/src/main/java/com/eamobile/download/Logging.java delete mode 100644 app/src/main/java/com/eamobile/download/MemoryStatus.java delete mode 100644 app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java delete mode 100644 app/src/main/java/com/eamobile/download/ReadThread.java delete mode 100644 app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java delete mode 100644 app/src/main/java/com/eamobile/download/SpeedCalculator.java delete mode 100644 app/src/main/java/com/eamobile/download/ZipExtractor.java delete mode 100644 app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java delete mode 100644 app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java delete mode 100644 app/src/main/java/com/eamobile/views/CheckUpdatesView.java delete mode 100644 app/src/main/java/com/eamobile/views/CheckingHostIpView.java delete mode 100644 app/src/main/java/com/eamobile/views/ContactingServerView.java delete mode 100644 app/src/main/java/com/eamobile/views/CustomProgressBar.java delete mode 100644 app/src/main/java/com/eamobile/views/CustomProgressDialog.java delete mode 100644 app/src/main/java/com/eamobile/views/CustomView.java delete mode 100644 app/src/main/java/com/eamobile/views/DefaultProgressDialog.java delete mode 100644 app/src/main/java/com/eamobile/views/DeletingAssetsView.java delete mode 100644 app/src/main/java/com/eamobile/views/DownloadFailedView.java delete mode 100644 app/src/main/java/com/eamobile/views/DownloadMsgView.java delete mode 100644 app/src/main/java/com/eamobile/views/DownloadProgressView.java delete mode 100644 app/src/main/java/com/eamobile/views/IDownloadView.java delete mode 100644 app/src/main/java/com/eamobile/views/IProgressDialog.java delete mode 100644 app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java delete mode 100644 app/src/main/java/com/eamobile/views/NetworkUnavailableView.java delete mode 100644 app/src/main/java/com/eamobile/views/ServerErrorView.java delete mode 100644 app/src/main/java/com/eamobile/views/Show3GView.java delete mode 100644 app/src/main/java/com/eamobile/views/ShowBGView.java delete mode 100644 app/src/main/java/com/eamobile/views/ShowWifiView.java delete mode 100644 app/src/main/java/com/eamobile/views/SpaceUnavailableView.java delete mode 100644 app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java delete mode 100644 app/src/main/java/com/eamobile/views/UpdatesFoundView.java delete mode 100644 app/src/main/java/com/facebook/android/BaseRequestListener.java delete mode 100644 app/src/main/java/com/facebook/android/SessionEvents.java delete mode 100644 app/src/main/java/com/google/android/c2dm/C2DMBaseReceiver.java delete mode 100644 app/src/main/java/com/google/android/c2dm/C2DMBroadcastReceiver.java delete mode 100644 app/src/main/java/com/google/android/c2dm/C2DMessaging.java delete mode 100644 app/src/main/java/com/google/android/gcm/GCMBaseIntentService.java delete mode 100644 app/src/main/java/com/google/android/gcm/GCMBroadcastReceiver.java delete mode 100644 app/src/main/java/com/google/android/gcm/GCMConstants.java delete mode 100644 app/src/main/java/com/google/android/gcm/GCMRegistrar.java delete mode 100644 app/src/main/java/com/savegame/SavesRestoring.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/APIUtils.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/DatabaseHelper.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/DiscoveryParameters.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/IVCastAppsLicenseService.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/IVCastInAppService.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/InAppActivity.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/InAppContentOffers.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/InAppContents.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/InAppPurchasor.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/InAppPurchasorInternal.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/Item.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticator.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticatorInternal.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/Offer.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/Purchase.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/PurchaseInAppContentResult.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/PurchaseParameters.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/PurchasedInAppContents.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/RemoteServiceManager.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwAsymBlkCipher.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwBigInt.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwDigest.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwGenDigest.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwPKCS1Encd.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwPack.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwRSACreEng.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwRSAEng.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwRSAKyParam.java delete mode 100644 app/src/main/java/com/verizon/vcast/apps/VzwSHA.java diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7e526c9..204ba88 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -87,19 +87,9 @@ dependencies { androidTestImplementation(libs.ui.test.junit4) debugImplementation(libs.ui.tooling) 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 ("com.google.code.gson:gson:2.7") - implementation ("com.facebook.android:facebook-android-sdk:3.21.0") val fragment_version = "1.6.1" implementation("androidx.fragment:fragment:$fragment_version") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 988fd59..5dbedb2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,5 @@ - + - - - - - - - - - - - - + + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/android/vending/billing/IInAppBillingService.java b/app/src/main/java/com/android/vending/billing/IInAppBillingService.java deleted file mode 100644 index b72489d..0000000 --- a/app/src/main/java/com/android/vending/billing/IInAppBillingService.java +++ /dev/null @@ -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; -} diff --git a/app/src/main/java/com/android/vending/billing/IMarketBillingService.java b/app/src/main/java/com/android/vending/billing/IMarketBillingService.java deleted file mode 100644 index 51d8dea..0000000 --- a/app/src/main/java/com/android/vending/billing/IMarketBillingService.java +++ /dev/null @@ -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; -} diff --git a/app/src/main/java/com/ea/EAMIO/StorageDirectory.kt b/app/src/main/java/com/ea/EAMIO/StorageDirectory.kt index 346488b..4eaa353 100644 --- a/app/src/main/java/com/ea/EAMIO/StorageDirectory.kt +++ b/app/src/main/java/com/ea/EAMIO/StorageDirectory.kt @@ -1,12 +1,6 @@ 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 { @JvmStatic fun GetDedicatedDirectory() = "" diff --git a/app/src/main/java/com/ea/easp/KeyboardAndroid.java b/app/src/main/java/com/ea/easp/KeyboardAndroid.java index 2d8585e..bf51cca 100644 --- a/app/src/main/java/com/ea/easp/KeyboardAndroid.java +++ b/app/src/main/java/com/ea/easp/KeyboardAndroid.java @@ -1,7 +1,6 @@ package com.ea.easp; import android.view.KeyEvent; -import com.eamobile.Language; public abstract class KeyboardAndroid { KeyboardAndroid() { @@ -13,9 +12,9 @@ public abstract class KeyboardAndroid { case 4: case 5: case 6: - case Language.NETWORK_WARNING_TXT /*{ENCODED_INT: 24}*/: - case Language.UPDATES_FOUND_TITLE /*{ENCODED_INT: 25}*/: - case Language.UPDATES_FOUND_TXT /*{ENCODED_INT: 26}*/: + case 24: + case 25: + case 26: case 91: return true; default: diff --git a/app/src/main/java/com/ea/easp/VirtualKeyboardAndroidDelegate.java b/app/src/main/java/com/ea/easp/VirtualKeyboardAndroidDelegate.java index dd19a55..971bc92 100644 --- a/app/src/main/java/com/ea/easp/VirtualKeyboardAndroidDelegate.java +++ b/app/src/main/java/com/ea/easp/VirtualKeyboardAndroidDelegate.java @@ -10,7 +10,6 @@ import android.widget.EditText; import android.widget.RelativeLayout; import com.ea.nimble.Log; -import com.google.android.gms.drive.DriveFile; public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid { private static final boolean DEBUG_LOG_ENABLED = true; @@ -89,12 +88,10 @@ public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid { return true; } - /* access modifiers changed from: private */ - /* access modifiers changed from: public */ private void Show() { VirtualKeyboardAndroidDelegate.Log("Show() from UiThread"); 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)}); try { VirtualKeyboardAndroidDelegate.this.mMainViewGroup.addView(VirtualKeyboardAndroidDelegate.this.mRelativeLayout); diff --git a/app/src/main/java/com/ea/easp/mtx/market/BillingReceiver.java b/app/src/main/java/com/ea/easp/mtx/market/BillingReceiver.java deleted file mode 100644 index 609ee9c..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/BillingReceiver.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/BillingService.java b/app/src/main/java/com/ea/easp/mtx/market/BillingService.java deleted file mode 100644 index e33e7b1..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/BillingService.java +++ /dev/null @@ -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(); -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/Consts.java b/app/src/main/java/com/ea/easp/mtx/market/Consts.java deleted file mode 100644 index dcba806..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/Consts.java +++ /dev/null @@ -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]; - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/MarketJNI.java b/app/src/main/java/com/ea/easp/mtx/market/MarketJNI.java deleted file mode 100644 index 1bbcd3d..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/MarketJNI.java +++ /dev/null @@ -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 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 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 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); -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/MarketJNIConsts.java b/app/src/main/java/com/ea/easp/mtx/market/MarketJNIConsts.java deleted file mode 100644 index 8c3e26d..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/MarketJNIConsts.java +++ /dev/null @@ -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; -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/PurchaseObserver.java b/app/src/main/java/com/ea/easp/mtx/market/PurchaseObserver.java deleted file mode 100644 index 817bae9..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/PurchaseObserver.java +++ /dev/null @@ -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 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); - } - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/ResponseHandler.java b/app/src/main/java/com/ea/easp/mtx/market/ResponseHandler.java deleted file mode 100644 index 94ed6a9..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/ResponseHandler.java +++ /dev/null @@ -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 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; - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/Security.java b/app/src/main/java/com/ea/easp/mtx/market/Security.java deleted file mode 100644 index a029847..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/Security.java +++ /dev/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 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 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 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; - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/SecurityJNI.java b/app/src/main/java/com/ea/easp/mtx/market/SecurityJNI.java deleted file mode 100644 index de788ac..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/SecurityJNI.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonBillingService.java b/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonBillingService.java deleted file mode 100644 index 4fb508e..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonBillingService.java +++ /dev/null @@ -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 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 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() { - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonPurchasingObserver.java b/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonPurchasingObserver.java deleted file mode 100644 index ed5cb71..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/amazon/AmazonPurchasingObserver.java +++ /dev/null @@ -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"); - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/android/AndroidBillingService.java b/app/src/main/java/com/ea/easp/mtx/market/android/AndroidBillingService.java deleted file mode 100644 index fd90c8a..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/android/AndroidBillingService.java +++ /dev/null @@ -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 mPendingRequests = new LinkedList<>(); - private static SecurityJNI mSecurityJNI; - private static HashMap 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 createVerifiedPurchasesList = Security.createVerifiedPurchasesList(str, z); - if (createVerifiedPurchasesList == null) { - Debug.Log.d(TAG, "...createPurchasesFromJsonAndSendThemToHandler(): purchases is null"); - return; - } - ArrayList arrayList = new ArrayList(); - Iterator 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"); - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/android/BillingReceiver.java b/app/src/main/java/com/ea/easp/mtx/market/android/BillingReceiver.java deleted file mode 100644 index 5c52217..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/android/BillingReceiver.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/util/Base64.java b/app/src/main/java/com/ea/easp/mtx/market/util/Base64.java deleted file mode 100644 index 54302e8..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/util/Base64.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/ea/easp/mtx/market/util/Base64DecoderException.java b/app/src/main/java/com/ea/easp/mtx/market/util/Base64DecoderException.java deleted file mode 100644 index e6cdff5..0000000 --- a/app/src/main/java/com/ea/easp/mtx/market/util/Base64DecoderException.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/ea/games/nfs13_na/C2DMReceiver.java b/app/src/main/java/com/ea/games/nfs13_na/C2DMReceiver.java deleted file mode 100644 index 23fe689..0000000 --- a/app/src/main/java/com/ea/games/nfs13_na/C2DMReceiver.java +++ /dev/null @@ -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 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); - } -} diff --git a/app/src/main/java/com/ea/ironmonkey/Accelerometer.java b/app/src/main/java/com/ea/ironmonkey/Accelerometer.java index e99691c..dbcdf4f 100644 --- a/app/src/main/java/com/ea/ironmonkey/Accelerometer.java +++ b/app/src/main/java/com/ea/ironmonkey/Accelerometer.java @@ -4,7 +4,6 @@ import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; -import com.google.android.gms.maps.model.BitmapDescriptorFactory; public class Accelerometer implements SensorEventListener { private int bufferReadIndex; @@ -30,10 +29,10 @@ public class Accelerometer implements SensorEventListener { } 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.registered = true; - } else if (this.registered && this.samplesPerSecond == BitmapDescriptorFactory.HUE_RED) { + } else if (this.registered && this.samplesPerSecond == 0) { this.sensorManager.unregisterListener(this); this.registered = false; } diff --git a/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.kt b/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.kt index b3204a1..15b8767 100644 --- a/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.kt +++ b/app/src/main/java/com/ea/ironmonkey/BitmapGraphics.kt @@ -1,50 +1,51 @@ -package com.ea.ironmonkey; +package com.ea.ironmonkey -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.Typeface; +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.Paint +import android.graphics.PorterDuff +import android.graphics.Typeface -public class BitmapGraphics { - private Bitmap bitmap; - private Canvas canvas = new Canvas(); +//Весь текст в игре отрисовывается от сюда +class BitmapGraphics(width: Int, height: Int) { - public BitmapGraphics(int i, int i2) { - this.bitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888); - this.canvas.setBitmap(this.bitmap); + private val bitmap: Bitmap + private val canvas = Canvas() + + // 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) { - Paint paint = new Paint(); - paint.setTypeface(typeface); - paint.setTextSize(f); - paint.setColor(-1); - paint.setAntiAlias(true); - return paint; - } + fun clear() = canvas.drawColor(0, PorterDuff.Mode.CLEAR) - 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) { - return createPaint(Typeface.createFromFile(str), f); - } + companion object { - public void clear() { - this.canvas.drawColor(0, PorterDuff.Mode.CLEAR); - } + private infix fun Typeface.withSize(textSize: Float): Paint{ + 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) { - this.canvas.drawText(str, (float) i, (float) i2, paint); - } + @JvmStatic + fun createPaintFromFamilyName(familyName: String, textSize: Float): Paint { + return Typeface.create(familyName, Typeface.BOLD_ITALIC) withSize textSize + } - public Bitmap getBitmap() { - return this.bitmap; - } - - public Canvas getCanvas() { - return this.canvas; + @JvmStatic + fun createPaintFromFile(path: String, textSize: Float): Paint { + return Typeface.createFromFile(path) withSize textSize + } } } diff --git a/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java b/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java deleted file mode 100644 index 0b2a91d..0000000 --- a/app/src/main/java/com/ea/ironmonkey/C2DMConstants.java +++ /dev/null @@ -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"; -} diff --git a/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.kt b/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.kt index a0ed30e..0f3976d 100644 --- a/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.kt +++ b/app/src/main/java/com/ea/ironmonkey/DrawFrameListener.kt @@ -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 { - void onDrawFrame(GL10 gl10); +interface DrawFrameListener { + fun onDrawFrame(gl10: GL10) } diff --git a/app/src/main/java/com/ea/ironmonkey/GameActivity.kt b/app/src/main/java/com/ea/ironmonkey/GameActivity.kt index c76a84f..505d683 100644 --- a/app/src/main/java/com/ea/ironmonkey/GameActivity.kt +++ b/app/src/main/java/com/ea/ironmonkey/GameActivity.kt @@ -25,10 +25,6 @@ import com.ea.EAMIO.StorageDirectory import com.ea.easp.EASPHandler import com.ea.games.nfs13_na.BuildConfig 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.File import java.io.FileReader @@ -41,7 +37,7 @@ import kotlin.math.sqrt import kotlin.system.exitProcess -class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownloadActivity { +class GameActivity : ComponentActivity(), DrawFrameListener { init { System.loadLibrary("nimble") @@ -144,20 +140,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl } } - fun IsSystemKey(key: Int): Boolean { - 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 IsSystemKey(key: Int) = false fun ShowMessage(message: String, strArr: Array, finish: Boolean) { Log.d(this.localClassName, "ShowMessage msg = $message finish = $finish") @@ -351,7 +334,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl gameRenderer = GameRenderer(this) gameRenderer!!.setDrawFrameListener(this) gameGLSurfaceView!!.setRenderer(gameRenderer) - runLoop = RunLoop(gameGLSurfaceView) + runLoop = RunLoop(gameGLSurfaceView!!) mFrameLayout = FrameLayout(this) mFrameLayout!!.addView(gameGLSurfaceView) val view = ComposeFrameLayout(this) @@ -392,11 +375,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl exitProcess(0) } - - override fun onDownloadEvent(i: Int) { - - } - override fun onDrawFrame(gl10: GL10) { Log.i("state_in", "state = $state") if (state != laststate) { @@ -507,25 +485,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl 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() { Log.i("Debug", "onResume") Log.i(this.localClassName, "onResume") @@ -548,10 +507,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener, IDeviceData, IDownl nativeOnResume() } - override fun onRetrievedDeviceData(deviceData: DeviceData) { - deviceData.setResolution(480, 800) - } - public override fun onSaveInstanceState(bundle: Bundle) { super.onSaveInstanceState(bundle) ApplicationLifecycle.onActivitySaveInstanceState(bundle, this) diff --git a/app/src/main/java/com/ea/ironmonkey/Receiver.java b/app/src/main/java/com/ea/ironmonkey/Receiver.java deleted file mode 100644 index a89302f..0000000 --- a/app/src/main/java/com/ea/ironmonkey/Receiver.java +++ /dev/null @@ -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 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()"); - } -} diff --git a/app/src/main/java/com/ea/ironmonkey/RunLoop.kt b/app/src/main/java/com/ea/ironmonkey/RunLoop.kt index f9e48ef..47d5d46 100644 --- a/app/src/main/java/com/ea/ironmonkey/RunLoop.kt +++ b/app/src/main/java/com/ea/ironmonkey/RunLoop.kt @@ -1,48 +1,36 @@ -package com.ea.ironmonkey; +package com.ea.ironmonkey -import android.opengl.GLSurfaceView; +import android.opengl.GLSurfaceView -public class RunLoop { - public static final int STATE_RUNNING = 1; - public static final int STATE_STOPPED = 0; - private GLSurfaceView glSurfaceView; - private int state; +class RunLoop(private val glSurfaceView: GLSurfaceView) { + private var state = 0 - public RunLoop(GLSurfaceView gLSurfaceView) { - this.glSurfaceView = gLSurfaceView; - updateRenderMode(); + init { updateRenderMode() } + + private external fun nativeOnRunLoopTick() + private fun setState(state: Int) { + this.state = state + updateRenderMode() } - private native void nativeOnRunLoopTick(); - - private void setState(int i) { - this.state = i; - updateRenderMode(); + private fun updateRenderMode() { + Log.v("RunLoop", "RunLoop.state = $state") + if (state == STATE_STOPPED) glSurfaceView.renderMode = STATE_STOPPED + if (state == STATE_RUNNING) glSurfaceView.renderMode = STATE_RUNNING } - private void updateRenderMode() { - Log.v("RunLoop", "RunLoop.state = " + this.state); - if(state == STATE_STOPPED) glSurfaceView.setRenderMode(STATE_STOPPED); - if(state == STATE_RUNNING) glSurfaceView.setRenderMode(STATE_RUNNING); + fun join() = setState(STATE_STOPPED) + + fun onRunLoopTick() { + if (state == STATE_RUNNING) nativeOnRunLoopTick() } - public int getState() { - return this.state; - } + fun start() = setState(STATE_RUNNING) - public void join() { - setState(STATE_STOPPED); - } + fun stop() = setState(STATE_STOPPED) - public void onRunLoopTick() { - if (state == STATE_RUNNING) nativeOnRunLoopTick(); - } - - public void start() { - setState(STATE_RUNNING); - } - - public void stop() { - setState(STATE_STOPPED); + companion object { + const val STATE_RUNNING = 1 + const val STATE_STOPPED = 0 } } diff --git a/app/src/main/java/com/ea/ironmonkey/WebActivity.java b/app/src/main/java/com/ea/ironmonkey/WebActivity.java deleted file mode 100644 index 3daf17f..0000000 --- a/app/src/main/java/com/ea/ironmonkey/WebActivity.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java b/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java index dcbb653..7b791a7 100644 --- a/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java +++ b/app/src/main/java/com/ea/nimble/ApplicationEnvironmentImpl.java @@ -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; import android.accounts.Account; @@ -29,9 +13,6 @@ import android.util.Log; import android.util.Patterns; 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.IOException; @@ -143,67 +124,7 @@ LogSource { * Enabled unnecessary exception pruning */ 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) { diff --git a/app/src/main/java/com/ea/nimble/FacebookImpl.java b/app/src/main/java/com/ea/nimble/FacebookImpl.java index e7932cf..dd4cf7d 100644 --- a/app/src/main/java/com/ea/nimble/FacebookImpl.java +++ b/app/src/main/java/com/ea/nimble/FacebookImpl.java @@ -6,22 +6,6 @@ import android.os.Bundle; import android.os.Handler; 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 java.util.ArrayList; @@ -31,11 +15,8 @@ import java.util.List; import java.util.Map; 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 { static boolean bHasSeenOpening; - private static Session.StatusCallback m_sessionCallback; - private HashMap m_fbHelpers; private static String TAG = "Facebook"; private static List m_callbackQueue = new ArrayList(); private Map userInfo = null; @@ -68,19 +49,11 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv @Override // com.ea.nimble.IFacebook public String getAccessToken() { - Session activeSession = Session.getActiveSession(); - if (activeSession != null) { - return activeSession.getAccessToken(); - } return null; } @Override // com.ea.nimble.IFacebook public String getApplicationId() { - Session activeSession = Session.getActiveSession(); - if (activeSession != null) { - return activeSession.getApplicationId(); - } return null; } @@ -91,10 +64,6 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv @Override // com.ea.nimble.IFacebook public Date getExpirationDate() { - Session activeSession = Session.getActiveSession(); - if (activeSession != null) { - return activeSession.getExpirationDate(); - } return null; } @@ -113,102 +82,46 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv @Override // com.ea.nimble.IFacebook public boolean hasOpenSession() { - Session activeSession = Session.getActiveSession(); - if (activeSession != null) { - return activeSession.isOpened(); - } return false; } @Override // com.ea.nimble.IFacebook public void login(List 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 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 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 public void onActivityDestroyed(Activity activity) { - UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity); - if (uiLifecycleHelper != null) { - uiLifecycleHelper.onDestroy(); - } + } @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks public void onActivityPaused(Activity activity) { - UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity); - if (uiLifecycleHelper != null) { - uiLifecycleHelper.onPause(); - } + } @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks 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 public void onActivityResumed(Activity activity) { - UiLifecycleHelper uiLifecycleHelper = this.m_fbHelpers.get(activity); - if (uiLifecycleHelper != null) { - uiLifecycleHelper.onResume(); - } + } @Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks 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 @@ -230,19 +143,7 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv @Override // com.ea.nimble.IFacebook 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 @@ -256,125 +157,17 @@ class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEv @Override // com.ea.nimble.IFacebook 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 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 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(); - } - } - }; + } } diff --git a/app/src/main/java/com/ea/nimble/NetworkConnection.java b/app/src/main/java/com/ea/nimble/NetworkConnection.java index d5f8cce..c04892b 100644 --- a/app/src/main/java/com/ea/nimble/NetworkConnection.java +++ b/app/src/main/java/com/ea/nimble/NetworkConnection.java @@ -3,7 +3,10 @@ package com.ea.nimble; import android.text.TextUtils; 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.FileInputStream; @@ -64,82 +67,14 @@ public class NetworkConnection implements LogSource, NetworkConnectionHandle, Ru } } - private String beautifyJSONString(String str) { - if (str == null || str.length() <= 0) { - return str; + private String beautifyJSONString(String jsonString) { + try { + 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; } diff --git a/app/src/main/java/com/ea/nimble/Utility.java b/app/src/main/java/com/ea/nimble/Utility.java index 0a199a2..e244f01 100644 --- a/app/src/main/java/com/ea/nimble/Utility.java +++ b/app/src/main/java/com/ea/nimble/Utility.java @@ -18,7 +18,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.XmlResourceParser; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import com.google.gson.GsonBuilder; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -127,7 +126,7 @@ public final class Utility { } public static String convertObjectToJSONString(Object object) { - return new GsonBuilder().disableHtmlEscaping().create().toJson(object); + return ""; } public static boolean getTestResult() { diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java b/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java index 471b6e1..6fb2222 100644 --- a/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFacebookUser.java @@ -1,19 +1,16 @@ package com.ea.nimble.friends; import com.ea.nimble.Global; -import com.ea.nimble.friends.NimbleUser; -import com.google.android.gms.plus.PlusShare; import java.util.Date; import org.json.JSONObject; -/* loaded from: stdlib.jar:com/ea/nimble/friends/NimbleFacebookUser.class */ class NimbleFacebookUser extends NimbleUser { - /* JADX INFO: Access modifiers changed from: package-private */ + public NimbleFacebookUser(JSONObject jSONObject) { this.authenticatorId = Global.NIMBLE_AUTHENTICATOR_FACEBOOK; this.userId = jSONObject.optString("id"); this.displayName = jSONObject.optString("name"); - this.imageUrl = jSONObject.optJSONObject("picture").optJSONObject("data").optString(PlusShare.KEY_CALL_TO_ACTION_URL); + this.imageUrl = jSONObject.optJSONObject("picture").optJSONObject("data").optString(""); this.refreshTimestamp = new Date(); setPlayedCurrentGame(NimbleUser.PlayedCurrentGameFlag.PLAYED); } diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java index c3da3ec..140bb83 100644 --- a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsError.java @@ -1,9 +1,7 @@ package com.ea.nimble.friends; 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 static final String NIMBLE_FRIENDS_ERROR_DOMAIN = "NimbleFriendsError"; private static final long serialVersionUID = 1; @@ -20,11 +18,11 @@ public class NimbleFriendsError extends Error { NIMBLE_FRIENDS_SMS_NOT_SENT_OUT(90007), NIMBLE_FRIENDS_NO_TARGETS_PROVIDED(90008), NIMBLE_FRIENDS_SERVER_RETURNED_ERROR(90009), - NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED), - NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(GamesActivityResultCodes.RESULT_SIGN_IN_FAILED), - NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(GamesActivityResultCodes.RESULT_LICENSE_FAILED), - NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(GamesActivityResultCodes.RESULT_APP_MISCONFIGURED), - NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(GamesActivityResultCodes.RESULT_LEFT_ROOM), + NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID(10001), + NIMBLE_FRIENDS_REFRESH_SCOPE_RANGE_EXCEED_LIMIT(10002), + NIMBLE_FRIENDS_REFRESH_SCOPE_INVALID_START_INDEX(10003), + NIMBLE_FRIENDS_REFRESH_FRIENDS_PROVIDER_NOT_AVAILABLE(10004), + NIMBLE_FRIENDS_REFRESH_NO_USER_IDS_LIST(10005), NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_ERROR(10006), NIMBLE_FRIENDS_REFRESH_IDENTITY_SERVER_EMPTY_RESPONSE(10007), NIMBLE_FRIENDS_REFRESH_FRIENDS_LIST_EMPTY(10008), diff --git a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java index 8b55cfe..68529f7 100644 --- a/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java +++ b/app/src/main/java/com/ea/nimble/friends/NimbleFriendsUtility.java @@ -3,8 +3,6 @@ package com.ea.nimble.friends; import com.ea.nimble.Base; import com.ea.nimble.Error; import com.ea.nimble.NetworkConnectionHandle; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -13,7 +11,6 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -/* loaded from: stdlib.jar:com/ea/nimble/friends/NimbleFriendsUtility.class */ class NimbleFriendsUtility { NimbleFriendsUtility() { } @@ -31,25 +28,7 @@ class NimbleFriendsUtility { } public static HashMap parseBodyJSONData(NetworkConnectionHandle networkConnectionHandle) throws Error { - InputStream dataStream = networkConnectionHandle.getResponse().getDataStream(); - 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 hashMap = null; - if (str != null) { - hashMap = null; - if (str.length() > 0) { - hashMap = (HashMap) new GsonBuilder().serializeNulls().create().fromJson(str, new TypeToken>() { // from class: com.ea.nimble.friends.NimbleFriendsUtility.1 - }.getType()); - } - } - return hashMap; + return null; } /* JADX INFO: Access modifiers changed from: protected */ diff --git a/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java b/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java index ad1a387..187e870 100644 --- a/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java +++ b/app/src/main/java/com/ea/nimble/identity/AuthenticatorFacebook.java @@ -11,10 +11,6 @@ import com.ea.nimble.Network; import com.ea.nimble.NetworkConnectionCallback; import com.ea.nimble.NetworkConnectionHandle; import com.ea.nimble.Utility; -import com.ea.nimble.identity.INimbleIdentityAuthenticator; -import com.ea.nimble.identity.NimbleIdentityError; -import com.ea.nimble.identity.NimbleIdentityLoginParams; -import com.facebook.FacebookOperationCanceledException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -73,26 +69,7 @@ class AuthenticatorFacebook extends AuthenticatorBase { } private void loginFacebook(IFacebook iFacebook, List 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 */ diff --git a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java index 363e654..23a037a 100644 --- a/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java +++ b/app/src/main/java/com/ea/nimble/identity/NimbleIdentityUtility.java @@ -5,8 +5,6 @@ import android.annotation.SuppressLint; import com.ea.nimble.Error; import com.ea.nimble.NetworkConnectionHandle; import com.ea.nimble.Utility; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; import org.json.JSONException; import org.json.JSONObject; @@ -89,29 +87,6 @@ class NimbleIdentityUtility { } public static ByteArrayOutputStream toJSONString(HashMap hashMap) { - IOException e; - UnsupportedEncodingException e2; - ByteArrayOutputStream byteArrayOutputStream = null; - if (hashMap != null) { - try { - byte[] bytes = new GsonBuilder().serializeNulls().create().toJson(hashMap, new TypeToken>() { // 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; + return null; } } diff --git a/app/src/main/java/com/ea/nimble/inappmessage/InAppMessage.java b/app/src/main/java/com/ea/nimble/inappmessage/InAppMessage.java index 1fe7b09..82cb634 100644 --- a/app/src/main/java/com/ea/nimble/inappmessage/InAppMessage.java +++ b/app/src/main/java/com/ea/nimble/inappmessage/InAppMessage.java @@ -19,7 +19,7 @@ public class InAppMessage { } 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); } } diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java deleted file mode 100644 index e44e5a8..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlay.java +++ /dev/null @@ -1,1634 +0,0 @@ -package com.ea.nimble.mtx.googleplay; - -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; -import android.provider.Settings; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import android.telephony.TelephonyManager; -import com.ea.nimble.ApplicationEnvironment; -import com.ea.nimble.ApplicationLifecycle; -import com.ea.nimble.Base; -import com.ea.nimble.Component; -import com.ea.nimble.Error; -import com.ea.nimble.Global; -import com.ea.nimble.IApplicationEnvironment; -import com.ea.nimble.IApplicationLifecycle; -import com.ea.nimble.IHttpRequest; -import com.ea.nimble.ISynergyEnvironment; -import com.ea.nimble.ISynergyIdManager; -import com.ea.nimble.Log; -import com.ea.nimble.LogSource; -import com.ea.nimble.Network; -import com.ea.nimble.NimbleConfiguration; -import com.ea.nimble.Persistence; -import com.ea.nimble.PersistenceService; -import com.ea.nimble.SynergyEnvironment; -import com.ea.nimble.SynergyIdManager; -import com.ea.nimble.SynergyNetwork; -import com.ea.nimble.SynergyRequest; -import com.ea.nimble.SynergyServerError; -import com.ea.nimble.Timer; -import com.ea.nimble.Utility; -import com.ea.nimble.mtx.INimbleMTX; -import com.ea.nimble.mtx.NimbleCatalogItem; -import com.ea.nimble.mtx.NimbleMTXError; -import com.ea.nimble.mtx.NimbleMTXTransaction; -import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; -import com.ea.nimble.mtx.catalog.synergy.SynergyCatalogItem; -import com.ea.nimble.mtx.googleplay.util.IabHelper; -import com.ea.nimble.mtx.googleplay.util.IabResult; -import com.ea.nimble.mtx.googleplay.util.Inventory; -import com.ea.nimble.mtx.googleplay.util.Purchase; -import com.ea.nimble.mtx.googleplay.util.SkuDetails; -import com.ea.nimble.tracking.ITracking; -import com.ea.nimble.tracking.Tracking; -import com.google.android.gms.maps.model.BitmapDescriptorFactory; -import java.io.Serializable; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Currency; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.TimeZone; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -public class GooglePlay extends Component implements IApplicationLifecycle.ActivityEventCallbacks, LogSource, INimbleMTX, IabHelper.OnIabPurchaseFinishedListener { - private static final double CACHE_EXPIRE_TIME = 3600.0d; - private static final String CACHE_TIMESTAMP_KEY = "cacheTimestamp"; - public static final String COMPONENT_ID = "com.ea.nimble.mtx.googleplay"; - private static final double DEFERRED_CALLBACK_DELAY = 0.1d; - private static final double MAX_REQUEST_RETRY_DELAY = 300.0d; - private static final String PERSISTENCE_CATALOG_ITEMS = "catalogItems"; - private static final String PERSISTENCE_PENDING_TRANSACTIONS = "pendingTransactions"; - private static final String PERSISTENCE_PURCHASED_TRANSACTIONS = "purchasedTransactions"; - private static final String PERSISTENCE_RECOVERED_TRANSACTIONS = "recoveredTransactions"; - private static final String PERSISTENCE_UNRECORDED_TRANSACTIONS = "unrecordedTransactions"; - private static final String SYNERGY_API_VERIFY_AND_RECORD_GOOGLEPLAY_PURCHASE = "/drm/api/android/verifyAndRecordPurchase"; - IabHelper mGooglePlayIabHelper; - String m_appPublicKey; - private Long m_cacheTimestamp; - private boolean m_restoreInProgress; - SynergyCatalog m_synergyCatalog; - private boolean m_verificationEnabled; - public static int GOOGLEPLAY_ACTIVITY_RESULT_REQUEST_CODE = 987654; - public static String GOOGLEPLAY_PLATFORM_PARAMETER_APPLICATION_PUBLIC_KEY = "GOOGLEPLAY_APPLICATION_PUBLIC_KEY"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID = "orderId"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME = "purchaseTime"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE = "purchaseState"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN = "token"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA = "purchaseData"; - public static String GOOGLEPLAY_ADDITIONALINFO_KEY_RECEIPT = "receipt"; - private ItemRestorer m_itemRestorer = new ItemRestorer(); - private TransactionRecorder m_transactionRecorder = new TransactionRecorder(); - HashMap mPendingTransactions = new HashMap<>(); - HashMap mPurchasedTransactions = new HashMap<>(); - HashMap mRecoveredTransactions = new HashMap<>(); - HashMap mCatalogItems = new HashMap<>(); - ArrayList mUnrecordedTransactions = new ArrayList<>(); - - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$GetNonceCallback.class */ - public interface GetNonceCallback { - void onGetNonceComplete(GooglePlayTransaction googlePlayTransaction, String str, Error error); - } - - /* JADX INFO: Access modifiers changed from: private */ - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$ItemRestorer.class */ - public class ItemRestorer extends BroadcastReceiver implements Runnable { - private double m_requestRetryDelay; - private Timer m_timer; - - private ItemRestorer() { - this.m_timer = new Timer(this); - this.m_requestRetryDelay = 1.0d; - } - - public void cancel() { - GooglePlay.this.m_restoreInProgress = false; - this.m_timer.cancel(); - this.m_requestRetryDelay = 1.0d; - Utility.unregisterReceiver(this); - } - - @Override // android.content.BroadcastReceiver - public void onReceive(Context context, Intent intent) { - if (intent.getExtras().getString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT).equals(Global.NOTIFICATION_DICTIONARY_RESULT_FAIL)) { - Log.Helper.LOGD(GooglePlay.this, "Catalog refresh failed with restore pending. Retrying in " + this.m_requestRetryDelay + " seconds."); - if (!this.m_timer.isRunning()) { - this.m_timer.schedule(this.m_requestRetryDelay, false); - return; - } - return; - } - this.m_timer.cancel(); - Utility.unregisterReceiver(this); - GooglePlay.this.m_restoreInProgress = false; - GooglePlay.this.restorePurchasedTransactionsImpl(false); - } - - public void restoreItems() { - if (!GooglePlay.this.m_restoreInProgress) { - if (GooglePlay.this.mCatalogItems == null || GooglePlay.this.mCatalogItems.isEmpty()) { - GooglePlay.this.m_restoreInProgress = true; - Log.Helper.LOGD(GooglePlay.this, "Restore pending but catalog is unavailable. Initiating refresh now."); - Utility.registerReceiver(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, this); - GooglePlay.this.refreshAvailableCatalogItems(); - return; - } - GooglePlay.this.restorePurchasedTransactionsImpl(false); - } - } - - @Override // java.lang.Runnable - public void run() { - this.m_requestRetryDelay = Math.min(this.m_requestRetryDelay * 2.0d, 300.0d); - GooglePlay.this.refreshAvailableCatalogItems(); - } - } - - /* JADX INFO: Access modifiers changed from: private */ - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$PurchaseTransactionVerifier.class */ - public class PurchaseTransactionVerifier { - private PurchaseTransactionVerifier() { - } - - public void verifyTransaction(GooglePlayTransaction googlePlayTransaction) { - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE); - GooglePlay.this.networkCallGetNonceFromSynergy(googlePlayTransaction, new GetNonceCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.PurchaseTransactionVerifier.1 - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback - public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction2, String str, Error error) { - if (googlePlayTransaction2.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE) { - if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction2, str, error)) { - GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction2, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.PurchaseTransactionVerifier.1.1 - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback - public void onVerificationComplete(Exception exc) { - if (googlePlayTransaction2.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION) { - if (exc != null) { - Log.Helper.LOGE(this, "Error making recordPurchase call to Synergy: " + exc); - googlePlayTransaction2.mError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy verification error", exc); - googlePlayTransaction2.mFailedState = googlePlayTransaction2.mGooglePlayTransactionState; - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - } else { - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT); - } - if (googlePlayTransaction2 != null && googlePlayTransaction2.mPurchaseCallback != null) { - googlePlayTransaction2.mPurchaseCallback.purchaseComplete(googlePlayTransaction2); - } - } - } - }); - } else if (googlePlayTransaction2 != null && googlePlayTransaction2.mPurchaseCallback != null) { - googlePlayTransaction2.mPurchaseCallback.purchaseComplete(googlePlayTransaction2); - } - } - } - }); - } - } - - /* JADX INFO: Access modifiers changed from: private */ - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$RestoreTransactionVerifier.class */ - public class RestoreTransactionVerifier { - private AtomicInteger m_transactionsVerifying; - private ArrayList m_verifiedTransactions; - - private RestoreTransactionVerifier() { - } - - public void verifyTransactions(List list) { - this.m_transactionsVerifying = new AtomicInteger(0); - this.m_verifiedTransactions = new ArrayList<>(); - if (list.size() == 0) { - GooglePlay.this.onRestoreComplete(this.m_verifiedTransactions); - return; - } - for (GooglePlayTransaction googlePlayTransaction : list) { - this.m_transactionsVerifying.incrementAndGet(); - GooglePlay.this.mPendingTransactions.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE); - GooglePlay.this.networkCallGetNonceFromSynergy(googlePlayTransaction, new GetNonceCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.RestoreTransactionVerifier.1 - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback - public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction2, String str, Error error) { - if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction2, str, error)) { - GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction2, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.RestoreTransactionVerifier.1.1 - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback - public void onVerificationComplete(Exception exc) { - if (exc != null) { - googlePlayTransaction2.mError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy verification error", exc); - } - RestoreTransactionVerifier.this.m_verifiedTransactions.add(googlePlayTransaction2); - if (RestoreTransactionVerifier.this.m_transactionsVerifying.decrementAndGet() == 0) { - GooglePlay.this.onRestoreComplete(RestoreTransactionVerifier.this.m_verifiedTransactions); - } - } - }); - } else if (RestoreTransactionVerifier.this.m_transactionsVerifying.decrementAndGet() == 0) { - GooglePlay.this.onRestoreComplete(RestoreTransactionVerifier.this.m_verifiedTransactions); - } - } - }); - } - } - } - - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$TransactionRecorder.class */ - public class TransactionRecorder extends BroadcastReceiver implements GetNonceCallback, Runnable { - private double m_requestRetryDelay; - private Timer m_timer; - - private TransactionRecorder() { - this.m_requestRetryDelay = 1.0d; - this.m_timer = new Timer(this); - } - - public void cancel() { - this.m_timer.cancel(); - this.m_requestRetryDelay = 1.0d; - Utility.unregisterReceiver(this); - } - - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.GetNonceCallback - public void onGetNonceComplete(final GooglePlayTransaction googlePlayTransaction, String str, Error error) { - if (!GooglePlay.this.isCancelledError(error)) { - if (GooglePlay.this.updateTransactionRecordWithNonce(googlePlayTransaction, str, error)) { - GooglePlay.this.networkCallRecordPurchase(googlePlayTransaction, new VerifyCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.TransactionRecorder.1 - @Override // com.ea.nimble.mtx.googleplay.GooglePlay.VerifyCallback - public void onVerificationComplete(Exception exc) { - if (!GooglePlay.this.isCancelledError(exc)) { - if (googlePlayTransaction.mIsRecorded) { - GooglePlay.this.mUnrecordedTransactions.remove(googlePlayTransaction); - GooglePlay.this.saveUnrecordedTransactionsToPersistence(); - TransactionRecorder.this.m_requestRetryDelay = 1.0d; - } else if (!TransactionRecorder.this.m_timer.isRunning()) { - TransactionRecorder.this.m_timer.schedule(TransactionRecorder.this.m_requestRetryDelay, false); - } - } - } - }); - } else if (!this.m_timer.isRunning()) { - this.m_timer.schedule(this.m_requestRetryDelay, false); - } - } - } - - @Override // android.content.BroadcastReceiver - public void onReceive(Context context, Intent intent) { - Log.Helper.LOGD(GooglePlay.this, "Received network notification"); - if (Network.getComponent().getStatus() == Network.Status.OK) { - Log.Helper.LOGD(GooglePlay.this, "Network status is OK, unregistering receiver and attempting to record transactions"); - Utility.unregisterReceiver(this); - recordTransactions(); - return; - } - Log.Helper.LOGD(GooglePlay.this, "Attempted to recordTransaction but network state was not OK. Aborting and eating my transaction."); - } - - public void recordTransactions() { - if (GooglePlay.this.mUnrecordedTransactions == null || GooglePlay.this.mUnrecordedTransactions.size() == 0) { - Log.Helper.LOGD(GooglePlay.this, "No transactions to record"); - return; - } - Log.Helper.LOGD(GooglePlay.this, "Attempting to record transactions"); - if (ApplicationEnvironment.getCurrentActivity() == null) { - Log.Helper.LOGD(GooglePlay.this, "Main application not running, ignoring record"); - } else if (Network.getComponent().getStatus() != Network.Status.OK) { - Log.Helper.LOGD(GooglePlay.this, "Waiting for Network connectivity"); - Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this); - } else { - Iterator it = GooglePlay.this.mUnrecordedTransactions.iterator(); - while (it.hasNext()) { - GooglePlay.this.networkCallGetNonceFromSynergy(it.next(), this); - } - } - } - - @Override // java.lang.Runnable - public void run() { - this.m_requestRetryDelay = Math.min(this.m_requestRetryDelay * 2.0d, 300.0d); - recordTransactions(); - } - } - - /* loaded from: stdlib.jar:com/ea/nimble/mtx/googleplay/GooglePlay$VerifyCallback.class */ - public interface VerifyCallback { - void onVerificationComplete(Exception exc); - } - - private GooglePlay() { - } - - public void broadcastLocalEvent(String str, String str2, String str3, Bundle bundle) { - LocalBroadcastManager instance = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()); - Intent intent = new Intent(); - intent.setAction(str); - Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle(); - if (str2 == null) { - bundle2.putString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, Global.NOTIFICATION_DICTIONARY_RESULT_SUCCESS); - } else { - bundle2.putString("error", str2); - bundle2.putString(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, Global.NOTIFICATION_DICTIONARY_RESULT_FAIL); - } - if (str3 != null) { - bundle2.putString(INimbleMTX.NOTIFICATION_DICTIONARY_KEY_TRANSACTIONID, str3); - } - intent.putExtras(bundle2); - instance.sendBroadcast(intent); - } - - public Map createAdditionalInfoBundleFromIabPurchase(Purchase purchase) { - HashMap hashMap = new HashMap(); - if (purchase != null) { - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID, purchase.getOrderId()); - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASETIME, Long.valueOf(purchase.getPurchaseTime())); - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASESTATE, Integer.valueOf(purchase.getPurchaseState())); - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_TOKEN, purchase.getToken()); - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA, purchase.getOriginalJson()); - hashMap.put(GOOGLEPLAY_ADDITIONALINFO_KEY_RECEIPT, purchase.getSignature()); - } - return hashMap; - } - - public GooglePlayError createGooglePlayErrorFromIabResult(IabResult iabResult) { - GooglePlayError.Code code; - if (iabResult == null || iabResult.getResponse() == 0) { - return null; - } - switch (iabResult.getResponse()) { - case IabHelper.IABHELPER_UNKNOWN_ERROR /* -1009 */: - code = GooglePlayError.Code.IABHELPER_UNKNOWN_ERROR; - break; - case IabHelper.IABHELPER_BAD_STATE_ERROR /* -1008 */: - code = GooglePlayError.Code.IABHELPER_BAD_STATE_ERROR; - break; - case IabHelper.IABHELPER_MISSING_TOKEN /* -1007 */: - code = GooglePlayError.Code.IABHELPER_MISSING_TOKEN; - break; - case IabHelper.IABHELPER_UNKNOWN_PURCHASE_RESPONSE /* -1006 */: - code = GooglePlayError.Code.IABHELPER_UNKNOWN_PURCHASE_RESPONSE; - break; - case IabHelper.IABHELPER_USER_CANCELLED /* -1005 */: - code = GooglePlayError.Code.IABHELPER_USER_CANCELLED; - break; - case IabHelper.IABHELPER_SEND_INTENT_FAILED /* -1004 */: - code = GooglePlayError.Code.IABHELPER_SEND_INTENT_FAILED; - break; - case IabHelper.IABHELPER_VERIFICATION_FAILED /* -1003 */: - code = GooglePlayError.Code.IABHELPER_VERIFICATION_FAILED; - break; - case IabHelper.IABHELPER_BAD_RESPONSE /* -1002 */: - code = GooglePlayError.Code.IABHELPER_BAD_RESPONSE; - break; - case IabHelper.IABHELPER_REMOTE_EXCEPTION /* -1001 */: - code = GooglePlayError.Code.IABHELPER_REMOTE_EXCEPTION; - break; - case IabHelper.IABHELPER_ERROR_BASE /* -1000 */: - code = GooglePlayError.Code.IABHELPER_ERROR_BASE; - break; - case 1: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_USER_CANCELED; - break; - case 3: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE; - break; - case 4: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE; - break; - case 5: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_DEVELOPER_ERROR; - break; - case 6: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ERROR; - break; - case 7: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED; - break; - case 8: - code = GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED; - break; - default: - code = GooglePlayError.Code.UNKNOWN; - break; - } - return new GooglePlayError(code, iabResult.getMessage()); - } - - private void createIabHelper() { - this.mGooglePlayIabHelper = new IabHelper(ApplicationEnvironment.getComponent().getApplicationContext(), getAppPublicKey()); - this.mGooglePlayIabHelper.enableDebugLogging(true); - this.mGooglePlayIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.1 - @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabSetupFinishedListener - public void onIabSetupFinished(IabResult iabResult) { - Log.Helper.LOGD(this, "InAppBilling helper setup finished."); - if (!iabResult.isSuccess()) { - Log.Helper.LOGD(this, "Error setting up InAppBilling helper: " + iabResult); - } else { - GooglePlay.this.m_itemRestorer.restoreItems(); - } - } - }, new IabHelper.OnIabBroadcastListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.2 - @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabBroadcastListener - public void receivedBroadcast() { - Log.Helper.LOGD(this, "Received PURCHASES_UPDATED broadcast - resolving transactions"); - GooglePlay.this.restorePurchasedTransactions(); - } - }); - } - - public NimbleMTXError createNimbleMTXErrorWithGooglePlayError(GooglePlayError googlePlayError, String str) { - NimbleMTXError.Code code = NimbleMTXError.Code.PLATFORM_ERROR; - NimbleMTXError.Code code2 = code; - if (googlePlayError != null) { - int code3 = googlePlayError.getCode(); - if (code3 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_USER_CANCELED.intValue() || code3 == GooglePlayError.Code.IABHELPER_USER_CANCELLED.intValue()) { - code2 = NimbleMTXError.Code.USER_CANCELED; - } else if (code3 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE.intValue()) { - code2 = NimbleMTXError.Code.BILLING_NOT_AVAILABLE; - } else if (code3 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE.intValue()) { - code2 = NimbleMTXError.Code.ITEM_UNAVAILABLE; - } else if (code3 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED.intValue()) { - code2 = NimbleMTXError.Code.ITEM_ALREADY_OWNED; - } else { - code2 = code; - if (code3 == GooglePlayError.Code.BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED.intValue()) { - code2 = NimbleMTXError.Code.ITEM_NOT_OWNED; - } - } - } - return new NimbleMTXError(code2, str, googlePlayError); - } - - private void deferredConsumeCallback(final INimbleMTX.ItemGrantedCallback itemGrantedCallback, final NimbleMTXTransaction nimbleMTXTransaction) { - new Timer(new Runnable() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.11 - @Override // java.lang.Runnable - public void run() { - itemGrantedCallback.itemGrantedComplete(nimbleMTXTransaction); - } - }).schedule(DEFERRED_CALLBACK_DELAY, false); - } - - private HashMap filterForResumablePurchaseTransactions(HashMap hashMap) { - HashMap hashMap2 = new HashMap<>(); - if (hashMap != null) { - for (GooglePlayTransaction googlePlayTransaction : hashMap.values()) { - if (googlePlayTransaction.mTransactionType == NimbleMTXTransaction.TransactionType.PURCHASE && (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.COMPLETE)) { - hashMap2.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); - } - } - } - return hashMap2; - } - - private List findRecoveredTransactionsWithItemSku(String str) { - ArrayList arrayList = new ArrayList(); - if (str != null) { - for (GooglePlayTransaction googlePlayTransaction : this.mRecoveredTransactions.values()) { - if (googlePlayTransaction.getItemSku().equals(str)) { - arrayList.add(googlePlayTransaction); - } - } - } - return arrayList; - } - - private String generateDeveloperPayloadForTransaction(GooglePlayTransaction googlePlayTransaction) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMddHHmmss", Locale.US); - simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - return simpleDateFormat.format(new Date()); - } - - public String generateTransactionId() { - return UUID.randomUUID().toString(); - } - - private String getAppPublicKey() { - return this.m_appPublicKey; - } - - private GooglePlayCatalogItem getCatalogItemBySku(String str) { - return this.mCatalogItems.get(str); - } - - public static GooglePlay getComponent() { - return (GooglePlay) Base.getComponent(COMPONENT_ID); - } - - public void getGooglePlayPricingForPendingCatalogItems(List list) { - if (list == null || list.isEmpty()) { - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, "Empty catalog item list for GooglePlay catalog query.", null, null); - return; - } - - ApplicationEnvironment.getCurrentActivity().runOnUiThread( - new Lambdas(list, this.mGooglePlayIabHelper, this) - ); - } - - class Lambdas implements Runnable, IabHelper.QueryInventoryFinishedListener{ - - List mCatalogItemList; - IabHelper mIabHelper; - GooglePlay mParentNimbleGooglePlayObject; - - public Lambdas(List mCatalogItemList, IabHelper mIabHelper, GooglePlay mParentNimbleGooglePlayObject) { - this.mCatalogItemList = mCatalogItemList; - this.mIabHelper = mIabHelper; - this.mParentNimbleGooglePlayObject = mParentNimbleGooglePlayObject; - } - - @Override - public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory) { - NimbleMTXError nimbleMTXError; - Log.Helper.LOGD(this, "GooglePlayCatalogUpdateListener onQueryInventoryFinished"); - if (iabResult.isFailure()) { - Log.Helper.LOGD(this, "Query inventory error: " + iabResult.getMessage()); - nimbleMTXError = GooglePlay.this.createNimbleMTXErrorWithGooglePlayError(GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult), "GooglePlay catalog query error"); - } else { - HashSet hashSet = new HashSet(); - for (GooglePlayCatalogItem googlePlayCatalogItem : this.mCatalogItemList) { - SkuDetails skuDetails = inventory.getSkuDetails(googlePlayCatalogItem.mSku); - if (skuDetails != null) { - googlePlayCatalogItem.mTitle = skuDetails.getTitle(); - googlePlayCatalogItem.mDescription = skuDetails.getDescription(); - googlePlayCatalogItem.mPriceWithCurrencyAndFormat = skuDetails.getPrice(); - googlePlayCatalogItem.mPriceDecimal = Utility.validString(skuDetails.getPriceMicros()) ? Float.parseFloat(skuDetails.getPriceMicros()) / 1000000.0f : BitmapDescriptorFactory.HUE_RED; - googlePlayCatalogItem.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, skuDetails.getCurrencyCode()); - } else { - Log.Helper.LOGE(this, "Could not get SKU details from GooglePlay for SKU: %s. Removing from results.", googlePlayCatalogItem.mSku); - hashSet.add(googlePlayCatalogItem); - } - } - nimbleMTXError = null; - if (hashSet.size() > 0) { - this.mCatalogItemList.removeAll(hashSet); - nimbleMTXError = null; - } - } - this.mParentNimbleGooglePlayObject.onGooglePlayCatalogItemsRefreshed(this.mCatalogItemList, true, nimbleMTXError); - } - - void queryGooglePlay() { - ArrayList arrayList = new ArrayList(); - for (GooglePlayCatalogItem googlePlayCatalogItem : this.mCatalogItemList) { - arrayList.add(googlePlayCatalogItem.mSku); - } - Log.Helper.LOGD(this, "Making GooglePlay inventory query for skus: " + arrayList); - this.mIabHelper.queryInventoryAsync(false, true, arrayList, this); - } - - @Override - public void run() { - try { - queryGooglePlay(); - } catch (IllegalStateException e) { - onQueryInventoryFinished(new IabResult(3, "Billing is unavailable"), null); - } - } - } - - private void googlePlayCallPurchaseItem(GooglePlayTransaction googlePlayTransaction) { - googlePlayTransaction.mDeveloperPayload = generateDeveloperPayloadForTransaction(googlePlayTransaction); - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE); - this.mGooglePlayIabHelper.launchPurchaseFlow(ApplicationEnvironment.getCurrentActivity(), googlePlayTransaction.getItemSku(), GOOGLEPLAY_ACTIVITY_RESULT_REQUEST_CODE, this, googlePlayTransaction.mDeveloperPayload); - } - - private void googlePlayConsumeItem(GooglePlayTransaction googlePlayTransaction) { - try { - this.mGooglePlayIabHelper.consumeAsync(new Purchase(googlePlayTransaction), new IabHelper.OnConsumeFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.10 - @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnConsumeFinishedListener - public void onConsumeFinished(Purchase purchase, IabResult iabResult) { - if (iabResult.isFailure()) { - Log.Helper.LOGE(this, "GooglePlay consume item failed, item SKU: " + purchase.getSku()); - GooglePlayTransaction googlePlayTransaction2 = GooglePlay.this.mPendingTransactions.get(purchase.getNimbleMTXTransactionId()); - if (googlePlayTransaction2 != null) { - googlePlayTransaction2.mError = GooglePlay.this.createNimbleMTXErrorWithGooglePlayError(GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult), "GooglePlay item consumption error."); - googlePlayTransaction2.mFailedState = googlePlayTransaction2.mGooglePlayTransactionState; - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction2, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - if (googlePlayTransaction2.mItemGrantedCallback != null) { - googlePlayTransaction2.mItemGrantedCallback.itemGrantedComplete(googlePlayTransaction2); - } else { - Log.Helper.LOGE(this, "Transaction does not have a consume callback to notify game of the finalize error."); - } - } - } else { - Log.Helper.LOGD(this, "GooglePlay consume item success, item SKU: " + purchase.getSku()); - GooglePlayTransaction googlePlayTransaction3 = GooglePlay.this.mPendingTransactions.get(purchase.getNimbleMTXTransactionId()); - if (googlePlayTransaction3 != null) { - GooglePlay.this.updateGooglePlayTransactionRecordState(googlePlayTransaction3, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - if (googlePlayTransaction3.mItemGrantedCallback != null) { - googlePlayTransaction3.mItemGrantedCallback.itemGrantedComplete(googlePlayTransaction3); - } else { - Log.Helper.LOGE(this, "Transaction does not have a consume callback to notify game."); - } - } else { - Log.Helper.LOGE(this, "Unable to find consumed transaction to remove."); - } - } - } - }); - } catch (Exception e) { - Log.Helper.LOGE(this, "Unable to construct a Purchase object from GooglePlayTransaction. Unable to consume item with Google Play!"); - if (googlePlayTransaction.mItemGrantedCallback != null) { - googlePlayTransaction.mError = new NimbleMTXError(NimbleMTXError.Code.UNABLE_TO_CONSTRUCT_REQUEST, "Unable to construct Purchase object from GooglePlayTransaction."); - googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; - deferredConsumeCallback(googlePlayTransaction.mItemGrantedCallback, googlePlayTransaction); - return; - } - Log.Helper.LOGE(this, "ItemGrantedCallback not set, no way to notify game."); - } - } - - private static void initialize() { - Base.registerComponent(new GooglePlay(), COMPONENT_ID); - } - - private boolean isCacheExpired() { - return this.m_cacheTimestamp == null || ((double) (System.currentTimeMillis() - this.m_cacheTimestamp.longValue())) > 3600000.0d; - } - - public boolean isCancelledError(Throwable th) { - if (!(th instanceof Error)) { - return false; - } - Error error = (Error) th; - return (error.getDomain().equals(Error.ERROR_DOMAIN) && error.getCode() == Error.Code.NETWORK_OPERATION_CANCELLED.intValue()) || isCancelledError(error.getCause()); - } - - private boolean isTransactionPending() { - return isTransactionPending(true); - } - - private boolean isTransactionPending(boolean z) { - if (this.mPendingTransactions.size() == 0) { - return z && this.mRecoveredTransactions.size() != 0; - } - return true; - } - - private void loadFromPersistence() { - Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); - Serializable value = persistenceForNimbleComponent.getValue(PERSISTENCE_CATALOG_ITEMS); - if (value != null && value.getClass() == HashMap.class) { - this.mCatalogItems = new HashMap<>((HashMap) value); - Log.Helper.LOGD(this, "Restored %d catalog items from persistence.", Integer.valueOf(this.mCatalogItems.size())); - } - Serializable value2 = persistenceForNimbleComponent.getValue(PERSISTENCE_PURCHASED_TRANSACTIONS); - if (value2 == null || value2.getClass() != HashMap.class) { - Log.Helper.LOGD(this, "No purchased transactions to restore."); - } else { - this.mPurchasedTransactions = new HashMap<>((HashMap) value2); - Log.Helper.LOGD(this, "%d purchased transactions restored from persistence.", Integer.valueOf(this.mPurchasedTransactions.size())); - } - Serializable value3 = persistenceForNimbleComponent.getValue(PERSISTENCE_RECOVERED_TRANSACTIONS); - if (value3 == null || value3.getClass() != HashMap.class) { - Log.Helper.LOGD(this, "No recovered transactions to restore."); - } else { - this.mRecoveredTransactions = new HashMap<>((HashMap) value3); - Log.Helper.LOGD(this, "%d recovered transactions restored from persistence.", Integer.valueOf(this.mRecoveredTransactions.size())); - } - Serializable value4 = persistenceForNimbleComponent.getValue(PERSISTENCE_PENDING_TRANSACTIONS); - if (value4 == null || value4.getClass() != HashMap.class) { - Log.Helper.LOGD(this, "No pending transactions to restore."); - } else { - HashMap hashMap = new HashMap<>((HashMap) value4); - Log.Helper.LOGD(this, "%d pending transactions restored from persistence.", Integer.valueOf(hashMap.size())); - if (this.mRecoveredTransactions == null) { - this.mRecoveredTransactions = new HashMap<>(); - } - this.mRecoveredTransactions.putAll(filterForResumablePurchaseTransactions(hashMap)); - for (GooglePlayTransaction googlePlayTransaction : this.mRecoveredTransactions.values()) { - this.mPendingTransactions.remove(googlePlayTransaction.getTransactionId()); - } - } - Serializable value5 = persistenceForNimbleComponent.getValue(PERSISTENCE_UNRECORDED_TRANSACTIONS); - if (value5 != null && (value5 instanceof ArrayList)) { - this.mUnrecordedTransactions = (ArrayList) value5; - this.m_transactionRecorder.recordTransactions(); - } - this.m_cacheTimestamp = (Long) persistenceForNimbleComponent.getValue(CACHE_TIMESTAMP_KEY); - if (this.mRecoveredTransactions != null && this.mRecoveredTransactions.size() > 0) { - Log.Helper.LOGD(this, "Recovered transactions: " + this.mRecoveredTransactions); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_TRANSACTIONS_RECOVERED, null, null, null); - } - } - - public void networkCallGetNonceFromSynergy(final GooglePlayTransaction googlePlayTransaction, final GetNonceCallback getNonceCallback) { - try { - this.m_synergyCatalog.getNonce(new SynergyCatalog.StringCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.7 - @Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.StringCallback - public void callback(String str, Exception exc) { - if (exc == null) { - getNonceCallback.onGetNonceComplete(googlePlayTransaction, str, null); - return; - } - getNonceCallback.onGetNonceComplete(googlePlayTransaction, null, new NimbleMTXError(NimbleMTXError.Code.GET_NONCE_ERROR, "Synergy getNonce request error.", exc)); - } - }); - } catch (Exception e) { - e.printStackTrace(); - getNonceCallback.onGetNonceComplete(googlePlayTransaction, null, new NimbleMTXError(NimbleMTXError.Code.GET_NONCE_ERROR, "Error making Synergy getNonce request", e)); - } - } - - public void networkCallRecordPurchase(final GooglePlayTransaction googlePlayTransaction, final VerifyCallback verifyCallback) { - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION); - - SynergyNetwork - .getComponent() - .sendRequest( - new SynergyRequest(SYNERGY_API_VERIFY_AND_RECORD_GOOGLEPLAY_PURCHASE, IHttpRequest.Method.POST, (synergyRequest)->{ - String str; - String str2; - Map pidMap; - String gameSpecifiedPlayerId; - IApplicationEnvironment component = ApplicationEnvironment.getComponent(); - ISynergyEnvironment component2 = SynergyEnvironment.getComponent(); - ISynergyIdManager component3 = SynergyIdManager.getComponent(); - HashMap hashMap = new HashMap(); - boolean z = googlePlayTransaction.getCatalogItem() != null && googlePlayTransaction.getCatalogItem().isFree(); - hashMap.put("transactionId", googlePlayTransaction.getAdditionalInfo().get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_ORDERID)); - hashMap.put("price", (int) (googlePlayTransaction.getPriceDecimal() * 100.0f)); - hashMap.put("currency", googlePlayTransaction.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY)); - hashMap.put("restore", googlePlayTransaction.getTransactionType() == NimbleMTXTransaction.TransactionType.RESTORE); - try { - hashMap.put("receipt", googlePlayTransaction.getAdditionalInfo().get(GooglePlay.GOOGLEPLAY_ADDITIONALINFO_KEY_PURCHASEDATA)); - } catch (Exception e) { - Log.Helper.LOGE(this, "Exception creating JSON body for /recordPurchase"); - hashMap.put("receipt", ""); - } - hashMap.put("itemSellId", googlePlayTransaction.getItemSku().substring(GooglePlay.this.m_synergyCatalog.getItemSkuPrefix().length())); - hashMap.put("masterSellId", component2.getSellId()); - hashMap.put("hwId", component2.getEAHardwareId()); - hashMap.put("signature", googlePlayTransaction.getReceipt()); - hashMap.put("nonce", googlePlayTransaction.getNonce()); - hashMap.put("isFree", z+""); - String synergyId = component3.getSynergyId(); - if (!(synergyId == null || synergyId == "")) { - hashMap.put("synergyUid", Utility.safeString(synergyId)); - } - HashMap hashMap2 = new HashMap(); - String string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id"); - if (!(component == null || (gameSpecifiedPlayerId = component.getGameSpecifiedPlayerId()) == null || gameSpecifiedPlayerId.length() <= 0)) { - hashMap.put("gamePlayerId", gameSpecifiedPlayerId); - } - String str3 = ""; - try { - String googleAdvertisingId = ApplicationEnvironment.getComponent().getGoogleAdvertisingId(); - str3 = googleAdvertisingId; - str = "true"; - str3 = googleAdvertisingId; - if (!ApplicationEnvironment.getComponent().isLimitAdTrackingEnabled()) { - str = "false"; - str3 = googleAdvertisingId; - } - } catch (Exception e2) { - Log.Helper.LOGW(this, "Exception when getting advertising ID for Android"); - str = "true"; - } - hashMap2.put("eaDeviceId", Utility.safeString(component2.getEADeviceId())); - hashMap2.put("androidId", Utility.safeString(string)); - hashMap2.put("advertiserId", Utility.safeString(str3)); - hashMap2.put("limitAdTracking", Utility.safeString(str)); - hashMap2.put("macHash", Utility.safeString(Utility.SHA256HashString(component.getMACAddress()))); - hashMap2.put("aut", Utility.safeString("")); - hashMap.put("didMap", Utility.convertObjectToJSONString(hashMap2)); - HashMap hashMap3 = new HashMap(); - hashMap3.put("timestamp", Utility.safeString(Utility.getUTCDateStringFormat(googlePlayTransaction.getTimeStamp()))); - hashMap3.put("bundleId", Utility.safeString(component.getApplicationBundleId())); - hashMap3.put("appName", Utility.safeString(component.getApplicationName())); - hashMap3.put("appVersion", Utility.safeString(component.getApplicationVersion())); - hashMap3.put("appLanguage", Utility.safeString(ApplicationEnvironment.getComponent().getShortApplicationLanguageCode())); - hashMap3.put("countryCode", Utility.safeString(Locale.getDefault().getCountry())); - try { - Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext(); - ApplicationInfo applicationInfo = applicationContext.getPackageManager().getApplicationInfo(applicationContext.getPackageName(), 128); - str2 = null; - if (applicationInfo.metaData != null) { - str2 = applicationInfo.metaData.getString("com.facebook.sdk.ApplicationId"); - } - } catch (PackageManager.NameNotFoundException e3) { - str2 = null; - } - if (Utility.validString(str2)) { - hashMap3.put("fbAppId", str2); - } - try { - Cursor query = ApplicationEnvironment.getComponent().getApplicationContext().getContentResolver().query(Uri.parse("content://com.facebook.katana.provider.AttributionIdProvider"), null, null, null, null); - if (query != null) { - query.moveToFirst(); - hashMap3.put("fbAttrId", query.getString(0)); - } - } catch (IllegalStateException e4) { - e4.printStackTrace(); - } catch (Exception e5) { - e5.printStackTrace(); - } - hashMap.put("appInfo", Utility.convertObjectToJSONString(hashMap3)); - HashMap hashMap4 = new HashMap(); - hashMap4.put("systemName", "Android"); - hashMap4.put("limitAdTracking", str); - PackageManager packageManager = component.getApplicationContext().getPackageManager(); - TelephonyManager telephonyManager = (TelephonyManager) component.getApplicationContext().getSystemService("phone"); - if (packageManager.checkPermission("android.permission.READ_PHONE_STATE", component.getApplicationContext().getPackageName()) == 0) { - hashMap4.put("imei", Utility.safeString(telephonyManager.getDeviceId())); - } - hashMap.put("deviceInfo", Utility.convertObjectToJSONString(hashMap4)); - hashMap.put("schemaVer", "2"); - hashMap.put("clientApiVersion", "2.0.0"); - synergyRequest.jsonData = hashMap; - synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM); - synergyRequest.send(); - }), (synergyNetworkConnectionHandle)->{ - Exception error = synergyNetworkConnectionHandle.getResponse().getError(); - if (error == null) { - Log.Helper.LOGD(this, "recordPurchase response: " + synergyNetworkConnectionHandle.getResponse().getJsonData().toString()); - googlePlayTransaction.mIsRecorded = true; - } else if (error instanceof Error) { - Error error2 = (Error) error; - if (!(!error2.getDomain().equals(SynergyServerError.ERROR_DOMAIN) || error2.getCode() == SynergyServerError.Code.AMAZON_SERVER_CONNECTION_ERROR.intValue() || error2.getCode() == SynergyServerError.Code.APPLE_SERVER_CONNECTION_ERROR.intValue())) { - Log.Helper.LOGD(GooglePlay.this, "Transaction " + googlePlayTransaction.mTransactionId + " failed to record with error: " + error2); - googlePlayTransaction.mIsRecorded = true; - } - } - if (verifyCallback != null && ApplicationEnvironment.isMainApplicationRunning() && ApplicationEnvironment.getCurrentActivity() != null) { - verifyCallback.onVerificationComplete(error); - } - }); - } - - private class AnonClass1 implements SynergyRequest.SynergyRequestPreparingCallback{ - @Override - public void prepareRequest(SynergyRequest var1) { - - } - } - - public void onRestoreComplete(List list) { - boolean z = false; - HashMap hashMap = new HashMap<>(); - for (GooglePlayTransaction googlePlayTransaction : list) { - if (googlePlayTransaction.mError != null) { - Log.Helper.LOGE(this, "Error making recordPurchase call to Synergy: " + googlePlayTransaction.mError); - googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; - } - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - boolean z2 = false; - if (this.mCatalogItems != null) { - z2 = false; - if (this.mCatalogItems.size() > 0) { - GooglePlayCatalogItem googlePlayCatalogItem = this.mCatalogItems.get(googlePlayTransaction.getItemSku()); - z2 = false; - if (googlePlayCatalogItem != null) { - z2 = false; - if (googlePlayCatalogItem.getItemType() == NimbleCatalogItem.ItemType.CONSUMABLE) { - Log.Helper.LOGD(this, "Consumable transaction restored, sku: " + googlePlayCatalogItem.getSku()); - z2 = true; - for (GooglePlayTransaction googlePlayTransaction2 : findRecoveredTransactionsWithItemSku(googlePlayTransaction.getItemSku())) { - googlePlayTransaction2.mError = new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_SUPERSEDED, "Transaction has been superseded by restored transaction"); - googlePlayTransaction2.mFailedState = googlePlayTransaction2.mGooglePlayTransactionState; - googlePlayTransaction2.mGooglePlayTransactionState = GooglePlayTransaction.GooglePlayTransactionState.COMPLETE; - } - } - } - } - } - if (z2) { - z = true; - this.mRecoveredTransactions.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); - googlePlayTransaction.mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT); - } else { - hashMap.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); - z = z; - if (!this.m_verificationEnabled) { - this.mUnrecordedTransactions.add(googlePlayTransaction); - this.m_transactionRecorder.recordTransactions(); - z = z; - } - } - this.mPendingTransactions.remove(googlePlayTransaction.getTransactionId()); - } - savePendingTransactionsToPersistence(); - this.mPurchasedTransactions = hashMap; - savePurchasedTransactionsToPersistence(); - saveUnrecordedTransactionsToPersistence(); - this.m_restoreInProgress = false; - Log.Helper.LOGD(this, "All RESTORE transactions processed. Raising REFRESH_PURCHASED_ITEMS_FINISHED notification."); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, null, null, null); - if (z) { - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_TRANSACTIONS_RECOVERED, null, null, null); - } - } - - public void restorePurchasedTransactionsImpl(boolean z) { - if (this.m_restoreInProgress) { - Log.Helper.LOGD(this, "restorePurchasedTransactions called while restore already in progress. Aborting."); - } else if (isTransactionPending(z)) { - Log.Helper.LOGD(this, "restorePurchasedTransactions called while transactions still pending."); - Log.Helper.LOGD(this, "pendingTransactions: " + this.mPendingTransactions); - Log.Helper.LOGD(this, "recoveredTransactions: " + this.mRecoveredTransactions); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, "Can't restore purchases while transaction is pending", null, null); - } else { - Log.Helper.LOGD(this, "restorePurchasedTransactions called."); - this.m_restoreInProgress = true; - try { - this.mGooglePlayIabHelper.queryInventoryAsync(true, true, new IabHelper.QueryInventoryFinishedListener() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.4 - @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.QueryInventoryFinishedListener - public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory) { - Log.Helper.LOGD(this, "restorePurchasedTransactions onQueryInventoryFinished"); - GooglePlayError googlePlayError = null; - if (iabResult == null || iabResult.isFailure()) { - Log.Helper.LOGE(this, "Error with GooglePlay purchased item query. %s", iabResult.getMessage()); - googlePlayError = GooglePlay.this.createGooglePlayErrorFromIabResult(iabResult); - } - ArrayList arrayList = new ArrayList(); - if (!(inventory == null || inventory.getAllPurchases() == null)) { - for (Purchase purchase : inventory.getAllPurchases()) { - GooglePlayTransaction googlePlayTransaction = new GooglePlayTransaction(); - googlePlayTransaction.mTransactionType = NimbleMTXTransaction.TransactionType.RESTORE; - googlePlayTransaction.mTransactionId = GooglePlay.this.generateTransactionId(); - googlePlayTransaction.mItemSku = Utility.safeString(purchase.getSku()); - googlePlayTransaction.mNonce = Utility.safeString(purchase.getDeveloperPayload()); - googlePlayTransaction.mReceipt = Utility.safeString(purchase.getSignature()); - googlePlayTransaction.mAdditionalInfo = GooglePlay.this.createAdditionalInfoBundleFromIabPurchase(purchase); - googlePlayTransaction.mGooglePlayTransactionState = GooglePlayTransaction.GooglePlayTransactionState.UNDEFINED; - SkuDetails skuDetails = inventory.getSkuDetails(purchase.getSku()); - try { - googlePlayTransaction.mPriceDecimal = Float.parseFloat(skuDetails.getPriceMicros()) / 1000000.0f; - } catch (NullPointerException e) { - Log.Helper.LOGE(this, "Error: got passed a null pointer when trying to parse the catalog prices."); - googlePlayTransaction.mPriceDecimal = BitmapDescriptorFactory.HUE_RED; - } catch (NumberFormatException e2) { - Log.Helper.LOGE(this, "Error: got passed an invalid float string when trying to parse the catalog prices."); - googlePlayTransaction.mPriceDecimal = BitmapDescriptorFactory.HUE_RED; - } - googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, skuDetails.getCurrencyCode()); - googlePlayTransaction.mTimeStamp = new Date(); - arrayList.add(googlePlayTransaction); - } - } - if (arrayList.size() == 0) { - Log.Helper.LOGD(this, "No restored transactions to verify. Raising REFRESH_PURCHASED_ITEMS_FINISHED notification."); - GooglePlay.this.m_restoreInProgress = false; - GooglePlay.this.broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, googlePlayError != null ? googlePlayError.getMessage() : null, null, null); - } else if (GooglePlay.this.m_verificationEnabled) { - new RestoreTransactionVerifier().verifyTransactions(arrayList); - } else { - GooglePlay.this.onRestoreComplete(arrayList); - } - } - }); - } catch (IllegalStateException e) { - this.m_restoreInProgress = false; - Log.Helper.LOGD(this, "IAB Helper not setup. Check for Google Play account"); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED, "ERROR_IAB_NULL", null, null); - } - } - } - - private void saveCatalogToPersistence() { - HashMap hashMap = new HashMap(this.mCatalogItems); - Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); - Log.Helper.LOGD(this, "Saving %d catalog items to persistence.", Integer.valueOf(hashMap.size())); - persistenceForNimbleComponent.setValue(PERSISTENCE_CATALOG_ITEMS, hashMap); - this.m_cacheTimestamp = Long.valueOf(System.currentTimeMillis()); - persistenceForNimbleComponent.setValue(CACHE_TIMESTAMP_KEY, this.m_cacheTimestamp); - persistenceForNimbleComponent.synchronize(); - } - - private void savePendingTransactionsToPersistence() { - HashMap hashMap = new HashMap(this.mPendingTransactions); - HashMap hashMap2 = new HashMap(this.mRecoveredTransactions); - Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); - Log.Helper.LOGD(this, "Saving %d pending and %d previously recovered transactions to persistence.", Integer.valueOf(hashMap.size()), Integer.valueOf(hashMap2.size())); - persistenceForNimbleComponent.setValue(PERSISTENCE_PENDING_TRANSACTIONS, hashMap); - persistenceForNimbleComponent.setValue(PERSISTENCE_RECOVERED_TRANSACTIONS, hashMap2); - persistenceForNimbleComponent.synchronize(); - } - - private void savePurchasedTransactionsToPersistence() { - HashMap hashMap = new HashMap(this.mPurchasedTransactions); - Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); - Log.Helper.LOGD(this, "Saving %d purchased transactions to persistence.", Integer.valueOf(hashMap.size())); - persistenceForNimbleComponent.setValue(PERSISTENCE_PURCHASED_TRANSACTIONS, hashMap); - persistenceForNimbleComponent.synchronize(); - } - - public void saveUnrecordedTransactionsToPersistence() { - ArrayList arrayList = new ArrayList(this.mUnrecordedTransactions); - Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT); - Log.Helper.LOGD(this, "Saving %d unrecorded transactions to persistence.", Integer.valueOf(arrayList.size())); - persistenceForNimbleComponent.setValue(PERSISTENCE_UNRECORDED_TRANSACTIONS, arrayList); - persistenceForNimbleComponent.synchronize(); - } - - public void updateGooglePlayTransactionRecordState(GooglePlayTransaction googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState googlePlayTransactionState) { - googlePlayTransaction.mGooglePlayTransactionState = googlePlayTransactionState; - googlePlayTransaction.mTimeStamp = new Date(); - savePendingTransactionsToPersistence(); - } - - public boolean updateTransactionRecordWithNonce(GooglePlayTransaction googlePlayTransaction, String str, Error error) { - NimbleMTXError nimbleMTXError; - if (error != null || str == null || str.length() == 0) { - if (error != null) { - Log.Helper.LOGE(this, "Error making getNonce call to Synergy: " + error); - nimbleMTXError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "Synergy getNonce error", error); - } else { - Log.Helper.LOGE(this, "No nonce in Synergy response for getNonce."); - nimbleMTXError = new NimbleMTXError(NimbleMTXError.Code.VERIFICATION_ERROR, "No nonce in Synergy response"); - } - if (googlePlayTransaction != null) { - googlePlayTransaction.mError = nimbleMTXError; - googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - return false; - } - Log.Helper.LOGE(this, "No transaction record in getNonce error handling. No callback to call."); - return false; - } - googlePlayTransaction.mNonce = str; - return true; - } - - @Override // com.ea.nimble.Component - public void cleanup() { - Log.Helper.LOGD(this, "Component cleanup"); - if (this.mGooglePlayIabHelper != null) { - this.mGooglePlayIabHelper.dispose(); - this.mGooglePlayIabHelper = null; - } - ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public Error finalizeTransaction(String str, INimbleMTX.FinalizeTransactionCallback finalizeTransactionCallback) { - Component component; - boolean z = true; - GooglePlayTransaction googlePlayTransaction = this.mPendingTransactions.get(str); - if (googlePlayTransaction == null) { - String str2 = "Could not find transaction by Id to perform finalize, id: " + str; - Log.Helper.LOGE(this, str2); - return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, str2); - } - if (googlePlayTransaction.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.COMPLETE) { - Log.Helper.LOGW(this, "Finalize called on unfinished transaction, for sku, %s.", googlePlayTransaction.getItemSku()); - } - googlePlayTransaction.mFinalizeCallback = finalizeTransactionCallback; - if (googlePlayTransaction.getError() == null && (component = Base.getComponent(Tracking.COMPONENT_ID)) != null) { - ITracking iTracking = (ITracking) component; - HashMap hashMap = new HashMap(); - hashMap.put(Tracking.KEY_MTX_SELLID, googlePlayTransaction.getItemSku()); - hashMap.put(Tracking.KEY_MTX_PRICE, String.valueOf(googlePlayTransaction.getPriceDecimal())); - if (googlePlayTransaction.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY) != null) { - hashMap.put(Tracking.KEY_MTX_CURRENCY, googlePlayTransaction.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY).toString()); - } else { - Log.Helper.LOGD(this, "Currency information not currently available; using local currency instead."); - hashMap.put(Tracking.KEY_MTX_CURRENCY, Currency.getInstance(Locale.getDefault()).toString()); - } - iTracking.logEvent(Tracking.EVENT_MTX_ITEM_PURCHASED, hashMap); - } - this.mPendingTransactions.remove(str); - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - if (googlePlayTransaction.getError() == null) { - this.mPurchasedTransactions.put(str, googlePlayTransaction); - savePurchasedTransactionsToPersistence(); - } - if (googlePlayTransaction.mIsRecorded || googlePlayTransaction.mError != null) { - z = false; - } - if (z) { - this.mUnrecordedTransactions.add(googlePlayTransaction); - saveUnrecordedTransactionsToPersistence(); - } - if (googlePlayTransaction.mFinalizeCallback != null) { - googlePlayTransaction.mFinalizeCallback.finalizeComplete(googlePlayTransaction); - } - if (!z) { - return null; - } - this.m_transactionRecorder.recordTransactions(); - return null; - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public List getAvailableCatalogItems() { - if (this.mCatalogItems == null || isCacheExpired()) { - return null; - } - ArrayList arrayList = new ArrayList(this.mCatalogItems.values()); - Collections.sort(arrayList, new Comparator() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.1SkuComparator - public int compare(NimbleCatalogItem nimbleCatalogItem, NimbleCatalogItem nimbleCatalogItem2) { - return nimbleCatalogItem.getSku().compareTo(nimbleCatalogItem2.getSku()); - } - }); - return arrayList; - } - - @Override // com.ea.nimble.Component - public String getComponentId() { - return COMPONENT_ID; - } - - @Override // com.ea.nimble.LogSource - public String getLogSourceTitle() { - return "MTX Google"; - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public List getPendingTransactions() { - if (this.mPendingTransactions == null) { - return null; - } - return new ArrayList(this.mPendingTransactions.values()); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public List getPurchasedTransactions() { - return new ArrayList(this.mPurchasedTransactions.values()); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public List getRecoveredTransactions() { - if (this.mRecoveredTransactions == null) { - return null; - } - return new ArrayList(this.mRecoveredTransactions.values()); - } - - public NimbleMTXTransaction getTransaction(String str) { - if (this.mPendingTransactions == null) { - return null; - } - return this.mPendingTransactions.get(str); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public Error itemGranted(String str, NimbleCatalogItem.ItemType itemType, INimbleMTX.ItemGrantedCallback itemGrantedCallback) { - GooglePlayTransaction googlePlayTransaction = this.mPendingTransactions.get(str); - if (googlePlayTransaction == null) { - Log.Helper.LOGE(this, "Could not find transaction by Id to perform item grant, id: " + str); - return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "Could not find transaction to perform item grant."); - } - if (googlePlayTransaction.mGooglePlayTransactionState != GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT) { - Log.Helper.LOGW(this, "Transaction in unexpected state for item grant. Transaction state: %s", googlePlayTransaction.mGooglePlayTransactionState); - } - if (itemGrantedCallback == null) { - Log.Helper.LOGE(this, "itemGranted called with empty callback parameter."); - return new Error(Error.Code.MISSING_CALLBACK, "Missing callback in itemGranted call."); - } - googlePlayTransaction.mItemGrantedCallback = itemGrantedCallback; - if (!(googlePlayTransaction.mCatalogItem == null || googlePlayTransaction.mCatalogItem.getItemType() != NimbleCatalogItem.ItemType.CONSUMABLE || itemType == NimbleCatalogItem.ItemType.CONSUMABLE)) { - Log.Helper.LOGW(this, "Game called item grant for SKU, %s, and indicated NOT consumable, though cached catalog data indicates the item is a consumable.", googlePlayTransaction.getItemSku()); - } - if (googlePlayTransaction.getError() != null) { - Log.Helper.LOGW(this, "Transaction for item SKU, %s, granted by game, despite an error. Clearing error from transaction.", googlePlayTransaction.getItemSku()); - googlePlayTransaction.mError = null; - } - if (itemType == NimbleCatalogItem.ItemType.CONSUMABLE) { - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION); - googlePlayConsumeItem(googlePlayTransaction); - return null; - } - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - deferredConsumeCallback(googlePlayTransaction.mItemGrantedCallback, googlePlayTransaction); - return null; - } - - public void networkCallGetAvailableItems() { - try { - this.m_synergyCatalog.getItemCatalog(new SynergyCatalog.ItemCallback() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.5 - @Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.ItemCallback - public void callback(List list, Exception exc) { - if (exc == null) { - LinkedList linkedList = new LinkedList(); - for (SynergyCatalogItem synergyCatalogItem : list) { - GooglePlayCatalogItem googlePlayCatalogItem = new GooglePlayCatalogItem(); - googlePlayCatalogItem.mItemType = synergyCatalogItem.getItemType(); - googlePlayCatalogItem.mAdditionalInfo = synergyCatalogItem.getAdditionalInfo(); - googlePlayCatalogItem.mDescription = synergyCatalogItem.getDescription(); - googlePlayCatalogItem.mSku = synergyCatalogItem.getSku(); - googlePlayCatalogItem.mTitle = synergyCatalogItem.getTitle(); - googlePlayCatalogItem.mUrl = synergyCatalogItem.getMetaDataUrl(); - googlePlayCatalogItem.mIsFree = synergyCatalogItem.isFree(); - linkedList.add(googlePlayCatalogItem); - } - if (Base.getConfiguration() != NimbleConfiguration.LIVE) { - GooglePlayCatalogItem googlePlayCatalogItem2 = new GooglePlayCatalogItem(); - googlePlayCatalogItem2.mSku = "android.test.purchased"; - googlePlayCatalogItem2.mTitle = "GP Purchased"; - googlePlayCatalogItem2.mDescription = "GP Purchased Desc"; - googlePlayCatalogItem2.mUrl = ""; - googlePlayCatalogItem2.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; - linkedList.add(googlePlayCatalogItem2); - GooglePlayCatalogItem googlePlayCatalogItem3 = new GooglePlayCatalogItem(); - googlePlayCatalogItem3.mSku = "android.test.canceled"; - googlePlayCatalogItem3.mTitle = "GP Canceled"; - googlePlayCatalogItem3.mDescription = "GP Canceled Desc"; - googlePlayCatalogItem3.mUrl = ""; - googlePlayCatalogItem3.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; - linkedList.add(googlePlayCatalogItem3); - GooglePlayCatalogItem googlePlayCatalogItem4 = new GooglePlayCatalogItem(); - googlePlayCatalogItem4.mSku = "android.test.refunded"; - googlePlayCatalogItem4.mTitle = "GP Refunded"; - googlePlayCatalogItem4.mDescription = "GP Refunded Desc"; - googlePlayCatalogItem4.mUrl = ""; - googlePlayCatalogItem4.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; - linkedList.add(googlePlayCatalogItem4); - GooglePlayCatalogItem googlePlayCatalogItem5 = new GooglePlayCatalogItem(); - googlePlayCatalogItem5.mSku = "android.test.item_unavailable"; - googlePlayCatalogItem5.mTitle = "GP Unavailable"; - googlePlayCatalogItem5.mDescription = "GP Unavailable Desc"; - googlePlayCatalogItem5.mUrl = ""; - googlePlayCatalogItem5.mItemType = NimbleCatalogItem.ItemType.NONCONSUMABLE; - linkedList.add(googlePlayCatalogItem5); - } - GooglePlay.this.getGooglePlayPricingForPendingCatalogItems(linkedList); - return; - } - Log.Helper.LOGE(this, "GetAvailableItems error: " + exc.toString()); - GooglePlay.this.broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, "Error making Synergy getAvailableItems call.", null, null); - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks - public void onActivityResult(Activity activity, int i, int i2, Intent intent) { - Log.Helper.LOGD(this, "onActivityResult"); - if (this.mGooglePlayIabHelper == null || !this.mGooglePlayIabHelper.isServiceAvailable()) { - Log.Helper.LOGE(this, "GooglePlayIabHelper is not created or service is not currently available!"); - } else { - this.mGooglePlayIabHelper.handleActivityResult(i, i2, intent); - } - } - - @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks - public boolean onBackPressed() { - return true; - } - - public void onGooglePlayCatalogItemsRefreshed(List list, boolean z, Exception exc) { - if (exc == null) { - Log.Helper.LOGD(this, "GooglePlayCatalog Updated."); - if (z) { - this.mCatalogItems.clear(); - } - for (GooglePlayCatalogItem googlePlayCatalogItem : list) { - this.mCatalogItems.put(googlePlayCatalogItem.getSku(), googlePlayCatalogItem); - } - saveCatalogToPersistence(); - } else { - Log.Helper.LOGE(this, "Error updating GooglePlay Catalog: " + exc); - } - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, exc != null ? exc.toString() : null, null, null); - } - - @Override // com.ea.nimble.mtx.googleplay.util.IabHelper.OnIabPurchaseFinishedListener - public void onIabPurchaseFinished(IabResult iabResult, Purchase purchase) { - GooglePlayTransaction googlePlayTransaction; - Log.Helper.LOGD(this, "IAB Purchase finished: " + iabResult + ", purchase: " + purchase); - GooglePlayTransaction googlePlayTransaction2 = null; - GooglePlayTransaction googlePlayTransaction3 = null; - if (purchase == null) { - Iterator it = this.mPendingTransactions.values().iterator(); - while (true) { - googlePlayTransaction = googlePlayTransaction2; - if (!it.hasNext()) { - break; - } - GooglePlayTransaction next = it.next(); - if (next.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE) { - if (googlePlayTransaction2 == null) { - googlePlayTransaction2 = next; - } else { - Log.Helper.LOGE(this, "More than one transaction record in WAITING_FOR_GOOGLE_PLAY_RESPONSE state found! Using: " + googlePlayTransaction2.getItemSku() + ". Additional transaction for: " + next.getItemSku()); - } - } - } - } else { - String developerPayload = purchase.getDeveloperPayload(); - String orderId = purchase.getOrderId(); - Iterator it2 = this.mPendingTransactions.values().iterator(); - while (true) { - googlePlayTransaction = googlePlayTransaction3; - if (!it2.hasNext()) { - break; - } - GooglePlayTransaction next2 = it2.next(); - if (!Utility.validString(next2.mDeveloperPayload) || !next2.mDeveloperPayload.equals(developerPayload)) { - if (!Utility.validString(orderId) && !Utility.validString(developerPayload) && next2.mItemSku.equals(purchase.getSku())) { - Log.Helper.LOGD(this, "Found a matching SKU for pending transaction without orderId or developer payload, this must be a code redemption!"); - if (googlePlayTransaction3 == null) { - googlePlayTransaction3 = next2; - } else { - Log.Helper.LOGE(this, "Multiple transactions that look like code redemptions found! Using the first one. TransactionA: " + googlePlayTransaction3.toString() + " TransactionB: " + next2.toString()); - } - } - } else if (googlePlayTransaction3 == null) { - googlePlayTransaction3 = next2; - } else { - Log.Helper.LOGE(this, "Multiple transactions with the same developerPayload found! Using the first one. TransactionA: " + googlePlayTransaction3.toString() + " TransactionB: " + next2.toString()); - } - } - } - if (googlePlayTransaction == null) { - Log.Helper.LOGE(this, "Transaction record could not be found for purchase"); - GooglePlayTransaction googlePlayTransaction4 = new GooglePlayTransaction(); - googlePlayTransaction4.mTransactionId = generateTransactionId(); - googlePlayTransaction4.mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; - if (purchase == null || purchase.getSku() == null) { - Log.Helper.LOGE(this, "No pre-existing transaction record, Google Play activity result has no SKU. No way to recover."); - new NimbleMTXError(NimbleMTXError.Code.INTERNAL_STATE, "Unrecoverable purchase notification from GooglePlay. No SKU."); - return; - } - Log.Helper.LOGD(this, "No transaction record for this purchase, creating one now. ItemSku(" + purchase.getSku() + ")"); - googlePlayTransaction4.mDeveloperPayload = purchase.getDeveloperPayload(); - googlePlayTransaction4.mItemSku = purchase.getSku(); - googlePlayTransaction4.mAdditionalInfo = createAdditionalInfoBundleFromIabPurchase(purchase); - this.mPendingTransactions.put(googlePlayTransaction4.mTransactionId, googlePlayTransaction4); - } else if (iabResult == null || iabResult.isFailure()) { - NimbleMTXError nimbleMTXError = null; - if (iabResult != null) { - nimbleMTXError = null; - if (0 == 0) { - Log.Helper.LOGD(this, "Error purchasing: " + iabResult); - nimbleMTXError = createNimbleMTXErrorWithGooglePlayError(createGooglePlayErrorFromIabResult(iabResult), "GooglePlay purchase error"); - } - } - googlePlayTransaction.mError = nimbleMTXError; - googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; - Log.Helper.LOGD(this, "MTX_GOOGLE: Purchase error. Purchase object is: " + purchase); - googlePlayTransaction.mAdditionalInfo = createAdditionalInfoBundleFromIabPurchase(purchase); - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.COMPLETE); - if (googlePlayTransaction.mPurchaseCallback != null) { - try { - googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); - } catch (Exception e) { - Log.Helper.LOGE(this, "MTX_GOOGLE: Unhandled exception in mPurchaseCallback: " + e); - e.printStackTrace(); - } - } - } else { - Log.Helper.LOGD(this, "GooglePlay Purchase successful."); - googlePlayTransaction.mReceipt = purchase.getSignature(); - if (googlePlayTransaction.mReceipt == null || googlePlayTransaction.mReceipt.length() == 0) { - Log.Helper.LOGW(this, "Purchase has an empty signature string. Setting to \"xxxxx\" for test."); - googlePlayTransaction.mReceipt = "xxxxxxxxxxxxxxxxxxxxxxxxx"; - } - googlePlayTransaction.mAdditionalInfo = createAdditionalInfoBundleFromIabPurchase(purchase); - GooglePlayCatalogItem catalogItemBySku = getCatalogItemBySku(purchase.getSku()); - if (catalogItemBySku != null) { - googlePlayTransaction.mPriceDecimal = catalogItemBySku.getPriceDecimal(); - Object obj = catalogItemBySku.getAdditionalInfo().get(SynergyCatalog.MTX_INFO_KEY_CURRENCY); - if (obj != null) { - googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, obj.toString()); - } else { - Log.Helper.LOGD(this, "Currency information not currently available; using local currency instead."); - googlePlayTransaction.mAdditionalInfo.put(SynergyCatalog.MTX_INFO_KEY_CURRENCY, Currency.getInstance(Locale.getDefault()).toString()); - } - } else { - Log.Helper.LOGW(this, "Purchased item not found in catalog, could not get price or currency of item."); - } - if (this.m_verificationEnabled) { - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION); - if (googlePlayTransaction.mPurchaseCallback != null) { - googlePlayTransaction.mPurchaseCallback.unverifiedReceiptReceived(googlePlayTransaction); - } else { - Log.Helper.LOGE(this, "Transaction missing callback, cannot notify game of unverified receipt"); - } - new PurchaseTransactionVerifier().verifyTransaction(googlePlayTransaction); - return; - } - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT); - if (googlePlayTransaction.mPurchaseCallback != null) { - googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); - } else { - Log.Helper.LOGE(this, "Transaction missing callback, cannot notify game of completed purchase"); - } - } - } - - @Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks - public void onWindowFocusChanged(boolean z) { - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public Error purchaseItem(String str, INimbleMTX.PurchaseTransactionCallback purchaseTransactionCallback) { - if (this.mGooglePlayIabHelper == null || !this.mGooglePlayIabHelper.isServiceAvailable()) { - return new NimbleMTXError(NimbleMTXError.Code.BILLING_NOT_AVAILABLE, "IabHelper is not set up"); - } - if (purchaseTransactionCallback == null) { - return new Error(Error.Code.MISSING_CALLBACK, "Missing purchase callback"); - } - if (isTransactionPending()) { - Log.Helper.LOGD(this, "purchaseItem called while transactions still pending."); - Log.Helper.LOGD(this, "pendingTransactions: " + this.mPendingTransactions); - Log.Helper.LOGD(this, "recoveredTransactions: " + this.mRecoveredTransactions); - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Another transaction is still outstanding."); - } else if (this.m_restoreInProgress) { - Log.Helper.LOGD(this, "purchaseItem called while restore is in progress."); - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Can't purchase item while restore is in progress."); - } else { - String generateTransactionId = generateTransactionId(); - GooglePlayTransaction googlePlayTransaction = new GooglePlayTransaction(); - googlePlayTransaction.mItemSku = str; - googlePlayTransaction.mTransactionId = generateTransactionId; - googlePlayTransaction.mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; - googlePlayTransaction.mPurchaseCallback = purchaseTransactionCallback; - GooglePlayCatalogItem googlePlayCatalogItem = this.mCatalogItems.get(str); - if (googlePlayCatalogItem != null) { - googlePlayTransaction.mCatalogItem = new GooglePlayCatalogItem(googlePlayCatalogItem); - } - this.mPendingTransactions.put(generateTransactionId, googlePlayTransaction); - updateGooglePlayTransactionRecordState(googlePlayTransaction, GooglePlayTransaction.GooglePlayTransactionState.USER_INITIATED); - Component component = Base.getComponent(Tracking.COMPONENT_ID); - if (component != null) { - ITracking iTracking = (ITracking) component; - HashMap hashMap = new HashMap(); - hashMap.put(Tracking.KEY_MTX_SELLID, googlePlayTransaction.getItemSku()); - iTracking.logEvent(Tracking.EVENT_MTX_ITEM_BEGIN_PURCHASE, hashMap); - } - googlePlayCallPurchaseItem(googlePlayTransaction); - return null; - } - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public void refreshAvailableCatalogItems() { - if (this.mGooglePlayIabHelper == null || !this.mGooglePlayIabHelper.isServiceAvailable()) { - Log.Helper.LOGW(this, "refreshAvailable returning because billing is unavailable"); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, String.valueOf(NimbleMTXError.Code.BILLING_NOT_AVAILABLE), null, null); - } else if (Network.getComponent().getStatus() != Network.Status.OK) { - Log.Helper.LOGW(this, "refreshAvailable returning because there is no network connection"); - broadcastLocalEvent(INimbleMTX.NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED, String.valueOf(Error.Code.NETWORK_NO_CONNECTION), null, null); - } else { - networkCallGetAvailableItems(); - } - } - - @Override // com.ea.nimble.Component - public void restore() { - Log.Helper.LOGD(this, "Component restore"); - this.m_synergyCatalog = new SynergyCatalog(SynergyCatalog.StoreType.GOOGLE); - loadFromPersistence(); - Utility.registerReceiver(Global.NOTIFICATION_LANGUAGE_CHANGE, new BroadcastReceiver() { // from class: com.ea.nimble.mtx.googleplay.GooglePlay.3 - @Override // android.content.BroadcastReceiver - public void onReceive(Context context, Intent intent) { - Log.Helper.LOGD(this, "refreshing catalog items after language change"); - GooglePlay.this.refreshAvailableCatalogItems(); - } - }); - ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public void restorePurchasedTransactions() { - restorePurchasedTransactionsImpl(true); - } - - @Override // com.ea.nimble.Component - public void resume() { - Log.Helper.LOGD(this, "Component resume"); - if (!this.mGooglePlayIabHelper.isServiceAvailable()) { - this.mGooglePlayIabHelper.dispose(); - createIabHelper(); - } - for (GooglePlayTransaction googlePlayTransaction : this.mPendingTransactions.values()) { - if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE) { - new PurchaseTransactionVerifier().verifyTransaction(googlePlayTransaction); - } - } - this.m_transactionRecorder.recordTransactions(); - this.m_itemRestorer.restoreItems(); - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public Error resumeTransaction(String str, INimbleMTX.PurchaseTransactionCallback purchaseTransactionCallback, INimbleMTX.ItemGrantedCallback itemGrantedCallback, INimbleMTX.FinalizeTransactionCallback finalizeTransactionCallback) { - GooglePlayTransaction googlePlayTransaction; - Log.Helper.LOGV(this, "Resuming transaction id, %s.", Utility.safeString(str)); - if (str == null) { - return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "Null transaction ID"); - } - if (this.m_restoreInProgress) { - Log.Helper.LOGD(this, "resumeTransaction called while restore is in progress."); - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Can't resume transaction while restore is in progress."); - } - if (this.mPendingTransactions.size() > 0) { - GooglePlayTransaction googlePlayTransaction2 = this.mPendingTransactions.get(str); - if (googlePlayTransaction2 == null) { - Log.Helper.LOGD(this, "Resume called while transactions are pending: " + this.mPendingTransactions); - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_PENDING, "Another transaction is pending. It needs to finish and finalize first."); - } else if (googlePlayTransaction2.mError == null) { - return new Error(Error.Code.INVALID_ARGUMENT, "Cannot resume a pending transaction with no error"); - } else { - googlePlayTransaction = googlePlayTransaction2; - if (googlePlayTransaction2.mTransactionType == NimbleMTXTransaction.TransactionType.RESTORE) { - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_NOT_RESUMABLE, "Cannot resume a restore transaction. Only Purchase transactions can be resumed."); - } - } - } else { - googlePlayTransaction = this.mRecoveredTransactions.remove(str); - if (googlePlayTransaction == null) { - return new NimbleMTXError(NimbleMTXError.Code.UNRECOGNIZED_TRANSACTION_ID, "No transaction for given transaction ID."); - } - if (googlePlayTransaction.mTransactionType == NimbleMTXTransaction.TransactionType.RESTORE) { - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_NOT_RESUMABLE, "Cannot resume a restore transaction. Only Purchase transactions can be resumed."); - } - this.mPendingTransactions.put(googlePlayTransaction.getTransactionId(), googlePlayTransaction); - } - if (googlePlayTransaction.mError != null && (!(googlePlayTransaction.mError instanceof Error) || ((Error) googlePlayTransaction.mError).getCode() != NimbleMTXError.Code.TRANSACTION_SUPERSEDED.intValue())) { - Log.Helper.LOGD(this, "Resuming transaction that failed in state " + googlePlayTransaction.mFailedState + " with error " + googlePlayTransaction.mError); - googlePlayTransaction.mGooglePlayTransactionState = googlePlayTransaction.mFailedState; - googlePlayTransaction.mFailedState = null; - googlePlayTransaction.mError = null; - } - if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.USER_INITIATED || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE) { - googlePlayTransaction.mFailedState = googlePlayTransaction.mGooglePlayTransactionState; - googlePlayTransaction.mGooglePlayTransactionState = GooglePlayTransaction.GooglePlayTransactionState.COMPLETE; - googlePlayTransaction.mError = new NimbleMTXError(NimbleMTXError.Code.NON_CRITICAL_INTERRUPTION, "MTX transaction interrupted before account charged."); - } - googlePlayTransaction.mPurchaseCallback = purchaseTransactionCallback; - googlePlayTransaction.mFinalizeCallback = finalizeTransactionCallback; - googlePlayTransaction.mItemGrantedCallback = itemGrantedCallback; - savePendingTransactionsToPersistence(); - if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_NONCE || googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION) { - new PurchaseTransactionVerifier().verifyTransaction(googlePlayTransaction); - return null; - } else if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT) { - if (googlePlayTransaction.mPurchaseCallback == null) { - return new Error(Error.Code.MISSING_CALLBACK, "Resumed transaction not given purchase callback."); - } - googlePlayTransaction.mPurchaseCallback.purchaseComplete(googlePlayTransaction); - return null; - } else if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION) { - if (googlePlayTransaction.mItemGrantedCallback == null) { - return new Error(Error.Code.MISSING_CALLBACK, "Resumed transaction not given item granted callback."); - } - googlePlayConsumeItem(googlePlayTransaction); - return null; - } else if (googlePlayTransaction.mGooglePlayTransactionState == GooglePlayTransaction.GooglePlayTransactionState.COMPLETE) { - finalizeTransaction(str, googlePlayTransaction.mFinalizeCallback); - return null; - } else { - Log.Helper.LOGE(this, "ResumeTransaction called on a transaction that can't be resumed: " + googlePlayTransaction); - return new NimbleMTXError(NimbleMTXError.Code.TRANSACTION_NOT_RESUMABLE, "Transaction not in a resumable state."); - } - } - - @Override // com.ea.nimble.mtx.INimbleMTX - public void setPlatformParameters(Map map) { - String str; - if (map != null && (str = map.get(GOOGLEPLAY_PLATFORM_PARAMETER_APPLICATION_PUBLIC_KEY)) != null) { - this.m_appPublicKey = str; - if (this.mGooglePlayIabHelper != null) { - this.mGooglePlayIabHelper.setApplicationPublicKey(this.m_appPublicKey); - } - } - } - - @Override // com.ea.nimble.Component - public void setup() { - Log.Helper.LOGD(this, "Component setup"); - if (this.mGooglePlayIabHelper == null) { - createIabHelper(); - } - try { - if ("false".equalsIgnoreCase(ApplicationEnvironment.getCurrentActivity().getPackageManager().getApplicationInfo(ApplicationEnvironment.getCurrentActivity().getPackageName(), 128).metaData.getString("com.ea.nimble.mtx.enableVerification"))) { - this.m_verificationEnabled = false; - return; - } - } catch (PackageManager.NameNotFoundException e) { - } - this.m_verificationEnabled = true; - } - - @Override // com.ea.nimble.Component - public void suspend() { - Log.Helper.LOGD(this, "Component suspend"); - this.m_transactionRecorder.cancel(); - this.m_itemRestorer.cancel(); - } - - @Override // com.ea.nimble.Component - public void teardown() { - this.m_transactionRecorder.cancel(); - this.m_itemRestorer.cancel(); - } -} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java deleted file mode 100644 index 5b1a133..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayCatalogItem.java +++ /dev/null @@ -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 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(); - } - - public GooglePlayCatalogItem(GooglePlayCatalogItem googlePlayCatalogItem) { - this.mSku = new String(googlePlayCatalogItem.mSku); - this.mTitle = new String(googlePlayCatalogItem.mTitle); - this.mDescription = new String(googlePlayCatalogItem.mDescription); - this.mPriceDecimal = googlePlayCatalogItem.mPriceDecimal; - this.mPriceWithCurrencyAndFormat = new String(googlePlayCatalogItem.mPriceWithCurrencyAndFormat); - this.mItemType = googlePlayCatalogItem.mItemType; - this.mUrl = new String(googlePlayCatalogItem.mUrl); - this.mIsFree = googlePlayCatalogItem.mIsFree; - this.mAdditionalInfo = new HashMap(googlePlayCatalogItem.mAdditionalInfo); - } - - @Override - public Map 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); - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java deleted file mode 100644 index 53f4e91..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayError.java +++ /dev/null @@ -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; - } - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java deleted file mode 100644 index 1309761..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayNetworkConnectionCallback.java +++ /dev/null @@ -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); -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java deleted file mode 100644 index d1e6447..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/GooglePlayTransaction.java +++ /dev/null @@ -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 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(); - } - - @Override - public Map getAdditionalInfo() { - return new HashMap(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; - } - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java deleted file mode 100644 index f86c00e..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java deleted file mode 100644 index d476507..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Base64DecoderException.java +++ /dev/null @@ -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); - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java deleted file mode 100644 index 9738da1..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabException.java +++ /dev/null @@ -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; - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java deleted file mode 100644 index 487b9ad..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabHelper.java +++ /dev/null @@ -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 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 arrayList = new ArrayList(); - arrayList.add(purchase); - this.consumeAsyncInternal(arrayList, onConsumeFinishedListener, null); - } - - public void consumeAsync(List list, OnConsumeMultiFinishedListener onConsumeMultiFinishedListener) { - this.consumeAsyncInternal(list, null, onConsumeMultiFinishedListener); - } - - void consumeAsyncInternal(final List 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 arrayList = new ArrayList(); - for (Purchase purchase : list) { - try { - IabHelper.this.consume(purchase); - arrayList.add(new IabResult(0, "Successful consume of sku " + purchase.getSku())); - } - catch (IabException 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 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 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 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 var1, List 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); - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java deleted file mode 100644 index 0d16551..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/IabResult.java +++ /dev/null @@ -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(); - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java deleted file mode 100644 index 5e2d200..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Inventory.java +++ /dev/null @@ -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 mPurchaseMap; - Map mSkuMap = new HashMap(); - - Inventory() { - this.mPurchaseMap = new HashMap(); - } - - 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 getAllOwnedSkus() { - return new ArrayList(this.mPurchaseMap.keySet()); - } - - public List getAllPurchases() { - return new ArrayList(this.mPurchaseMap.values()); - } - - public List getAllSkuDetails() { - return new ArrayList(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); - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java deleted file mode 100644 index fd5ece3..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Purchase.java +++ /dev/null @@ -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 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; - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java deleted file mode 100644 index b07de10..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/Security.java +++ /dev/null @@ -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; - } -} - diff --git a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java b/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java deleted file mode 100644 index 5f5025b..0000000 --- a/app/src/main/java/com/ea/nimble/mtx/googleplay/util/SkuDetails.java +++ /dev/null @@ -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; - } -} - diff --git a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/GCMIntentService.java b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/GCMIntentService.java deleted file mode 100644 index 0b58080..0000000 --- a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/GCMIntentService.java +++ /dev/null @@ -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(); - } - }); - } - } -} diff --git a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/NimbleBroadcastReceiver.java b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/NimbleBroadcastReceiver.java deleted file mode 100644 index 07f4e0f..0000000 --- a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/NimbleBroadcastReceiver.java +++ /dev/null @@ -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(); - } -} - diff --git a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotification.java b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotification.java index 197f7f7..5bc8350 100644 --- a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotification.java +++ b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotification.java @@ -28,7 +28,6 @@ import com.ea.nimble.SynergyNetworkConnectionHandle; import com.ea.nimble.Utility; import com.ea.nimble.identity.INimbleIdentity; import com.ea.nimble.identity.INimbleIdentityAuthenticator; -import com.google.android.gcm.GCMRegistrar; import java.util.ArrayList; import java.util.HashMap; @@ -37,8 +36,6 @@ import java.util.Locale; public class PushNotification { 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 void callSynergyRevokePushTokenByPid(String string2) { @@ -180,7 +177,6 @@ public class PushNotification { public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) { if (synergyNetworkConnectionHandle.getResponse().getError() != null) return; 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 -> { if (synergyNetworkConnectionHandle.getResponse().getError() != null) return; d("GCM", "GCM Push Token unregistered with synergy. Status code: " + synergyNetworkConnectionHandle.getResponse().getHttpResponse().getStatusCode()); - GCMRegistrar.setRegisteredOnServer(finalContext, false); }); } } diff --git a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotificationImpl.java b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotificationImpl.java index 8e41fc3..90fbfe2 100644 --- a/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotificationImpl.java +++ b/app/src/main/java/com/ea/nimble/pushnotificationgoogle/PushNotificationImpl.java @@ -27,7 +27,6 @@ import com.ea.nimble.SynergyNetworkConnectionHandle; import com.ea.nimble.Utility; import com.ea.nimble.identity.INimbleIdentity; import com.ea.nimble.identity.INimbleIdentityAuthenticator; -import com.google.android.gcm.GCMRegistrar; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -133,7 +132,6 @@ IPushNotification { if (this.m_handleMessageReceiver != null) { context.unregisterReceiver(this.m_handleMessageReceiver); } - GCMRegistrar.onDestroy(context); Utility.unregisterReceiver(this.m_synergyIdChangedReceiver); Utility.unregisterReceiver(this.m_IdentityChangedReceiver); } @@ -150,48 +148,7 @@ IPushNotification { @Override 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 diff --git a/app/src/main/java/com/eamobile/ADCTelemetry.java b/app/src/main/java/com/eamobile/ADCTelemetry.java deleted file mode 100644 index 2cf0c36..0000000 --- a/app/src/main/java/com/eamobile/ADCTelemetry.java +++ /dev/null @@ -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 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 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 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); - } - } -} diff --git a/app/src/main/java/com/eamobile/DownloadActivity.java b/app/src/main/java/com/eamobile/DownloadActivity.java deleted file mode 100644 index 78402e5..0000000 --- a/app/src/main/java/com/eamobile/DownloadActivity.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/eamobile/DownloadActivityInternal.java b/app/src/main/java/com/eamobile/DownloadActivityInternal.java deleted file mode 100644 index 33e2f54..0000000 --- a/app/src/main/java/com/eamobile/DownloadActivityInternal.java +++ /dev/null @@ -1,2307 +0,0 @@ -package com.eamobile; - -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.net.wifi.SupplicantState; -import android.net.wifi.WifiManager; -import android.os.Build; -import android.os.Environment; -import android.os.Handler; -import android.provider.Settings; -import android.telephony.TelephonyManager; -import android.util.DisplayMetrics; -import android.view.Display; - -import com.eamobile.download.AssetManager; -import com.eamobile.download.Constants; -import com.eamobile.download.Device; -import com.eamobile.download.DeviceData; -import com.eamobile.download.DownloadFileData; -import com.eamobile.download.DownloadProgress; -import com.eamobile.download.LocalZipExtractorEvent; -import com.eamobile.download.Logging; -import com.eamobile.download.MemoryStatus; -import com.eamobile.download.RemoteZipExtractorEvent; -import com.eamobile.download.ZipExtractor; -import com.eamobile.views.CheckUpdatesView; -import com.eamobile.views.CheckingHostIpView; -import com.eamobile.views.ContactingServerView; -import com.eamobile.views.CustomView; -import com.eamobile.views.DeletingAssetsView; -import com.eamobile.views.DownloadFailedView; -import com.eamobile.views.DownloadMsgView; -import com.eamobile.views.DownloadProgressView; -import com.eamobile.views.InvalidAssetVersionView; -import com.eamobile.views.NetworkUnavailableView; -import com.eamobile.views.ServerErrorView; -import com.eamobile.views.Show3GView; -import com.eamobile.views.ShowBGView; -import com.eamobile.views.ShowWifiView; -import com.eamobile.views.SpaceUnavailableView; -import com.eamobile.views.UnSupportedDeviceView; -import com.eamobile.views.UpdatesFoundView; - -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.HttpGet; -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.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.Hashtable; -import java.util.List; -import java.util.Properties; - -import javax.microedition.khronos.opengles.GL10; -import javax.microedition.khronos.opengles.GL11; -import javax.xml.parsers.DocumentBuilderFactory; - -public class DownloadActivityInternal { - static boolean ALTERNATIVE_DATA_FOLDER = false; - static boolean CUSTOM_PROGRESS_BAR = true; - static boolean DELETE_ASSETS_ON_UPDATE = false; - static boolean DISABLE_3G = false; - static String DOWNLOAD_URL = null; - static final String DOWNLOAD_URL_CONFIG_FILE = "DownloadURL.indicate"; - static boolean DO_NOT_OPEN_STORAGE_SETTINGS = false; - public static final int ERROR_ASSETS_NOT_FOUND = 5002; - public static final int ERROR_CHECKSUM_MATCH_FAILED = -11; - public static final int ERROR_CHECKSUM_NOT_FOUND = -10; - public static final int ERROR_CONNECTION_UNAVAILABLE = -16; - public static final int ERROR_CORRUPTED_ZIP = -12; - public static final int ERROR_DOWNLOAD_TIMEOUT = -1; - public static final int ERROR_FILE_LIST_RETRIEVE_FAILED = -15; - public static final int ERROR_MISSING_CHECKSUMS = -13; - public static final int ERROR_UNEXPECTED_SERVER_ERROR = -14; - public static final int ERROR_UNSUPPORTED_ASSET_VERSION = -17; - public static final int ERROR_UNSUPPORTED_DEVICE = 5001; - private static final int ERROR_ZIP_CHECKSUM_MATCH_FAILED = -4; - private static final int ERROR_ZIP_CHECKSUM_NOT_FOUND = -3; - private static final int ERROR_ZIP_EXCEPTION = -1; - private static final int ERROR_ZIP_NO_ENTRIES = -2; - private static final String[] EXPECTED_PERMISSIONS = { - "android.permission.WRITE_EXTERNAL_STORAGE", - "android.permission.ACCESS_WIFI_STATE", - "android.permission.ACCESS_NETWORK_STATE", - "android.permission.CHANGE_NETWORK_STATE", - "android.permission.INTERNET", - "android.permission.READ_PHONE_STATE", - "android.permission.WAKE_LOCK" - }; - private static boolean FORCE_WAKE_DURING_DOWNLOAD = false; - static int MASTER_SELL_ID = 0; - static String MIN_ASSET_VERSION_REQUIRED = null; - private static final int NO_ZIP_ERRORS = 1; - static int NUMBER_OF_HOURS_TO_UPDATE_CHECKING = 0; - static int PRODUCT_ID = 0; - static boolean REDOWNLOAD_ON_SCREEN_SIZE_CHANGE = false; - private static final String RESOURCES_PATH = "downloadcontent/"; - static boolean RETRIEVE_FULL_SCREEN_RESOLUTION = false; - public static final int STATE_INVALID = -1; - public static final int STATE_SHOW_DOWNLOAD_MSG = 1; - public static final int STATE_DOWNLOADING_ASSETS = 2; - public static final int STATE_SUCCESS = 3; - public static final int STATE_SPACE_UNAVAILABLE = 4; - public static final int STATE_FAILURE = 5; - public static final int STATE_SHOW_WIFI_DIALOG = 6; - public static final int STATE_3G_UNAVAILABLE = 7; - public static final int STATE_CHECK_UPDATES = 8; - public static final int STATE_UPDATES_FOUND = 9; - public static final int STATE_SHOW_3G_DIALOG = 10; - public static final int STATE_BG_VIEW = 11; - public static final int STATE_UNSUPPORTED_DEVICE = 12; - public static final int STATE_SERVER_ERROR = 13; - public static final int STATE_CONTACTING_SERVER = 14; - public static final int STATE_CHECKING_HOST_IP = 15; - public static final int STATE_SHOW_DELETING_ASSETS = 16; - private static final String[] STATE_STRINGS = { - "", - "STATE_SHOW_DOWNLOAD_MSG", - "STATE_DOWNLOADING_ASSETS", - "STATE_SUCCESS", - "STATE_SPACE_UNAVAILABLE", - "STATE_FAILURE", - "STATE_SHOW_WIFI_DIALOG", - "STATE_3G_UNAVAILABLE", - "STATE_CHECK_UPDATES", - "STATE_UPDATES_FOUND", - "STATE_SHOW_3G_DIALOG", - "STATE_BG_VIEW", - "STATE_UNSUPPORTED_DEVICE", - "STATE_SERVER_ERROR", - "STATE_CONTACTING_SERVER", - "STATE_CHECKING_HOST_IP", - "STATE_SHOW_DELETING_ASSETS" - }; - static int TIMEOUT = 10000; - static int TOTAL_SPACE_MB = 0; - static int TOTAL_SPACE_MB_MIN = 0; - static boolean UNCOMPRESS_ZIP_ON_DEVICE = false; - static boolean UNSAFE_ASSET_DELETION_ON_UPDATE = false; - static boolean USE_INTERNAL_STORAGE = false; - static boolean USE_OLD_PROGRESS_BAR = false; - private static volatile boolean changingState = false; - protected static DownloadProgress downloadProgress; - private static int height; - private static Activity instance; - private static boolean isDownloadRange = false; - private static boolean isInitialized = false; - protected static Language language; - private static ArrayList mErrorList = new ArrayList<>(); - static DownloadActivityInternal mMainActivity = null; - private static int pState = -1; - private static int pStatePrev = -1; - private static String resolution = ""; - private static long spaceAvailableToDownload = -1; - private static long spaceNeededToDownload = -1; - private static int totalDownloadSizeMB = 0; - static boolean unknownHostExceptionTryAgain = true; - private static int width; - private String activityAssetPath; - private boolean activityUseExternal; - private AssetManager assetManager; - String bgFileName; - private Bitmap bmpBg; - private boolean callSetAssetPathAux; - private CheckUpdatesView checkUpdatesView; - private CheckingHostIpView checkingHostIpView; - private boolean configLoaded; - private ContactingServerView contactingServerView; - private DeletingAssetsView deletingAssetsView; - private Device deviceFallback; - private DownloadFailedView downloadFailedView; - private DownloadFileData[] downloadFileData; - private DownloadMsgView downloadMsgView; - private DownloadProgressView downloadProgressView; - String glExtensions; - private InvalidAssetVersionView invalidAssetVersionView; - Context mContext; - IDownloadActivity mDownloadActivity; - Handler mHandler; - private String mLocale; - private NetworkUnavailableView networkUnavailableView; - private ArrayList overrideDevices; - private CustomView pCurrentView; - protected int percent_downloaded; - private ServerErrorView serverErrorView; - private Show3GView show3GView; - private ShowBGView showBGView; - private ShowWifiView showWifiView; - private SpaceUnavailableView spaceUnavailableView; - private UnSupportedDeviceView unSupportedDeviceView; - private UpdatesFoundView updatesFoundView; - private WifiReceiver wifiReceiver; - - public DownloadActivityInternal(Context context) { - this(context, "title.png"); - } - - public DownloadActivityInternal(Context context, String str) { - this.overrideDevices = new ArrayList<>(); - this.deviceFallback = null; - this.downloadFileData = null; - this.mLocale = "en"; - this.percent_downloaded = 0; - this.mDownloadActivity = null; - this.glExtensions = null; - this.bmpBg = null; - this.callSetAssetPathAux = false; - this.activityAssetPath = ""; - this.activityUseExternal = false; - this.configLoaded = false; - Logging.DEBUG_INIT(); - this.mHandler = new Handler(); - if (mMainActivity == null) { - mMainActivity = this; - } - if (this.assetManager == null) { - this.assetManager = new AssetManager(); - } - this.mContext = context; - this.bgFileName = str; - Logging.DEBUG_OUT("DownloadActivityInternal.init()"); - initScreens(context); - } - - private void checkBackgroundImage() { - Logging.DEBUG_OUT("Calling: DownloadActivityInternal checkBackgroundImage()"); - if (this.mContext != null && getBackgroundBitmap() == null) { - try { - InputStream open = this.mContext.getAssets().open(getResourcesPath() + this.bgFileName); - if (open != null) { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inTempStorage = new byte[4096]; - setBackgroundBitmap(Bitmap.createBitmap(BitmapFactory.decodeStream(open, null, options))); - open.close(); - } - Logging.DEBUG_OUT("\tCreating background image"); - } catch (IOException e) { - setBackgroundBitmap(null); - } - } - } - - private void checkLanguageChange() { - Logging.DEBUG_OUT("Calling: DownloadActivityInternal checkLanguageChange()"); - if (this.mContext != null && !this.mContext.getResources().getConfiguration().locale.toString().equalsIgnoreCase(this.mLocale)) { - language = new Language(); - this.mLocale = this.mContext.getResources().getConfiguration().locale.toString(); - String language2 = this.mContext.getResources().getConfiguration().locale.getLanguage(); - Logging.DEBUG_OUT("\tLocale: " + this.mLocale); - Logging.DEBUG_OUT("\tLanguage: " + language2); - if (!language.loadStrings(this.mLocale) && !language.loadStrings(language2)) { - this.mLocale = "en"; - language.loadStrings("en"); - } - } - } - - private void checkPermissions() { - try { - PackageManager packageManager = this.mContext.getPackageManager(); - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("[uses-permission tags]"); - Logging.DEBUG_OUT("Checking permissions for package: " + this.mContext.getPackageName()); - List asList = Arrays.asList(packageManager.getPackageInfo(this.mContext.getPackageName(), PackageManager.GET_PERMISSIONS).requestedPermissions); - boolean z = false; - for (int i = 0; i < EXPECTED_PERMISSIONS.length; i++) { - if (!asList.contains(EXPECTED_PERMISSIONS[i])) { - z = true; - Logging.DEBUG_OUT("\tPermission " + EXPECTED_PERMISSIONS[i] + " is missing."); - } - } - if (z) { - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - Logging.DEBUG_OUT("\tOne or more expected permissions is missing. Please check uses-permission tags in AndroidManifest.xml"); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - } else { - Logging.DEBUG_OUT("\tPermissions OK."); - } - Logging.DEBUG_OUT(" "); - } catch (Exception e) { - Logging.DEBUG_OUT_STACK(e); - } - } - - private boolean checkZipExtractorResult(int i) { - switch (i) { - case ERROR_ZIP_CHECKSUM_MATCH_FAILED /*{ENCODED_INT: -4}*/: - recordError(-11); - return false; - case ERROR_ZIP_CHECKSUM_NOT_FOUND /*{ENCODED_INT: -3}*/: - setStateChecksumError(); - return false; - case -2: - case -1: - recordError(-12); - return false; - default: - return true; - } - } - - /* access modifiers changed from: private */ - /* access modifiers changed from: public */ - private void cleanState(int i) { - switch (i) { - case 1: - this.pCurrentView = this.downloadMsgView; - break; - case 2: - this.pCurrentView = this.downloadProgressView; - break; - case 3: - if (!checkLocalAssetVersion()) { - this.pCurrentView = this.invalidAssetVersionView; - break; - } else { - Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = " + -1); - this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); - Logging.DEBUG_CLOSE(); - return; - } - case 4: - this.pCurrentView = this.spaceUnavailableView; - break; - case 5: - this.pCurrentView = this.downloadFailedView; - break; - case 6: - this.pCurrentView = this.showWifiView; - break; - case 7: - this.pCurrentView = this.networkUnavailableView; - break; - case 8: - this.pCurrentView = this.checkUpdatesView; - break; - case 9: - this.pCurrentView = this.updatesFoundView; - break; - case 10: - this.pCurrentView = this.show3GView; - break; - case 11: - this.pCurrentView = this.showBGView; - break; - case 12: - this.pCurrentView = this.unSupportedDeviceView; - break; - case 13: - this.pCurrentView = this.serverErrorView; - break; - case 14: - this.pCurrentView = this.contactingServerView; - break; - case 15: - this.pCurrentView = this.checkingHostIpView; - break; - case 16: - this.pCurrentView = this.deletingAssetsView; - break; - } - try { - this.pCurrentView.clean(); - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while cleaning state:" + e); - } - } - - private void cleanStates() { - if (this.downloadMsgView != null) { - this.downloadMsgView.clean(); - } - if (this.showWifiView != null) { - this.showWifiView.clean(); - } - if (this.networkUnavailableView != null) { - this.networkUnavailableView.clean(); - } - if (this.downloadProgressView != null) { - this.downloadProgressView.clean(); - } - if (this.downloadFailedView != null) { - this.downloadFailedView.clean(); - } - if (this.spaceUnavailableView != null) { - this.spaceUnavailableView.clean(); - } - if (this.checkUpdatesView != null) { - this.checkUpdatesView.clean(); - } - if (this.updatesFoundView != null) { - this.updatesFoundView.clean(); - } - if (this.show3GView != null) { - this.show3GView.clean(); - } - if (this.showBGView != null) { - this.showBGView.clean(); - } - if (this.unSupportedDeviceView != null) { - this.unSupportedDeviceView.clean(); - } - if (this.serverErrorView != null) { - this.serverErrorView.clean(); - } - if (this.contactingServerView != null) { - this.contactingServerView.clean(); - } - if (this.checkingHostIpView != null) { - this.checkingHostIpView.clean(); - } - if (this.invalidAssetVersionView != null) { - this.invalidAssetVersionView.clean(); - } - if (this.deletingAssetsView != null) { - this.deletingAssetsView.clean(); - } - this.showBGView = null; - this.show3GView = null; - this.updatesFoundView = null; - this.checkUpdatesView = null; - this.downloadMsgView = null; - this.showWifiView = null; - this.networkUnavailableView = null; - this.downloadProgressView = null; - this.downloadFailedView = null; - this.spaceUnavailableView = null; - this.unSupportedDeviceView = null; - this.serverErrorView = null; - this.contactingServerView = null; - this.checkingHostIpView = null; - this.invalidAssetVersionView = null; - this.deletingAssetsView = null; - } - - private String convertStreamToString(InputStream inputStream) { - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 8192); - StringBuilder sb = new StringBuilder(); - try { - while (true) { - String readLine = bufferedReader.readLine(); - if (readLine != null) - sb.append(readLine + "\n"); - else - break; - } - } catch (IOException e) { - Logging.DEBUG_OUT("convertStreamToString Exception: " + e); - } - - try { - bufferedReader.close(); - } catch (IOException e) { - Logging.DEBUG_OUT("convertStreamToString Exception: " + e); - } - return sb.toString(); - } - - private boolean downloadAndValidateZipFile(DownloadFileData downloadFileData2, Hashtable hashtable) { - String fileURL = downloadFileData2.getFileURL(); - Logging.DEBUG_OUT("Downloading Zip:" + fileURL); - try { - URLConnection openConnection = new URL(fileURL).openConnection(); - openConnection.setConnectTimeout(30000); - openConnection.setReadTimeout(30000); - InputStream inputStream = openConnection.getInputStream(); - if (inputStream == null) { - return false; - } - return checkZipExtractorResult(new ZipExtractor().extractFiles(inputStream, hashtable, this.assetManager.getAssetPath(), TIMEOUT, new RemoteZipExtractorEvent(downloadProgress, downloadFileData2))); - } catch (MalformedURLException e) { - e.printStackTrace(); - return false; - } catch (IOException e2) { - e2.printStackTrace(); - return false; - } - } - - /* JADX WARNING: Removed duplicated region for block: B:105:0x031f A[SYNTHETIC, Splitter:B:105:0x031f] */ - /* JADX WARNING: Removed duplicated region for block: B:108:0x0324 A[SYNTHETIC, Splitter:B:108:0x0324] */ - /* JADX WARNING: Removed duplicated region for block: B:32:0x0163 A[SYNTHETIC, Splitter:B:32:0x0163] */ - /* JADX WARNING: Removed duplicated region for block: B:35:0x0168 A[SYNTHETIC, Splitter:B:35:0x0168] */ - /* Code decompiled incorrectly, please refer to instructions dump. */ - private boolean downloadOtherFile(com.eamobile.download.DownloadFileData r29, java.util.Hashtable r30) { - /* - // Method dump skipped, instructions count: 825 - */ - throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.downloadOtherFile(com.eamobile.download.DownloadFileData, java.util.Hashtable):boolean"); - } - - private boolean extractAndValidateFilesFromZip(String str, Hashtable hashtable) { - IOException e; - Logging.DEBUG_OUT("Extracting files from Zip: " + str); - try { - FileInputStream fileInputStream = new FileInputStream(this.assetManager.getFilePath(str)); - try { - Thread.sleep(1000); - return checkZipExtractorResult(new ZipExtractor().extractFiles(fileInputStream, hashtable, this.assetManager.getAssetPath(), TIMEOUT, new LocalZipExtractorEvent())); - } catch (InterruptedException e3) { - return false; - } - } catch (IOException e4) { - e = e4; - e.printStackTrace(); - return false; - } - } - - private Properties generateAssetInfo() { - Properties properties = new Properties(); - properties.setProperty("packageName", this.mContext.getPackageName()); - properties.setProperty("width", String.valueOf(width)); - properties.setProperty("height", String.valueOf(height)); - return properties; - } - - /* JADX WARNING: Removed duplicated region for block: B:24:0x0085 A[SYNTHETIC, Splitter:B:24:0x0085] */ - /* JADX WARNING: Removed duplicated region for block: B:35:0x00a5 A[SYNTHETIC, Splitter:B:35:0x00a5] */ - /* Code decompiled incorrectly, please refer to instructions dump. */ - private java.util.Hashtable getChecksumsHashtable(java.lang.String r17, com.eamobile.download.DownloadFileData[] r18) { - /* - // Method dump skipped, instructions count: 204 - */ - throw new UnsupportedOperationException("Method not decompiled: com.eamobile.DownloadActivityInternal.getChecksumsHashtable(java.lang.String, com.eamobile.download.DownloadFileData[]):java.util.Hashtable"); - } - - private Device getDevice(String str) { - if (this.overrideDevices != null) { - for (int i = 0; i < this.overrideDevices.size(); i++) { - Device device = this.overrideDevices.get(i); - if (device.getName().equals(str)) { - return device; - } - } - } - return null; - } - - public static boolean getFlagLastReportDownload() { - return downloadProgress.getFlagLastReportDownload(); - } - - public static boolean getForceWakeDuringDownload() { - return FORCE_WAKE_DURING_DOWNLOAD; - } - - protected static Activity getInstance() { - return instance; - } - - public static DownloadActivityInternal getMainActivity() { - return mMainActivity; - } - - private DownloadFileData getMatchingChecksumFile(String str, DownloadFileData[] downloadFileDataArr) { - for (int i = 0; i < downloadFileDataArr.length; i++) { - if (downloadFileDataArr[i].getType() == 2 && downloadFileDataArr[i].getFileName().contains(str)) { - return downloadFileDataArr[i]; - } - } - return null; - } - - public static long getRealDownloaded() { - return downloadProgress.getRealDownloaded(); - } - - private String getResolution() { - Device device = getDevice(getModel()); - if (device != null) { - return device.getResolutionString(); - } - String str = null; - if (RETRIEVE_FULL_SCREEN_RESOLUTION) { - str = getResolutionUsingUndocumentedMethods(); - } - if (str == null) { - str = getResolutionUsingDisplayMetrics(); - } - if (instance.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { - Logging.DEBUG_OUT("SCREEN_ORIENTATION_LANDSCAPE"); - return str; - } - Logging.DEBUG_OUT("SCREEN_ORIENTATION_PORTRAIT"); - return str; - } - - private String getResolutionUsingDisplayMetrics() { - Logging.DEBUG_OUT("Calling getResolutionUsingDisplayMetrics()..."); - DisplayMetrics displayMetrics = new DisplayMetrics(); - instance.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - Logging.DEBUG_OUT("displayMetrics: " + displayMetrics.toString()); - width = displayMetrics.widthPixels; - height = displayMetrics.heightPixels; - return width + "x" + height; - } - - private String getResolutionUsingUndocumentedMethods() { - Logging.DEBUG_OUT("Calling getResolutionUsingUndocumentedMethods()..."); - - Display defaultDisplay = instance.getWindowManager().getDefaultDisplay(); - width = defaultDisplay.getWidth(); - height = defaultDisplay.getHeight(); - - if (instance.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { - if (width < height) { - int i = width; - width = height; - height = i; - } - } else if (width > height) { - int i2 = width; - width = height; - height = i2; - } - return width + "x" + height; - - } - - public static String getResourcesPath() { - return RESOURCES_PATH; - } - - public static long getSizeDownloaded() { - return downloadProgress.getSizeDownloaded(); - } - - public static int getTotalDownloadSizeMB() { - return totalDownloadSizeMB; - } - - public static String getTotalDownloadSizeMBString() { - return Integer.toString(totalDownloadSizeMB); - } - - public static boolean isInitialized() { - return isInitialized; - } - - private void loadConfigProperties() { - try { - Properties properties = new Properties(); - properties.load(instance.getAssets().open(getResourcesPath() + "config.properties")); - MASTER_SELL_ID = Integer.parseInt(properties.getProperty("MASTER_SELL_ID").trim()); - TOTAL_SPACE_MB = Integer.parseInt(properties.getProperty("TOTAL_SPACE_MB").trim()); - PRODUCT_ID = Integer.parseInt(properties.getProperty("PRODUCT_ID").trim()); - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("[config.properties]"); - Logging.DEBUG_OUT("\tMASTER_SELL_ID: " + MASTER_SELL_ID); - Logging.DEBUG_OUT("\tPRODUCT_ID: " + PRODUCT_ID); - Logging.DEBUG_OUT("\tTOTAL_SPACE_MB: " + TOTAL_SPACE_MB); - String property = properties.getProperty("USE_INTERNAL_STORAGE"); - if (property != null) { - USE_INTERNAL_STORAGE = Boolean.parseBoolean(property.trim()); - } - Logging.DEBUG_OUT("\tUSE_INTERNAL_STORAGE: " + USE_INTERNAL_STORAGE); - String property2 = properties.getProperty("ALTERNATIVE_DATA_FOLDER"); - if (property2 != null) { - ALTERNATIVE_DATA_FOLDER = Boolean.parseBoolean(property2.trim()); - } - Logging.DEBUG_OUT("\tALTERNATIVE_DATA_FOLDER: " + ALTERNATIVE_DATA_FOLDER); - String property3 = properties.getProperty("DATA_FOLDER"); - if (property3 != null) { - Logging.DEBUG_OUT("\tDATA_FOLDER: " + property3); - setAssetPathAux(property3, true); - } else { - Logging.DEBUG_OUT("\tDATA_FOLDER not specified in config.properties"); - if (this.callSetAssetPathAux) { - setAssetPathAux(this.activityAssetPath, this.activityUseExternal); - } else { - Logging.DEBUG_OUT("[ERROR] DATA_FOLDER not specified in config.properties and setAssetPath() was not called from game's activity."); - } - } - String property4 = properties.getProperty("TIMEOUT"); - if (property4 != null) { - try { - int parseInt = Integer.parseInt(property4.trim()); - if (parseInt > 0) { - TIMEOUT = parseInt * 1000; - Logging.DEBUG_OUT("\tTIMEOUT read from config.properties"); - } - } catch (Exception e) { - Logging.DEBUG_OUT("\t" + e.toString()); - } - } - Logging.DEBUG_OUT("\tTIMEOUT: " + TIMEOUT + " milliseconds"); - String property5 = properties.getProperty("READ_DOWNLOAD_URL_FROM_SDCARD"); - if (property5 != null) { - property5 = property5.trim(); - } - if (Boolean.parseBoolean(property5)) { - Logging.DEBUG_OUT("\tWill try to read DOWNLOAD_URL from SD card..."); - String readUrlFromFile = readUrlFromFile(); - if (readUrlFromFile != null) { - Logging.DEBUG_OUT("\t\tOK: DOWNLOAD_URL read from SD Card"); - DOWNLOAD_URL = readUrlFromFile; - } else { - Logging.DEBUG_OUT("\t\tFAILED. Will use DOWNLOAD_URL defined in config.properties"); - DOWNLOAD_URL = properties.getProperty("DOWNLOAD_URL").trim(); - } - } else { - DOWNLOAD_URL = properties.getProperty("DOWNLOAD_URL").trim(); - } - Logging.DEBUG_OUT("\tDOWNLOAD_URL: " + DOWNLOAD_URL); - String property6 = properties.getProperty("UNCOMPRESS_ZIP_ON_DEVICE"); - if (property6 != null) { - property6 = property6.trim(); - } - UNCOMPRESS_ZIP_ON_DEVICE = Boolean.parseBoolean(property6); - Logging.DEBUG_OUT("\tUNCOMPRESS_ZIP_ON_DEVICE: " + UNCOMPRESS_ZIP_ON_DEVICE); - String property7 = properties.getProperty("CUSTOM_PROGRESS_BAR"); - if (property7 != null) { - CUSTOM_PROGRESS_BAR = Boolean.parseBoolean(property7.trim()); - } - Logging.DEBUG_OUT("\tCUSTOM_PROGRESS_BAR: " + CUSTOM_PROGRESS_BAR); - String property8 = properties.getProperty("USE_OLD_PROGRESS_BAR"); - if (property8 != null) { - USE_OLD_PROGRESS_BAR = Boolean.parseBoolean(property8.trim()); - } - Logging.DEBUG_OUT("\tUSE_OLD_PROGRESS_BAR: " + USE_OLD_PROGRESS_BAR); - String property9 = properties.getProperty("TOTAL_SPACE_MB_MIN"); - if (property9 != null) { - try { - TOTAL_SPACE_MB_MIN = Integer.parseInt(property9.trim()); - } catch (Exception e2) { - Logging.DEBUG_OUT("\t" + e2.toString()); - } - } - Logging.DEBUG_OUT("\tTOTAL_SPACE_MB_MIN: " + TOTAL_SPACE_MB_MIN); - if (TOTAL_SPACE_MB_MIN <= 0 || TOTAL_SPACE_MB <= TOTAL_SPACE_MB_MIN) { - isDownloadRange = false; - } else { - isDownloadRange = true; - } - String property10 = properties.getProperty("DISABLE_3G"); - if (property10 != null) { - DISABLE_3G = Boolean.parseBoolean(property10.trim()); - } - Logging.DEBUG_OUT("\tDISABLE_3G: " + DISABLE_3G); - String property11 = properties.getProperty("FORCE_WAKE_DURING_DOWNLOAD"); - if (property11 != null) { - setForceWakeDuringDownload(Boolean.parseBoolean(property11.trim())); - } - Logging.DEBUG_OUT("\tFORCE_WAKE_DURING_DOWNLOAD: " + getForceWakeDuringDownload()); - String property12 = properties.getProperty("DO_NOT_OPEN_STORAGE_SETTINGS"); - if (property12 != null) { - DO_NOT_OPEN_STORAGE_SETTINGS = Boolean.parseBoolean(property12.trim()); - } - Logging.DEBUG_OUT("\tDO_NOT_OPEN_STORAGE_SETTINGS: " + DO_NOT_OPEN_STORAGE_SETTINGS); - MIN_ASSET_VERSION_REQUIRED = properties.getProperty("MIN_ASSET_VERSION_REQUIRED"); - Logging.DEBUG_OUT("\tMIN_ASSET_VERSION_REQUIRED: " + MIN_ASSET_VERSION_REQUIRED); - String property13 = properties.getProperty("DELETE_ASSETS_ON_UPDATE"); - if (property13 != null) { - DELETE_ASSETS_ON_UPDATE = Boolean.parseBoolean(property13.trim()); - } - Logging.DEBUG_OUT("\tDELETE_ASSETS_ON_UPDATE: " + DELETE_ASSETS_ON_UPDATE); - String property14 = properties.getProperty("UNSAFE_ASSET_DELETION_ON_UPDATE"); - if (property14 != null) { - UNSAFE_ASSET_DELETION_ON_UPDATE = Boolean.parseBoolean(property14.trim()); - } - Logging.DEBUG_OUT("\tUNSAFE_ASSET_DELETION_ON_UPDATE: " + UNSAFE_ASSET_DELETION_ON_UPDATE); - if (UNSAFE_ASSET_DELETION_ON_UPDATE) { - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - Logging.DEBUG_OUT("\tUNSAFE_ASSET_DELETION_ON_UPDATE = true"); - Logging.DEBUG_OUT("\tADC will delete the entire download folder before an update"); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - } - String property15 = properties.getProperty("REDOWNLOAD_ON_SCREEN_SIZE_CHANGE"); - if (property15 != null) { - REDOWNLOAD_ON_SCREEN_SIZE_CHANGE = Boolean.parseBoolean(property15.trim()); - } - Logging.DEBUG_OUT("\tREDOWNLOAD_ON_SCREEN_SIZE_CHANGE: " + REDOWNLOAD_ON_SCREEN_SIZE_CHANGE); - String property16 = properties.getProperty("NUMBER_OF_HOURS_TO_UPDATE_CHECKING"); - if (property16 != null) { - try { - NUMBER_OF_HOURS_TO_UPDATE_CHECKING = Integer.parseInt(property16.trim()); - Logging.DEBUG_OUT("\tNUMBER_OF_HOURS_TO_UPDATE_CHECKING read from config.properties"); - } catch (Exception e3) { - Logging.DEBUG_OUT("\t" + e3.toString()); - } - } - Logging.DEBUG_OUT("\tNUMBER_OF_HOURS_TO_UPDATE_CHECKING: " + NUMBER_OF_HOURS_TO_UPDATE_CHECKING + " hours"); - String property17 = properties.getProperty("RETRIEVE_FULL_SCREEN_RESOLUTION"); - if (property17 != null) { - RETRIEVE_FULL_SCREEN_RESOLUTION = Boolean.parseBoolean(property17.trim()); - } - Logging.DEBUG_OUT("\tRETRIEVE_FULL_SCREEN_RESOLUTION: " + RETRIEVE_FULL_SCREEN_RESOLUTION); - this.configLoaded = true; - Logging.DEBUG_OUT(" "); - } catch (Exception e4) { - Logging.DEBUG_OUT("\tException while loading properties: config.properties" + e4); - } finally { - Logging.DEBUG_OUT(" "); - } - } - - private void loadOverrides() { - InputStream inputStream = null; - try { - InputStream open = instance.getAssets().open(getResourcesPath() + "overrides.xml"); - Element documentElement = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(open).getDocumentElement(); - NodeList elementsByTagName = documentElement.getElementsByTagName("device"); - if (elementsByTagName != null && elementsByTagName.getLength() != 0) { - for (int i = 0; i < elementsByTagName.getLength(); i++) { - Element element = (Element) elementsByTagName.item(i); - NodeList elementsByTagName2 = element.getElementsByTagName("resolution"); - if (!(elementsByTagName2 == null || elementsByTagName2.getLength() == 0)) { - Element element2 = (Element) elementsByTagName2.item(0); - this.overrideDevices.add(new Device(element.getAttribute("name"), Integer.parseInt(element2.getAttribute("width")), Integer.parseInt(element2.getAttribute("height")))); - } - } - NodeList elementsByTagName3 = documentElement.getElementsByTagName("fallback"); - if (elementsByTagName3 != null && elementsByTagName3.getLength() != 0) { - String str = ""; - Element element3 = (Element) elementsByTagName3.item(0); - NodeList elementsByTagName4 = element3.getElementsByTagName("forceDevice"); - if (elementsByTagName4 != null && elementsByTagName4.getLength() > 0) { - str = ((Element) elementsByTagName4.item(0)).getAttribute("name"); - } - NodeList elementsByTagName5 = element3.getElementsByTagName("resolution"); - if (elementsByTagName5 != null && elementsByTagName5.getLength() != 0) { - Element element4 = (Element) elementsByTagName5.item(0); - this.deviceFallback = new Device(str, Integer.parseInt(element4.getAttribute("width")), Integer.parseInt(element4.getAttribute("height"))); - if (open != null) { - try { - open.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } else if (open != null) { - try { - open.close(); - } catch (Exception e2) { - e2.printStackTrace(); - } - } - } else if (open != null) { - try { - open.close(); - } catch (Exception e3) { - e3.printStackTrace(); - } - } - } else if (open != null) { - try { - open.close(); - } catch (Exception e4) { - e4.printStackTrace(); - } - } - } catch (FileNotFoundException e5) { - if (0 != 0) { - try { - inputStream.close(); - } catch (Exception e6) { - e6.printStackTrace(); - } - } - } catch (Exception e7) { - e7.printStackTrace(); - if (0 != 0) { - try { - inputStream.close(); - } catch (Exception e8) { - e8.printStackTrace(); - } - } - } catch (Throwable th) { - if (0 != 0) { - try { - inputStream.close(); - } catch (Exception e9) { - e9.printStackTrace(); - } - } - throw th; - } - } - - private void printADCLibInfo() { - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("[ADC lib info]"); - if (Constants.ADC_BUILD_LOCAL.equalsIgnoreCase("true")) { - Logging.DEBUG_OUT("\t[WARNING] This version of ADC was built locally and should not be used in production."); - } - Logging.DEBUG_OUT("\tADC build version: @ADC_BUILD_VERSION_DYNAMIC_VALUE@"); - Logging.DEBUG_OUT("\tADC build time: @ADC_BUILD_TIME_DYNAMIC_VALUE@"); - Logging.DEBUG_OUT(" "); - } - - private void printDeviceAndAppInfo() { - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("[Device/App info]"); - Logging.DEBUG_OUT("\tDevice: " + getDeviceString()); - Logging.DEBUG_OUT("\tBrand: " + getBrand()); - Logging.DEBUG_OUT("\tAndroid Unique ID: " + getAndroidUniqueId()); - Logging.DEBUG_OUT("\tApplication name: " + getApplicationName()); - Logging.DEBUG_OUT("\tAPK version: " + getAPKVersion()); - Logging.DEBUG_OUT(" "); - } - - private String readUrlFromFile() { - try { - File file = new File(this.assetManager.getFilePath(DOWNLOAD_URL_CONFIG_FILE)); - if (file.exists()) { - BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); - String readLine = bufferedReader.readLine(); - bufferedReader.close(); - return readLine; - } - Logging.DEBUG_OUT("\t\tDownloadURL.indicate does not exist."); - return ""; - } catch (Exception e) { - Logging.DEBUG_OUT("\t\tException while reading DownloadURL.indicate: " + e); - } - return ""; - } - - private JSONObject sendHttpPost(String str, JSONObject jSONObject) { - InputStream inputStream = null; - try { - DefaultHttpClient defaultHttpClient = new DefaultHttpClient(); - HttpConnectionParams.setConnectionTimeout(defaultHttpClient.getParams(), 10000); - HttpPost httpPost = new HttpPost(str); - httpPost.setEntity(new StringEntity(jSONObject.toString())); - httpPost.setHeader("Accept", "application/json"); - httpPost.setHeader("Content-type", "application/json"); - HttpEntity entity = defaultHttpClient.execute(httpPost).getEntity(); - if (entity != null) { - InputStream content = entity.getContent(); - JSONObject jSONObject2 = new JSONObject(convertStreamToString(content)); - unknownHostExceptionTryAgain = true; - if (content == null) { - return jSONObject2; - } - try { - content.close(); - return jSONObject2; - } catch (Exception e) { - return jSONObject2; - } - } else { - return null; - } - } catch (Exception e3) { - Logging.DEBUG_OUT("[ERROR] An exception occurred in sendHttpPost while trying to obtain the file list."); - Logging.DEBUG_OUT_STACK(e3); - Logging.DEBUG_OUT("URL: " + str); - Logging.DEBUG_OUT("jsonObjSend: " + jSONObject); - if (unknownHostExceptionTryAgain) { - Logging.DEBUG_OUT("Trying sendHttpPost again..."); - unknownHostExceptionTryAgain = false; - JSONObject sendHttpPost = sendHttpPost(str, jSONObject); - return sendHttpPost; - } else { - Logging.DEBUG_OUT("Already tried sendHttpPost after failure."); - } - } catch (Throwable th) { - throw th; - } - return new JSONObject(); - } - - private void setAssetPathAux(String str, boolean z) { - String str2 = ""; - String str3 = ""; - String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath(); - String absolutePath2 = this.mContext.getFilesDir().getAbsolutePath(); - String str4 = null; - if (USE_INTERNAL_STORAGE) { - str2 = str2 + this.mContext.getFilesDir().getAbsolutePath(); - str3 = str3 + absolutePath2; - } else if (z) { - str2 = str2 + absolutePath; - str3 = str3 + absolutePath2; - } else { - Logging.DEBUG_OUT("User entered an absolute path."); - if (str.startsWith(absolutePath)) { - USE_INTERNAL_STORAGE = false; - str4 = str.replaceFirst(absolutePath, absolutePath2); - } else if (str.startsWith(absolutePath2)) { - USE_INTERNAL_STORAGE = true; - str4 = str.replaceFirst(absolutePath2, absolutePath); - } - } - if (str != null) { - str2 = str2 + str; - } - this.assetManager.setAssetPath(str2); - if (ALTERNATIVE_DATA_FOLDER) { - String str5 = str4 == null ? str3 + str : str4; - this.assetManager.setAlternativeAssetPath(str5); - Logging.DEBUG_OUT("\tsetAlternativeAssetPath(), mAlternativeAssetPath = " + str5); - } - Logging.DEBUG_OUT("\tsetAssetPath(), mAssetPath = " + str2); - } - - public static void setFlagLastReportDownload(boolean z) { - downloadProgress.setFlagLastReportDownload(z); - } - - public static void setForceWakeDuringDownload(boolean z) { - FORCE_WAKE_DURING_DOWNLOAD = z; - } - - private boolean shouldSkipUpdateCheck() { - Logging.DEBUG_OUT("DownloadActivityInternal shouldSkipUpdateCheck()"); - if (NUMBER_OF_HOURS_TO_UPDATE_CHECKING > 0) { - Properties loadAssetInfo = this.assetManager.loadAssetInfo(); - if (loadAssetInfo != null) { - String property = loadAssetInfo.getProperty("updateCheckLastTime"); - if (property != null) { - try { - long parseLong = Long.parseLong(property); - Logging.DEBUG_OUT("Last time checked for update: " + parseLong); - long time = new Date().getTime(); - Logging.DEBUG_OUT("Current time: " + time); - long j = time - parseLong; - if (j < 0) { - Logging.DEBUG_OUT("Time travel not allowed!"); - return false; - } - int i = (int) (j / 3600000); - Logging.DEBUG_OUT("Number of hours since last update checking: " + i); - Logging.DEBUG_OUT("Number of hours needed: " + NUMBER_OF_HOURS_TO_UPDATE_CHECKING); - return i < NUMBER_OF_HOURS_TO_UPDATE_CHECKING; - } catch (Exception e) { - Logging.DEBUG_OUT_STACK(e); - return false; - } - } else { - Logging.DEBUG_OUT("Property updateCheckLastTime not found."); - return false; - } - } else { - Logging.DEBUG_OUT("AssetInfo file could not be read."); - return false; - } - } else { - Logging.DEBUG_OUT("NUMBER_OF_HOURS_TO_UPDATE_CHECKING not defined or invalid."); - return false; - } - } - - private boolean startDownloadingFiles(DownloadFileData[] downloadFileDataArr) { - if (!isConnected()) { - Logging.DEBUG_OUT("[ERROR] Connection unavailable"); - recordError(-16); - return false; - } - boolean z = false; - int i = 0; - while (true) { - try { - if (i >= downloadFileDataArr.length) { - break; - } - DownloadFileData downloadFileData2 = downloadFileDataArr[i]; - if (downloadFileData2.getType() == 1) { - if (!UNCOMPRESS_ZIP_ON_DEVICE) { - Logging.DEBUG_OUT("File to download (ZIP): " + downloadFileData2.getFileName()); - Logging.DEBUG_OUT("Files will be downloaded using a ZipInputStream: will NOT be ale to resume"); - Hashtable checksumsHashtable = getChecksumsHashtable(downloadFileData2.getFileName(), downloadFileDataArr); - if (checksumsHashtable == null) { - Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData2.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); - recordError(-13); - return false; - } else if (!this.assetManager.isFileDownloaded(downloadFileData2.getFileName())) { - Logging.DEBUG_OUT("Downloading file: " + downloadFileData2.getFileName()); - z = downloadAndValidateZipFile(downloadFileData2, checksumsHashtable); - if (!z) { - break; - } - this.assetManager.saveState(downloadFileData2.getFileName() + "\t" + downloadFileData2.getVersion(), null); - downloadProgress.setCurrentFile("n_" + downloadFileData2.getFileName(), (long) downloadFileData2.getSize()); - downloadProgress.fillCurrentFileDownload(false); - } else { - Logging.DEBUG_OUT("File already downloaded:" + downloadFileData2.getFileName()); - downloadProgress.setCurrentFile("n_" + downloadFileData2.getFileName(), (long) downloadFileData2.getSize()); - downloadProgress.fillCurrentFileDownload(true); - setFlagLastReportDownload(false); - z = true; - } - } else { - Logging.DEBUG_OUT("File to download (ZIP): " + downloadFileData2.getFileName()); - Logging.DEBUG_OUT("Zip will be downloaded and uncompressed on device: resume is possible"); - Hashtable checksumsHashtable2 = getChecksumsHashtable(downloadFileData2.getFileName(), downloadFileDataArr); - if (checksumsHashtable2 == null) { - Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData2.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); - recordError(-13); - return false; - } else if (!this.assetManager.isFileDownloaded(downloadFileData2.getFileName())) { - Logging.DEBUG_OUT("Downloading file: " + downloadFileData2.getFileName()); - z = false; - if (!downloadOtherFile(downloadFileData2, null)) { - break; - } - z = extractAndValidateFilesFromZip(downloadFileData2.getFileName(), checksumsHashtable2); - new File(this.assetManager.getFilePath(downloadFileData2.getFileName())).delete(); - if (!z) { - recordError(-12); - break; - } - this.assetManager.saveState(downloadFileData2.getFileName() + "\t" + downloadFileData2.getVersion(), null); - } else { - Logging.DEBUG_OUT("File already downloaded:" + downloadFileData2.getFileName()); - z = true; - downloadProgress.setCurrentFile("n_" + downloadFileData2.getFileName(), (long) downloadFileData2.getSize()); - downloadProgress.fillCurrentFileDownload(true); - setFlagLastReportDownload(false); - } - } - } else if (downloadFileData2.getType() == 3) { - Logging.DEBUG_OUT("File to download (NON-ZIP): " + downloadFileData2.getFileName()); - Hashtable checksumsHashtable3 = getChecksumsHashtable(downloadFileData2.getFileName(), downloadFileDataArr); - if (checksumsHashtable3 == null) { - Logging.DEBUG_OUT("[ERROR] Unable to download required checksums file: " + getMatchingChecksumFile(downloadFileData2.getFileName(), this.downloadFileData).getFileName() + " (" + resolution + ")"); - recordError(-13); - return false; - } else if (!this.assetManager.isFileDownloaded(downloadFileData2.getFileName())) { - Logging.DEBUG_OUT("Downloading file: " + downloadFileData2.getFileName()); - z = downloadOtherFile(downloadFileData2, checksumsHashtable3); - if (!z) { - break; - } - this.assetManager.saveState(downloadFileData2.getFileName() + "\t" + downloadFileData2.getVersion(), null); - } else { - Logging.DEBUG_OUT("File already downloaded:" + downloadFileData2.getFileName()); - z = true; - downloadProgress.setCurrentFile("n_" + downloadFileData2.getFileName(), (long) downloadFileData2.getSize()); - downloadProgress.fillCurrentFileDownload(true); - setFlagLastReportDownload(false); - } - } else { - continue; - } - i++; - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while downloading files: " + e); - Logging.DEBUG_OUT_STACK(e); - return false; - } - } - if (z) { - this.assetManager.saveStateDownloadFinished(); - this.assetManager.saveDownloadListFile(downloadFileDataArr); - this.assetManager.saveAssetInfo(generateAssetInfo()); - this.percent_downloaded = 100; - Logging.DEBUG_OUT("[FINISHED] All files downloaded successfully."); - return z; - } - Logging.DEBUG_OUT("[ERROR] Assets download failed."); - return z; - } - - private void unregisterWifiReceiver() { - try { - if (this.wifiReceiver != null) { - instance.unregisterReceiver(this.wifiReceiver); - } - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while unregistering WifiReceiver."); - Logging.DEBUG_OUT_STACK(e); - } finally { - this.wifiReceiver = null; - } - } - - private int updateDownloadFilesData(boolean z) { - String brand = getBrand(); - resolution = getResolution(); - String deviceString = getDeviceString(); - if (z) { - if (this.deviceFallback == null) { - return ERROR_UNSUPPORTED_DEVICE; - } - resolution = this.deviceFallback.getResolutionString(); - String name = this.deviceFallback.getName(); - if (!name.equals("")) { - deviceString = name; - } - } - String str = DOWNLOAD_URL; - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("[OVERRIDE DEVICE DATA]"); - Logging.DEBUG_OUT("Checking if device data have been overridden in onRetrievedDeviceData()..."); - try { - DeviceData deviceData = new DeviceData(); - deviceData.setDeviceName(deviceString); - deviceData.setBrandName(brand); - deviceData.setResolution(width, height); - deviceData.setGlExtensions(this.glExtensions); - ((IDeviceData) instance).onRetrievedDeviceData(deviceData); - int i = 0; - if (!deviceString.equals(deviceData.getDeviceName())) { - i = 0 + 1; - Logging.DEBUG_OUT(i + ") Device name was overridden"); - Logging.DEBUG_OUT("\tFrom: " + deviceString); - Logging.DEBUG_OUT("\tTo: " + deviceData.getDeviceName()); - deviceString = deviceData.getDeviceName(); - } - if (!brand.equals(deviceData.getBrandName())) { - i++; - Logging.DEBUG_OUT(i + ") Brand name was overridden"); - Logging.DEBUG_OUT("\tFrom: " + brand); - Logging.DEBUG_OUT("\tTo: " + deviceData.getBrandName()); - brand = deviceData.getBrandName(); - } - width = deviceData.getWidth(); - height = deviceData.getHeight(); - String str2 = deviceData.getWidth() + "x" + deviceData.getHeight(); - if (!resolution.equals(str2)) { - i++; - Logging.DEBUG_OUT(i + ") Resolution was overridden"); - Logging.DEBUG_OUT("\tFrom: " + resolution); - Logging.DEBUG_OUT("\tTo: " + str2); - resolution = str2; - } - if (!this.glExtensions.equals(deviceData.getGlExtensions())) { - i++; - Logging.DEBUG_OUT(i + ") GL Extensions was overridden"); - Logging.DEBUG_OUT("\tFrom: " + this.glExtensions); - Logging.DEBUG_OUT("\tTo: " + deviceData.getGlExtensions()); - this.glExtensions = deviceData.getGlExtensions(); - } - if (i == 0) { - Logging.DEBUG_OUT("No device data overridden."); - } - } catch (ClassCastException e) { - Logging.DEBUG_OUT("onRetrievedDeviceData() not implemented."); - } finally { - Logging.DEBUG_OUT(" "); - } - String str3 = str + "androidContentWS/cms/android/gameasset/application/" + MASTER_SELL_ID + "/pId/" + PRODUCT_ID + "/version/" + getAPKVersion() + "/resolution/" + resolution + "/glext/device/" + deviceString + "/brand/" + brand + "?language=" + this.mLocale; - Logging.DEBUG_OUT("[SENDING REQUEST]"); - Logging.DEBUG_OUT("DOWNLOAD DATA URL\n" + str3); - Logging.DEBUG_OUT("TYPE: POST"); - JSONObject jSONObject = new JSONObject(); - this.downloadFileData = null; - totalDownloadSizeMB = 0; - try { - Logging.DEBUG_OUT("PARAMETERS: "); - jSONObject.put("glext", this.glExtensions); - Logging.DEBUG_OUT("\tglext: " + this.glExtensions); - Logging.DEBUG_OUT("ADDITIONAL INFORMATION:"); - Logging.DEBUG_OUT("\tProduct ID:" + PRODUCT_ID); - Logging.DEBUG_OUT("\tSell ID:" + MASTER_SELL_ID); - Logging.DEBUG_OUT("\tBrand:" + brand); - Logging.DEBUG_OUT("\tDevice:" + deviceString); - Logging.DEBUG_OUT("\tResolution:" + resolution); - Logging.DEBUG_OUT("\tLanguage:" + this.mLocale); - JSONObject sendHttpPost = sendHttpPost(str3, jSONObject); - if (sendHttpPost == null) { - return -15; - } - Logging.DEBUG_OUT("[JSON RESULT]\n" + sendHttpPost); - if (sendHttpPost.has("responseCode")) { - int i2 = sendHttpPost.getInt("responseCode"); - return i2 == 5001 ? ERROR_UNSUPPORTED_DEVICE : i2; - } - Logging.DEBUG_OUT("FILES: "); - JSONArray jSONArray = sendHttpPost.getJSONArray("files"); - for (int i3 = 0; i3 < jSONArray.length(); i3++) { - JSONObject jSONObject2 = jSONArray.getJSONObject(i3); - Logging.DEBUG_OUT("--------------------------------------"); - Logging.DEBUG_OUT("Filename:" + jSONObject2.getString("fileName")); - Logging.DEBUG_OUT("Size (bytes): " + jSONObject2.getInt("fileSize")); - Logging.DEBUG_OUT("Version: " + jSONObject2.getString("version")); - Logging.DEBUG_OUT("Language: " + jSONObject2.getString("language")); - Logging.DEBUG_OUT("URL: " + jSONObject2.getString("fileURL")); - Logging.DEBUG_OUT("--------------------------------------"); - } - this.downloadFileData = new DownloadFileData[jSONArray.length()]; - for (int i4 = 0; i4 < jSONArray.length(); i4++) { - JSONObject jSONObject3 = jSONArray.getJSONObject(i4); - String string = jSONObject3.getString("fileName"); - this.downloadFileData[i4] = new DownloadFileData(string, jSONObject3.getInt("fileSize"), jSONObject3.getString("version"), jSONObject3.getString("language"), jSONObject3.getString("fileURL"), 3); - if (MIN_ASSET_VERSION_REQUIRED != null) { - if (this.assetManager.isVersionLower(this.downloadFileData[i4].getVersion(), MIN_ASSET_VERSION_REQUIRED)) { - return -17; - } - } - if (string.endsWith(".zip")) { - this.downloadFileData[i4].setType(1); - } else if (string.endsWith(".checksums")) { - this.downloadFileData[i4].setType(2); - } - } - try { - spaceNeededToDownload = sendHttpPost.getLong("totalUncompressFilesSize"); - spaceNeededToDownload += getTotalDownloadSizeForNonZipFiles(this.downloadFileData); - } catch (JSONException e2) { - Logging.DEBUG_OUT(e2.toString()); - } - if (this.downloadFileData != null) { - totalDownloadSizeMB = getTotalDownloadSize(this.downloadFileData); - } - return 0; - } catch (Exception e3) { - Logging.DEBUG_OUT("[ERROR]An exception occurred in updateDownloadFilesData():"); - Logging.DEBUG_OUT_STACK(e3); - return -15; - } - } - - /* access modifiers changed from: protected */ - public long calculateDownloaded(File file) { - File[] listFiles = file.listFiles(); - if (listFiles == null) { - return 0; - } - long j = 0; - for (int i = 0; i < listFiles.length; i++) { - j += listFiles[i].isDirectory() ? calculateDownloaded(listFiles[i]) : listFiles[i].length(); - } - return j; - } - - public boolean canFindHostIP() { - try { - Logging.DEBUG_OUT("Getting host name from URL: " + DOWNLOAD_URL); - Logging.DEBUG_OUT("Host name: " + new URL(DOWNLOAD_URL).getHost()); - try { - BasicHttpParams basicHttpParams = new BasicHttpParams(); - HttpConnectionParams.setConnectionTimeout(basicHttpParams, 5000); - HttpConnectionParams.setSoTimeout(basicHttpParams, 5000); - return new DefaultHttpClient(basicHttpParams).execute(new HttpGet(DOWNLOAD_URL)).getStatusLine().getStatusCode() == 200; - } catch (Exception e) { - Logging.DEBUG_OUT_STACK(e); - return false; - } - } catch (MalformedURLException e2) { - Logging.DEBUG_OUT("Not found: URL is malformed"); - return false; - } - } - - public boolean canOpenStorageSettings() { - return !DO_NOT_OPEN_STORAGE_SETTINGS; - } - - public boolean checkForUpdates() { - if (!ALTERNATIVE_DATA_FOLDER) { - return this.assetManager.checkForUpdates(this.downloadFileData); - } - this.assetManager.useAlternativeAssetPath(false); - if (!this.assetManager.assetsFoundLocally() || this.assetManager.checkForUpdates(this.downloadFileData)) { - this.assetManager.useAlternativeAssetPath(true); - if (!this.assetManager.assetsFoundLocally()) { - Logging.DEBUG_OUT("[ERROR] Something very wrong happened: assets have been found previously, but cannot be found anymore."); - this.assetManager.useAlternativeAssetPath(false); - return true; - } else if (this.assetManager.checkForUpdates(this.downloadFileData)) { - Logging.DEBUG_OUT("Assets on alternative location and update found."); - return true; - } else { - Logging.DEBUG_OUT("Assets on alternative location and no update NOT found."); - return false; - } - } else { - Logging.DEBUG_OUT("Assets on main location and update NOT found."); - return false; - } - } - - public boolean checkLocalAssetVersion() { - if (MIN_ASSET_VERSION_REQUIRED != null) { - return this.assetManager.isAssetVersionCompatible(MIN_ASSET_VERSION_REQUIRED); - } - return true; - } - - public boolean checkScreenSizeChange() { - if (!REDOWNLOAD_ON_SCREEN_SIZE_CHANGE) { - return false; - } - Logging.DEBUG_OUT("Checking for screen size change..."); - Properties loadAssetInfo = this.assetManager.loadAssetInfo(); - if (loadAssetInfo != null) { - String property = loadAssetInfo.getProperty("width"); - String property2 = loadAssetInfo.getProperty("height"); - if (property == null || property2 == null) { - Logging.DEBUG_OUT("No information found."); - return false; - } - try { - int parseInt = Integer.parseInt(property); - int parseInt2 = Integer.parseInt(property2); - Logging.DEBUG_OUT("Device width: " + width); - Logging.DEBUG_OUT("Assets width: " + parseInt); - Logging.DEBUG_OUT("Device height: " + height); - Logging.DEBUG_OUT("Assets height: " + parseInt2); - if (parseInt == width && parseInt2 == height) { - Logging.DEBUG_OUT("NO screen change detected."); - return false; - } - Logging.DEBUG_OUT("Screen change detected."); - return true; - } catch (Exception e) { - Logging.DEBUG_OUT("Invalid information."); - Logging.DEBUG_OUT_STACK(e); - return false; - } - } else { - Logging.DEBUG_OUT("No information found."); - return false; - } - } - - public void checkServerContent(Boolean bool) { - int updateDownloadFilesData = getMainActivity().updateDownloadFilesData(false); - if ((updateDownloadFilesData == 5001 || updateDownloadFilesData == 5002) && this.deviceFallback != null) { - updateDownloadFilesData = getMainActivity().updateDownloadFilesData(true); - } - if (this.downloadFileData != null && spaceNeededToDownload > 0) { - spaceNeededToDownload -= this.assetManager.getTotalSize(this.assetManager.getDownloadList(this.downloadFileData)); - } - boolean z = false; - if (ALTERNATIVE_DATA_FOLDER) { - this.assetManager.useAlternativeAssetPath(false); - if (this.assetManager.assetsFoundLocally()) { - z = true; - } else { - this.assetManager.useAlternativeAssetPath(true); - if (this.assetManager.assetsFoundLocally()) { - z = true; - } else { - this.assetManager.useAlternativeAssetPath(false); - } - } - } else { - z = this.assetManager.assetsFoundLocally(); - } - if (!z) { - Logging.DEBUG_OUT("Assets not found on the device. ADC will try to download from the server."); - if (updateDownloadFilesData != 0) { - recordError(updateDownloadFilesData); - if (updateDownloadFilesData == 5001) { - Logging.DEBUG_OUT("[ERROR] Unsupported device: unable to find assets"); - Logging.DEBUG_OUT("\tfor resolution: " + resolution); - Logging.DEBUG_OUT("\ton server: " + DOWNLOAD_URL); - setState(12); - return; - } - if (updateDownloadFilesData == -15) { - Logging.DEBUG_OUT("[ERROR] Failed to retrieve download file list"); - if (bool.booleanValue()) { - Logging.DEBUG_OUT("Ignoring ERROR_FILE_LIST_RETRIEVE_FAILED and going to STATE_SHOW_WIFI_DIALOG."); - setState(6); - return; - } - } else { - Logging.DEBUG_OUT("[ERROR] Error from Server: " + updateDownloadFilesData); - } - this.serverErrorView.setErrorCode(updateDownloadFilesData); - setState(13); - } else if (!chooseAvailableMemory()) { - setState(4); - } else if (getState() != 2) { - setState(1); - } - } else { - Logging.DEBUG_OUT("checkServerContent(): assets found on the device."); - if (updateDownloadFilesData == 0) { - long time = new Date().getTime(); - Logging.DEBUG_OUT("Saving update checking timestamp: " + time); - Properties loadAssetInfo = this.assetManager.loadAssetInfo(); - if (loadAssetInfo == null) { - loadAssetInfo = new Properties(); - } - loadAssetInfo.setProperty("updateCheckLastTime", "" + time); - this.assetManager.saveAssetInfo(loadAssetInfo); - setState(8); - return; - } - if (updateDownloadFilesData == -15) { - Logging.DEBUG_OUT("[ERROR] Failed to retrieve download file list."); - } else if (updateDownloadFilesData == 5001 || updateDownloadFilesData == 5002) { - Logging.DEBUG_OUT("[ERROR] Assets found on the device but server returned error code " + updateDownloadFilesData + " while checking for assets."); - } - setState(11); - } - } - - public boolean chooseAvailableMemory() { - if (!ALTERNATIVE_DATA_FOLDER) { - return isSpaceAvailableForDownload(); - } - if (isSpaceAvailableForDownload()) { - this.assetManager.useAlternativeAssetPath(false); - Logging.DEBUG_OUT("Memory space is available in main location."); - return true; - } else if (isSpaceAvailableForAlternativeDownload()) { - this.assetManager.useAlternativeAssetPath(true); - Logging.DEBUG_OUT("Memory space is available only in alternative location."); - return true; - } else { - Logging.DEBUG_OUT("Memory space is not available."); - return false; - } - } - - public void deleteAssets() { - if (UNSAFE_ASSET_DELETION_ON_UPDATE) { - this.assetManager.deleteEntireDownloadFolder(); - } else { - this.assetManager.deleteAssets(); - } - } - - public void destroyDownloadActvity() { - if (getBackgroundBitmap() != null) { - getBackgroundBitmap().recycle(); - setBackgroundBitmap(null); - } - unregisterWifiReceiver(); - cleanStates(); - isInitialized = false; - instance = null; - mMainActivity = null; - downloadProgress = null; - this.assetManager = null; - pState = -1; - } - - /* access modifiers changed from: protected */ - public String getAPKVersion() { - try { - return instance.getPackageManager().getPackageInfo(instance.getPackageName(), 0).versionName; - } catch (PackageManager.NameNotFoundException e) { - return ""; - } - } - - /* access modifiers changed from: protected */ - public String getAndroidUniqueId() { - String string = Settings.Secure.getString(instance.getContentResolver(), Settings.Secure.ANDROID_ID); - String deviceId = ((TelephonyManager) instance.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); - return string != null ? "androidId=" + string + "&imei=" + deviceId : "imei=" + deviceId; - } - - public String getApplicationName() { - try { - return instance.getString(instance.getPackageManager().getPackageInfo(instance.getPackageName(), 0).applicationInfo.labelRes); - } catch (PackageManager.NameNotFoundException e) { - return ""; - } - } - - public String getAvailableSpaceForDownload() { - return "" + ((spaceAvailableToDownload / 1024) / 1024); - } - - public Bitmap getBackgroundBitmap() { - return this.bmpBg; - } - - /* access modifiers changed from: protected */ - public String getBrand() { - String str = Build.BRAND; - try { - return URLEncoder.encode(str, "UTF-8"); - } catch (Exception e) { - return str; - } - } - - /* access modifiers changed from: protected */ - public String getDeviceString() { - String str = getManufacturer() + "-" + getModel(); - try { - return URLEncoder.encode(str, "UTF-8"); - } catch (Exception e) { - Logging.DEBUG_OUT("getDeviceString Encode Exception:" + e); - return str; - } - } - - public int getLastError() { - if (mErrorList.size() == 0) { - return 0; - } - return mErrorList.get(mErrorList.size() - 1).intValue(); - } - - /* access modifiers changed from: protected */ - public String getManufacturer() { - try { - return Build.MANUFACTURER; - } catch (Exception e) { - Logging.DEBUG_OUT("getManufacturer Exception:" + e); - return "Unknown"; - } - } - - /* access modifiers changed from: protected */ - public String getModel() { - try { - return Build.MODEL; - } catch (Exception e) { - Logging.DEBUG_OUT("getModel Exception:" + e); - return "Unknown"; - } - } - - public int getNumErrors() { - return mErrorList.size(); - } - - public int getPercentDownloaded() { - double sizeDownloaded = (double) (((float) ((getSizeDownloaded() / 1024) / 1024)) / ((float) totalDownloadSizeMB)); - if (this.percent_downloaded < 100) { - this.percent_downloaded = (int) (100.0d * sizeDownloaded); - } else { - this.percent_downloaded = 100; - } - return this.percent_downloaded; - } - - /* access modifiers changed from: protected */ - public int getPreviousState() { - return pStatePrev; - } - - public String getRequiredSpaceForDownload() { - return spaceNeededToDownload > 0 ? "" + ((spaceNeededToDownload / 1024) / 1024) : "" + TOTAL_SPACE_MB; - } - - public String getSpaceRangeForDownload() { - return spaceNeededToDownload > 0 ? "" + ((spaceNeededToDownload / 1024) / 1024) : !isDownloadRange ? "" + TOTAL_SPACE_MB : "" + TOTAL_SPACE_MB_MIN + "-" + TOTAL_SPACE_MB; - } - - public int getState() { - return pState; - } - - public String getStateName() { - return pState != -1 ? STATE_STRINGS[pState] : "STATE_INVALID"; - } - - public int getTotalDownloadSize(DownloadFileData[] downloadFileDataArr) { - totalDownloadSizeMB = 0; - int i = 0; - for (DownloadFileData downloadFileData2 : downloadFileDataArr) { - try { - i += downloadFileData2.getSize(); - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while calculating download size:" + e); - } - } - totalDownloadSizeMB = (i / 1024) / 1024; - return totalDownloadSizeMB; - } - - public long getTotalDownloadSizeForNonZipFiles(DownloadFileData[] downloadFileDataArr) { - long j = 0; - for (int i = 0; i < downloadFileDataArr.length; i++) { - try { - if (downloadFileDataArr[i].getType() != 1) { - j += (long) downloadFileDataArr[i].getSize(); - } - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while calculating download size for non-zip files:"); - Logging.DEBUG_OUT_STACK(e); - } - } - return j; - } - - public WifiReceiver getWifiReceiver() { - return this.wifiReceiver; - } - - public void init(Activity activity, IDownloadActivity iDownloadActivity, Context context, Object obj) { - Logging.DEBUG_OUT("Calling: DownloadActivityInternal init()"); - this.mContext = context; - if (instance == null) { - instance = activity; - this.mDownloadActivity = iDownloadActivity; - } - printADCLibInfo(); - printDeviceAndAppInfo(); - loadConfigProperties(); - loadOverrides(); - checkPermissions(); - checkLanguageChange(); - checkBackgroundImage(); - if (downloadProgress == null) { - downloadProgress = new DownloadProgress(); - } - if (obj != null) { - try { - if (obj instanceof GL10) { - this.glExtensions = ((GL10) obj).glGetString(7939); - } else if (obj instanceof GL11) { - this.glExtensions = ((GL11) obj).glGetString(7939); - } - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while trying to get GL Extensions:" + e); - } - } - if (this.wifiReceiver == null) { - this.wifiReceiver = new WifiReceiver(); - instance.registerReceiver(this.wifiReceiver, new IntentFilter("android.net.wifi.RSSI_CHANGED")); - this.wifiReceiver.updateWifiInfo(); - } - if (!isInitialized) { - isInitialized = true; - boolean z = false; - if (ALTERNATIVE_DATA_FOLDER) { - this.assetManager.useAlternativeAssetPath(false); - if (this.assetManager.assetsFoundLocally()) { - z = true; - } else { - this.assetManager.useAlternativeAssetPath(true); - if (this.assetManager.assetsFoundLocally()) { - z = true; - } else { - this.assetManager.useAlternativeAssetPath(false); - } - } - } else { - z = this.assetManager.assetsFoundLocally(); - } - ADCTelemetry.getInstance().onCreate(this.assetManager.getAssetPath()); - if (!z) { - setState(14); - } else if (shouldSkipUpdateCheck()) { - setState(11); - } else { - setState(14); - } - } else { - setState(pState); - } - } - - /* access modifiers changed from: protected */ - public void initScreens(Context context) { - if (this.downloadMsgView == null) { - this.downloadMsgView = new DownloadMsgView(context); - } - if (this.showWifiView == null) { - this.showWifiView = new ShowWifiView(context); - } - if (this.networkUnavailableView == null) { - this.networkUnavailableView = new NetworkUnavailableView(context); - } - if (this.downloadProgressView == null) { - this.downloadProgressView = new DownloadProgressView(context); - } - if (this.downloadFailedView == null) { - this.downloadFailedView = new DownloadFailedView(context); - } - if (this.spaceUnavailableView == null) { - this.spaceUnavailableView = new SpaceUnavailableView(context); - } - if (this.checkUpdatesView == null) { - this.checkUpdatesView = new CheckUpdatesView(context); - } - if (this.updatesFoundView == null) { - this.updatesFoundView = new UpdatesFoundView(context); - } - if (this.show3GView == null) { - this.show3GView = new Show3GView(context); - } - if (this.showBGView == null) { - this.showBGView = new ShowBGView(context); - } - if (this.unSupportedDeviceView == null) { - this.unSupportedDeviceView = new UnSupportedDeviceView(context); - } - if (this.serverErrorView == null) { - this.serverErrorView = new ServerErrorView(context); - } - if (this.contactingServerView == null) { - this.contactingServerView = new ContactingServerView(context); - } - if (this.checkingHostIpView == null) { - this.checkingHostIpView = new CheckingHostIpView(context); - } - if (this.invalidAssetVersionView == null) { - this.invalidAssetVersionView = new InvalidAssetVersionView(context); - } - if (this.deletingAssetsView == null) { - this.deletingAssetsView = new DeletingAssetsView(context); - } - } - - /* access modifiers changed from: protected */ - public int is3G() { - NetworkInfo activeNetworkInfo = ((ConnectivityManager) - instance - .getSystemService(Context.CONNECTIVITY_SERVICE)) - .getActiveNetworkInfo(); - return (activeNetworkInfo == - null || - !activeNetworkInfo.isConnected() || - !activeNetworkInfo.isAvailable() || - activeNetworkInfo.getType() != 0) - ? 0 : 1; - } - - public boolean is3GDisabled() { - return DISABLE_3G; - } - - public boolean isAmazonDevice() { - return getManufacturer().equalsIgnoreCase("amazon"); - } - - /* access modifiers changed from: protected */ - public boolean isConnected() { - NetworkInfo activeNetworkInfo = ((ConnectivityManager) - instance - .getSystemService(Context.CONNECTIVITY_SERVICE)) - .getActiveNetworkInfo(); - return activeNetworkInfo != - null && - activeNetworkInfo.isConnected() && - activeNetworkInfo.isAvailable(); - } - - /* access modifiers changed from: protected */ - public boolean isSpaceAvailableForAlternativeDownload() { - long availableInternalMemorySize; - long j = spaceNeededToDownload; - if (j <= 0) { - j = ((((long) TOTAL_SPACE_MB) * 1024) * 1024) - calculateDownloaded(new File(this.assetManager.getAssetPath())); - if (j <= 0) { - j = 1048576; - } - spaceNeededToDownload = j; - } - if (USE_INTERNAL_STORAGE) { - availableInternalMemorySize = MemoryStatus.getAvailableExternalMemorySize(); - Logging.DEBUG_OUT("Using alternative location: External Storage is " + availableInternalMemorySize); - } else { - availableInternalMemorySize = MemoryStatus.getAvailableInternalMemorySize(); - Logging.DEBUG_OUT("Using alternative location: Internal Storage is " + availableInternalMemorySize); - } - return availableInternalMemorySize >= j; - } - - /* access modifiers changed from: protected */ - public boolean isSpaceAvailableForDownload() { - long availableExternalMemorySize; - long j = spaceNeededToDownload; - if (j <= 0) { - j = ((((long) TOTAL_SPACE_MB) * 1024) * 1024) - calculateDownloaded(new File(this.assetManager.getAssetPath())); - if (j <= 0) { - j = 1048576; - } - spaceNeededToDownload = j; - } - if (USE_INTERNAL_STORAGE) { - availableExternalMemorySize = MemoryStatus.getAvailableInternalMemorySize(); - Logging.DEBUG_OUT("Using main location: Internal Storage is " + availableExternalMemorySize); - } else { - availableExternalMemorySize = MemoryStatus.getAvailableExternalMemorySize(); - Logging.DEBUG_OUT("Using main location: External Storage is " + availableExternalMemorySize); - } - return availableExternalMemorySize >= j; - } - - public boolean isWifiAvailable() { - WifiManager wifiManager = (WifiManager) - instance - .getApplicationContext() - .getSystemService(Context.WIFI_SERVICE); - - boolean isWifiEnabled = wifiManager.isWifiEnabled(); - return isWifiEnabled ? wifiManager.getConnectionInfo().getSupplicantState() == SupplicantState.COMPLETED : isWifiEnabled; - } - - public void onDestroy() { - Logging.DEBUG_OUT("DownloadActivityInternal.onDestroy()"); - unregisterWifiReceiver(); - cleanStates(); - isInitialized = false; - instance = null; - downloadProgress = null; - this.assetManager = null; - mMainActivity = null; - language = null; - } - - public void onPause() { - Logging.DEBUG_OUT("DownloadActivityInternal.onPause()"); - if (this.pCurrentView != null) { - this.pCurrentView.pause(); - } - } - - public void onResume() { - Logging.DEBUG_OUT("DownloadActivityInternal.onResume()"); - if (getState() == 6) { - startWifiDownload(true); - } else if (getState() != 4) { - resumeState(getState()); - } else if (chooseAvailableMemory()) { - cleanState(4); - if (!this.assetManager.assetsFoundLocally()) { - setState(1); - } else { - setState(8); - } - } else { - resumeState(4); - } - } - - public void onWindowFocusChanged(boolean z) { - Logging.DEBUG_OUT("DownloadActivityInternal.onWindowFocusChanged(focus == " + z + ")"); - /* - if (instance != null) { - instance.getWindow().getDecorView().setSystemUiVisibility(5894); - } - */ - } - - public void recordError(int i) { - mErrorList.add(Integer.valueOf(i)); - Logging.DEBUG_OUT("ERROR OCCURRED: " + i + " (total: " + mErrorList.size() + ")"); - } - - public void resumeState(int i) { - Logging.DEBUG_OUT("DownloadActivityInternal resumeState: " + (i == -1 ? "STATE_INVALID" : STATE_STRINGS[i])); - switch (i) { - case 1: - this.pCurrentView = this.downloadMsgView; - break; - case 2: - this.pCurrentView = this.downloadProgressView; - break; - case 3: - if (!checkLocalAssetVersion()) { - this.pCurrentView = this.invalidAssetVersionView; - break; - } else { - Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = " + -1); - this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); - Logging.DEBUG_CLOSE(); - return; - } - case 4: - this.pCurrentView = this.spaceUnavailableView; - break; - case 5: - this.pCurrentView = this.downloadFailedView; - break; - case 6: - this.pCurrentView = this.showWifiView; - break; - case 7: - this.pCurrentView = this.networkUnavailableView; - break; - case 8: - this.pCurrentView = this.checkUpdatesView; - break; - case 9: - this.pCurrentView = this.updatesFoundView; - break; - case 10: - this.pCurrentView = this.show3GView; - break; - case 11: - this.pCurrentView = this.showBGView; - break; - case 12: - this.pCurrentView = this.unSupportedDeviceView; - break; - case 13: - this.pCurrentView = this.serverErrorView; - break; - case 14: - this.pCurrentView = this.contactingServerView; - break; - case 15: - this.pCurrentView = this.checkingHostIpView; - break; - case 16: - this.pCurrentView = this.deletingAssetsView; - break; - } - try { - this.mHandler.postDelayed(new Runnable() { - /* class com.eamobile.DownloadActivityInternal.AnonymousClass3 */ - - public void run() { - Logging.DEBUG_OUT("DownloadActivityInternal resumeState - Making a new runnable to resume."); - if (DownloadActivityInternal.instance != null && DownloadActivityInternal.this.pCurrentView != null) { - Logging.DEBUG_OUT("resumeState: pCurrentView = " + DownloadActivityInternal.this.pCurrentView); - Logging.DEBUG_OUT("resumeState: before calling pCurrentView.resume()"); - DownloadActivityInternal.this.pCurrentView.resume(); - Logging.DEBUG_OUT("resumeState: after calling pCurrentView.resume()"); - } - } - }, 20); - pState = i; - } catch (Exception e) { - Logging.DEBUG_OUT("[ERROR] An exception occurred while resuming State:"); - Logging.DEBUG_OUT_STACK(e); - } - } - - public void setAssetPath(String str, boolean z) { - if (this.configLoaded) { - setAssetPathAux(str, z); - return; - } - this.callSetAssetPathAux = true; - this.activityAssetPath = str; - this.activityUseExternal = z; - } - - public void setBackgroundBitmap(Bitmap bitmap) { - this.bmpBg = bitmap; - } - - public void setState(int i) { - switch (i) { - case STATE_SHOW_DOWNLOAD_MSG: - this.pCurrentView = this.downloadMsgView; - break; - case STATE_DOWNLOADING_ASSETS: - this.pCurrentView = this.downloadProgressView; - break; - case STATE_SUCCESS: - if (!checkLocalAssetVersion()) { - this.pCurrentView = this.invalidAssetVersionView; - break; - } else { - Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = " + -1); - this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), -1); - ADCTelemetry.getInstance().sendTelemetry(1); - try { - Thread.sleep(1000); - } catch (Exception e) { - } - ADCTelemetry.getInstance().onDestroy(); - Logging.DEBUG_CLOSE(); - return; - } - case STATE_SPACE_UNAVAILABLE: - this.pCurrentView = this.spaceUnavailableView; - break; - case STATE_FAILURE: - this.downloadFailedView.setErrorCode(getLastError()); - ADCTelemetry.getInstance().sendTelemetry(3, "MINOR ERROR - error code=" + Integer.toString(getLastError())); - this.pCurrentView = this.downloadFailedView; - break; - case STATE_SHOW_WIFI_DIALOG: - this.pCurrentView = this.showWifiView; - break; - case STATE_3G_UNAVAILABLE: - this.pCurrentView = this.networkUnavailableView; - break; - case STATE_CHECK_UPDATES: - this.pCurrentView = this.checkUpdatesView; - break; - case STATE_UPDATES_FOUND: - this.pCurrentView = this.updatesFoundView; - break; - case STATE_SHOW_3G_DIALOG: - this.pCurrentView = this.show3GView; - break; - case STATE_BG_VIEW: - this.pCurrentView = this.showBGView; - break; - case STATE_UNSUPPORTED_DEVICE: - ADCTelemetry.getInstance().sendTelemetry(3, "CRITICAL ERROR - error code=" + getLastError()); - this.pCurrentView = this.unSupportedDeviceView; - break; - case STATE_SERVER_ERROR: - ADCTelemetry.getInstance().sendTelemetry(3, "CRITICAL ERROR - error code=" + getLastError()); - this.pCurrentView = this.serverErrorView; - break; - case STATE_CONTACTING_SERVER: - this.pCurrentView = this.contactingServerView; - break; - case STATE_CHECKING_HOST_IP: - this.pCurrentView = this.checkingHostIpView; - break; - case STATE_SHOW_DELETING_ASSETS: - this.pCurrentView = this.deletingAssetsView; - break; - } - try { - - Runnable r0 = new Runnable() { - @Override - public void run() { - Logging.DEBUG_OUT("DownloadActivityInternal setState - Making a new runnable to init."); - if (!(DownloadActivityInternal.instance == null || DownloadActivityInternal.this.pCurrentView == null)) { - DownloadActivityInternal.instance.runOnUiThread(new Runnable() { - - public void run() { - Logging.DEBUG_OUT("setState: pCurrentView = " + DownloadActivityInternal.this.pCurrentView); - Logging.DEBUG_OUT("setState: before calling pCurrentView.init()"); - DownloadActivityInternal.this.pCurrentView.init(); - Logging.DEBUG_OUT("setState: after calling pCurrentView.init()"); - DownloadActivityInternal.instance.setContentView(DownloadActivityInternal.this.pCurrentView); - Logging.DEBUG_OUT("setState: after calling setContentView"); - } - }); - } - DownloadActivityInternal.changingState = false; - } - }; - changingState = true; - this.mHandler.postDelayed(r0, 20); - pStatePrev = pState; - pState = i; - } catch (Exception e2) { - Logging.DEBUG_OUT("[ERROR] An exception occurred in setState:"); - Logging.DEBUG_OUT_STACK(e2); - } - } - - public void setStateChecksumError() { - recordError(-10); - this.serverErrorView.setErrorCode(getLastError()); - setState(13); - } - - /* access modifiers changed from: protected */ - public void start3GManager() { - instance.startActivity(new Intent("android.settings.NETWORK_OPERATOR_SETTINGS")); - } - - public void startDataManagement() { - instance.startActivity(new Intent("android.settings.MEMORY_CARD_SETTINGS")); - } - - public boolean startDownload() { - Logging.DEBUG_OUT("DownloadActivityInternal.startDownload()"); - this.assetManager.saveStateDownloadStarted(); - if (this.downloadFileData == null || this.downloadFileData.length <= 0) { - checkServerContent(false); - return false; - } - totalDownloadSizeMB = getTotalDownloadSize(this.downloadFileData); - Logging.DEBUG_OUT("Total Download Size: " + totalDownloadSizeMB + " MB"); - boolean startDownloadingFiles = startDownloadingFiles(this.downloadFileData); - Logging.DEBUG_OUT("startDownload expectedResult: " + startDownloadingFiles); - return startDownloadingFiles; - } - - public void startGameActivity(int i) { - ADCTelemetry.getInstance().sendTelemetry(4); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - } - ADCTelemetry.getInstance().onDestroy(); - Logging.DEBUG_OUT("onResult assetPath = " + this.assetManager.getAssetPath() + " result = " + i); - this.mDownloadActivity.onResult(this.assetManager.getAssetPath(), i); - Logging.DEBUG_CLOSE(); - } - - public void startWifiDownload(final boolean z) { - Thread r0 = new Thread() { - - @Override - public void run() { - do { - } while (DownloadActivityInternal.changingState); - if (DownloadActivityInternal.this.isWifiAvailable()) { - Logging.DEBUG_OUT("checking wifi: OK"); - if (z) { - DownloadActivityInternal.this.cleanState(6); - if (DownloadActivityInternal.getTotalDownloadSizeMB() == 0) { - DownloadActivityInternal.this.setState(14); - } else { - DownloadActivityInternal.this.setState(2); - } - } else { - DownloadActivityInternal.this.setState(2); - } - } else { - Logging.DEBUG_OUT("checking wifi: FAILED"); - if (z) { - DownloadActivityInternal.this.resumeState(6); - } else { - DownloadActivityInternal.this.setState(6); - } - } - } - }; - Logging.DEBUG_OUT("startWifiDownload"); - setState(15); - r0.start(); - } - - public void startWifiManager() { - try { - instance.startActivity(new Intent("android.settings.WIFI_SETTINGS")); - } catch (ActivityNotFoundException e) { - Logging.DEBUG_OUT("[ERROR] Unable to find an Activity to open Wifi settings."); - instance.startActivity(new Intent("android.settings.SETTINGS")); - } - } - - public boolean test3GNetwork() { - NetworkInfo activeNetworkInfo = ((ConnectivityManager) - instance - .getSystemService(Context.CONNECTIVITY_SERVICE)) - .getActiveNetworkInfo(); - if (activeNetworkInfo == null || !activeNetworkInfo.isConnected() || !activeNetworkInfo.isAvailable()) { - return false; - } - return activeNetworkInfo.getType() != ConnectivityManager.TYPE_WIFI - && activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE; - } - - public boolean testNetwork(int[] iArr) { - iArr[0] = -1; - NetworkInfo activeNetworkInfo = ((ConnectivityManager) - instance - .getSystemService(Context.CONNECTIVITY_SERVICE)) - .getActiveNetworkInfo(); - if (activeNetworkInfo == null || !activeNetworkInfo.isConnected() || !activeNetworkInfo.isAvailable()) { - return false; - } - iArr[0] = activeNetworkInfo.getType(); - return true; - } - - public void updateDownload() { - this.assetManager.prepareSDCard(); - if (DELETE_ASSETS_ON_UPDATE) { - if (UNSAFE_ASSET_DELETION_ON_UPDATE) { - Logging.DEBUG_OUT(" "); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - Logging.DEBUG_OUT("Deleting assets without any additional checking:"); - Logging.DEBUG_OUT("!!!!! WARNING !!!!!"); - Logging.DEBUG_OUT(" "); - setState(16); - return; - } - Logging.DEBUG_OUT("Checking for asset deletion:"); - Properties loadAssetInfo = this.assetManager.loadAssetInfo(); - if (loadAssetInfo != null) { - String property = loadAssetInfo.getProperty("packageName"); - if (property != null) { - Logging.DEBUG_OUT("packageName read from AssetInfo.indicate: " + property); - Logging.DEBUG_OUT("application packageName: " + this.mContext.getPackageName()); - if (property.equals(this.mContext.getPackageName())) { - Logging.DEBUG_OUT("packageNames match"); - setState(16); - return; - } - Logging.DEBUG_OUT("packageNames DO NOT match"); - } else { - Logging.DEBUG_OUT("packageName not found"); - } - } else { - Logging.DEBUG_OUT("properties not found"); - } - } - setState(1); - } - - public boolean useCustomProgressBar() { - return CUSTOM_PROGRESS_BAR; - } - - public boolean useOldProgressBar() { - return USE_OLD_PROGRESS_BAR; - } -} diff --git a/app/src/main/java/com/eamobile/IDeviceData.java b/app/src/main/java/com/eamobile/IDeviceData.java deleted file mode 100644 index 1f28274..0000000 --- a/app/src/main/java/com/eamobile/IDeviceData.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.eamobile; - -import com.eamobile.download.DeviceData; - -public interface IDeviceData { - void onRetrievedDeviceData(DeviceData deviceData); -} diff --git a/app/src/main/java/com/eamobile/IDownloadActivity.java b/app/src/main/java/com/eamobile/IDownloadActivity.java deleted file mode 100644 index eedd440..0000000 --- a/app/src/main/java/com/eamobile/IDownloadActivity.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.eamobile; - -public interface IDownloadActivity { - void onDownloadEvent(int i); - - void onResult(String str, int i); -} diff --git a/app/src/main/java/com/eamobile/Language.java b/app/src/main/java/com/eamobile/Language.java deleted file mode 100644 index d954feb..0000000 --- a/app/src/main/java/com/eamobile/Language.java +++ /dev/null @@ -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; -*/ - } -} diff --git a/app/src/main/java/com/eamobile/WifiReceiver.java b/app/src/main/java/com/eamobile/WifiReceiver.java deleted file mode 100644 index 5342afb..0000000 --- a/app/src/main/java/com/eamobile/WifiReceiver.java +++ /dev/null @@ -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)"); - } - } - } -} diff --git a/app/src/main/java/com/eamobile/download/AssetManager.java b/app/src/main/java/com/eamobile/download/AssetManager.java deleted file mode 100644 index 5366a23..0000000 --- a/app/src/main/java/com/eamobile/download/AssetManager.java +++ /dev/null @@ -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 arrayList) { - return arrayList.contains(file); - } - - private boolean checkFiles(ArrayList arrayList) { - Logging.DEBUG_OUT("[checkFiles]"); - for (int i = 0; i < arrayList.size(); i++) { - String filePath = getFilePath(arrayList.get(i)); - if (!new File(filePath).exists()) { - Logging.DEBUG_OUT("\tChecking file: " + filePath + " (NOT FOUND)"); - new File(getFilePath(DOWNLOAD_CONTROL_FILE1)).delete(); - return false; - } - Logging.DEBUG_OUT("\tChecking file: " + filePath + " (OK)"); - } - Logging.DEBUG_OUT(" "); - return true; - } - - private void deleteEmptyDirs(String str, ArrayList arrayList) { - try { - File file = new File(str); - File[] listFiles = file.listFiles(); - if (listFiles == null) { - Logging.DEBUG_OUT("Error listing files for directory: " + file.getAbsolutePath()); - return; - } - for (int i = 0; i < listFiles.length; i++) { - if (listFiles[i].isDirectory()) { - deleteEmptyDirs(listFiles[i].getAbsolutePath(), arrayList); - } - } - File[] listFiles2 = file.listFiles(); - String absolutePath = file.getAbsolutePath(); - if (listFiles2.length != 0) { - 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 getDirList() { - try { - ArrayList 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 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; - } -} diff --git a/app/src/main/java/com/eamobile/download/ChecksumValidator.java b/app/src/main/java/com/eamobile/download/ChecksumValidator.java deleted file mode 100644 index 194b14d..0000000 --- a/app/src/main/java/com/eamobile/download/ChecksumValidator.java +++ /dev/null @@ -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; - } - } -} diff --git a/app/src/main/java/com/eamobile/download/Constants.java b/app/src/main/java/com/eamobile/download/Constants.java deleted file mode 100644 index efe5a1d..0000000 --- a/app/src/main/java/com/eamobile/download/Constants.java +++ /dev/null @@ -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; -} diff --git a/app/src/main/java/com/eamobile/download/Device.java b/app/src/main/java/com/eamobile/download/Device.java deleted file mode 100644 index dc76b61..0000000 --- a/app/src/main/java/com/eamobile/download/Device.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/download/DeviceData.java b/app/src/main/java/com/eamobile/download/DeviceData.java deleted file mode 100644 index 8e88f0d..0000000 --- a/app/src/main/java/com/eamobile/download/DeviceData.java +++ /dev/null @@ -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 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 getSupportedTextureTypes() { - EnumSet of = EnumSet.of(TextureType.UNCOMPRESSED); - if (this.glExtensions.contains("GL_IMG_texture_compression_pvrtc")) { - of.add(TextureType.PVR); - } - if (this.glExtensions.contains("GL_ATI_compressed_texture_atitc") || this.glExtensions.contains("GL_AMD_compressed_ATC_texture") || this.glExtensions.contains("GL_ATI_texture_compression_atitc")) { - of.add(TextureType.ATI); - } - if (this.glExtensions.contains("GL_EXT_texture_compression_dxt1") || this.glExtensions.contains("GL_EXT_texture_compression_dxt3") || this.glExtensions.contains("GL_EXT_texture_compression_dxt5")) { - of.add(TextureType.DXT); - } - if (this.glExtensions.contains("GL_OES_compressed_ETC1_RGB8_texture")) { - of.add(TextureType.ETC); - } - if (this.glExtensions.contains("GL_OES_texture_compression_S3TC") || this.glExtensions.contains("GL_EXT_texture_compression_s3tc")) { - of.add(TextureType.S3TC); - } - if (this.glExtensions.contains("GL_AMD_compressed_3DC_texture")) { - of.add(TextureType._3DC); - } - if (this.glExtensions.contains("GL_OES_compressed_paletted_texture")) { - of.add(TextureType.PALETTED); - } - if (this.glExtensions.contains("GL_EXT_texture_compression_latc")) { - of.add(TextureType.LATC); - } - return of; - } - - public 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; - } -} diff --git a/app/src/main/java/com/eamobile/download/DownloadFileData.java b/app/src/main/java/com/eamobile/download/DownloadFileData.java deleted file mode 100644 index 7889b66..0000000 --- a/app/src/main/java/com/eamobile/download/DownloadFileData.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/download/DownloadProgress.java b/app/src/main/java/com/eamobile/download/DownloadProgress.java deleted file mode 100644 index 997ae5c..0000000 --- a/app/src/main/java/com/eamobile/download/DownloadProgress.java +++ /dev/null @@ -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 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; - } -} diff --git a/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java deleted file mode 100644 index 3d31c18..0000000 --- a/app/src/main/java/com/eamobile/download/IZipExtractorEvent.java +++ /dev/null @@ -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); -} diff --git a/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java deleted file mode 100644 index 441b85f..0000000 --- a/app/src/main/java/com/eamobile/download/LocalZipExtractorEvent.java +++ /dev/null @@ -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) { - } -} diff --git a/app/src/main/java/com/eamobile/download/LockManager.java b/app/src/main/java/com/eamobile/download/LockManager.java deleted file mode 100644 index e65f5a6..0000000 --- a/app/src/main/java/com/eamobile/download/LockManager.java +++ /dev/null @@ -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."); - } - } -} diff --git a/app/src/main/java/com/eamobile/download/Logging.java b/app/src/main/java/com/eamobile/download/Logging.java deleted file mode 100644 index d782025..0000000 --- a/app/src/main/java/com/eamobile/download/Logging.java +++ /dev/null @@ -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()); - } -} diff --git a/app/src/main/java/com/eamobile/download/MemoryStatus.java b/app/src/main/java/com/eamobile/download/MemoryStatus.java deleted file mode 100644 index 229f885..0000000 --- a/app/src/main/java/com/eamobile/download/MemoryStatus.java +++ /dev/null @@ -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()); - } -} diff --git a/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java b/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java deleted file mode 100644 index 92906f1..0000000 --- a/app/src/main/java/com/eamobile/download/RandomAccessFileReadThread.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/download/ReadThread.java b/app/src/main/java/com/eamobile/download/ReadThread.java deleted file mode 100644 index 3de4639..0000000 --- a/app/src/main/java/com/eamobile/download/ReadThread.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java b/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java deleted file mode 100644 index 1423abc..0000000 --- a/app/src/main/java/com/eamobile/download/RemoteZipExtractorEvent.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/java/com/eamobile/download/SpeedCalculator.java b/app/src/main/java/com/eamobile/download/SpeedCalculator.java deleted file mode 100644 index 227a369..0000000 --- a/app/src/main/java/com/eamobile/download/SpeedCalculator.java +++ /dev/null @@ -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; - } - } -} diff --git a/app/src/main/java/com/eamobile/download/ZipExtractor.java b/app/src/main/java/com/eamobile/download/ZipExtractor.java deleted file mode 100644 index e774c03..0000000 --- a/app/src/main/java/com/eamobile/download/ZipExtractor.java +++ /dev/null @@ -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 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"); - } -} diff --git a/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java b/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java deleted file mode 100644 index a17c707..0000000 --- a/app/src/main/java/com/eamobile/licensing/ILicenseServerActivityCallback.java +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Decompiled with CFR 0.152. - */ -package com.eamobile.licensing; - -public interface ILicenseServerActivityCallback { - void onLicenseResultEnd(); - void onLicenseResultStart(); -} - diff --git a/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java b/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java deleted file mode 100644 index 65700d4..0000000 --- a/app/src/main/java/com/eamobile/licensing/LicenseServerActivity.java +++ /dev/null @@ -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); - } -} - diff --git a/app/src/main/java/com/eamobile/views/CheckUpdatesView.java b/app/src/main/java/com/eamobile/views/CheckUpdatesView.java deleted file mode 100644 index 87c82b7..0000000 --- a/app/src/main/java/com/eamobile/views/CheckUpdatesView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/CheckingHostIpView.java b/app/src/main/java/com/eamobile/views/CheckingHostIpView.java deleted file mode 100644 index 1016b53..0000000 --- a/app/src/main/java/com/eamobile/views/CheckingHostIpView.java +++ /dev/null @@ -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(); - } -} diff --git a/app/src/main/java/com/eamobile/views/ContactingServerView.java b/app/src/main/java/com/eamobile/views/ContactingServerView.java deleted file mode 100644 index 2a35fbe..0000000 --- a/app/src/main/java/com/eamobile/views/ContactingServerView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/CustomProgressBar.java b/app/src/main/java/com/eamobile/views/CustomProgressBar.java deleted file mode 100644 index 7fde258..0000000 --- a/app/src/main/java/com/eamobile/views/CustomProgressBar.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/views/CustomProgressDialog.java b/app/src/main/java/com/eamobile/views/CustomProgressDialog.java deleted file mode 100644 index abc320d..0000000 --- a/app/src/main/java/com/eamobile/views/CustomProgressDialog.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/CustomView.java b/app/src/main/java/com/eamobile/views/CustomView.java deleted file mode 100644 index 3e77d97..0000000 --- a/app/src/main/java/com/eamobile/views/CustomView.java +++ /dev/null @@ -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()); - } -} diff --git a/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java b/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java deleted file mode 100644 index 6f2bc77..0000000 --- a/app/src/main/java/com/eamobile/views/DefaultProgressDialog.java +++ /dev/null @@ -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()); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/DeletingAssetsView.java b/app/src/main/java/com/eamobile/views/DeletingAssetsView.java deleted file mode 100644 index 1057423..0000000 --- a/app/src/main/java/com/eamobile/views/DeletingAssetsView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/DownloadFailedView.java b/app/src/main/java/com/eamobile/views/DownloadFailedView.java deleted file mode 100644 index 5af7248..0000000 --- a/app/src/main/java/com/eamobile/views/DownloadFailedView.java +++ /dev/null @@ -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; - } -} diff --git a/app/src/main/java/com/eamobile/views/DownloadMsgView.java b/app/src/main/java/com/eamobile/views/DownloadMsgView.java deleted file mode 100644 index 241e4b6..0000000 --- a/app/src/main/java/com/eamobile/views/DownloadMsgView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/DownloadProgressView.java b/app/src/main/java/com/eamobile/views/DownloadProgressView.java deleted file mode 100644 index 2125e1a..0000000 --- a/app/src/main/java/com/eamobile/views/DownloadProgressView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/IDownloadView.java b/app/src/main/java/com/eamobile/views/IDownloadView.java deleted file mode 100644 index 7f788d3..0000000 --- a/app/src/main/java/com/eamobile/views/IDownloadView.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.eamobile.views; - -public interface IDownloadView { - void clean(); - - void init(); -} diff --git a/app/src/main/java/com/eamobile/views/IProgressDialog.java b/app/src/main/java/com/eamobile/views/IProgressDialog.java deleted file mode 100644 index 45c9455..0000000 --- a/app/src/main/java/com/eamobile/views/IProgressDialog.java +++ /dev/null @@ -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(); -} diff --git a/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java b/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java deleted file mode 100644 index 9533472..0000000 --- a/app/src/main/java/com/eamobile/views/InvalidAssetVersionView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java b/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java deleted file mode 100644 index 6aa34ad..0000000 --- a/app/src/main/java/com/eamobile/views/NetworkUnavailableView.java +++ /dev/null @@ -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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/ServerErrorView.java b/app/src/main/java/com/eamobile/views/ServerErrorView.java deleted file mode 100644 index e7b9b28..0000000 --- a/app/src/main/java/com/eamobile/views/ServerErrorView.java +++ /dev/null @@ -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.DownloadActivityInternal; -import com.eamobile.Language; - -public class ServerErrorView extends CustomView { - Dialog dialog; - int errorCode = 0; - Button lskBtn; - LinearLayout mainLayout; - - public ServerErrorView(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(33)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - textView.setText(Language.getString(34, new String[]{"" + this.errorCode})); - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { - /* class com.eamobile.views.ServerErrorView.AnonymousClass1 */ - - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.ServerErrorView.AnonymousClass2 */ - - public void onClick(View view) { - ServerErrorView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.ServerErrorView.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); - } - } - - public void setErrorCode(int i) { - this.errorCode = i; - } -} diff --git a/app/src/main/java/com/eamobile/views/Show3GView.java b/app/src/main/java/com/eamobile/views/Show3GView.java deleted file mode 100644 index bbf6788..0000000 --- a/app/src/main/java/com/eamobile/views/Show3GView.java +++ /dev/null @@ -1,126 +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 Show3GView extends CustomView { - Dialog dialog; - Button lskBtn; - LinearLayout mainLayout; - Button rskBtn; - - public Show3GView(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(39)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - textView.setText(Language.getString(24) + " " + Language.getString(29)); - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(17)); - this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { - /* class com.eamobile.views.Show3GView.AnonymousClass1 */ - - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.dismiss(); - DownloadActivityInternal.getMainActivity().setState(6); - } - }); - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.Show3GView.AnonymousClass2 */ - - public void onClick(View view) { - Show3GView.this.dialog.dismiss(); - if (!DownloadActivityInternal.getMainActivity().test3GNetwork()) { - DownloadActivityInternal.getMainActivity().setState(7); - } else if (DownloadActivityInternal.getTotalDownloadSizeMB() != 0) { - DownloadActivityInternal.getMainActivity().setState(2); - } else { - DownloadActivityInternal.getMainActivity().setState(14); - } - } - }); - this.rskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.Show3GView.AnonymousClass3 */ - - public void onClick(View view) { - Show3GView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.Show3GView.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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/ShowBGView.java b/app/src/main/java/com/eamobile/views/ShowBGView.java deleted file mode 100644 index 4cc126f..0000000 --- a/app/src/main/java/com/eamobile/views/ShowBGView.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.eamobile.views; - -import android.content.Context; -import android.os.CountDownTimer; -import android.view.View; -import com.eamobile.DownloadActivityInternal; -import com.eamobile.download.Logging; - -public class ShowBGView extends CustomView { - public ShowBGView(Context context) { - super(context); - this.context = context; - } - - private void showContent(View view) { - new CountDownTimer(1000, 100) { - /* class com.eamobile.views.ShowBGView.AnonymousClass1 */ - - public void onFinish() { - if (DownloadActivityInternal.getMainActivity() != null) { - DownloadActivityInternal.getMainActivity().setState(3); - } - } - - public void onTick(long j) { - } - }.start(); - } - - @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(); - Logging.DEBUG_OUT("ShowBGView.init: before calling showContent"); - showContent(this); - Logging.DEBUG_OUT("ShowBGView.init: after calling showContent"); - } - - @Override // com.eamobile.views.CustomView - public void resume() { - Logging.DEBUG_OUT("ShowBGView.resume"); - } -} diff --git a/app/src/main/java/com/eamobile/views/ShowWifiView.java b/app/src/main/java/com/eamobile/views/ShowWifiView.java deleted file mode 100644 index c2af748..0000000 --- a/app/src/main/java/com/eamobile/views/ShowWifiView.java +++ /dev/null @@ -1,144 +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 ShowWifiView extends CustomView { - Dialog dialog; - Button lskBtn; - LinearLayout mainLayout; - Button midBtn; - Button rskBtn; - - public ShowWifiView(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(7)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - if (DownloadActivityInternal.getMainActivity().isAmazonDevice()) { - textView.setText(Language.getString(32)); - } else if (DownloadActivityInternal.getMainActivity().is3GDisabled()) { - textView.setText(Language.getString(8)); - } else { - textView.setText(Language.getString(8) + " " + Language.getString(31)); - } - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - if (!DownloadActivityInternal.getMainActivity().isAmazonDevice()) { - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(16)); - if (!DownloadActivityInternal.getMainActivity().is3GDisabled()) { - this.midBtn = addButton(this.context, linearLayout2, Language.getString(23)); - } - } - this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.dialog.setContentView(this.mainLayout); - this.dialog.show(); - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.ShowWifiView.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.ShowWifiView.AnonymousClass2 */ - - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.dismiss(); - DownloadActivityInternal.getMainActivity().setState(1); - } - }); - if (!DownloadActivityInternal.getMainActivity().isAmazonDevice()) { - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.ShowWifiView.AnonymousClass3 */ - - public void onClick(View view) { - ShowWifiView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().startWifiManager(); - } - }); - if (!DownloadActivityInternal.getMainActivity().is3GDisabled()) { - this.midBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.ShowWifiView.AnonymousClass4 */ - - public void onClick(View view) { - ShowWifiView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().setState(10); - } - }); - } - } - this.rskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.ShowWifiView.AnonymousClass5 */ - - public void onClick(View view) { - ShowWifiView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - } - - @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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java b/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java deleted file mode 100644 index 169aa6d..0000000 --- a/app/src/main/java/com/eamobile/views/SpaceUnavailableView.java +++ /dev/null @@ -1,130 +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 SpaceUnavailableView extends CustomView { - Dialog dialog; - Button lskBtn; - LinearLayout mainLayout; - Button rskBtn; - - public SpaceUnavailableView(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(3)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - textView.setText(Language.getString(51, new String[]{DownloadActivityInternal.getMainActivity().getRequiredSpaceForDownload(), DownloadActivityInternal.getMainActivity().getAvailableSpaceForDownload()})); - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - if (DownloadActivityInternal.getMainActivity().canOpenStorageSettings()) { - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(2)); - } - this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.rskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.SpaceUnavailableView.AnonymousClass1 */ - - public void onClick(View view) { - SpaceUnavailableView.this.dialog.dismiss(); - try { - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } catch (Throwable th) { - } - } - }); - if (DownloadActivityInternal.getMainActivity().canOpenStorageSettings()) { - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.SpaceUnavailableView.AnonymousClass2 */ - - public void onClick(View view) { - SpaceUnavailableView.this.dialog.dismiss(); - try { - DownloadActivityInternal.getMainActivity().startDataManagement(); - } catch (Throwable th) { - } - } - }); - } - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.SpaceUnavailableView.AnonymousClass3 */ - - public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { - return i == 82 || i == 84; - } - }); - this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { - /* class com.eamobile.views.SpaceUnavailableView.AnonymousClass4 */ - - 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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java b/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java deleted file mode 100644 index 93a8adb..0000000 --- a/app/src/main/java/com/eamobile/views/UnSupportedDeviceView.java +++ /dev/null @@ -1,110 +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 UnSupportedDeviceView extends CustomView { - Dialog dialog; - Button lskBtn; - LinearLayout mainLayout; - - public UnSupportedDeviceView(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(27)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - textView.setText(Language.getString(28)); - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { - /* class com.eamobile.views.UnSupportedDeviceView.AnonymousClass1 */ - - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.UnSupportedDeviceView.AnonymousClass2 */ - - public void onClick(View view) { - UnSupportedDeviceView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - }); - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.UnSupportedDeviceView.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); - } - } -} diff --git a/app/src/main/java/com/eamobile/views/UpdatesFoundView.java b/app/src/main/java/com/eamobile/views/UpdatesFoundView.java deleted file mode 100644 index 2d869e6..0000000 --- a/app/src/main/java/com/eamobile/views/UpdatesFoundView.java +++ /dev/null @@ -1,135 +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 UpdatesFoundView extends CustomView { - Dialog dialog; - boolean localAssetsOK = true; - Button lskBtn; - LinearLayout mainLayout; - Button rskBtn; - - public UpdatesFoundView(Context context) { - super(context); - this.context = context; - } - - private void createContent(View view) { - this.localAssetsOK = DownloadActivityInternal.getMainActivity().checkLocalAssetVersion(); - this.dialog = new Dialog(this.context); - this.dialog.setCancelable(true); - this.dialog.setCanceledOnTouchOutside(false); - this.dialog.requestWindowFeature(1); - this.mainLayout = new LinearLayout(this.context); - this.mainLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - this.mainLayout.setOrientation(1); - this.mainLayout.setGravity(16); - addTitle(this.context, this.mainLayout, Language.getString(25)); - LinearLayout linearLayout = new LinearLayout(this.context); - linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout.setOrientation(1); - linearLayout.setGravity(16); - ScrollView scrollView = new ScrollView(this.context); - scrollView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - scrollView.setForegroundGravity(16); - TextView textView = new TextView(this.context); - textView.setClickable(false); - textView.setCursorVisible(false); - textView.setPadding(10, 10, 10, 10); - textView.setTextSize(1, 16.0f); - String string = Language.getString(26, new String[]{DownloadActivityInternal.getMainActivity().getApplicationName(), DownloadActivityInternal.getMainActivity().getSpaceRangeForDownload()}); - String string2 = Language.getString(44); - if (!this.localAssetsOK) { - string = string + "\n" + string2; - } - textView.setText(string); - scrollView.addView(textView); - LinearLayout linearLayout2 = new LinearLayout(this.context); - linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 1.0f)); - linearLayout2.setPadding(5, 0, 5, 5); - linearLayout2.setOrientation(0); - linearLayout2.setGravity(80); - this.lskBtn = addButton(this.context, linearLayout2, Language.getString(5)); - if (this.localAssetsOK) { - this.rskBtn = addButton(this.context, linearLayout2, Language.getString(18)); - } else { - this.rskBtn = addButton(this.context, linearLayout2, Language.getString(6)); - } - linearLayout.addView(scrollView); - this.mainLayout.addView(linearLayout); - this.mainLayout.addView(linearLayout2); - } - - private void showContent(View view) { - this.dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { - /* class com.eamobile.views.UpdatesFoundView.AnonymousClass1 */ - - public void onCancel(DialogInterface dialogInterface) { - dialogInterface.dismiss(); - DownloadActivityInternal.getMainActivity().setState(3); - } - }); - this.lskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.UpdatesFoundView.AnonymousClass2 */ - - public void onClick(View view) { - UpdatesFoundView.this.dialog.dismiss(); - DownloadActivityInternal.getMainActivity().updateDownload(); - } - }); - this.rskBtn.setOnClickListener(new View.OnClickListener() { - /* class com.eamobile.views.UpdatesFoundView.AnonymousClass3 */ - - public void onClick(View view) { - UpdatesFoundView.this.dialog.dismiss(); - if (UpdatesFoundView.this.localAssetsOK) { - DownloadActivityInternal.getMainActivity().setState(11); - } else { - DownloadActivityInternal.getMainActivity().startGameActivity(0); - } - } - }); - this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { - /* class com.eamobile.views.UpdatesFoundView.AnonymousClass4 */ - - public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { - return i == 82 || i == 84 || i == 4; - } - }); - 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); - } - } -} diff --git a/app/src/main/java/com/facebook/android/BaseRequestListener.java b/app/src/main/java/com/facebook/android/BaseRequestListener.java deleted file mode 100644 index 5ae3333..0000000 --- a/app/src/main/java/com/facebook/android/BaseRequestListener.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.facebook.android; - -import android.util.Log; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.MalformedURLException; - -/** - * Skeleton base class for RequestListeners, providing default error - * handling. Applications should handle these error conditions. - * - */ -public abstract class BaseRequestListener implements AsyncFacebookRunner.RequestListener { - - public void onFacebookError(FacebookError e) { - Log.e("Facebook", e.getMessage()); - e.printStackTrace(); - } - - public void onFileNotFoundException(FileNotFoundException e) { - Log.e("Facebook", e.getMessage()); - e.printStackTrace(); - } - - public void onIOException(IOException e) { - Log.e("Facebook", e.getMessage()); - e.printStackTrace(); - } - - public void onMalformedURLException(MalformedURLException e) { - Log.e("Facebook", e.getMessage()); - e.printStackTrace(); - } - -} diff --git a/app/src/main/java/com/facebook/android/SessionEvents.java b/app/src/main/java/com/facebook/android/SessionEvents.java deleted file mode 100644 index 1351f88..0000000 --- a/app/src/main/java/com/facebook/android/SessionEvents.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2010 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.facebook.android; - -import java.util.LinkedList; - -public class SessionEvents { - - private static LinkedList mAuthListeners = - new LinkedList(); - private static LinkedList mLogoutListeners = - new LinkedList(); - - /** - * Associate the given listener with this Facebook object. The listener's - * callback interface will be invoked when authentication events occur. - * - * @param listener - * The callback object for notifying the application when auth - * events happen. - */ - public static void addAuthListener(AuthListener listener) { - mAuthListeners.add(listener); - } - - /** - * Remove the given listener from the list of those that will be notified - * when authentication events occur. - * - * @param listener - * The callback object for notifying the application when auth - * events happen. - */ - public static void removeAuthListener(AuthListener listener) { - mAuthListeners.remove(listener); - } - - /** - * Associate the given listener with this Facebook object. The listener's - * callback interface will be invoked when logout occurs. - * - * @param listener - * The callback object for notifying the application when log out - * starts and finishes. - */ - public static void addLogoutListener(LogoutListener listener) { - mLogoutListeners.add(listener); - } - - /** - * Remove the given listener from the list of those that will be notified - * when logout occurs. - * - * @param listener - * The callback object for notifying the application when log out - * starts and finishes. - */ - public static void removeLogoutListener(LogoutListener listener) { - mLogoutListeners.remove(listener); - } - - public static void onLoginSuccess() { - for (AuthListener listener : mAuthListeners) { - listener.onAuthSucceed(); - } - } - - public static void onLoginError(String error) { - for (AuthListener listener : mAuthListeners) { - listener.onAuthFail(error); - } - } - - public static void onLogoutBegin() { - for (LogoutListener l : mLogoutListeners) { - l.onLogoutBegin(); - } - } - - public static void onLogoutFinish() { - for (LogoutListener l : mLogoutListeners) { - l.onLogoutFinish(); - } - } - - /** - * Callback interface for authorization events. - * - */ - public static interface AuthListener { - - /** - * Called when a auth flow completes successfully and a valid OAuth - * Token was received. - * - * Executed by the thread that initiated the authentication. - * - * API requests can now be made. - */ - public void onAuthSucceed(); - - /** - * Called when a login completes unsuccessfully with an error. - * - * Executed by the thread that initiated the authentication. - */ - public void onAuthFail(String error); - } - - /** - * Callback interface for logout events. - * - */ - public static interface LogoutListener { - /** - * Called when logout begins, before session is invalidated. - * Last chance to make an API call. - * - * Executed by the thread that initiated the logout. - */ - public void onLogoutBegin(); - - /** - * Called when the session information has been cleared. - * UI should be updated to reflect logged-out state. - * - * Executed by the thread that initiated the logout. - */ - public void onLogoutFinish(); - } - -} diff --git a/app/src/main/java/com/google/android/c2dm/C2DMBaseReceiver.java b/app/src/main/java/com/google/android/c2dm/C2DMBaseReceiver.java deleted file mode 100644 index 5d848b0..0000000 --- a/app/src/main/java/com/google/android/c2dm/C2DMBaseReceiver.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.app.AlarmManager - * android.app.IntentService - * android.app.PendingIntent - * android.content.Context - * android.content.Intent - * android.os.PowerManager - * android.os.PowerManager$WakeLock - * android.util.Log - */ -package com.google.android.c2dm; - -import android.annotation.SuppressLint; -import android.app.AlarmManager; -import android.app.IntentService; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.os.PowerManager; -import android.util.Log; -import com.google.android.c2dm.C2DMessaging; -import java.io.IOException; - -public abstract class C2DMBaseReceiver -extends IntentService { - private static final String C2DM_INTENT = "com.google.android.c2dm.intent.RECEIVE"; - private static final String C2DM_RETRY = "com.google.android.c2dm.intent.RETRY"; - public static final String ERR_ACCOUNT_MISSING = "ACCOUNT_MISSING"; - public static final String ERR_AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED"; - public static final String ERR_INVALID_PARAMETERS = "INVALID_PARAMETERS"; - public static final String ERR_INVALID_SENDER = "INVALID_SENDER"; - public static final String ERR_PHONE_REGISTRATION_ERROR = "PHONE_REGISTRATION_ERROR"; - public static final String ERR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE"; - public static final String ERR_TOO_MANY_REGISTRATIONS = "TOO_MANY_REGISTRATIONS"; - public static final String EXTRA_ERROR = "error"; - public static final String EXTRA_REGISTRATION_ID = "registration_id"; - public static final String EXTRA_UNREGISTERED = "unregistered"; - public static final String REGISTRATION_CALLBACK_INTENT = "com.google.android.c2dm.intent.REGISTRATION"; - private static final String TAG = "C2DM"; - private static final String WAKELOCK_KEY = "C2DM_LIB"; - private static PowerManager.WakeLock mWakeLock; - private final String senderId; - - public C2DMBaseReceiver(String string) { - super(string); - this.senderId = string; - } - - private void handleRegistration(Context context, Intent object) { - String string = object.getStringExtra(EXTRA_REGISTRATION_ID); - String string2 = object.getStringExtra(EXTRA_ERROR); - String stringExtra = object.getStringExtra(EXTRA_UNREGISTERED); - if (Log.isLoggable((String)TAG, (int)3)) { - Log.d((String)TAG, (String)("dmControl: registrationId = " + string + ", error = " + string2 + ", removed = " + stringExtra)); - } - C2DMessaging.clearRegistrationId(context); - this.onUnregistered(context); - } - - @SuppressLint("InvalidWakeLockTag") - static void runIntentInService(Context context, Intent intent) { - if (mWakeLock == null) { - mWakeLock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).newWakeLock(1, WAKELOCK_KEY); - } - mWakeLock.acquire(10*60*1000L /*10 minutes*/); - intent.setClassName(context, context.getPackageName() + ".C2DMReceiver"); - context.startService(intent); - } - - public abstract void onError(Context var1, String var2); - - /* - * Enabled unnecessary exception pruning - */ - public final void onHandleIntent(Intent intent) { - try { - Context context = this.getApplicationContext(); - if (intent.getAction().equals(REGISTRATION_CALLBACK_INTENT)) { - this.handleRegistration(context, intent); - return; - } - if (intent.getAction().equals(C2DM_INTENT)) { - this.onMessage(context, intent); - return; - } - if (!intent.getAction().equals(C2DM_RETRY)) return; - C2DMessaging.register(context, this.senderId); - return; - } - finally { - mWakeLock.release(); - } - } - - protected abstract void onMessage(Context var1, Intent var2); - - public void onRegistered(Context context, String string) throws IOException { - } - - public void onUnregistered(Context context) { - } -} - diff --git a/app/src/main/java/com/google/android/c2dm/C2DMBroadcastReceiver.java b/app/src/main/java/com/google/android/c2dm/C2DMBroadcastReceiver.java deleted file mode 100644 index 0b44332..0000000 --- a/app/src/main/java/com/google/android/c2dm/C2DMBroadcastReceiver.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.content.BroadcastReceiver - * android.content.Context - * android.content.Intent - */ -package com.google.android.c2dm; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import com.google.android.c2dm.C2DMBaseReceiver; - -public class C2DMBroadcastReceiver -extends BroadcastReceiver { - public final void onReceive(Context context, Intent intent) { - C2DMBaseReceiver.runIntentInService(context, intent); - this.setResult(-1, null, null); - } -} - diff --git a/app/src/main/java/com/google/android/c2dm/C2DMessaging.java b/app/src/main/java/com/google/android/c2dm/C2DMessaging.java deleted file mode 100644 index 9cc6a7b..0000000 --- a/app/src/main/java/com/google/android/c2dm/C2DMessaging.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.app.PendingIntent - * android.content.Context - * android.content.Intent - * android.os.Parcelable - */ -package com.google.android.c2dm; - -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Parcelable; - -public class C2DMessaging { - public static final String BACKOFF = "backoff"; - private static final long DEFAULT_BACKOFF = 30000L; - public static final String EXTRA_APPLICATION_PENDING_INTENT = "app"; - public static final String EXTRA_SENDER = "sender"; - public static final String GSF_PACKAGE = "com.google.android.gsf"; - public static final String LAST_REGISTRATION_CHANGE = "last_registration_change"; - static final String PREFERENCE = "com.google.android.c2dm"; - public static final String REQUEST_REGISTRATION_INTENT = "com.google.android.c2dm.intent.REGISTER"; - public static final String REQUEST_UNREGISTRATION_INTENT = "com.google.android.c2dm.intent.UNREGISTER"; - - static void clearRegistrationId(Context context) { - SharedPreferences.Editor edit = context.getSharedPreferences(PREFERENCE, 0).edit(); - edit.putString("dm_registration", ""); - edit.putLong(LAST_REGISTRATION_CHANGE, System.currentTimeMillis()); - edit.apply(); - } - - static long getBackoff(Context context) { - return context.getSharedPreferences(PREFERENCE, 0).getLong(BACKOFF, 30000L); - } - - public static long getLastRegistrationChange(Context context) { - return context.getSharedPreferences(PREFERENCE, 0).getLong(LAST_REGISTRATION_CHANGE, 0L); - } - - public static String getRegistrationId(Context context) { - return context.getSharedPreferences(PREFERENCE, 0).getString("dm_registration", ""); - } - - public static void register(Context context, String string) { - Intent intent = new Intent(REQUEST_REGISTRATION_INTENT); - intent.setPackage(GSF_PACKAGE); - intent.putExtra(EXTRA_APPLICATION_PENDING_INTENT, (Parcelable)PendingIntent.getBroadcast((Context)context, (int)0, (Intent)new Intent(), (int)0)); - intent.putExtra(EXTRA_SENDER, string); - context.startService(intent); - } - - static void setBackoff(Context context, long l2) { - SharedPreferences.Editor edit = context.getSharedPreferences(PREFERENCE, 0).edit(); - edit.putLong(BACKOFF, l2); - edit.apply(); - } - - static void setRegistrationId(Context context, String string) { - SharedPreferences.Editor edit = context.getSharedPreferences(PREFERENCE, 0).edit(); - edit.putString("dm_registration", string); - edit.apply(); - } - - public static void unregister(Context context) { - Intent intent = new Intent(REQUEST_UNREGISTRATION_INTENT); - intent.setPackage(GSF_PACKAGE); - intent.putExtra(EXTRA_APPLICATION_PENDING_INTENT, (Parcelable)PendingIntent.getBroadcast((Context)context, (int)0, (Intent)new Intent(), (int)0)); - context.startService(intent); - } -} - diff --git a/app/src/main/java/com/google/android/gcm/GCMBaseIntentService.java b/app/src/main/java/com/google/android/gcm/GCMBaseIntentService.java deleted file mode 100644 index 6467d01..0000000 --- a/app/src/main/java/com/google/android/gcm/GCMBaseIntentService.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.app.AlarmManager - * android.app.IntentService - * android.app.PendingIntent - * android.content.Context - * android.content.Intent - * android.os.PowerManager - * android.os.PowerManager$WakeLock - * android.os.SystemClock - * android.util.Log - */ -package com.google.android.gcm; - -import android.app.IntentService; -import android.content.Context; -import android.content.Intent; -import android.os.PowerManager; -import android.util.Log; - -import java.util.Random; -import java.util.concurrent.TimeUnit; - -public abstract class GCMBaseIntentService -extends IntentService { - private static final String EXTRA_TOKEN = "token"; - private static final Object LOCK = GCMBaseIntentService.class; - private static final int MAX_BACKOFF_MS; - public static final String TAG = "GCMBaseIntentService"; - private static final String TOKEN; - private static final String WAKELOCK_KEY = "GCM_LIB"; - private static int sCounter; - private static final Random sRandom; - private static PowerManager.WakeLock sWakeLock; - private final String[] mSenderIds; - - static { - sCounter = 0; - sRandom = new Random(); - MAX_BACKOFF_MS = (int)TimeUnit.SECONDS.toMillis(3600L); - TOKEN = Long.toBinaryString(sRandom.nextLong()); - } - - protected GCMBaseIntentService() { - this(GCMBaseIntentService.getName("DynamicSenderIds"), (String[])null); - } - - private GCMBaseIntentService(String string, String[] stringArray) { - super(string); - this.mSenderIds = stringArray; - } - - protected GCMBaseIntentService(String ... stringArray) { - this(GCMBaseIntentService.getName(stringArray), stringArray); - } - - private static String getName(String charSequence) { - int n2; - StringBuilder append = new StringBuilder().append("GCMIntentService-").append(charSequence).append("-"); - sCounter = n2 = sCounter + 1; - charSequence = append.append(n2).toString(); - Log.v(TAG, "Intent service name: " + charSequence); - return charSequence; - } - - private static String getName(String[] stringArray) { - return GCMBaseIntentService.getName(GCMRegistrar.getFlatSenderIds(stringArray)); - } - - private void handleRegistration(Context context, Intent object) {} - - /* - * Enabled unnecessary exception pruning - */ - static void runIntentInService(Context context, Intent intent, String string) { - - } - - protected String[] getSenderIds(Context context) { - if (this.mSenderIds != null) return this.mSenderIds; - throw new IllegalStateException("sender id not set on constructor"); - } - - protected void onDeletedMessages(Context context, int n2) { - } - - protected abstract void onError(Context var1, String var2); - - /* - * Enabled unnecessary exception pruning - * Converted monitor instructions to comments - */ - public final void onHandleIntent(Intent object) { - Context context = this.getApplicationContext(); - String string = object.getAction(); - if (string.equals("com.google.android.c2dm.intent.REGISTRATION")) { - GCMRegistrar.setRetryBroadcastReceiver(context); - this.handleRegistration(context, (Intent)object); - return; - } - if (string.equals("com.google.android.c2dm.intent.RECEIVE")) { - string = object.getStringExtra("message_type"); - if (string == null) { - this.onMessage(context, (Intent)object); - return; - } - if (!string.equals("deleted_messages")) { - Log.e((String)TAG, (String)("Received unknown special message: " + string)); - return; - } - if (object.getStringExtra("total_deleted") == null) return; - try { - int n2 = 0; - Log.v((String)TAG, (String)("Received deleted messages notification: " + n2)); - this.onDeletedMessages(context, n2); - return; - } - catch (NumberFormatException numberFormatException) { - Log.e((String)TAG, (String)("GCM returned invalid number of deleted messages: ")); - return; - } - } - if (!string.equals("com.google.android.gcm.intent.RETRY")) return; - - if (GCMRegistrar.isRegistered(context)) { - GCMRegistrar.internalUnregister(context); - return; - } - GCMRegistrar.internalRegister(context, this.getSenderIds(context)); - return; - } - - protected abstract void onMessage(Context var1, Intent var2); - - protected boolean onRecoverableError(Context context, String string) { - return true; - } - - protected abstract void onRegistered(Context var1, String var2); - - protected abstract void onUnregistered(Context var1, String var2); -} - diff --git a/app/src/main/java/com/google/android/gcm/GCMBroadcastReceiver.java b/app/src/main/java/com/google/android/gcm/GCMBroadcastReceiver.java deleted file mode 100644 index 366d7e8..0000000 --- a/app/src/main/java/com/google/android/gcm/GCMBroadcastReceiver.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.content.BroadcastReceiver - * android.content.Context - * android.content.Intent - * android.util.Log - */ -package com.google.android.gcm; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import com.google.android.gcm.GCMBaseIntentService; -import com.google.android.gcm.GCMRegistrar; - -public class GCMBroadcastReceiver -extends BroadcastReceiver { - private static final String TAG = "GCMBroadcastReceiver"; - private static boolean mReceiverSet = false; - - static final String getDefaultIntentServiceClassName(Context context) { - return context.getPackageName() + ".GCMIntentService"; - } - - protected String getGCMIntentServiceClassName(Context context) { - return GCMBroadcastReceiver.getDefaultIntentServiceClassName(context); - } - - public final void onReceive(Context context, Intent intent) { - String string; - Log.v((String)TAG, (String)("onReceive: " + intent.getAction())); - if (!mReceiverSet) { - mReceiverSet = true; - string = ((Object)((Object)this)).getClass().getName(); - if (!string.equals(GCMBroadcastReceiver.class.getName())) { - GCMRegistrar.setRetryReceiverClassName(string); - } - } - string = this.getGCMIntentServiceClassName(context); - Log.v((String)TAG, (String)("GCM IntentService class: " + string)); - GCMBaseIntentService.runIntentInService(context, intent, string); - this.setResult(-1, null, null); - } -} - diff --git a/app/src/main/java/com/google/android/gcm/GCMConstants.java b/app/src/main/java/com/google/android/gcm/GCMConstants.java deleted file mode 100644 index b8c5159..0000000 --- a/app/src/main/java/com/google/android/gcm/GCMConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Decompiled with CFR 0.152. - */ -package com.google.android.gcm; - -public final class GCMConstants { - public static final String DEFAULT_INTENT_SERVICE_CLASS_NAME = ".GCMIntentService"; - public static final String ERROR_ACCOUNT_MISSING = "ACCOUNT_MISSING"; - public static final String ERROR_AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED"; - public static final String ERROR_INVALID_PARAMETERS = "INVALID_PARAMETERS"; - public static final String ERROR_INVALID_SENDER = "INVALID_SENDER"; - public static final String ERROR_PHONE_REGISTRATION_ERROR = "PHONE_REGISTRATION_ERROR"; - public static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE"; - public static final String EXTRA_APPLICATION_PENDING_INTENT = "app"; - public static final String EXTRA_ERROR = "error"; - public static final String EXTRA_REGISTRATION_ID = "registration_id"; - public static final String EXTRA_SENDER = "sender"; - public static final String EXTRA_SPECIAL_MESSAGE = "message_type"; - public static final String EXTRA_TOTAL_DELETED = "total_deleted"; - public static final String EXTRA_UNREGISTERED = "unregistered"; - public static final String INTENT_FROM_GCM_LIBRARY_RETRY = "com.google.android.gcm.intent.RETRY"; - public static final String INTENT_FROM_GCM_MESSAGE = "com.google.android.c2dm.intent.RECEIVE"; - public static final String INTENT_FROM_GCM_REGISTRATION_CALLBACK = "com.google.android.c2dm.intent.REGISTRATION"; - public static final String INTENT_TO_GCM_REGISTRATION = "com.google.android.c2dm.intent.REGISTER"; - public static final String INTENT_TO_GCM_UNREGISTRATION = "com.google.android.c2dm.intent.UNREGISTER"; - public static final String PERMISSION_GCM_INTENTS = "com.google.android.c2dm.permission.SEND"; - public static final String VALUE_DELETED_MESSAGES = "deleted_messages"; - - private GCMConstants() { - throw new UnsupportedOperationException(); - } -} - diff --git a/app/src/main/java/com/google/android/gcm/GCMRegistrar.java b/app/src/main/java/com/google/android/gcm/GCMRegistrar.java deleted file mode 100644 index c382f59..0000000 --- a/app/src/main/java/com/google/android/gcm/GCMRegistrar.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.app.PendingIntent - * android.content.BroadcastReceiver - * android.content.Context - * android.content.Intent - * android.content.IntentFilter - * android.content.SharedPreferences - * android.content.SharedPreferences$Editor - * android.content.pm.ActivityInfo - * android.content.pm.PackageManager - * android.content.pm.PackageManager$NameNotFoundException - * android.content.pm.ResolveInfo - * android.os.Build$VERSION - * android.os.Parcelable - * android.util.Log - */ -package com.google.android.gcm; - -import android.annotation.SuppressLint; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.Build; -import android.os.Parcelable; -import android.util.Log; - -import java.sql.Timestamp; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -public final class GCMRegistrar { - private static final String BACKOFF_MS = "backoff_ms"; - private static final int DEFAULT_BACKOFF_MS = 3000; - public static final long DEFAULT_ON_SERVER_LIFESPAN_MS = 604800000L; - private static final String GSF_PACKAGE = "com.google.android.gsf"; - private static final String PREFERENCES = "com.google.android.gcm"; - private static final String PROPERTY_APP_VERSION = "appVersion"; - private static final String PROPERTY_ON_SERVER = "onServer"; - private static final String PROPERTY_ON_SERVER_EXPIRATION_TIME = "onServerExpirationTime"; - private static final String PROPERTY_ON_SERVER_LIFESPAN = "onServerLifeSpan"; - private static final String PROPERTY_REG_ID = "regId"; - private static final String TAG = "GCMRegistrar"; - private static GCMBroadcastReceiver sRetryReceiver; - private static String sRetryReceiverClassName; - - private GCMRegistrar() { - throw new UnsupportedOperationException(); - } - - public static void checkDevice(Context context) { - int n2 = Build.VERSION.SDK_INT; - if (n2 < 8) { - throw new UnsupportedOperationException("Device must be at least API Level 8 (instead of " + n2 + ")"); - } - PackageManager packageManager = context.getPackageManager(); - try { - packageManager.getPackageInfo(GSF_PACKAGE, 0); - return; - } - catch (PackageManager.NameNotFoundException nameNotFoundException) { - throw new UnsupportedOperationException("Device does not have package com.google.android.gsf"); - } - } - - public static void checkManifest(Context context) { - PackageManager packageManager2 = context.getPackageManager(); - String packageName = context.getPackageName();//object - ActivityInfo[] activityInfoArray; - String permissions = packageName + ".permission.C2D_MESSAGE"; - - try { - packageManager2.getPermissionInfo(packageName, PackageManager.GET_META_DATA); - } - catch (PackageManager.NameNotFoundException nameNotFoundException) { - throw new IllegalStateException("Application does not define permission " + permissions); - } - PackageInfo packageInfo = new PackageInfo(); - try { - packageInfo = packageManager2.getPackageInfo(packageName, PackageManager.GET_RECEIVERS); - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } - activityInfoArray = packageInfo.receivers; - if (activityInfoArray == null) throw new IllegalStateException("No receiver for package " + packageName); - if (activityInfoArray.length == 0) { - throw new IllegalStateException("No receiver for package " + packageName); - } - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "number of receivers for " + packageName + ": " + activityInfoArray.length); - } - HashSet hashSet = new HashSet<>(); - for (ActivityInfo activityInfo : activityInfoArray) { - if (!"com.google.android.c2dm.permission.SEND".equals(activityInfo.permission)) continue; - hashSet.add(activityInfo.name); - } - if (hashSet.isEmpty()) { - throw new IllegalStateException("No receiver allowed to receive com.google.android.c2dm.permission.SEND"); - } - GCMRegistrar.checkReceiver(context, hashSet, "com.google.android.c2dm.intent.REGISTRATION"); - GCMRegistrar.checkReceiver(context, hashSet, "com.google.android.c2dm.intent.RECEIVE"); - } - - private static void checkReceiver(Context object, Set set, String string) { - PackageManager packageManager = object.getPackageManager(); - String packageName = object.getPackageName(); - Intent intent = new Intent(string); - intent.setPackage(packageName); - @SuppressLint("WrongConstant") List resolveInfos = packageManager.queryBroadcastReceivers(intent, PackageManager.GET_INTENT_FILTERS); - if (resolveInfos.isEmpty()) { - throw new IllegalStateException("No receivers for action " + string); - } - if (Log.isLoggable(TAG, (int)2)) { - Log.v(TAG, "Found " + resolveInfos.size() + " receivers for action " + string); - } - Iterator iterator = resolveInfos.iterator(); - do { - if (!iterator.hasNext()) return; - } while (set.contains(string = iterator.next().activityInfo.name)); - throw new IllegalStateException("Receiver " + string + " is not set with permission " + "com.google.android.c2dm.permission.SEND"); - } - - static String clearRegistrationId(Context context) { - return GCMRegistrar.setRegistrationId(context, ""); - } - - private static int getAppVersion(Context context) { - try { - return context.getPackageManager().getPackageInfo((String)context.getPackageName(), (int)0).versionCode; - } - catch (PackageManager.NameNotFoundException nameNotFoundException) { - throw new RuntimeException("Coult not get package name: " + (Object)((Object)nameNotFoundException)); - } - } - - static int getBackoff(Context context) { - return GCMRegistrar.getGCMPreferences(context).getInt(BACKOFF_MS, 3000); - } - - static String getFlatSenderIds(String ... stringArray) { - if (stringArray == null) throw new IllegalArgumentException("No senderIds"); - if (stringArray.length == 0) { - throw new IllegalArgumentException("No senderIds"); - } - StringBuilder stringBuilder = new StringBuilder(stringArray[0]); - int n2 = 1; - while (n2 < stringArray.length) { - stringBuilder.append(',').append(stringArray[n2]); - ++n2; - } - return stringBuilder.toString(); - } - - private static SharedPreferences getGCMPreferences(Context context) { - return context.getSharedPreferences(PREFERENCES, 0); - } - - public static long getRegisterOnServerLifespan(Context context) { - return GCMRegistrar.getGCMPreferences(context).getLong(PROPERTY_ON_SERVER_LIFESPAN, 604800000L); - } - - public static String getRegistrationId(Context context) { - SharedPreferences gcmPreferences = GCMRegistrar.getGCMPreferences(context); - String string = gcmPreferences.getString(PROPERTY_REG_ID, ""); - int n2 = gcmPreferences.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE); - int n3 = GCMRegistrar.getAppVersion(context); - if (n2 == Integer.MIN_VALUE) return string; - if (n2 == n3) return string; - Log.v(TAG, "App version changed from " + n2 + " to " + n3 + "; resetting registration id"); - GCMRegistrar.clearRegistrationId(context); - return ""; - } - - static void internalRegister(Context context, String ... object) { - String flatSenderIds = GCMRegistrar.getFlatSenderIds(object); - Log.v(TAG, "Registering app " + context.getPackageName() + " of senders " + flatSenderIds); - Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER"); - intent.setPackage(GSF_PACKAGE); - intent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0)); - intent.putExtra("sender", flatSenderIds); - context.startService(intent); - } - - static void internalUnregister(Context context) { - Log.v((String)TAG, (String)("Unregistering app " + context.getPackageName())); - Intent intent = new Intent("com.google.android.c2dm.intent.UNREGISTER"); - intent.setPackage(GSF_PACKAGE); - intent.putExtra("app", (Parcelable)PendingIntent.getBroadcast((Context)context, (int)0, (Intent)new Intent(), (int)0)); - context.startService(intent); - } - - public static boolean isRegistered(Context context) { - if (GCMRegistrar.getRegistrationId(context).length() <= 0) return false; - return true; - } - - public static boolean isRegisteredOnServer(Context context) { - SharedPreferences gcmPreferences = GCMRegistrar.getGCMPreferences(context); - boolean bl2 = gcmPreferences.getBoolean(PROPERTY_ON_SERVER, false); - Log.v(TAG, "Is registered on server: " + bl2); - if (!bl2) return false; - long l2 = gcmPreferences.getLong(PROPERTY_ON_SERVER_EXPIRATION_TIME, -1L); - if (System.currentTimeMillis() <= l2) return true; - Log.v(TAG, "flag expired on: " + new Timestamp(l2)); - return false; - } - - public static void onDestroy(Context context) { - synchronized (GCMRegistrar.class) { - if (sRetryReceiver == null) return; - Log.v(TAG, "Unregistering receiver"); - context.unregisterReceiver((BroadcastReceiver)sRetryReceiver); - sRetryReceiver = null; - } - } - - public static void register(Context context, String ... stringArray) { - GCMRegistrar.resetBackoff(context); - GCMRegistrar.internalRegister(context, stringArray); - } - - static void resetBackoff(Context context) { - Log.d((String)TAG, (String)("resetting backoff for " + context.getPackageName())); - GCMRegistrar.setBackoff(context, 3000); - } - - static void setBackoff(Context context, int n2) { - SharedPreferences.Editor edit = GCMRegistrar.getGCMPreferences(context).edit(); - edit.putInt(BACKOFF_MS, n2); - edit.apply(); - } - - public static void setRegisterOnServerLifespan(Context context, long l2) { - SharedPreferences.Editor edit = GCMRegistrar.getGCMPreferences(context).edit(); - edit.putLong(PROPERTY_ON_SERVER_LIFESPAN, l2); - edit.apply(); - } - - public static void setRegisteredOnServer(Context context, boolean bl2) { - SharedPreferences.Editor editor = GCMRegistrar.getGCMPreferences(context).edit(); - editor.putBoolean(PROPERTY_ON_SERVER, bl2); - long l2 = GCMRegistrar.getRegisterOnServerLifespan(context); - l2 = System.currentTimeMillis() + l2; - Log.v((String)TAG, (String)("Setting registeredOnServer status as " + bl2 + " until " + new Timestamp(l2))); - editor.putLong(PROPERTY_ON_SERVER_EXPIRATION_TIME, l2); - editor.apply(); - } - - static String setRegistrationId(Context context, String string) { - SharedPreferences sharedPreferences = GCMRegistrar.getGCMPreferences(context); - String string2 = sharedPreferences.getString(PROPERTY_REG_ID, ""); - int n2 = GCMRegistrar.getAppVersion(context); - Log.v(TAG, "Saving regId on app version " + n2); - SharedPreferences.Editor edit = sharedPreferences.edit(); - edit.putString(PROPERTY_REG_ID, string); - edit.putInt(PROPERTY_APP_VERSION, n2); - edit.commit(); - return string2; - } - - static void setRetryBroadcastReceiver(Context context) { - synchronized (GCMRegistrar.class) { - if (sRetryReceiver != null) return; - if (sRetryReceiverClassName == null) { - Log.e(TAG, "internal error: retry receiver class not set yet"); - sRetryReceiver = new GCMBroadcastReceiver(); - } else { - try { - sRetryReceiver = (GCMBroadcastReceiver) Class.forName(sRetryReceiverClassName).newInstance(); - } - catch (Exception exception) { - Log.e(TAG, "Could not create instance of " + sRetryReceiverClassName + ". Using " + GCMBroadcastReceiver.class.getName() + " directly."); - sRetryReceiver = new GCMBroadcastReceiver(); - } - } - String string = context.getPackageName(); - IntentFilter intentFilter = new IntentFilter("com.google.android.gcm.intent.RETRY"); - intentFilter.addCategory(string); - string = string + ".permission.C2D_MESSAGE"; - Log.v(TAG, "Registering receiver"); - context.registerReceiver((BroadcastReceiver)sRetryReceiver, intentFilter, string, null); - return; - } - } - - static void setRetryReceiverClassName(String string) { - Log.v(TAG, "Setting the name of retry receiver class to " + string); - sRetryReceiverClassName = string; - } - - public static void unregister(Context context) { - GCMRegistrar.resetBackoff(context); - GCMRegistrar.internalUnregister(context); - } -} - diff --git a/app/src/main/java/com/savegame/SavesRestoring.java b/app/src/main/java/com/savegame/SavesRestoring.java deleted file mode 100644 index 535c265..0000000 --- a/app/src/main/java/com/savegame/SavesRestoring.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.savegame; - -import android.app.Activity; -import android.content.Context; -import android.content.res.AssetManager; -import android.os.Environment; -import android.util.Log; -import android.widget.Toast; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public final class SavesRestoring extends Activity { - private static int PdsjdolaSd = 0; - private static int daDakdsIID = 0; - - public static void DoSmth(Context context) { - try { - SmartDataRestoreForYou(context, context.getAssets(), context.getPackageName()); - } catch (Exception e) { - Log.e(context.getPackageName() + ":savemessages", "Message: " + e.getMessage()); - e.printStackTrace(); - } - } - - public static boolean ExistsInArray(String[] strArr, String str) { - for (int i = 0; i < strArr.length; i++) { - if (strArr[i].contains(str)) { - return true; - } - } - return false; - } - - private static String IcvaeLIJAFL() { - daDakdsIID++; - return Character.toString('b'); - } - - private static String JaEBhFLsj() { - daDakdsIID++; - return Character.toString('s'); - } - - private static String MNTRGWO() { - daDakdsIID++; - return Character.toString('o'); - } - - private static String SWoFpOGUOR() { - daDakdsIID++; - return Character.toString('m'); - } - - private static void SmartDataRestoreForYou(Context context, AssetManager assetManager, String str) throws Exception { - if (!context.getSharedPreferences("savegame", 0).getBoolean("notfirst", false)) { - context.getSharedPreferences("savegame", 0).edit().putBoolean("notfirst", true).commit(); - String str2 = str + ":savemessages"; - Log.i(str2, "SmDR: Starting..."); - context.getSharedPreferences("savegame", 0).edit().putBoolean("notfirst", true).apply(); - String[] list = assetManager.list(""); - for (int i = 0; i < list.length; i++) { - Log.i(str2, "ListFiles[" + i + "] = " + list[i]); - } - if (ExistsInArray(list, "data.save")) { - Toast.makeText(context, "Restoring save...", Toast.LENGTH_SHORT); - try { - Log.i(str2, "data.save : Restoring..."); - unZipIt(assetManager.open("data.save"), "/data/data/" + context.getPackageName()); - Log.i(str2, "data.save: Successfully restored"); - } catch (Exception e) { - Log.e(str2, "data.save: Message: " + e.getMessage()); - Toast.makeText(context, "Can't restore save", Toast.LENGTH_SHORT); - } - } - if (ExistsInArray(list, "extobb.save")) { - Toast.makeText(context, "Restoring cache...", Toast.LENGTH_SHORT); - try { - Log.i(str2, "extobb.save: Restoring..."); - unZipIt(assetManager.open("extobb.save"), context.getObbDir().getAbsolutePath() + "/"); - Log.i(str2, "extobb.save: Successfully restored"); - } catch (Exception e2) { - Log.e(str2, "extobb.save: Message: " + e2.getMessage()); - Toast.makeText(context, "Can't restore external cache", Toast.LENGTH_SHORT); - } - } - if (ExistsInArray(list, "extdata.save")) { - Toast.makeText(context, "Restoring external data...", Toast.LENGTH_SHORT); - try { - Log.i(str2, "extdata.save: Restoring..."); - String str3 = Environment.getExternalStorageDirectory() + "/Android/data/" + context.getPackageName() + "/"; - new File(str3).mkdirs(); - unZipIt(assetManager.open("extdata.save"), str3); - Log.i(str2, "extdata.save: Successfully restored"); - } catch (Exception e3) { - Log.e(str2, "extdata.save: Message: " + e3.getMessage()); - Toast.makeText(context, "Can't restore external data", Toast.LENGTH_SHORT); - } - } - Log.i(str2, "Restoring completed"); - Toast.makeText(context, "Restoring completed", Toast.LENGTH_SHORT); - } - } - - private static String VNoYQilb() { - daDakdsIID++; - return Character.toString(' '); - } - - private static String cTDeCJR() { - daDakdsIID++; - return Character.toString('s'); - } - - private static String gwlVJD() { - daDakdsIID++; - return Character.toString('y'); - } - - private static String iiAqKeUvKgqUd() { - daDakdsIID++; - return Character.toString('M'); - } - - private static String ldpSDcTKVdWbP() { - daDakdsIID++; - return Character.toString('o'); - } - - private static String plKpPgCYGa() { - daDakdsIID++; - return Character.toString(' '); - } - - private static String tIdtgslWSDS() { - daDakdsIID++; - return Character.toString('d'); - } - - private static void unZipIt(InputStream inputStream, String str) throws Exception { - ZipInputStream zipInputStream = new ZipInputStream(inputStream); - if (daDakdsIID != PdsjdolaSd) { - throw new Exception("System error..."); - } - byte[] bArr = new byte[1024]; - new File(str).mkdirs(); - ZipEntry nextEntry = zipInputStream.getNextEntry(); - if (daDakdsIID != PdsjdolaSd) { - throw new Exception("System error! please don't cheat..."); - } - while (nextEntry != null) { - if (nextEntry.isDirectory()) { - nextEntry = zipInputStream.getNextEntry(); - } else { - int lastIndexOf = nextEntry.getName().lastIndexOf(47); - if (lastIndexOf < 0) { - lastIndexOf = 0; - } - new File(str + "/" + nextEntry.getName().substring(0, lastIndexOf)).mkdirs(); - FileOutputStream fileOutputStream = new FileOutputStream(new File(str + "/" + nextEntry.getName()), false); - if (daDakdsIID != PdsjdolaSd) { - fileOutputStream.close(); - throw new Exception("You are clever..."); - } - while (true) { - int read = zipInputStream.read(bArr); - if (read <= 0) { - break; - } - fileOutputStream.write(bArr, 0, read); - } - fileOutputStream.close(); - nextEntry = zipInputStream.getNextEntry(); - } - } - if (daDakdsIID != PdsjdolaSd) { - throw new Exception("And again..."); - } - zipInputStream.closeEntry(); - zipInputStream.close(); - } -/* - private static String wrEBJneYLx() { - daDakdsIID++; - return Character.toString('y'); - }*/ -} diff --git a/app/src/main/java/com/verizon/vcast/apps/APIUtils.java b/app/src/main/java/com/verizon/vcast/apps/APIUtils.java deleted file mode 100644 index 5856db0..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/APIUtils.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.verizon.vcast.apps; - -public class APIUtils { - InAppPurchasor iap; - - APIUtils(InAppPurchasor inAppPurchasor) { - this.iap = inAppPurchasor; - } - - public DiscoveryParameters convertDiscoveryParameters(InAppPurchasor.DiscoveryParameters discoveryParameters) { - DiscoveryParameters discoveryParameters2 = new DiscoveryParameters(); - discoveryParameters2.ascendingOrder = discoveryParameters.isAscendingOrder(); - discoveryParameters2.maxResults = discoveryParameters.getMaxResults(); - discoveryParameters2.sortBy = discoveryParameters.getSortBy(); - discoveryParameters2.startIndex = discoveryParameters.getStartIndex(); - return discoveryParameters2; - } - - public InAppPurchasor.InAppContentOffers convertGetInAppContentOfferResult(InAppContentOffers inAppContentOffers) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.InAppContentOffers inAppContentOffers2 = new InAppPurchasor.InAppContentOffers(); - inAppContentOffers2.setResult(inAppContentOffers.result); - inAppContentOffers2.setTotalSize(inAppContentOffers.totalSize); - InAppPurchasor.Offer[] offerArr = new InAppPurchasor.Offer[inAppContentOffers.offers.length]; - for (int i = 0; i < inAppContentOffers.offers.length; i++) { - offerArr[i] = convertOffer(inAppContentOffers.offers[i]); - } - inAppContentOffers2.setOffers(offerArr); - return inAppContentOffers2; - } - - public InAppPurchasor.InAppContents convertGetInAppContentsResult(InAppContents inAppContents) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.InAppContents inAppContents2 = new InAppPurchasor.InAppContents(); - inAppContents2.setResult(inAppContents.result); - inAppContents2.setTotalSize(inAppContents.totalSize); - inAppContents2.setItems(convertItemArray(inAppContents.items)); - return inAppContents2; - } - - public InAppPurchasor.PurchasedInAppContents convertGetPurchasedInAppContentsResult(PurchasedInAppContents purchasedInAppContents) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.PurchasedInAppContents purchasedInAppContents2 = new InAppPurchasor.PurchasedInAppContents(); - purchasedInAppContents2.setResult(purchasedInAppContents.result); - purchasedInAppContents2.setTotalSize(purchasedInAppContents.totalSize); - purchasedInAppContents2.setPurchases(convertPurchaseArray(purchasedInAppContents.purchases)); - return purchasedInAppContents2; - } - - public InAppPurchasor.Item convertItem(Item item) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.Item item2 = new InAppPurchasor.Item(); - item2.setAgeRating(item.ageRating); - item2.setItemDescription(item.itemDescription); - item2.setItemID(item.itemID); - item2.setItemName(item.itemName); - return item2; - } - - public InAppPurchasor.Item[] convertItemArray(Item[] itemArr) { - InAppPurchasor.Item[] itemArr2 = new InAppPurchasor.Item[itemArr.length]; - for (int i = 0; i < itemArr.length; i++) { - itemArr2[i] = convertItem(itemArr[i]); - } - return itemArr2; - } - - public InAppPurchasor.Offer convertOffer(Offer offer) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.Offer offer2 = new InAppPurchasor.Offer(); - offer2.setOfferID(offer.offerID); - offer2.setMaxPrice(offer.maxPrice); - offer2.setMinPrice(offer.minPrice); - offer2.setPriceLine(offer.priceLine); - offer2.setPriceType(offer.priceType); - offer2.setPricingTerms(offer.pricingTerms); - return offer2; - } - - public InAppPurchasor.Purchase convertPurchase(Purchase purchase) { - if (purchase == null) { - return null; - } - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.Purchase purchase2 = new InAppPurchasor.Purchase(); - purchase2.setInAppName(purchase.inAppName); - purchase2.setItem(convertItem(purchase.item)); - purchase2.setPrice(purchase.price); - purchase2.setPriceLine(purchase.priceLine); - purchase2.setPriceType(purchase.priceType); - purchase2.setPricingTerms(purchase.pricingTerms); - purchase2.setPurchaseDate(purchase.purchaseDate); - purchase2.setSku(purchase.sku); - purchase2.setPurchaseID(purchase.purchaseID); - return purchase2; - } - - public InAppPurchasor.Purchase[] convertPurchaseArray(Purchase[] purchaseArr) { - if (purchaseArr == null) { - return null; - } - InAppPurchasor.Purchase[] purchaseArr2 = new InAppPurchasor.Purchase[purchaseArr.length]; - for (int i = 0; i < purchaseArr.length; i++) { - purchaseArr2[i] = convertPurchase(purchaseArr[i]); - } - return purchaseArr2; - } - - public InAppPurchasor.PurchaseInAppContentResult convertPurchaseInAppContentResult(PurchaseInAppContentResult purchaseInAppContentResult) { - InAppPurchasor inAppPurchasor = this.iap; - inAppPurchasor.getClass(); - InAppPurchasor.PurchaseInAppContentResult purchaseInAppContentResult2 = new InAppPurchasor.PurchaseInAppContentResult(); - purchaseInAppContentResult2.setLicense(purchaseInAppContentResult.license); - purchaseInAppContentResult2.setPurchaseID(purchaseInAppContentResult.purchaseID); - purchaseInAppContentResult2.setResult(purchaseInAppContentResult.result); - return purchaseInAppContentResult2; - } - - public PurchaseParameters convertPurchaseParameters(InAppPurchasor.PurchaseParameters purchaseParameters) { - PurchaseParameters purchaseParameters2 = new PurchaseParameters(); - purchaseParameters2.contentSize = Integer.valueOf(purchaseParameters.getContentSize() == null ? 0 : purchaseParameters.getContentSize().intValue()); - purchaseParameters2.inAppName = purchaseParameters.getInAppName(); - purchaseParameters2.offerID = purchaseParameters.getOfferID(); - purchaseParameters2.price = purchaseParameters.getPrice(); - purchaseParameters2.sku = purchaseParameters.getSku(); - purchaseParameters2.priceType = purchaseParameters.getPriceType(); - purchaseParameters2.priceLine = purchaseParameters.getPriceLine(); - purchaseParameters2.pricingTerms = purchaseParameters.getPricingTerms(); - return purchaseParameters2; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/DatabaseHelper.java b/app/src/main/java/com/verizon/vcast/apps/DatabaseHelper.java deleted file mode 100644 index 5860eb3..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/DatabaseHelper.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.verizon.vcast.apps; - -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.database.sqlite.SQLiteStatement; -import android.util.Log; -import java.util.ArrayList; -import java.util.List; - -public class DatabaseHelper { - private static final String DATABASE_NAME = "timeStore.db"; - private static final int DATABASE_VERSION = 1; - private static final String INSERT = "insert into table1(name) values (?)"; - private static final String INSERT_RUNTIME = "insert into tableLastRunTime(name) values (?)"; - private static final String TABLE_NAME = "table1"; - private static final String TABLE_NAME_LAST_RUN_TIME = "tableLastRunTime"; - private Context context; - private SQLiteDatabase db = new OpenHelper(this.context).getWritableDatabase(); - private SQLiteStatement insertStmt = this.db.compileStatement(INSERT); - private SQLiteStatement insertStmt_runtime = this.db.compileStatement(INSERT_RUNTIME); - - private static class OpenHelper extends SQLiteOpenHelper { - OpenHelper(Context context) { - super(context, DatabaseHelper.DATABASE_NAME, (SQLiteDatabase.CursorFactory) null, 1); - } - - public void onCreate(SQLiteDatabase sQLiteDatabase) { - sQLiteDatabase.execSQL("CREATE TABLE tableLastRunTime (id INTEGER PRIMARY KEY, name TEXT)"); - sQLiteDatabase.execSQL("CREATE TABLE table1 (id INTEGER PRIMARY KEY, name TEXT)"); - } - - public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) { - Log.w("Example", "Upgrading database, this will drop tables and recreate."); - sQLiteDatabase.execSQL("DROP TABLE IF EXISTS table1"); - sQLiteDatabase.execSQL("DROP TABLE IF EXISTS tableLastRunTime"); - onCreate(sQLiteDatabase); - } - } - - public DatabaseHelper(Context context2) { - this.context = context2; - } - - public void cleanup() { - if (this.db != null) { - try { - this.db.close(); - } catch (Exception e) { - } - this.db = null; - } - } - - public void deleteAll() { - this.db.delete(TABLE_NAME, null, null); - } - - public void deleteRuntime() { - this.db.delete(TABLE_NAME_LAST_RUN_TIME, null, null); - } - - public long insert(String str) { - this.insertStmt.bindString(1, str); - return this.insertStmt.executeInsert(); - } - - public long insertRunTime(String str) { - this.insertStmt_runtime.bindString(1, str); - return this.insertStmt_runtime.executeInsert(); - } - - public List selectAll() { - ArrayList arrayList = new ArrayList(); - Cursor query = this.db.query(TABLE_NAME, new String[]{"name"}, null, null, null, null, "name desc"); - if (query.moveToFirst()) { - do { - arrayList.add(query.getString(0)); - } while (query.moveToNext()); - } - if (query != null && !query.isClosed()) { - query.close(); - } - return arrayList; - } - - public List selectRunTime() { - ArrayList arrayList = new ArrayList(); - Cursor query = this.db.query(TABLE_NAME_LAST_RUN_TIME, new String[]{"name"}, null, null, null, null, "name desc"); - if (query.moveToFirst()) { - do { - arrayList.add(query.getString(0)); - } while (query.moveToNext()); - } - if (query != null && !query.isClosed()) { - query.close(); - } - return arrayList; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/DiscoveryParameters.java b/app/src/main/java/com/verizon/vcast/apps/DiscoveryParameters.java deleted file mode 100644 index e5d77c9..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/DiscoveryParameters.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class DiscoveryParameters implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.DiscoveryParameters.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public DiscoveryParameters createFromParcel(Parcel parcel) { - return new DiscoveryParameters(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public DiscoveryParameters[] newArray(int i) { - return new DiscoveryParameters[i]; - } - }; - public boolean ascendingOrder; - public int maxResults; - public String sortBy; - public int startIndex; - - public DiscoveryParameters() { - } - - private DiscoveryParameters(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ DiscoveryParameters(Parcel parcel, DiscoveryParameters discoveryParameters) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - parcel.readBooleanArray(new boolean[1]); - this.ascendingOrder = false; - this.maxResults = parcel.readInt(); - this.sortBy = parcel.readString(); - this.startIndex = parcel.readInt(); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeBooleanArray(new boolean[]{this.ascendingOrder}); - parcel.writeInt(this.maxResults); - parcel.writeString(this.sortBy); - parcel.writeInt(this.startIndex); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/IVCastAppsLicenseService.java b/app/src/main/java/com/verizon/vcast/apps/IVCastAppsLicenseService.java deleted file mode 100644 index 00f9e78..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/IVCastAppsLicenseService.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Binder; -import android.os.IBinder; -import android.os.IInterface; -import android.os.Parcel; -import android.os.RemoteException; - -public interface IVCastAppsLicenseService extends IInterface { - - public static abstract class Stub extends Binder implements IVCastAppsLicenseService { - private static final String DESCRIPTOR = "com.verizon.vcast.apps.IVCastAppsLicenseService"; - static final int TRANSACTION_getLicense = 1; - static final int TRANSACTION_getRemoteLicense = 3; - static final int TRANSACTION_getTime = 2; - - private static class Proxy implements IVCastAppsLicenseService { - private IBinder mRemote; - - Proxy(IBinder iBinder) { - this.mRemote = iBinder; - } - - public IBinder asBinder() { - return this.mRemote; - } - - public String getInterfaceDescriptor() { - return Stub.DESCRIPTOR; - } - - @Override // com.verizon.vcast.apps.IVCastAppsLicenseService - public byte[] getLicense(String str) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - this.mRemote.transact(1, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.createByteArray(); - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - @Override // com.verizon.vcast.apps.IVCastAppsLicenseService - public byte[] getRemoteLicense(String str, boolean z) throws RemoteException { - int i = 0; - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - if (z) { - i = 1; - } - obtain.writeInt(i); - this.mRemote.transact(3, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.createByteArray(); - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - @Override // com.verizon.vcast.apps.IVCastAppsLicenseService - public long getTime() throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - this.mRemote.transact(2, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readLong(); - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - } - - public Stub() { - attachInterface(this, DESCRIPTOR); - } - - public static IVCastAppsLicenseService asInterface(IBinder iBinder) { - if (iBinder == null) { - return null; - } - IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR); - return (queryLocalInterface == null || !(queryLocalInterface instanceof IVCastAppsLicenseService)) ? new Proxy(iBinder) : (IVCastAppsLicenseService) queryLocalInterface; - } - - 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); - byte[] license = getLicense(parcel.readString()); - parcel2.writeNoException(); - parcel2.writeByteArray(license); - return true; - case 2: - parcel.enforceInterface(DESCRIPTOR); - long time = getTime(); - parcel2.writeNoException(); - parcel2.writeLong(time); - return true; - case 3: - parcel.enforceInterface(DESCRIPTOR); - byte[] remoteLicense = getRemoteLicense(parcel.readString(), parcel.readInt() != 0); - parcel2.writeNoException(); - parcel2.writeByteArray(remoteLicense); - return true; - case 1598968902: - parcel2.writeString(DESCRIPTOR); - return true; - default: - return super.onTransact(i, parcel, parcel2, i2); - } - } - } - - byte[] getLicense(String str) throws RemoteException; - - byte[] getRemoteLicense(String str, boolean z) throws RemoteException; - - long getTime() throws RemoteException; -} diff --git a/app/src/main/java/com/verizon/vcast/apps/IVCastInAppService.java b/app/src/main/java/com/verizon/vcast/apps/IVCastInAppService.java deleted file mode 100644 index 6fcc80e..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/IVCastInAppService.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Binder; -import android.os.IBinder; -import android.os.IInterface; -import android.os.Parcel; -import android.os.RemoteException; - -public interface IVCastInAppService extends IInterface { - - public static abstract class Stub extends Binder implements IVCastInAppService { - private static final String DESCRIPTOR = "com.verizon.vcast.apps.IVCastInAppService"; - static final int TRANSACTION_cancelInAppContentSubscription = 1; - static final int TRANSACTION_getInAppContentOffer = 2; - static final int TRANSACTION_getInAppContents = 3; - static final int TRANSACTION_getPurchasedInAppContents = 4; - static final int TRANSACTION_purchaseInAppContent = 5; - - /* access modifiers changed from: private */ - public static class Proxy implements IVCastInAppService { - private IBinder mRemote; - - Proxy(IBinder iBinder) { - this.mRemote = iBinder; - } - - public IBinder asBinder() { - return this.mRemote; - } - - @Override // com.verizon.vcast.apps.IVCastInAppService - public int cancelInAppContentSubscription(String str, String str2, String str3) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - obtain.writeString(str2); - obtain.writeString(str3); - this.mRemote.transact(1, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readInt(); - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - @Override // com.verizon.vcast.apps.IVCastInAppService - public InAppContentOffers getInAppContentOffer(String str, String str2) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - obtain.writeString(str2); - this.mRemote.transact(2, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readInt() != 0 ? InAppContentOffers.CREATOR.createFromParcel(obtain2) : null; - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - @Override // com.verizon.vcast.apps.IVCastInAppService - public InAppContents getInAppContents(String str, DiscoveryParameters discoveryParameters) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - if (discoveryParameters != null) { - obtain.writeInt(1); - discoveryParameters.writeToParcel(obtain, 0); - } else { - obtain.writeInt(0); - } - this.mRemote.transact(3, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readInt() != 0 ? InAppContents.CREATOR.createFromParcel(obtain2) : null; - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - public String getInterfaceDescriptor() { - return Stub.DESCRIPTOR; - } - - @Override // com.verizon.vcast.apps.IVCastInAppService - public PurchasedInAppContents getPurchasedInAppContents(String str, DiscoveryParameters discoveryParameters) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - if (discoveryParameters != null) { - obtain.writeInt(1); - discoveryParameters.writeToParcel(obtain, 0); - } else { - obtain.writeInt(0); - } - this.mRemote.transact(4, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readInt() != 0 ? PurchasedInAppContents.CREATOR.createFromParcel(obtain2) : null; - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - - @Override // com.verizon.vcast.apps.IVCastInAppService - public PurchaseInAppContentResult purchaseInAppContent(String str, String str2, PurchaseParameters purchaseParameters) throws RemoteException { - Parcel obtain = Parcel.obtain(); - Parcel obtain2 = Parcel.obtain(); - try { - obtain.writeInterfaceToken(Stub.DESCRIPTOR); - obtain.writeString(str); - obtain.writeString(str2); - if (purchaseParameters != null) { - obtain.writeInt(1); - purchaseParameters.writeToParcel(obtain, 0); - } else { - obtain.writeInt(0); - } - this.mRemote.transact(5, obtain, obtain2, 0); - obtain2.readException(); - return obtain2.readInt() != 0 ? PurchaseInAppContentResult.CREATOR.createFromParcel(obtain2) : null; - } finally { - obtain2.recycle(); - obtain.recycle(); - } - } - } - - public Stub() { - attachInterface(this, DESCRIPTOR); - } - - public static IVCastInAppService asInterface(IBinder iBinder) { - if (iBinder == null) { - return null; - } - IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR); - return (queryLocalInterface == null || !(queryLocalInterface instanceof IVCastInAppService)) ? new Proxy(iBinder) : (IVCastInAppService) queryLocalInterface; - } - - 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 cancelInAppContentSubscription = cancelInAppContentSubscription(parcel.readString(), parcel.readString(), parcel.readString()); - parcel2.writeNoException(); - parcel2.writeInt(cancelInAppContentSubscription); - return true; - case 2: - parcel.enforceInterface(DESCRIPTOR); - InAppContentOffers inAppContentOffer = getInAppContentOffer(parcel.readString(), parcel.readString()); - parcel2.writeNoException(); - if (inAppContentOffer != null) { - parcel2.writeInt(1); - inAppContentOffer.writeToParcel(parcel2, 1); - return true; - } - parcel2.writeInt(0); - return true; - case 3: - parcel.enforceInterface(DESCRIPTOR); - InAppContents inAppContents = getInAppContents(parcel.readString(), parcel.readInt() != 0 ? DiscoveryParameters.CREATOR.createFromParcel(parcel) : null); - parcel2.writeNoException(); - if (inAppContents != null) { - parcel2.writeInt(1); - inAppContents.writeToParcel(parcel2, 1); - return true; - } - parcel2.writeInt(0); - return true; - case 4: - parcel.enforceInterface(DESCRIPTOR); - PurchasedInAppContents purchasedInAppContents = getPurchasedInAppContents(parcel.readString(), parcel.readInt() != 0 ? DiscoveryParameters.CREATOR.createFromParcel(parcel) : null); - parcel2.writeNoException(); - if (purchasedInAppContents != null) { - parcel2.writeInt(1); - purchasedInAppContents.writeToParcel(parcel2, 1); - return true; - } - parcel2.writeInt(0); - return true; - case 5: - parcel.enforceInterface(DESCRIPTOR); - PurchaseInAppContentResult purchaseInAppContent = purchaseInAppContent(parcel.readString(), parcel.readString(), parcel.readInt() != 0 ? PurchaseParameters.CREATOR.createFromParcel(parcel) : null); - parcel2.writeNoException(); - if (purchaseInAppContent != null) { - parcel2.writeInt(1); - purchaseInAppContent.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); - } - } - } - - int cancelInAppContentSubscription(String str, String str2, String str3) throws RemoteException; - - InAppContentOffers getInAppContentOffer(String str, String str2) throws RemoteException; - - InAppContents getInAppContents(String str, DiscoveryParameters discoveryParameters) throws RemoteException; - - PurchasedInAppContents getPurchasedInAppContents(String str, DiscoveryParameters discoveryParameters) throws RemoteException; - - PurchaseInAppContentResult purchaseInAppContent(String str, String str2, PurchaseParameters purchaseParameters) throws RemoteException; -} diff --git a/app/src/main/java/com/verizon/vcast/apps/InAppActivity.java b/app/src/main/java/com/verizon/vcast/apps/InAppActivity.java deleted file mode 100644 index 42cdaa5..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/InAppActivity.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.verizon.vcast.apps; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import com.verizon.vcast.apps.InAppPurchasor; -import java.util.Iterator; - -public abstract class InAppActivity extends Activity { - private static final String TAG = "InAppActivity"; - public static final int purchaseInAppContentRequestCode = 4684978; - protected InAppPurchasor inAppPurchasor; - - private void reportPurchaseError(int i) { - InAppPurchasor inAppPurchasor2 = this.inAppPurchasor; - inAppPurchasor2.getClass(); - InAppPurchasor.PurchaseInAppContentResult purchaseInAppContentResult = new InAppPurchasor.PurchaseInAppContentResult(); - purchaseInAppContentResult.setResult(Integer.valueOf(i)); - Log.e(TAG, "Purchase Response is invalid."); - onPurchaseResult(purchaseInAppContentResult); - } - - /* access modifiers changed from: protected */ - public void onActivityResult(int i, int i2, Intent intent) { - if (i != 4684978) { - return; - } - if (intent == null) { - reportPurchaseError(4); - return; - } - Bundle extras = intent.getExtras(); - if (extras == null) { - reportPurchaseError(4); - return; - } - Bundle bundle = extras.getBundle("bundle"); - if (bundle == null) { - reportPurchaseError(4); - return; - } - PurchaseInAppContentResult purchaseInAppContentResult = (PurchaseInAppContentResult) bundle.getParcelable("purchaseResult"); - if (purchaseInAppContentResult == null) { - reportPurchaseError(4); - return; - } - InAppPurchasor.PurchaseInAppContentResult convertPurchaseInAppContentResult = new APIUtils(this.inAppPurchasor).convertPurchaseInAppContentResult(purchaseInAppContentResult); - if (convertPurchaseInAppContentResult.getResult().intValue() == 3) { - try { - Iterator it = new LicenseAuthenticatorInternal().getInAppLicenses(convertPurchaseInAppContentResult.getLicense()).iterator(); - while (true) { - if (!it.hasNext()) { - break; - } - String next = it.next(); - int indexOf = next.indexOf(""); - int indexOf2 = next.indexOf(""); - if (indexOf != -1 && indexOf2 != -1 && next.substring(indexOf + 6, indexOf2).trim().equals(this.inAppPurchasor.itemIDBeingPurchased)) { - convertPurchaseInAppContentResult.setLicense(next); - if (convertPurchaseInAppContentResult.getPurchaseID() == null) { - int indexOf3 = next.indexOf(""); - int indexOf4 = next.indexOf(""); - if (indexOf != -1 && indexOf2 != -1) { - convertPurchaseInAppContentResult.setPurchaseID(next.substring(indexOf3 + 12, indexOf4)); - } - } - } - } - } catch (Exception e) { - Log.e("InAppPurchasor", "Cannot get specific in app license and populate purchase id.", e); - } - } - onPurchaseResult(convertPurchaseInAppContentResult); - } - - public void onCreate(Bundle bundle) { - super.onCreate(bundle); - this.inAppPurchasor = InAppPurchasor.getInstance(this); - } - - /* access modifiers changed from: protected */ - public abstract void onPurchaseResult(InAppPurchasor.PurchaseInAppContentResult purchaseInAppContentResult); -} diff --git a/app/src/main/java/com/verizon/vcast/apps/InAppContentOffers.java b/app/src/main/java/com/verizon/vcast/apps/InAppContentOffers.java deleted file mode 100644 index 3c3f210..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/InAppContentOffers.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class InAppContentOffers implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.InAppContentOffers.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public InAppContentOffers createFromParcel(Parcel parcel) { - return new InAppContentOffers(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public InAppContentOffers[] newArray(int i) { - return new InAppContentOffers[i]; - } - }; - Offer[] offers; - int result; - int totalSize; - - public InAppContentOffers() { - } - - private InAppContentOffers(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ InAppContentOffers(Parcel parcel, InAppContentOffers inAppContentOffers) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - Object[] readArray = parcel.readArray(Offer.class.getClassLoader()); - this.offers = new Offer[readArray.length]; - for (int i = 0; i < readArray.length; i++) { - this.offers[i] = (Offer) readArray[i]; - } - this.result = parcel.readInt(); - this.totalSize = parcel.readInt(); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeArray(this.offers); - parcel.writeInt(this.result); - parcel.writeInt(this.totalSize); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/InAppContents.java b/app/src/main/java/com/verizon/vcast/apps/InAppContents.java deleted file mode 100644 index 4675b9d..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/InAppContents.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class InAppContents implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.InAppContents.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public InAppContents createFromParcel(Parcel parcel) { - return new InAppContents(parcel); - } - - @Override // android.os.Parcelable.Creator - public InAppContents[] newArray(int i) { - return new InAppContents[i]; - } - }; - public Item[] items; - public Integer result; - public Integer totalSize; - - public InAppContents() { - } - - public InAppContents(Parcel parcel) { - readFromParcel(parcel); - } - - private void readFromParcel(Parcel parcel) { - Object[] readArray = parcel.readArray(Item.class.getClassLoader()); - this.items = new Item[readArray.length]; - for (int i = 0; i < readArray.length; i++) { - this.items[i] = (Item) readArray[i]; - } - this.result = Integer.valueOf(parcel.readInt()); - this.totalSize = Integer.valueOf(parcel.readInt()); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeArray(this.items); - parcel.writeInt(this.result.intValue()); - parcel.writeInt(this.totalSize.intValue()); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/InAppPurchasor.java b/app/src/main/java/com/verizon/vcast/apps/InAppPurchasor.java deleted file mode 100644 index 164622d..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/InAppPurchasor.java +++ /dev/null @@ -1,754 +0,0 @@ -package com.verizon.vcast.apps; - -import android.app.Activity; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.RemoteException; -import android.util.Log; - -import java.util.Arrays; -import java.util.Date; - -public class InAppPurchasor extends InAppPurchasorInternal { - public static final int ERROR_CONTENT_HANDLER = 100; - public static final int ERROR_GENERAL = 106; - public static final int ERROR_ILLEGAL_ARGUMENT = 101; - public static final int ERROR_SECURITY = 102; - public static final int ERROR_UNABLE_TO_CONNECT_TO_CDS = 107; - public static final int INVALID_SUBSCIPTION_ID = 7; - public static final int LIST_REQ_FAILED = 9; - public static final int LIST_REQ_OK = 8; - public static final int PURCHASE_FAILED = 4; - public static final int PURCHASE_INITIATION_OK = 10; - public static final int PURCHASE_OK = 3; - public static final int SUBSCRIPTION_CANCELLATION_FAILED = 6; - public static final int SUBSCRIPTION_CANCELLED = 5; - private static InAppPurchasor instance = null; - - public class DiscoveryParameters { - private boolean ascendingOrder; - private int maxResults; - private String sortBy; - private int startIndex; - - public DiscoveryParameters() { - } - - public int getMaxResults() { - return this.maxResults; - } - - public String getSortBy() { - return this.sortBy; - } - - public int getStartIndex() { - return this.startIndex; - } - - public boolean isAscendingOrder() { - return this.ascendingOrder; - } - - public void setAscendingOrder(boolean z) { - this.ascendingOrder = z; - } - - public void setMaxResults(int i) { - this.maxResults = i; - } - - public void setSortBy(String str) { - this.sortBy = str; - } - - public void setStartIndex(int i) { - this.startIndex = i; - } - - public String toString() { - return "Start Index:" + this.startIndex + "\n" + "maxResults:" + this.maxResults + "\n" + "ascendingOrder:" + this.ascendingOrder + "\n" + "sortBy:" + this.sortBy; - } - } - - public static class InAppContentOffers { - private Offer[] offers; - private Integer result; - private Integer totalSize; - - public InAppContentOffers() { - } - - public Offer[] getOffers() { - return this.offers; - } - - public Integer getResult() { - return this.result; - } - - public Integer getTotalSize() { - return this.totalSize; - } - - public void setOffers(Offer[] offerArr) { - this.offers = offerArr; - } - - public void setResult(Integer num) { - this.result = num; - } - - public void setTotalSize(Integer num) { - this.totalSize = num; - } - - public String toString() { - return "Result:" + this.result + " \n" + "Total Size:" + this.totalSize + " \n" + "Offer:" + Arrays.deepToString(this.offers); - } - } - - public static class InAppContents { - private Item[] items; - private Integer result; - private Integer totalSize; - - public InAppContents() { - } - - public Item[] getItems() { - return this.items; - } - - public Integer getResult() { - return this.result; - } - - public Integer getTotalSize() { - return this.totalSize; - } - - public void setItems(Item[] itemArr) { - this.items = itemArr; - } - - public void setResult(Integer num) { - this.result = num; - } - - /* access modifiers changed from: package-private */ - public void setTotalSize(Integer num) { - this.totalSize = num; - } - - public String toString() { - return "Result:" + this.result + " \n" + "Total Size:" + this.totalSize + " \n" + "Offer:" + Arrays.deepToString(this.items); - } - } - - public static class Item { - private String ageRating; - private String itemDescription; - private String itemID; - private String itemName; - private float suggestedPrice; - private String suggestedPriceType; - - public Item() { - } - - public String getAgeRating() { - return this.ageRating; - } - - public String getItemDescription() { - return this.itemDescription; - } - - public String getItemID() { - return this.itemID; - } - - public String getItemName() { - return this.itemName; - } - - public float getSuggestedPrice() { - return this.suggestedPrice; - } - - public String getSuggestedPriceType() { - return this.suggestedPriceType; - } - - public void setAgeRating(String str) { - this.ageRating = str; - } - - public void setItemDescription(String str) { - this.itemDescription = str; - } - - public void setItemID(String str) { - this.itemID = str; - } - - public void setItemName(String str) { - this.itemName = str; - } - - public void setSuggestedPrice(float f) { - this.suggestedPrice = f; - } - - public void setSuggestedPriceType(String str) { - this.suggestedPriceType = str; - } - - public String toString() { - return "Item ID:" + this.itemID + "\n" + "Item Name:" + this.itemName + "\n" + "Item Description:" + this.itemDescription + "\n" + "Age Rating:" + this.ageRating; - } - } - - public static class Offer { - private float maxPrice; - private float minPrice; - private String offerID; - private String priceLine; - private String priceType; - private String pricingTerms; - - public Offer() { - } - - public float getMaxPrice() { - return this.maxPrice; - } - - public float getMinPrice() { - return this.minPrice; - } - - public String getOfferID() { - return this.offerID; - } - - public String getPriceLine() { - return this.priceLine; - } - - public String getPriceType() { - return this.priceType; - } - - public String getPricingTerms() { - return this.pricingTerms; - } - - public void setMaxPrice(float f) { - this.maxPrice = f; - } - - public void setMinPrice(float f) { - this.minPrice = f; - } - - public void setOfferID(String str) { - this.offerID = str; - } - - public void setPriceLine(String str) { - this.priceLine = str; - } - - public void setPriceType(String str) { - this.priceType = str; - } - - public void setPricingTerms(String str) { - this.pricingTerms = str; - } - - public String toString() { - return "Offer ID:" + this.offerID + "\n" + "Max Price:" + this.maxPrice + "\n" + "Min Price:" + this.minPrice + "\n" + "Price Line:" + this.priceLine + "\n" + "Price Type:" + this.priceType + "\n" + "Pricing Terms:" + this.pricingTerms; - } - } - - public static class Purchase { - private String inAppName; - private Item item; - private float price; - private String priceLine; - private String priceType; - private String pricingTerms; - private Date purchaseDate; - private String purchaseID; - private String sku; - - public Purchase() { - } - - public String getInAppName() { - return this.inAppName; - } - - public Item getItem() { - return this.item; - } - - public float getPrice() { - return this.price; - } - - public String getPriceLine() { - return this.priceLine; - } - - public String getPriceType() { - return this.priceType; - } - - public String getPricingTerms() { - return this.pricingTerms; - } - - public Date getPurchaseDate() { - return this.purchaseDate; - } - - public String getPurchaseID() { - return this.purchaseID; - } - - public String getSku() { - return this.sku; - } - - public void setInAppName(String str) { - this.inAppName = str; - } - - public void setItem(Item item2) { - this.item = item2; - } - - public void setPrice(float f) { - this.price = f; - } - - public void setPriceLine(String str) { - this.priceLine = str; - } - - public void setPriceType(String str) { - this.priceType = str; - } - - public void setPricingTerms(String str) { - this.pricingTerms = str; - } - - public void setPurchaseDate(Date date) { - this.purchaseDate = date; - } - - public void setPurchaseID(String str) { - this.purchaseID = str; - } - - public void setSku(String str) { - this.sku = str; - } - - public String toString() { - return "Offer ID:" + this.purchaseID + "\n" + "In App Name:" + this.inAppName + "\n" + "SKU:" + this.sku + "\n" + "Price Line:" + this.priceLine + "\n" + "Price Type:" + this.priceType + "\n" + "Pricing Terms:" + this.pricingTerms + "\n" + "Purchase Date:" + this.purchaseDate + "\n" + "Item: " + this.item + "\n"; - } - } - - public static class PurchaseInAppContentResult { - private String license; - private String purchaseID; - private Integer result; - - public PurchaseInAppContentResult() { - } - - public String getLicense() { - return this.license; - } - - public String getPurchaseID() { - return this.purchaseID; - } - - public Integer getResult() { - return this.result; - } - - public void setLicense(String str) { - this.license = str; - } - - public void setPurchaseID(String str) { - this.purchaseID = str; - } - - public void setResult(Integer num) { - this.result = num; - } - - public String toString() { - return "Result:" + this.result + " \n" + "License:" + this.license + " \n" + "purchaseID:" + this.purchaseID; - } - } - - public class PurchaseParameters { - private Integer contentSize; - private String inAppName; - private String offerID; - private float price; - private String priceLine; - private String priceType; - private String pricingTerms; - private String sku; - - public PurchaseParameters() { - } - - public Integer getContentSize() { - return this.contentSize; - } - - public String getInAppName() { - return this.inAppName; - } - - public String getOfferID() { - return this.offerID; - } - - public float getPrice() { - return this.price; - } - - public String getPriceLine() { - return this.priceLine; - } - - public String getPriceType() { - return this.priceType; - } - - public String getPricingTerms() { - return this.pricingTerms; - } - - public String getSku() { - return this.sku; - } - - public void setContentSize(Integer num) { - this.contentSize = num; - } - - public void setInAppName(String str) { - this.inAppName = str; - } - - public void setOfferID(String str) { - this.offerID = str; - } - - public void setPrice(float f) { - this.price = f; - } - - public void setPriceLine(String str) { - this.priceLine = str; - } - - public void setPriceType(String str) { - this.priceType = str; - } - - public void setPricingTerms(String str) { - this.pricingTerms = str; - } - - public void setSku(String str) { - this.sku = str; - } - - public String toString() { - return "In App Name:" + this.inAppName + "\n" + "SKU:" + this.sku + "\n" + "Price:" + this.price + "\n" + "Content Size:" + this.contentSize + "\n" + "Offer Id:" + this.offerID + "\n" + "Price Type:" + this.priceType + "\n" + "Price Line:" + this.priceLine + "\n" + "Pricing Terms:" + this.pricingTerms; - } - } - - public static class PurchasedInAppContents { - private Purchase[] purchases; - private Integer result; - private Integer totalSize; - - public PurchasedInAppContents() { - } - - public Purchase[] getPurchases() { - return this.purchases; - } - - public Integer getResult() { - return this.result; - } - - public Integer getTotalSize() { - return this.totalSize; - } - - public void setPurchases(Purchase[] purchaseArr) { - this.purchases = purchaseArr; - } - - public void setResult(Integer num) { - this.result = num; - } - - public void setTotalSize(Integer num) { - this.totalSize = num; - } - - public String toString() { - return "Result:" + this.result + " \n" + "Total Size:" + this.totalSize + " \n" + "Purchases:" + Arrays.deepToString(this.purchases); - } - } - - private InAppPurchasor(Context context) { - this.c = context; - this.apiUtils = new APIUtils(this); - this.isVcastUIEInstalled = isOdpInstalled("com.verizon.vcast.apps"); - this.isVcastGMInstalled = isOdpInstalled("com.gravitymobile.app.hornbill"); - if (!this.isVcastGMInstalled || this.isVcastUIEInstalled) { - this.serviceManager = new RemoteServiceManager(context, "com.verizon.vcast.apps", "com.verizon.vcast.apps.VCastInAppService"); - } else { - this.serviceManager = new RemoteServiceManager(context, "com.gravitymobile.app.hornbill", "com.verizon.vcast.apps.VCastInAppService"); - } - } - - public static InAppPurchasor getInstance(Context context) { - return instance == null ? new InAppPurchasor(context) : instance; - } - - public synchronized int cancelInAppContentSubscription(String str, String str2, String str3) { - int i; - Log.i("InAppPurchasor", "begin cancelInAppContentSubscription()"); - if (str != null) { - try { - if (!str.equals("") && str2 != null && !str2.equals("") && str3 != null && !str3.equals("")) { - i = this.serviceManager.validateService(); - if (i == 0) { - try { - int cancelInAppContentSubscription = IVCastInAppService.Stub.asInterface(this.serviceManager.getServiceBinder()).cancelInAppContentSubscription(str, str2, str3); - Log.i("LicenseAuthenticator", "cancelInAppContentSubscription() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - i = cancelInAppContentSubscription; - } catch (RemoteException e) { - Log.e("InAppPurchasor", "Error getting content offers from remote service", e); - i = 106; - Log.i("LicenseAuthenticator", "cancelInAppContentSubscription() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - } - } finally { - Log.i("LicenseAuthenticator", "cancelInAppContentSubscription() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - i = 101; - Log.i("LicenseAuthenticator", "cancelInAppContentSubscription() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - return i; - } - - public synchronized InAppContentOffers getInAppContentOffer(String str, String str2) { - Throwable th; - InAppContentOffers inAppContentOffers; - Log.i("InAppPurchasor", "begin getInAppContentOffer()"); - if (str != null) { - try { - if (!str.equals("") && str2 != null && !str2.equals("")) { - int validateService = this.serviceManager.validateService(); - if (validateService != 0) { - inAppContentOffers = new InAppContentOffers(); - inAppContentOffers.result = validateService; - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } else { - try { - InAppContentOffers convertGetInAppContentOfferResult = this.apiUtils.convertGetInAppContentOfferResult(IVCastInAppService.Stub.asInterface(this.serviceManager.getServiceBinder()).getInAppContentOffer(str, str2)); - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - inAppContentOffers = convertGetInAppContentOfferResult; - } catch (RemoteException e) { - Log.e("InAppPurchasor", "Error getting content offers from remote service", e); - inAppContentOffers = new InAppContentOffers(); - inAppContentOffers.result = 101; - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - } - } catch (Throwable th2) { - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - inAppContentOffers = new InAppContentOffers(); - try { - inAppContentOffers.result = 101; - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } catch (Throwable th3) { - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - return inAppContentOffers; - } - - public synchronized InAppContents getInAppContents(String str, DiscoveryParameters discoveryParameters) { - Throwable th; - InAppContents inAppContents; - Log.i("InAppPurchasor", "begin getInAppContents()"); - if (str != null) { - try { - if (!str.equals("") && discoveryParameters != null) { - int validateService = this.serviceManager.validateService(); - if (validateService != 0) { - inAppContents = new InAppContents(); - inAppContents.result = Integer.valueOf(validateService); - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } else { - IVCastInAppService asInterface = IVCastInAppService.Stub.asInterface(this.serviceManager.getServiceBinder()); - try { - InAppContents convertGetInAppContentsResult = this.apiUtils.convertGetInAppContentsResult(asInterface.getInAppContents(str, this.apiUtils.convertDiscoveryParameters(discoveryParameters))); - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - inAppContents = convertGetInAppContentsResult; - } catch (RemoteException e) { - Log.e("InAppPurchasor", "Error getting content offers from remote service", e); - inAppContents = new InAppContents(); - inAppContents.result = 101; - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - } - } catch (Throwable th2) { - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - inAppContents = new InAppContents(); - try { - inAppContents.result = 101; - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } catch (Throwable th3) { - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - return inAppContents; - } - - public synchronized PurchasedInAppContents getPurchasedInAppContents(String str, DiscoveryParameters discoveryParameters) { - Throwable th; - PurchasedInAppContents purchasedInAppContents; - Log.i("InAppPurchasor", "begin getPurchasedInAppContents()"); - if (str != null) { - try { - if (!str.equals("") && discoveryParameters != null) { - int validateService = this.serviceManager.validateService(); - if (validateService != 0) { - purchasedInAppContents = new PurchasedInAppContents(); - purchasedInAppContents.result = Integer.valueOf(validateService); - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } else { - IVCastInAppService asInterface = IVCastInAppService.Stub.asInterface(this.serviceManager.getServiceBinder()); - try { - PurchasedInAppContents convertGetPurchasedInAppContentsResult = this.apiUtils.convertGetPurchasedInAppContentsResult(asInterface.getPurchasedInAppContents(str, this.apiUtils.convertDiscoveryParameters(discoveryParameters))); - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - purchasedInAppContents = convertGetPurchasedInAppContentsResult; - } catch (RemoteException e) { - Log.e("InAppPurchasor", "Error getting content offers from remote service", e); - purchasedInAppContents = new PurchasedInAppContents(); - purchasedInAppContents.result = 101; - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - } - } catch (Throwable th2) { - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - purchasedInAppContents = new PurchasedInAppContents(); - try { - purchasedInAppContents.result = 101; - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } catch (Throwable th3) { - Log.i("LicenseAuthenticator", "getInAppContents() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - return purchasedInAppContents; - } - - /* JADX INFO: finally extract failed */ - public synchronized int purchaseInAppContent(String str, String str2, PurchaseParameters purchaseParameters) { - int i; - Log.i("InAppPurchasor", "begin PurchaseInAppContentResult()"); - if (str != null) { - try { - if (!str.equals("") && str2 != null && !str2.equals("")) { - try { - com.verizon.vcast.apps.PurchaseParameters convertPurchaseParameters = this.apiUtils.convertPurchaseParameters(purchaseParameters); - Intent intent = new Intent(); - if (this.isVcastUIEInstalled) { - intent.setComponent(new ComponentName("com.verizon.vcast.apps", "com.vzw.inapp.VZWInAppPurchase")); - } else { - intent.setComponent(new ComponentName("com.gravitymobile.app.hornbill", "com.vzw.inapp.VZWInAppPurchase")); - } - Bundle bundle = new Bundle(); - bundle.putString("keyword", str); - bundle.putString("itemID", str2); - bundle.putParcelable("purchaseParameters", convertPurchaseParameters); - intent.putExtra("purchaseInAppContentArguments", bundle); - ((Activity) this.c).startActivityForResult(intent, InAppActivity.purchaseInAppContentRequestCode); - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - this.itemIDBeingPurchased = str2; - i = 10; - } catch (Exception e) { - Log.e("InAppPurchasor", "Error intiating In App Purchase", e); - i = 106; - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - } - } - } catch (Throwable th) { - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - throw th; - } - } - i = 101; - Log.i("LicenseAuthenticator", "getInAppContentOffer() finished. Trying to shutDownRemoteService()"); - this.serviceManager.shutDownRemoteService(this.c); - return i; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/InAppPurchasorInternal.java b/app/src/main/java/com/verizon/vcast/apps/InAppPurchasorInternal.java deleted file mode 100644 index 0d9977b..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/InAppPurchasorInternal.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.verizon.vcast.apps; - -import android.content.Context; -import android.content.pm.PackageManager; -import android.util.Log; - -public class InAppPurchasorInternal { - protected static final String ODP_INTENT_CLASSNAME = "com.verizon.vcast.apps.VCastInAppService"; - protected static final String ODP_PURCHASE_CLASSNAME = "com.vzw.inapp.VZWInAppPurchase"; - protected static final String TAG = "InAppPurchasor"; - protected static final String VCAST_GM_ODP_IDENTIFIER = "com.gravitymobile.app.hornbill"; - protected static final String VCAST_UIE_ODP_IDENTIFIER = "com.verizon.vcast.apps"; - protected APIUtils apiUtils; - protected Context c; - protected boolean isVcastGMInstalled; - protected boolean isVcastUIEInstalled; - public String itemIDBeingPurchased; - protected RemoteServiceManager serviceManager; - - /* access modifiers changed from: protected */ - public boolean isOdpInstalled(String str) { - boolean z = false; - try { - this.c.getPackageManager().getApplicationInfo(str, 8192); - z = true; - Log.i(TAG, String.valueOf(str) + " is installed"); - return true; - } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, String.valueOf(str) + " is not installed"); - return z; - } - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/Item.java b/app/src/main/java/com/verizon/vcast/apps/Item.java deleted file mode 100644 index c44262c..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/Item.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class Item implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.Item.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public Item createFromParcel(Parcel parcel) { - return new Item(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public Item[] newArray(int i) { - return new Item[i]; - } - }; - public String ageRating; - public String itemDescription; - public String itemID; - public String itemName; - - public Item() { - } - - private Item(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ Item(Parcel parcel, Item item) { - this(parcel); - } - - public int describeContents() { - return 0; - } - - public void readFromParcel(Parcel parcel) { - this.ageRating = parcel.readString(); - this.itemDescription = parcel.readString(); - this.itemID = parcel.readString(); - this.itemName = parcel.readString(); - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeString(this.ageRating); - parcel.writeString(this.itemDescription); - parcel.writeString(this.itemID); - parcel.writeString(this.itemName); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticator.java b/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticator.java deleted file mode 100644 index d0e1f4e..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticator.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.verizon.vcast.apps; - -import android.content.Context; -import android.util.Log; - -public final class LicenseAuthenticator extends LicenseAuthenticatorInternal { - public static final int ERROR_CONTENT_HANDLER = 100; - public static final int ERROR_GENERAL = 106; - public static final int ERROR_ILLEGAL_ARGUMENT = 101; - public static final int ERROR_SECURITY = 102; - public static final int ERROR_UNABLE_TO_CONNECT_TO_CDS = 107; - public static final int ITEM_NOT_FOUND = 51; - public static final int ITEM_USE_BLOCKED = 60; - public static final int LICENSE_NOT_FOUND = 52; - public static final int LICENSE_OK = 0; - public static final int LICENSE_TRIAL_OK = 1; - public static final int LICENSE_VALIDATION_FAILED = 50; - - public class CheckLicenseResult { - public String license; - public Integer result; - - public CheckLicenseResult() { - } - - public String getLicense() { - return this.license; - } - - public Integer getResult() { - return this.result; - } - - /* access modifiers changed from: package-private */ - public void setLicense(String str) { - this.license = str; - } - - /* access modifiers changed from: package-private */ - public void setResult(Integer num) { - this.result = num; - } - - public String toString() { - return "result code:" + this.result + ", license:" + this.license; - } - } - - public LicenseAuthenticator(Context context) { - callingContext = context; - } - - public synchronized CheckLicenseResult checkContentLicense(String str) { - return checkInAppContentLicense(str, null); - } - - public synchronized CheckLicenseResult checkContentLicense(String str, boolean z) { - return checkInAppContentLicense(str, null, z); - } - - public synchronized CheckLicenseResult checkInAppContentLicense(String str, String str2) { - return checkInAppContentLicense(str, str2, false); - } - - public synchronized CheckLicenseResult checkInAppContentLicense(String str, String str2, boolean z) { - CheckLicenseResult checkLicenseResult; - Log.i("LicenseAuthenticator", "begin checkLicense()"); - checkLicenseResult = new CheckLicenseResult(); - String str3 = null; - if (str != null) { - try { - if (!str.equals("")) { - boolean isOdpInstalled = isOdpInstalled("com.vzw.appstore.android"); - boolean z2 = false; - if (isOdpInstalled("com.gravitymobile.app.hornbill")) { - z2 = true; - str3 = "com.gravitymobile.app.hornbill"; - } - if (isOdpInstalled("com.verizon.vcast.apps")) { - z2 = true; - str3 = "com.verizon.vcast.apps"; - } - if (isEmaKeyword(str) && !isOdpInstalled) { - checkLicenseResult.setResult(100); - } else if (isEmaKeyword(str) && isOdpInstalled) { - checkLicenseResult = checkLicenseInternal("com.vzw.appstore.android", "com.verizon.vcast.apps.VCastAppsLicenseService", str, str2, z, checkLicenseResult); - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - } else if (!isEmaKeyword(str)) { - if (isOdpInstalled) { - CheckLicenseResult checkLicenseInternal = checkLicenseInternal("com.vzw.appstore.android", "com.verizon.vcast.apps.VCastAppsLicenseService", str, str2, z, checkLicenseResult); - if (checkLicenseInternal.getResult().intValue() == 0 || checkLicenseInternal.getResult().intValue() == 1 || !z2) { - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - checkLicenseResult = checkLicenseInternal; - } else { - shutDownLicenseService(); - } - } - if (z2) { - checkLicenseResult = checkLicenseInternal(str3, "com.verizon.vcast.apps.VCastAppsLicenseService", str, str2, z, checkLicenseResult); - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - } else { - checkLicenseResult.setResult(100); - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - } - } else { - checkLicenseResult.setResult(106); - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - } - } - } finally { - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - } - } - checkLicenseResult.setResult(101); - Log.i("LicenseAuthenticator", "checkLicense() finished. Trying to shutDownLicenseService()"); - shutDownLicenseService(); - return checkLicenseResult; - } - - public synchronized int checkLicense(String str) { - new CheckLicenseResult(); - return checkContentLicense(str).result.intValue(); - } - - public synchronized int checkLicense(String str, boolean z) { - new CheckLicenseResult(); - return checkContentLicense(str, z).result.intValue(); - } - - public CheckLicenseResult checkTestContentLicense(String str, CheckLicenseResult checkLicenseResult) { - return checkLicenseResult; - } - - public CheckLicenseResult checkTestInAppContentLicense(String str, String str2, CheckLicenseResult checkLicenseResult) { - return checkLicenseResult; - } - - public int checkTestLicense(String str, int i) { - return i; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticatorInternal.java b/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticatorInternal.java deleted file mode 100644 index 5a36add..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/LicenseAuthenticatorInternal.java +++ /dev/null @@ -1,606 +0,0 @@ -package com.verizon.vcast.apps; - -import android.content.ComponentName; -import android.content.Context; -import android.content.ServiceConnection; -import android.content.pm.PackageManager; -import android.os.IBinder; -import android.os.RemoteException; -import android.telephony.TelephonyManager; -import android.util.Log; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.TimeZone; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -public class LicenseAuthenticatorInternal { - protected static final String EMA_KEYWORD_PREFIX = "ema_"; - private static final int EMA_LICENSE_SIGNATURE_LENGTH = 172; - protected static final String EMA_ODP_IDENTIFIER = "com.vzw.appstore.android"; - protected static final int LICENSE_SERVICE_STARTED = -1; - private static final byte ODP_ERROR_GENERAL = 3; - private static final byte ODP_ERROR_ITEM_NOT_FOUND = 1; - private static final byte ODP_ERROR_ITEM_USE_BLOCKED = 5; - private static final byte ODP_ERROR_LICENSE_VALIDATION_FAILED = 2; - protected static final String ODP_INTENT_CLASSNAME = "com.verizon.vcast.apps.VCastAppsLicenseService"; - private static final int ODP_TYPE_EMA = 1; - private static final int ODP_TYPE_VCAST = 0; - protected static final String TAG = LicenseAuthenticator.class.getSimpleName(); - protected static final String VCAST_GM_ODP_IDENTIFIER = "com.gravitymobile.app.hornbill"; - private static final int VCAST_LICENSE_SIGNATURE_LENGTH = 128; - protected static final String VCAST_UIE_ODP_IDENTIFIER = "com.verizon.vcast.apps"; - protected static Context callingContext = null; - private volatile DatabaseHelper db = null; - List inAppLicenses = null; - private int indexOfInApp; - private volatile Object initLock = new Object(); - protected volatile IVCastAppsLicenseService licenseService = null; - protected volatile LicenseServiceConnection licenseServiceConnection; - private volatile boolean serviceStarted = false; - - /* access modifiers changed from: private */ - public class LicenseServiceConnection implements ServiceConnection { - private LicenseServiceConnection() { - } - - /* synthetic */ LicenseServiceConnection(LicenseAuthenticatorInternal licenseAuthenticatorInternal, LicenseServiceConnection licenseServiceConnection) { - this(); - } - - public void onServiceConnected(ComponentName componentName, IBinder iBinder) { - LicenseAuthenticatorInternal.this.licenseService = IVCastAppsLicenseService.Stub.asInterface(iBinder); - synchronized (LicenseAuthenticatorInternal.this.initLock) { - LicenseAuthenticatorInternal.this.initLock.notifyAll(); - } - } - - public void onServiceDisconnected(ComponentName componentName) { - LicenseAuthenticatorInternal.this.licenseService = null; - LicenseAuthenticatorInternal.this.licenseServiceConnection = null; - synchronized (LicenseAuthenticatorInternal.this.initLock) { - LicenseAuthenticatorInternal.this.initLock.notifyAll(); - } - } - } - - private long convertToLong(String str) { - int i; - int i2; - int i3; - int i4; - int i5; - int i6; - try { - int indexOf = str.indexOf("-"); - i = Integer.parseInt(str.substring(0, indexOf)); - int i7 = indexOf + 1; - int indexOf2 = str.indexOf("-", indexOf + 1); - i2 = Integer.parseInt(str.substring(i7, indexOf2)) - 1; - int i8 = indexOf2 + 1; - int indexOf3 = str.indexOf("T", indexOf2 + 1); - i3 = Integer.parseInt(str.substring(i8, indexOf3)); - int i9 = indexOf3 + 1; - int indexOf4 = str.indexOf(":", indexOf3 + 1); - i4 = Integer.parseInt(str.substring(i9, indexOf4)); - int i10 = indexOf4 + 1; - int indexOf5 = str.indexOf(":", indexOf4 + 1); - i5 = Integer.parseInt(str.substring(i10, indexOf5)); - i6 = Integer.parseInt(str.substring(indexOf5 + 1)); - } catch (Exception e) { - i = 1970; - i2 = 0; - i3 = 1; - i4 = 0; - i5 = 0; - i6 = 0; - } - Calendar instance = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - instance.set(Calendar.YEAR, i); - instance.set(Calendar.MONTH, i2); - instance.set(Calendar.DAY_OF_MONTH, i3); - instance.set(Calendar.HOUR_OF_DAY, i4); - instance.set(Calendar.MINUTE, i5); - instance.set(Calendar.SECOND, i6); - return instance.getTime().getTime(); - } - - private long getBestCurrentTime() { - long currentTimeMillis = System.currentTimeMillis(); - long savedNetworkTime = getSavedNetworkTime(); - return savedNetworkTime > currentTimeMillis ? savedNetworkTime : currentTimeMillis; - } - - private List getChildByName(Node node, String str) { - ArrayList arrayList = new ArrayList(); - NodeList childNodes = node.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node item = childNodes.item(i); - if (item.getNodeName().equals(str)) { - arrayList.add(item); - } - } - return arrayList; - } - - private int getErrorCode(byte[] bArr) { - switch (bArr[0]) { - case 1: - return 51; - case 2: - return 52; - case 3: - return 107; - case 4: - default: - return 106; - case 5: - return 60; - } - } - - private String getMDN() { - TelephonyManager telephonyManager = (TelephonyManager) callingContext.getSystemService(Context.TELEPHONY_SERVICE); - int phoneType = telephonyManager.getPhoneType(); - switch (phoneType) { - case 1: - case 2: - return telephonyManager.getLine1Number(); - default: - Log.i("VZWLicense", "LicenseAuthenticator.getMDN(): Unsupported phoneType " + phoneType); - return null; - } - } - - private String getMEID() { - TelephonyManager telephonyManager = (TelephonyManager) callingContext.getSystemService(Context.TELEPHONY_SERVICE); - int phoneType = telephonyManager.getPhoneType(); - switch (phoneType) { - case 1: - case 2: - return telephonyManager.getDeviceId(); - default: - Log.i("VZWLicense", "LicenseAuthenticator.getMEID(): Unsupported phoneType " + phoneType); - return null; - } - } - - private String getMapValue(String str, String str2) { - try { - int indexOf = str2.indexOf("<" + str + ">") + 2 + str.length(); - int indexOf2 = str2.indexOf(""); - if (indexOf < 0 || indexOf2 < 0) { - return null; - } - return str2.substring(indexOf, indexOf2); - } catch (Exception e) { - return null; - } - } - - private long getSavedNetworkTime() { - Long l = 0L; - if (this.db == null) { - this.db = new DatabaseHelper(LicenseAuthenticator.callingContext); - } - try { - Iterator it = this.db.selectAll().iterator(); - if (it.hasNext()) { - l = Long.valueOf(Long.parseLong(it.next())); - } - } catch (Throwable th) { - System.err.print(th); - th.printStackTrace(); - } - Log.d("VZWLicense", "getSavedNetworkTime()=" + Long.toString(l)); - return l; - } - - private boolean isEmaSource(String str) { - return str.contains("") && getMapValue("Source", str).equalsIgnoreCase("EMA"); - } - - private boolean isSignatureValid(byte[] bArr, byte[] bArr2, int i) { - VzwRSAKyParam vzwRSAKyParam = null; - Log.i(TAG, "Validating Signature"); - if (i == 1) { - try { - vzwRSAKyParam = new VzwRSAKyParam(false, new VzwBigInt("107493806210625235577865383583966213583203769054180884203670357027270028071413938146414253505380813234565169065101353106586121476194778366775987951307055104758706320089544509318953312117460811040627008525057894596490834350638622651605940563447702952001450779562939078801196325903274126043191010876664350998971"), new VzwBigInt("65537")); - } catch (Exception e) { - return false; - } - } else { - vzwRSAKyParam = new VzwRSAKyParam(false, new VzwBigInt("113751985209425220389904911573418596054906626841732881629605928013581871729424978229159252758527107263930688983674762647850445576382155543169643622580638253014102297871653770954828091210266102863696922720690032125039249372686528361690969551775463749111601961827967139084754353180300766686096391389069084141699"), new VzwBigInt("65537")); - } - VzwPKCS1Encd vzwPKCS1Encd = new VzwPKCS1Encd(new VzwRSAEng()); - vzwPKCS1Encd.init(false, vzwRSAKyParam); - byte[] processBlock = new byte[0]; - try { - processBlock = vzwPKCS1Encd.processBlock(bArr, 0, bArr.length); - } catch (Exception e) { - e.printStackTrace(); - } - VzwSHA vzwSHA = new VzwSHA(); - byte[] bArr3 = new byte[20]; - vzwSHA.update(bArr2, 0, bArr2.length); - vzwSHA.doFinal(bArr3, 0); - if (processBlock.length == 20) { - for (int i2 = 0; i2 < bArr3.length; i2++) { - if (bArr3[i2] != processBlock[i2]) { - Log.e(TAG, "Signature Validation Failed"); - return false; - } - } - Log.i(TAG, "Signature Validation Passed"); - return true; - } - Log.e(TAG, "Signature Validation Failed"); - return false; - } - - private int validateLicense(Node node, String str, String str2) throws Exception { - String str3 = null; - String str4 = null; - String str5 = null; - String str6 = null; - String str7 = null; - String str8 = null; - String str9 = null; - String str10 = null; - boolean z = false; - boolean z2 = false; - long j = 0; - long j2 = 0; - long j3 = 0; - NodeList childNodes = node.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - try { - Node item = childNodes.item(i); - String nodeName = item.getNodeName(); - if (nodeName.equals("MDN")) { - str3 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("MEID")) { - str4 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("UniqueDeviceId")) { - str10 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("IsLocked")) { - z = Boolean.parseBoolean(item.getFirstChild().getNodeValue()); - } else if (nodeName.equals("IsSubscriptionExpired")) { - str5 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("IsLimitedTimeExpired")) { - str6 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("IsPurchaseRequired")) { - str7 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("Keyword")) { - str8 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("PriceType")) { - str9 = item.getFirstChild().getNodeValue(); - } else if (nodeName.equals("IssueTime")) { - j = convertToLong(item.getFirstChild().getNodeValue()); - } else if (nodeName.equals("NextCheckTime")) { - j2 = convertToLong(item.getFirstChild().getNodeValue()); - } else if (nodeName.equals("PurchaseDate")) { - j3 = convertToLong(item.getFirstChild().getNodeValue()); - } - } catch (Exception e) { - Log.e(TAG, "Cannot fetch:" + ((String) null) + "from license."); - } - } - if (str9.equalsIgnoreCase("Subscription")) { - if (!str5.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Subscription Expired"); - return 50; - } else if (!str7.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Purchase is Required"); - return 50; - } - } else if (str9.equalsIgnoreCase("Per Period")) { - if (!str6.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Limited Time Expired"); - return 50; - } else if (!str7.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Purchase is Required"); - return 50; - } - } else if (str9.equalsIgnoreCase("First Download") || str9.equalsIgnoreCase("Free")) { - if (!str7.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Purchase is Required"); - return 50; - } - } else if (str9.equalsIgnoreCase("Trial Period")) { - z2 = true; - if (!str6.equalsIgnoreCase("FALSE")) { - Log.e(TAG, "License Validation Failed: Limited Time Expired"); - return 50; - } - } - String mdn = getMDN(); - String meid = getMEID(); - if (!str3.equalsIgnoreCase(mdn)) { - Log.e(TAG, "License Validation Failed: MDN from license (" + str3 + ") does not match MDN of device (" + mdn + ")"); - return 50; - } - if (str2.equals(EMA_ODP_IDENTIFIER)) { - if (str4 != null && !str4.equalsIgnoreCase(meid)) { - Log.e(TAG, "License Validation Failed: MEID from license (" + str4 + ") does not match MEID of device (" + meid + ")"); - return 50; - } else if (str10 != null && !str10.equalsIgnoreCase(meid)) { - Log.e(TAG, "License Validation Failed: UniqueDeviceId from license (" + str4 + ") does not match MEID of device (" + meid + ")"); - return 50; - } - } - if (str != null && !str8.equalsIgnoreCase(str)) { - Log.e(TAG, "License Validation Failed: Keyword from license (" + str8 + ") does not match keyword (" + str + ")"); - return 50; - } else if (z) { - Log.e(TAG, "License Validation Failed: The app is 'Remote Blocked'"); - return 50; - } else { - long bestCurrentTime = getBestCurrentTime(); - if (bestCurrentTime < j) { - Log.e(TAG, "License Validation Failed: CurrentTime < LastIssueTime. CurrentTime: " + bestCurrentTime + ", LastIssueTime: " + j); - return 50; - } else if (bestCurrentTime < j3) { - Log.e(TAG, "License Validation Failed: CurrentTime < PurchaseDate. CurrentTime: " + bestCurrentTime + ", PurchaseDate: " + j3); - return 50; - } else if (bestCurrentTime > j2) { - Log.e(TAG, "License Validation Failed: CurrentTime > NextCheckTime. CurrentTime: " + bestCurrentTime + ", NextCheckTime: " + j2); - return 50; - } else if (z2) { - Log.e(TAG, "License Validation OK: LICENSE_TRIAL_OK"); - return 1; - } else { - Log.i(TAG, "License Validation OK: LICENSE_OK"); - return 0; - } - } - } - - /* access modifiers changed from: protected */ - public LicenseAuthenticator.CheckLicenseResult checkLicenseInternal(String str, String str2, String str3, String str4, boolean z, LicenseAuthenticator.CheckLicenseResult checkLicenseResult) { - byte[] bArr = null; - int initLicenseService = initLicenseService(str, str2); - if (initLicenseService == -1) { - initLicenseService = 106; - try { - long time = new Date().getTime(); - if (!z || str != EMA_ODP_IDENTIFIER) { - Log.d(TAG, "Calling getLicense() with: keyword=" + str3); - bArr = this.licenseService.getLicense(str3); - } else { - Log.d(TAG, "Calling getRemoteLicense() with: keyword=" + str3 + ", isRemoteLockEnabled=" + z); - bArr = this.licenseService.getRemoteLicense(str3, z); - } - Log.d(TAG, "getRemoteLicense() took " + (new Date().getTime() - time) + " milliseconds and returned:" + new String(bArr)); - checkLicenseResult.setLicense(new String(bArr)); - } catch (RemoteException e) { - Log.e("LicenseAuthenticator", "Error fetching license from remote service", e); - initLicenseService = 100; - } - try { - saveNetworkTime(); - initLicenseService = validateLicense(bArr, str3, str4, str); - } catch (RemoteException e2) { - checkLicenseResult.setResult(107); - } catch (Exception e3) { - Log.e("LicenseAuthenticator", "General failure", e3); - } - } - checkLicenseResult.setResult(Integer.valueOf(initLicenseService)); - if (str4 != null) { - try { - this.inAppLicenses = getInAppLicenses(new String(bArr)); - checkLicenseResult.setLicense(this.inAppLicenses.get(this.indexOfInApp)); - } catch (Exception e4) { - Log.e(TAG, "Failed to extract in app specific license", e4); - } - } - return checkLicenseResult; - } - - /* access modifiers changed from: protected */ - public void cleanupDB() { - if (this.db != null) { - this.db.cleanup(); - this.db = null; - } - } - - public List getInAppLicenses(String str) { - int indexOf = str.indexOf(""); - if (indexOf == -1) { - return null; - } - ArrayList arrayList = new ArrayList(); - int i = indexOf; - while (str.indexOf("", i) != -1) { - int indexOf2 = str.indexOf("", i); - int indexOf3 = str.indexOf("", indexOf2); - arrayList.add(str.substring(indexOf2, indexOf3 + 8)); - i = indexOf3; - } - return arrayList; - } - - /* access modifiers changed from: protected */ - /* JADX WARNING: Code restructure failed: missing block: B:33:0x0094, code lost: - r3 = move-exception; - */ - /* JADX WARNING: Code restructure failed: missing block: B:34:0x0095, code lost: - android.util.Log.e("LicenseAuthenticator", "Security error connecting to remote service", r3); - android.util.Log.e("LicenseAuthenticator", "Likely cause: missing service permission. Required permissions:", r3); - android.util.Log.e("LicenseAuthenticator", " android.permission.READ_PHONE_STATE"); - android.util.Log.e("LicenseAuthenticator", " android.permission.START_BACKGROUND_SERVICE"); - android.util.Log.e("LicenseAuthenticator", " com.verizon.vcast.apps.VCAST_APPS_LICENSE_SERVICE"); - android.util.Log.e("LicenseAuthenticator", " com.verizon.vcast.apps.ACCESS_NETWORK_STATE"); - android.util.Log.e("LicenseAuthenticator", " android.permission.INTERNET"); - android.util.Log.e("LicenseAuthenticator", " com.vzw.appstore.android.permission"); - */ - /* JADX WARNING: Code restructure failed: missing block: B:35:0x00d1, code lost: - r0 = move-exception; - */ - /* JADX WARNING: Code restructure failed: missing block: B:36:0x00d2, code lost: - android.util.Log.e("LicenseAuthenticator", "initting license service failed", r0); - */ - /* JADX WARNING: Code restructure failed: missing block: B:46:?, code lost: - return 102; - */ - /* JADX WARNING: Code restructure failed: missing block: B:47:?, code lost: - return 106; - */ - /* JADX WARNING: Failed to process nested try/catch */ - /* JADX WARNING: Removed duplicated region for block: B:33:0x0094 A[ExcHandler: SecurityException (r3v0 'e' java.lang.SecurityException A[CUSTOM_DECLARE]), Splitter:B:8:0x0032] */ - /* Code decompiled incorrectly, please refer to instructions dump. */ - public int initLicenseService(java.lang.String r13, java.lang.String r14) throws java.lang.SecurityException { - /* - // Method dump skipped, instructions count: 234 - */ - throw new UnsupportedOperationException("Method not decompiled: com.verizon.vcast.apps.LicenseAuthenticatorInternal.initLicenseService(java.lang.String, java.lang.String):int"); - } - - /* access modifiers changed from: protected */ - public boolean isEmaKeyword(String str) { - boolean z = str.startsWith(EMA_KEYWORD_PREFIX) && str.split("[_]").length > 2; - Log.i(TAG, "isKeyWord: " + str); - return z; - } - - /* access modifiers changed from: protected */ - public boolean isOdpInstalled(String str) { - boolean z = false; - try { - callingContext.getPackageManager().getApplicationInfo(str, PackageManager.GET_UNINSTALLED_PACKAGES); - z = true; - Log.i(TAG, String.valueOf(str) + " is installed"); - return true; - } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, String.valueOf(str) + " is not installed"); - return z; - } - } - - /* access modifiers changed from: protected */ - public void saveNetworkTime() throws RemoteException { - long currentTimeMillis = System.currentTimeMillis(); - try { - currentTimeMillis = this.licenseService.getTime(); - } catch (RemoteException e) { - Log.e("LicenseAuthenticator", "Error fetching network time from remote service", e); - } - if (currentTimeMillis == -1) { - Log.e("LicenseAuthenticator", "Failure to fetch network time from CDS servers"); - throw new RemoteException(); - } - long j = 0; - if (this.db == null) { - this.db = new DatabaseHelper(LicenseAuthenticator.callingContext); - } - try { - long savedNetworkTime = getSavedNetworkTime(); - j = currentTimeMillis > savedNetworkTime ? currentTimeMillis : savedNetworkTime; - if (j != savedNetworkTime) { - this.db.deleteAll(); - this.db.insert(Long.toString(j)); - } - } catch (Throwable th) { - Log.e("LicenseAuthenticator", "Error saving network time to Database", th); - } - Log.d("VZWLicense", "saveNetworkTime()=" + Long.toString(j)); - } - - public void shutDownLicenseService() { - Log.i(TAG, "shutDownLicenseService()"); - cleanupDB(); - try { - if (this.licenseServiceConnection != null) { - callingContext.unbindService(this.licenseServiceConnection); - this.licenseServiceConnection = null; - this.serviceStarted = false; - } - } catch (Exception e) { - Log.e(TAG, "Failed to shutdown license service.", e); - } - } - - /* access modifiers changed from: protected */ - public int validateLicense(byte[] bArr, String str, String str2, String str3) throws SecurityException { - int i; - byte[] bArr2; - byte[] bArr3; - Log.d(TAG, "License XML: [" + new String(bArr) + "]"); - if (bArr.length == 1) { - return getErrorCode(bArr); - } - try { - if (isEmaSource(new String(bArr))) { - i = 1; - bArr2 = new byte[(bArr.length - 172)]; - bArr3 = new byte[EMA_LICENSE_SIGNATURE_LENGTH]; - } else { - i = 0; - bArr2 = new byte[(bArr.length - 128)]; - bArr3 = new byte[128]; - } - System.arraycopy(bArr, 0, bArr2, 0, bArr2.length); - System.arraycopy(bArr, bArr2.length, bArr3, 0, bArr3.length); - if (!isSignatureValid(bArr3, bArr2, i)) { - Log.e(TAG, "License Validation Failed: license signature is not valid"); - return 50; - } - DocumentBuilder newDocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource inputSource = new InputSource(); - inputSource.setCharacterStream(new StringReader(new String(bArr2))); - NodeList elementsByTagName = newDocumentBuilder.parse(inputSource).getElementsByTagName("License"); - if (elementsByTagName == null) { - Log.e(TAG, "License Validation Failed: License element not found in license xml."); - return 50; - } else if (str2 == null) { - return validateLicense(elementsByTagName.item(0), str, str3); - } else { - Node item = elementsByTagName.item(0); - if (item == null) { - Log.e(TAG, "License Validation Failed: License element not found in license xml."); - return 50; - } - List childByName = getChildByName(item, "InAppList"); - if (childByName == null || childByName.size() == 0) { - Log.e(TAG, "License Validation Failed: InAppList element not found in license xml."); - return 50; - } - List childByName2 = getChildByName(childByName.get(0), "InApp"); - for (int i2 = 0; i2 < childByName2.size(); i2++) { - List childByName3 = getChildByName(childByName2.get(i2), "InAppSKU"); - if (childByName3.size() != 0 && childByName3.get(0).getFirstChild().getNodeValue().equals(str2)) { - this.indexOfInApp = i2; - return validateLicense(childByName2.get(i2), null, str3); - } - } - Log.e(TAG, "License Validation Failed: General failure"); - return 50; - } - } catch (SecurityException e) { - Log.e("LicenseAuthenticator", "Security error connecting to remote service", e); - Log.e("LicenseAuthenticator", "Likely cause: missing service permission. Required permissions:", e); - Log.e("LicenseAuthenticator", " android.permission.READ_PHONE_STATE", e); - Log.e("LicenseAuthenticator", " android.permission.START_BACKGROUND_SERVICE", e); - Log.e("LicenseAuthenticator", " com.verizon.vcast.apps.VCAST_APPS_LICENSE_SERVICE", e); - Log.e("LicenseAuthenticator", " com.verizon.vcast.apps.ACCESS_NETWORK_STATE", e); - Log.e("LicenseAuthenticator", " android.permission.INTERNET", e); - Log.e("LicenseAuthenticator", " com.vzw.appstore.android.permission", e); - return 102; - } catch (Exception e2) { - Log.e("LicenseAuthenticator", "General failure", e2); - return 106; - } - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/Offer.java b/app/src/main/java/com/verizon/vcast/apps/Offer.java deleted file mode 100644 index e5c5a44..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/Offer.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class Offer implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.Offer.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public Offer createFromParcel(Parcel parcel) { - return new Offer(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public Offer[] newArray(int i) { - return new Offer[i]; - } - }; - public float maxPrice; - public float minPrice; - public String offerID; - public String priceLine; - public String priceType; - public String pricingTerms; - - public Offer() { - } - - private Offer(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ Offer(Parcel parcel, Offer offer) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - this.maxPrice = parcel.readFloat(); - this.minPrice = parcel.readFloat(); - this.offerID = parcel.readString(); - this.priceLine = parcel.readString(); - this.priceType = parcel.readString(); - this.pricingTerms = parcel.readString(); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeFloat(this.maxPrice); - parcel.writeFloat(this.minPrice); - parcel.writeString(this.offerID); - parcel.writeString(this.priceLine); - parcel.writeString(this.priceType); - parcel.writeString(this.pricingTerms); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/Purchase.java b/app/src/main/java/com/verizon/vcast/apps/Purchase.java deleted file mode 100644 index 24a7e06..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/Purchase.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; -import java.util.Date; - -public class Purchase implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.Purchase.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public Purchase createFromParcel(Parcel parcel) { - return new Purchase(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public Purchase[] newArray(int i) { - return new Purchase[i]; - } - }; - public String inAppName; - public Item item; - public float price; - public String priceLine; - public String priceType; - public String pricingTerms; - public Date purchaseDate; - public String purchaseID; - public String sku; - - public Purchase() { - } - - private Purchase(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ Purchase(Parcel parcel, Purchase purchase) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - this.inAppName = parcel.readString(); - this.item = (Item) parcel.readValue(Item.class.getClassLoader()); - this.priceLine = parcel.readString(); - this.priceType = parcel.readString(); - this.pricingTerms = parcel.readString(); - this.purchaseID = parcel.readString(); - this.sku = parcel.readString(); - this.price = parcel.readFloat(); - this.purchaseDate = new Date(); - this.purchaseDate.setTime(parcel.readLong()); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeString(this.inAppName); - parcel.writeValue(this.item); - parcel.writeString(this.priceLine); - parcel.writeString(this.priceType); - parcel.writeString(this.pricingTerms); - parcel.writeString(this.purchaseID); - parcel.writeString(this.sku); - parcel.writeFloat(this.price); - parcel.writeLong(this.purchaseDate.getTime()); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/PurchaseInAppContentResult.java b/app/src/main/java/com/verizon/vcast/apps/PurchaseInAppContentResult.java deleted file mode 100644 index 39b6f7d..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/PurchaseInAppContentResult.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class PurchaseInAppContentResult implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.PurchaseInAppContentResult.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public PurchaseInAppContentResult createFromParcel(Parcel parcel) { - return new PurchaseInAppContentResult(parcel); - } - - @Override // android.os.Parcelable.Creator - public PurchaseInAppContentResult[] newArray(int i) { - return new PurchaseInAppContentResult[i]; - } - }; - public String license; - public String purchaseID; - public Integer result; - - public PurchaseInAppContentResult() { - } - - public PurchaseInAppContentResult(Parcel parcel) { - readFromParcel(parcel); - } - - private void readFromParcel(Parcel parcel) { - this.license = parcel.readString(); - this.purchaseID = parcel.readString(); - this.result = Integer.valueOf(parcel.readInt()); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeString(this.license); - parcel.writeString(this.purchaseID); - parcel.writeInt(this.result.intValue()); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/PurchaseParameters.java b/app/src/main/java/com/verizon/vcast/apps/PurchaseParameters.java deleted file mode 100644 index 50c5441..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/PurchaseParameters.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class PurchaseParameters implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.PurchaseParameters.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public PurchaseParameters createFromParcel(Parcel parcel) { - return new PurchaseParameters(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public PurchaseParameters[] newArray(int i) { - return new PurchaseParameters[i]; - } - }; - public Integer contentSize; - public String inAppName; - public String offerID; - public float price; - public String priceLine; - public String priceType; - public String pricingTerms; - public String sku; - - public PurchaseParameters() { - this.contentSize = 0; - } - - private PurchaseParameters(Parcel parcel) { - this.contentSize = 0; - readFromParcel(parcel); - } - - /* synthetic */ PurchaseParameters(Parcel parcel, PurchaseParameters purchaseParameters) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - this.contentSize = Integer.valueOf(parcel.readInt()); - this.inAppName = parcel.readString(); - this.offerID = parcel.readString(); - this.price = parcel.readFloat(); - this.sku = parcel.readString(); - this.priceType = parcel.readString(); - this.priceLine = parcel.readString(); - this.pricingTerms = parcel.readString(); - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeInt(this.contentSize.intValue()); - parcel.writeString(this.inAppName); - parcel.writeString(this.offerID); - parcel.writeFloat(this.price); - parcel.writeString(this.sku); - parcel.writeString(this.priceType); - parcel.writeString(this.priceLine); - parcel.writeString(this.pricingTerms); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/PurchasedInAppContents.java b/app/src/main/java/com/verizon/vcast/apps/PurchasedInAppContents.java deleted file mode 100644 index 61218a0..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/PurchasedInAppContents.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.verizon.vcast.apps; - -import android.os.Parcel; -import android.os.Parcelable; - -public class PurchasedInAppContents implements Parcelable { - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - /* class com.verizon.vcast.apps.PurchasedInAppContents.AnonymousClass1 */ - - @Override // android.os.Parcelable.Creator - public PurchasedInAppContents createFromParcel(Parcel parcel) { - return new PurchasedInAppContents(parcel, null); - } - - @Override // android.os.Parcelable.Creator - public PurchasedInAppContents[] newArray(int i) { - return new PurchasedInAppContents[i]; - } - }; - public Purchase[] purchases; - public Integer result; - public Integer totalSize; - - public PurchasedInAppContents() { - } - - private PurchasedInAppContents(Parcel parcel) { - readFromParcel(parcel); - } - - /* synthetic */ PurchasedInAppContents(Parcel parcel, PurchasedInAppContents purchasedInAppContents) { - this(parcel); - } - - private void readFromParcel(Parcel parcel) { - this.result = Integer.valueOf(parcel.readInt()); - this.totalSize = Integer.valueOf(parcel.readInt()); - Object[] readArray = parcel.readArray(Purchase.class.getClassLoader()); - this.purchases = new Purchase[readArray.length]; - for (int i = 0; i < readArray.length; i++) { - this.purchases[i] = (Purchase) readArray[i]; - } - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel parcel, int i) { - parcel.writeInt(this.result.intValue()); - parcel.writeInt(this.totalSize.intValue()); - parcel.writeArray(this.purchases); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/RemoteServiceManager.java b/app/src/main/java/com/verizon/vcast/apps/RemoteServiceManager.java deleted file mode 100644 index 9366c26..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/RemoteServiceManager.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.verizon.vcast.apps; - -import android.content.ComponentName; -import android.content.Context; -import android.content.ServiceConnection; -import android.os.IBinder; -import android.util.Log; - -public class RemoteServiceManager { - public static final int ERROR_CONTENT_HANDLER = 100; - public static final int ERROR_SECURITY = 102; - public static final String TAG = "RemoteServiceManager"; - protected Context callingContext; - private String className; - private volatile Object initLock = new Object(); - private String packageName; - protected volatile IBinder remoteServiceBinder = null; - protected volatile RemoteServiceConnection serviceConnection; - private volatile boolean serviceStarted = false; - - /* access modifiers changed from: package-private */ - public class RemoteServiceConnection implements ServiceConnection { - RemoteServiceConnection() { - } - - public void onServiceConnected(ComponentName componentName, IBinder iBinder) { - RemoteServiceManager.this.remoteServiceBinder = iBinder; - synchronized (RemoteServiceManager.this.initLock) { - RemoteServiceManager.this.initLock.notifyAll(); - } - } - - public void onServiceDisconnected(ComponentName componentName) { - RemoteServiceManager.this.remoteServiceBinder = null; - RemoteServiceManager.this.serviceConnection = null; - synchronized (RemoteServiceManager.this.initLock) { - RemoteServiceManager.this.initLock.notifyAll(); - } - } - } - - public RemoteServiceManager(Context context, String str, String str2) { - this.callingContext = context; - this.packageName = str; - this.className = str2; - } - - public IBinder getServiceBinder() { - return this.remoteServiceBinder; - } - - /* access modifiers changed from: protected */ - /* JADX WARNING: Code restructure failed: missing block: B:21:0x0077, code lost: - r3 = move-exception; - */ - /* JADX WARNING: Code restructure failed: missing block: B:22:0x0078, code lost: - throw r3; - */ - /* JADX WARNING: Code restructure failed: missing block: B:25:0x0082, code lost: - r0 = move-exception; - */ - /* JADX WARNING: Code restructure failed: missing block: B:26:0x0083, code lost: - android.util.Log.e(com.verizon.vcast.apps.RemoteServiceManager.TAG, "initializing remote service failed", r0); - */ - /* JADX WARNING: Code restructure failed: missing block: B:30:?, code lost: - return; - */ - /* JADX WARNING: Failed to process nested try/catch */ - /* JADX WARNING: Removed duplicated region for block: B:21:0x0077 A[ExcHandler: SecurityException (r3v0 'e' java.lang.SecurityException A[CUSTOM_DECLARE]), Splitter:B:2:0x0005] */ - /* Code decompiled incorrectly, please refer to instructions dump. */ - public void initRemoteService() throws java.lang.SecurityException { - /* - // Method dump skipped, instructions count: 142 - */ - throw new UnsupportedOperationException("Method not decompiled: com.verizon.vcast.apps.RemoteServiceManager.initRemoteService():void"); - } - - public void shutDownRemoteService(Context context) { - Log.i("LicenseAuthenticator", "shutDownRemoteService()"); - try { - if (this.serviceConnection != null) { - context.unbindService(this.serviceConnection); - this.serviceConnection = null; - } - } catch (Exception e) { - } - } - - public int validateService() { - if (this.remoteServiceBinder == null || this.serviceConnection == null) { - try { - initRemoteService(); - } catch (SecurityException e) { - Log.e(TAG, "Security error connecting to remote service", e); - Log.e(TAG, "Likely cause: missing service permission. Required permissions:"); - Log.e(TAG, " android.permission.READ_PHONE_STATE"); - Log.e(TAG, " android.permission.START_BACKGROUND_SERVICE"); - Log.e(TAG, " com.verizon.vcast.apps.VCAST_IN_APP_SERVICE"); - Log.e(TAG, " com.verizon.vcast.apps.ACCESS_NETWORK_STATE"); - Log.e(TAG, " android.permission.INTERNET"); - Log.e(TAG, " com.vzw.appstore.android.permission"); - return 102; - } - } - if (this.remoteServiceBinder != null && this.serviceConnection != null) { - return 0; - } - Log.e(TAG, "Failure connecting to remote service"); - return 100; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwAsymBlkCipher.java b/app/src/main/java/com/verizon/vcast/apps/VzwAsymBlkCipher.java deleted file mode 100644 index faa7cb9..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwAsymBlkCipher.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public interface VzwAsymBlkCipher { - int getInputBlockSize(); - - int getOutputBlockSize(); - - void init(boolean z, VzwRSAKyParam vzwRSAKyParam); - - byte[] processBlock(byte[] bArr, int i, int i2) throws Exception; -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwBigInt.java b/app/src/main/java/com/verizon/vcast/apps/VzwBigInt.java deleted file mode 100644 index 9f76592..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwBigInt.java +++ /dev/null @@ -1,1905 +0,0 @@ -package com.verizon.vcast.apps; - -import androidx.core.view.MotionEventCompat; -import androidx.customview.widget.ExploreByTouchHelper; -import com.ea.nimble.Global; -import com.google.android.gms.wallet.WalletConstants; -import java.util.Random; -import java.util.Stack; - -/* access modifiers changed from: package-private */ -public class VzwBigInt { - private static final int BITS_PER_BYTE = 8; - private static final int BYTES_PER_INT = 4; - private static final long IMASK = 4294967295L; - public static final VzwBigInt ONE = valueOf(1); - private static final VzwBigInt THREE = valueOf(3); - private static final VzwBigInt TWO = valueOf(2); - private static final int[] ZERO_MAGNITUDE = new int[0]; - public static final VzwBigInt ZERO = new VzwBigInt(0, ZERO_MAGNITUDE); - private static final byte[] bitCounts; - private static final int[][] primeLists = {new int[]{3, 5, 7, 11, 13, 17, 19, 23}, new int[]{29, 31, 37, 41, 43}, new int[]{47, 53, 59, 61, 67}, new int[]{71, 73, 79, 83}, new int[]{89, 97, 101, 103}, new int[]{107, 109, 113, 3}, new int[]{131, 137, 139, 149}, new int[]{151, 157, 163, 167}, new int[]{173, 179, 181, 191}, new int[]{193, 197, 199, 211}, new int[]{223, 227, 229}, new int[]{233, 239, 241}, new int[]{251, 257, 263}, new int[]{269, 271, 277}, new int[]{281, 283, 293}, new int[]{307, 311, 313}, new int[]{317, 331, 337}, new int[]{347, 349, 353}, new int[]{359, 367, 373}, new int[]{379, 383, 389}, new int[]{397, 401, WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR}, new int[]{419, 421, 431}, new int[]{433, 439, 443}, new int[]{449, 457, 461}, new int[]{463, 467, 479}, new int[]{487, 491, 499}, new int[]{503, 509, 521}, new int[]{523, 541, 547}, new int[]{557, 563, 569}, new int[]{571, 577, 587}, new int[]{593, 599, 601}, new int[]{607, 613, 617}, new int[]{619, 631, 641}, new int[]{643, 647, 653}, new int[]{659, 661, 673}, new int[]{677, 683, 691}, new int[]{701, 709, 719}, new int[]{727, 733, 739}, new int[]{743, 751, 757}, new int[]{761, 769, 773}, new int[]{787, 797, 809}, new int[]{811, 821, 823}, new int[]{827, 829, 839}, new int[]{853, 857, 859}, new int[]{863, 877, 881}, new int[]{883, 887, 907}, new int[]{911, 919, 929}, new int[]{937, 941, 947}, new int[]{953, 967, 971}, new int[]{977, 983, 991}, new int[]{997, 1009, 1013}, new int[]{1019, 1021, 1031}}; - private static int[] primeProducts = new int[primeLists.length]; - private static final byte[] rndMask = {-1, Byte.MAX_VALUE, 63, 31, 15, 7, 3, 1}; - private long mQuote; - private int[] magnitude; - private int nBitLength; - private int nBits; - private int sign; - - static { - int[] iArr; - ZERO.nBits = 0; - ZERO.nBitLength = 0; - ONE.nBits = 1; - ONE.nBitLength = 1; - TWO.nBits = 1; - TWO.nBitLength = 2; - for (int i = 0; i < primeLists.length; i++) { - int i2 = 1; - for (int i3 : primeLists[i]) { - i2 *= i3; - } - primeProducts[i] = i2; - } - byte[] bArr = new byte[256]; - bArr[1] = 1; - bArr[2] = 1; - bArr[3] = 2; - bArr[4] = 1; - bArr[5] = 2; - bArr[6] = 2; - bArr[7] = 3; - bArr[8] = 1; - bArr[9] = 2; - bArr[10] = 2; - bArr[11] = 3; - bArr[12] = 2; - bArr[13] = 3; - bArr[14] = 3; - bArr[15] = 4; - bArr[16] = 1; - bArr[17] = 2; - bArr[18] = 2; - bArr[19] = 3; - bArr[20] = 2; - bArr[21] = 3; - bArr[22] = 3; - bArr[23] = 4; - bArr[24] = 2; - bArr[25] = 3; - bArr[26] = 3; - bArr[27] = 4; - bArr[28] = 3; - bArr[29] = 4; - bArr[30] = 4; - bArr[31] = 5; - bArr[32] = 1; - bArr[33] = 2; - bArr[34] = 2; - bArr[35] = 3; - bArr[36] = 2; - bArr[37] = 3; - bArr[38] = 3; - bArr[39] = 4; - bArr[40] = 2; - bArr[41] = 3; - bArr[42] = 3; - bArr[43] = 4; - bArr[44] = 3; - bArr[45] = 4; - bArr[46] = 4; - bArr[47] = 5; - bArr[48] = 2; - bArr[49] = 3; - bArr[50] = 3; - bArr[51] = 4; - bArr[52] = 3; - bArr[53] = 4; - bArr[54] = 4; - bArr[55] = 5; - bArr[56] = 3; - bArr[57] = 4; - bArr[58] = 4; - bArr[59] = 5; - bArr[60] = 4; - bArr[61] = 5; - bArr[62] = 5; - bArr[63] = 6; - bArr[64] = 1; - bArr[65] = 2; - bArr[66] = 2; - bArr[67] = 3; - bArr[68] = 2; - bArr[69] = 3; - bArr[70] = 3; - bArr[71] = 4; - bArr[72] = 2; - bArr[73] = 3; - bArr[74] = 3; - bArr[75] = 4; - bArr[76] = 3; - bArr[77] = 4; - bArr[78] = 4; - bArr[79] = 5; - bArr[80] = 2; - bArr[81] = 3; - bArr[82] = 3; - bArr[83] = 4; - bArr[84] = 3; - bArr[85] = 4; - bArr[86] = 4; - bArr[87] = 5; - bArr[88] = 3; - bArr[89] = 4; - bArr[90] = 4; - bArr[91] = 5; - bArr[92] = 4; - bArr[93] = 5; - bArr[94] = 5; - bArr[95] = 6; - bArr[96] = 2; - bArr[97] = 3; - bArr[98] = 3; - bArr[99] = 4; - bArr[100] = 3; - bArr[101] = 4; - bArr[102] = 4; - bArr[103] = 5; - bArr[104] = 3; - bArr[105] = 4; - bArr[106] = 4; - bArr[107] = 5; - bArr[108] = 4; - bArr[109] = 5; - bArr[110] = 5; - bArr[111] = 6; - bArr[112] = 3; - bArr[113] = 4; - bArr[114] = 4; - bArr[115] = 5; - bArr[116] = 4; - bArr[117] = 5; - bArr[118] = 5; - bArr[119] = 6; - bArr[120] = 4; - bArr[121] = 5; - bArr[122] = 5; - bArr[123] = 6; - bArr[124] = 5; - bArr[125] = 6; - bArr[126] = 6; - bArr[127] = 7; - bArr[128] = 1; - bArr[129] = 2; - bArr[130] = 2; - bArr[131] = 3; - bArr[132] = 2; - bArr[133] = 3; - bArr[134] = 3; - bArr[135] = 4; - bArr[136] = 2; - bArr[137] = 3; - bArr[138] = 3; - bArr[139] = 4; - bArr[140] = 3; - bArr[141] = 4; - bArr[142] = 4; - bArr[143] = 5; - bArr[144] = 2; - bArr[145] = 3; - bArr[146] = 3; - bArr[147] = 4; - bArr[148] = 3; - bArr[149] = 4; - bArr[150] = 4; - bArr[151] = 5; - bArr[152] = 3; - bArr[153] = 4; - bArr[154] = 4; - bArr[155] = 5; - bArr[156] = 4; - bArr[157] = 5; - bArr[158] = 5; - bArr[159] = 6; - bArr[160] = 2; - bArr[161] = 3; - bArr[162] = 3; - bArr[163] = 4; - bArr[164] = 3; - bArr[165] = 4; - bArr[166] = 4; - bArr[167] = 5; - bArr[168] = 3; - bArr[169] = 4; - bArr[170] = 4; - bArr[171] = 5; - bArr[172] = 4; - bArr[173] = 5; - bArr[174] = 5; - bArr[175] = 6; - bArr[176] = 3; - bArr[177] = 4; - bArr[178] = 4; - bArr[179] = 5; - bArr[180] = 4; - bArr[181] = 5; - bArr[182] = 5; - bArr[183] = 6; - bArr[184] = 4; - bArr[185] = 5; - bArr[186] = 5; - bArr[187] = 6; - bArr[188] = 5; - bArr[189] = 6; - bArr[190] = 6; - bArr[191] = 7; - bArr[192] = 2; - bArr[193] = 3; - bArr[194] = 3; - bArr[195] = 4; - bArr[196] = 3; - bArr[197] = 4; - bArr[198] = 4; - bArr[199] = 5; - bArr[200] = 3; - bArr[201] = 4; - bArr[202] = 4; - bArr[203] = 5; - bArr[204] = 4; - bArr[205] = 5; - bArr[206] = 5; - bArr[207] = 6; - bArr[208] = 3; - bArr[209] = 4; - bArr[210] = 4; - bArr[211] = 5; - bArr[212] = 4; - bArr[213] = 5; - bArr[214] = 5; - bArr[215] = 6; - bArr[216] = 4; - bArr[217] = 5; - bArr[218] = 5; - bArr[219] = 6; - bArr[220] = 5; - bArr[221] = 6; - bArr[222] = 6; - bArr[223] = 7; - bArr[224] = 3; - bArr[225] = 4; - bArr[226] = 4; - bArr[227] = 5; - bArr[228] = 4; - bArr[229] = 5; - bArr[230] = 5; - bArr[231] = 6; - bArr[232] = 4; - bArr[233] = 5; - bArr[234] = 5; - bArr[235] = 6; - bArr[236] = 5; - bArr[237] = 6; - bArr[238] = 6; - bArr[239] = 7; - bArr[240] = 4; - bArr[241] = 5; - bArr[242] = 5; - bArr[243] = 6; - bArr[244] = 5; - bArr[245] = 6; - bArr[246] = 6; - bArr[247] = 7; - bArr[248] = 5; - bArr[249] = 6; - bArr[250] = 6; - bArr[251] = 7; - bArr[252] = 6; - bArr[253] = 7; - bArr[254] = 7; - bArr[255] = 8; - bitCounts = bArr; - } - - private VzwBigInt() { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - } - - public VzwBigInt(int i, int i2, Random random) throws ArithmeticException { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (i < 2) { - throw new ArithmeticException("bitLength < 2"); - } - this.sign = 1; - this.nBitLength = i; - if (i == 2) { - this.magnitude = random.nextInt() < 0 ? TWO.magnitude : THREE.magnitude; - return; - } - int i3 = (i + 7) / 8; - int i4 = (i3 * 8) - i; - byte b = rndMask[i4]; - byte[] bArr = new byte[i3]; - while (true) { - nextRndBytes(random, bArr); - bArr[0] = (byte) (bArr[0] & b); - bArr[0] = (byte) (bArr[0] | ((byte) (1 << (7 - i4)))); - int i5 = i3 - 1; - bArr[i5] = (byte) (bArr[i5] | 1); - this.magnitude = makeMagnitude(bArr, 1); - this.nBits = -1; - this.mQuote = -1; - if (i2 < 1 || isProbablePrime(i2)) { - return; - } - if (i > 32) { - for (int i6 = 0; i6 < 10000; i6++) { - int nextInt = ((random.nextInt() >>> 1) % (i - 2)) + 33; - int[] iArr = this.magnitude; - int length = this.magnitude.length - (nextInt >>> 5); - iArr[length] = iArr[length] ^ (1 << (nextInt & 31)); - int[] iArr2 = this.magnitude; - int length2 = this.magnitude.length - 1; - iArr2[length2] = iArr2[length2] ^ (random.nextInt() << 1); - this.mQuote = -1; - if (isProbablePrime(i2)) { - return; - } - } - continue; - } - } - } - - public VzwBigInt(int i, Random random) throws IllegalArgumentException { - int i2 = 0; - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (i < 0) { - throw new IllegalArgumentException("numBits must be non-negative"); - } - this.nBits = -1; - this.nBitLength = -1; - if (i == 0) { - this.magnitude = ZERO_MAGNITUDE; - return; - } - int i3 = (i + 7) / 8; - byte[] bArr = new byte[i3]; - nextRndBytes(random, bArr); - bArr[0] = (byte) (bArr[0] & rndMask[(i3 * 8) - i]); - this.magnitude = makeMagnitude(bArr, 1); - this.sign = this.magnitude.length >= 1 ? 1 : i2; - } - - public VzwBigInt(int i, byte[] bArr) throws NumberFormatException { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (i < -1 || i > 1) { - throw new NumberFormatException("Invalid sign value"); - } else if (i == 0) { - this.sign = 0; - this.magnitude = new int[0]; - } else { - this.magnitude = makeMagnitude(bArr, 1); - this.sign = i; - } - } - - private VzwBigInt(int i, int[] iArr) { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (iArr.length > 0) { - this.sign = i; - int i2 = 0; - while (i2 < iArr.length && iArr[i2] == 0) { - i2++; - } - if (i2 == 0) { - this.magnitude = iArr; - return; - } - int[] iArr2 = new int[(iArr.length - i2)]; - System.arraycopy(iArr, i2, iArr2, 0, iArr2.length); - this.magnitude = iArr2; - if (iArr2.length == 0) { - this.sign = 0; - return; - } - return; - } - this.magnitude = iArr; - this.sign = 0; - } - - public VzwBigInt(String str) throws NumberFormatException { - this(str, 10); - } - - public VzwBigInt(String str, int i) throws NumberFormatException { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (str.length() == 0) { - throw new NumberFormatException("Zero length BigInteger"); - } else if (i < 2 || i > 36) { - throw new NumberFormatException("Radix out of range"); - } else { - int i2 = 0; - this.sign = 1; - if (str.charAt(0) == '-') { - if (str.length() == 1) { - throw new NumberFormatException("Zero length BigInteger"); - } - this.sign = -1; - i2 = 1; - } - while (i2 < str.length() && Character.digit(str.charAt(i2), i) == 0) { - i2++; - } - if (i2 >= str.length()) { - this.sign = 0; - this.magnitude = new int[0]; - return; - } - VzwBigInt vzwBigInt = ZERO; - VzwBigInt valueOf = valueOf((long) i); - while (i2 < str.length()) { - vzwBigInt = vzwBigInt.multiply(valueOf).add(valueOf((long) Character.digit(str.charAt(i2), i))); - i2++; - } - this.magnitude = vzwBigInt.magnitude; - } - } - - public VzwBigInt(byte[] bArr) throws NumberFormatException { - this.nBits = -1; - this.nBitLength = -1; - this.mQuote = -1; - if (bArr.length == 0) { - throw new NumberFormatException("Zero length BigInteger"); - } - this.sign = 1; - if (bArr[0] < 0) { - this.sign = -1; - } - this.magnitude = makeMagnitude(bArr, this.sign); - if (this.magnitude.length == 0) { - this.sign = 0; - } - } - - private long _extEuclid(long j, long j2, long[] jArr) { - long j3 = 1; - long j4 = j; - long j5 = 0; - long j6 = j2; - while (j6 > 0) { - long j7 = j4 / j6; - long j8 = j3 - (j5 * j7); - j3 = j5; - j5 = j8; - long j9 = j4 - (j6 * j7); - j4 = j6; - j6 = j9; - } - jArr[0] = j3; - jArr[1] = (j4 - (j3 * j)) / j2; - return j4; - } - - private long _modInverse(long j, long j2) throws ArithmeticException { - if (j2 < 0) { - throw new ArithmeticException("Modulus must be positive"); - } - long[] jArr = new long[2]; - if (_extEuclid(j, j2, jArr) != 1) { - throw new ArithmeticException("Numbers not relatively prime."); - } - if (jArr[0] < 0) { - jArr[0] = jArr[0] + j2; - } - return jArr[0]; - } - - private int[] add(int[] iArr, int[] iArr2) { - int length = iArr.length - 1; - long j = 0; - int length2 = iArr2.length - 1; - int i = length; - while (length2 >= 0) { - long j2 = j + (((long) iArr[i]) & IMASK) + (((long) iArr2[length2]) & IMASK); - iArr[i] = (int) j2; - j = j2 >>> 32; - length2--; - i--; - } - while (i >= 0 && j != 0) { - long j3 = j + (((long) iArr[i]) & IMASK); - iArr[i] = (int) j3; - j = j3 >>> 32; - i--; - } - return iArr; - } - - private VzwBigInt addToMagnitude(int[] iArr) { - int[] iArr2; - int[] iArr3; - int i = 1; - if (this.magnitude.length < iArr.length) { - iArr2 = iArr; - iArr3 = this.magnitude; - } else { - iArr2 = this.magnitude; - iArr3 = iArr; - } - int i2 = Integer.MAX_VALUE; - if (iArr2.length == iArr3.length) { - i2 = Integer.MAX_VALUE - iArr3[0]; - } - if (!((iArr2[0] ^ ExploreByTouchHelper.INVALID_ID) >= i2)) { - i = 0; - } - int[] iArr4 = new int[(iArr2.length + i)]; - System.arraycopy(iArr2, 0, iArr4, i, iArr2.length); - return new VzwBigInt(this.sign, add(iArr4, iArr3)); - } - - static int bitLen(int i) { - if (i >= 32768) { - return i < 8388608 ? i < 524288 ? i < 131072 ? i < 65536 ? 16 : 17 : i < 262144 ? 18 : 19 : i < 2097152 ? i < 1048576 ? 20 : 21 : i < 4194304 ? 22 : 23 : i < 134217728 ? i < 33554432 ? i < 16777216 ? 24 : 25 : i < 67108864 ? 26 : 27 : i < 536870912 ? i < 268435456 ? 28 : 29 : i < 1073741824 ? 30 : 31; - } - if (i >= 128) { - return i < 2048 ? i < 512 ? i < 256 ? 8 : 9 : i < 1024 ? 10 : 11 : i < 8192 ? i < 4096 ? 12 : 13 : i < 16384 ? 14 : 15; - } - if (i >= 8) { - return i < 32 ? i < 16 ? 4 : 5 : i < 64 ? 6 : 7; - } - if (i >= 2) { - return i < 4 ? 2 : 3; - } - if (i < 1) { - return i < 0 ? 32 : 0; - } - return 1; - } - - private int bitLength(int i, int[] iArr) { - int i2 = 1; - if (iArr.length == 0) { - return 0; - } - while (i != iArr.length && iArr[i] == 0) { - i++; - } - if (i == iArr.length) { - return 0; - } - int length = (((iArr.length - i) - 1) * 32) + bitLen(iArr[i]); - if (this.sign < 0) { - boolean z = ((bitCounts[iArr[i] & MotionEventCompat.ACTION_MASK] + bitCounts[(iArr[i] >> 8) & MotionEventCompat.ACTION_MASK]) + bitCounts[(iArr[i] >> 16) & MotionEventCompat.ACTION_MASK]) + bitCounts[(iArr[i] >> 24) & MotionEventCompat.ACTION_MASK] == 1; - for (int i3 = i + 1; i3 < iArr.length && z; i3++) { - z = iArr[i3] == 0; - } - if (!z) { - i2 = 0; - } - length -= i2; - } - return length; - } - - private int compareNoLeadingZeroes(int i, int[] iArr, int i2, int[] iArr2) { - int i3 = -1; - int length = (iArr.length - iArr2.length) - (i - i2); - if (length != 0) { - return length < 0 ? -1 : 1; - } - while (i < iArr.length) { - int i4 = i + 1; - int i5 = iArr[i]; - int i6 = i2 + 1; - int i7 = iArr2[i2]; - if (i5 != i7) { - if ((i5 ^ ExploreByTouchHelper.INVALID_ID) >= (i7 ^ ExploreByTouchHelper.INVALID_ID)) { - i3 = 1; - } - return i3; - } - i2 = i6; - i = i4; - } - return 0; - } - - private int compareTo(int i, int[] iArr, int i2, int[] iArr2) { - while (i != iArr.length && iArr[i] == 0) { - i++; - } - while (i2 != iArr2.length && iArr2[i2] == 0) { - i2++; - } - return compareNoLeadingZeroes(i, iArr, i2, iArr2); - } - - private int[] divide(int[] iArr, int[] iArr2) { - int[] iArr3; - int[] iArr4; - int compareTo; - int compareTo2 = compareTo(0, iArr, 0, iArr2); - if (compareTo2 > 0) { - int bitLength = bitLength(0, iArr) - bitLength(0, iArr2); - if (bitLength > 1) { - iArr3 = shiftLeft(iArr2, bitLength - 1); - iArr4 = shiftLeft(ONE.magnitude, bitLength - 1); - if (bitLength % 32 == 0) { - int[] iArr5 = new int[((bitLength / 32) + 1)]; - System.arraycopy(iArr4, 0, iArr5, 1, iArr5.length - 1); - iArr5[0] = 0; - iArr4 = iArr5; - } - } else { - iArr3 = new int[iArr.length]; - System.arraycopy(iArr2, 0, iArr3, iArr3.length - iArr2.length, iArr2.length); - iArr4 = new int[]{1}; - } - int[] iArr6 = new int[iArr4.length]; - subtract(0, iArr, 0, iArr3); - System.arraycopy(iArr4, 0, iArr6, 0, iArr4.length); - int i = 0; - int i2 = 0; - int i3 = 0; - while (true) { - int compareTo3 = compareTo(i, iArr, i2, iArr3); - while (compareTo3 >= 0) { - subtract(i, iArr, i2, iArr3); - add(iArr4, iArr6); - compareTo3 = compareTo(i, iArr, i2, iArr3); - } - compareTo = compareTo(i, iArr, 0, iArr2); - if (compareTo <= 0) { - break; - } - if (iArr[i] == 0) { - i++; - } - int bitLength2 = bitLength(i2, iArr3) - bitLength(i, iArr); - if (bitLength2 == 0) { - shiftRightOneInPlace(i2, iArr3); - shiftRightOneInPlace(i3, iArr6); - } else { - shiftRightInPlace(i2, iArr3, bitLength2); - shiftRightInPlace(i3, iArr6, bitLength2); - } - if (iArr3[i2] == 0) { - i2++; - } - if (iArr6[i3] == 0) { - i3++; - } - } - if (compareTo != 0) { - return iArr4; - } - add(iArr4, ONE.magnitude); - for (int i4 = i; i4 != iArr.length; i4++) { - iArr[i4] = 0; - } - return iArr4; - } else if (compareTo2 == 0) { - return new int[]{1}; - } else { - return new int[]{0}; - } - } - - private static VzwBigInt extEuclid(VzwBigInt vzwBigInt, VzwBigInt vzwBigInt2, VzwBigInt vzwBigInt3, VzwBigInt vzwBigInt4) { - VzwBigInt vzwBigInt5 = ONE; - VzwBigInt vzwBigInt6 = vzwBigInt; - VzwBigInt vzwBigInt7 = ZERO; - VzwBigInt vzwBigInt8 = vzwBigInt2; - while (vzwBigInt8.sign > 0) { - VzwBigInt[] divideAndRemainder = vzwBigInt6.divideAndRemainder(vzwBigInt8); - VzwBigInt subtract = vzwBigInt5.subtract(vzwBigInt7.multiply(divideAndRemainder[0])); - vzwBigInt5 = vzwBigInt7; - vzwBigInt7 = subtract; - vzwBigInt6 = vzwBigInt8; - vzwBigInt8 = divideAndRemainder[1]; - } - if (vzwBigInt3 != null) { - vzwBigInt3.sign = vzwBigInt5.sign; - vzwBigInt3.magnitude = vzwBigInt5.magnitude; - } - if (vzwBigInt4 != null) { - VzwBigInt divide = vzwBigInt6.subtract(vzwBigInt5.multiply(vzwBigInt)).divide(vzwBigInt2); - vzwBigInt4.sign = divide.sign; - vzwBigInt4.magnitude = divide.magnitude; - } - return vzwBigInt6; - } - - private VzwBigInt flipExistingBit(int i) { - int[] iArr = new int[this.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, 0, iArr.length); - int length = (iArr.length - 1) - (i >>> 5); - iArr[length] = iArr[length] ^ (1 << (i & 31)); - return new VzwBigInt(this.sign, iArr); - } - - private long getMQuote() { - if (this.mQuote != -1) { - return this.mQuote; - } - if ((this.magnitude[this.magnitude.length - 1] & 1) == 0) { - return -1; - } - this.mQuote = _modInverse(((long) ((this.magnitude[this.magnitude.length - 1] ^ -1) | 1)) & IMASK, 4294967296L); - return this.mQuote; - } - - private int[] inc(int[] iArr) { - int length = iArr.length - 1; - long j = (((long) iArr[length]) & IMASK) + 1; - iArr[length] = (int) j; - long j2 = j >>> 32; - for (int i = length - 1; i >= 0 && j2 != 0; i--) { - long j3 = j2 + (((long) iArr[i]) & IMASK); - iArr[i] = (int) j3; - j2 = j3 >>> 32; - } - return iArr; - } - - private int[] lastNBits(int i) { - if (i < 1) { - return ZERO_MAGNITUDE; - } - int min = Math.min((i + 31) / 32, this.magnitude.length); - int[] iArr = new int[min]; - System.arraycopy(this.magnitude, this.magnitude.length - min, iArr, 0, min); - int i2 = i % 32; - if (i2 == 0) { - return iArr; - } - iArr[0] = iArr[0] & ((-1 << i2) ^ -1); - return iArr; - } - - private int[] makeMagnitude(byte[] bArr, int i) { - if (i >= 0) { - int i2 = 0; - while (i2 < bArr.length && bArr[i2] == 0) { - i2++; - } - if (i2 >= bArr.length) { - return new int[0]; - } - int length = ((bArr.length - i2) + 3) / 4; - int length2 = (bArr.length - i2) % 4; - if (length2 == 0) { - length2 = 4; - } - int[] iArr = new int[length]; - int i3 = 0; - int i4 = 0; - for (int i5 = i2; i5 < bArr.length; i5++) { - i3 = (i3 << 8) | (bArr[i5] & 255); - length2--; - if (length2 <= 0) { - iArr[i4] = i3; - i4++; - length2 = 4; - i3 = 0; - } - } - return iArr; - } - int i6 = 0; - while (i6 < bArr.length - 1 && bArr[i6] == 255) { - i6++; - } - int length3 = bArr.length; - boolean z = false; - if (bArr[i6] == 128) { - int i7 = i6 + 1; - while (i7 < bArr.length && bArr[i7] == 0) { - i7++; - } - if (i7 == bArr.length) { - length3++; - z = true; - } - } - int i8 = ((length3 - i6) + 3) / 4; - int i9 = (length3 - i6) % 4; - if (i9 == 0) { - i9 = 4; - } - int[] iArr2 = new int[i8]; - int i10 = 0; - int i11 = 0; - if (z && i9 - 1 <= 0) { - i11 = 0 + 1; - i9 = 4; - } - for (int i12 = i6; i12 < bArr.length; i12++) { - i10 = (i10 << 8) | ((bArr[i12] ^ -1) & MotionEventCompat.ACTION_MASK); - i9--; - if (i9 <= 0) { - iArr2[i11] = i10; - i11++; - i9 = 4; - i10 = 0; - } - } - int[] inc = inc(iArr2); - if (inc[0] != 0) { - return inc; - } - int[] iArr3 = new int[(inc.length - 1)]; - System.arraycopy(inc, 1, iArr3, 0, iArr3.length); - return iArr3; - } - - private int[] multiply(int[] iArr, int[] iArr2, int[] iArr3) { - long j; - int length = iArr3.length; - if (length >= 1) { - int length2 = iArr.length - iArr2.length; - while (true) { - length--; - long j2 = ((long) iArr3[length]) & IMASK; - j = 0; - for (int length3 = iArr2.length - 1; length3 >= 0; length3--) { - long j3 = j + ((((long) iArr2[length3]) & IMASK) * j2) + (((long) iArr[length2 + length3]) & IMASK); - iArr[length2 + length3] = (int) j3; - j = j3 >>> 32; - } - length2--; - if (length < 1) { - break; - } - iArr[length2] = (int) j; - } - if (length2 >= 0) { - iArr[length2] = (int) j; - } - } - return iArr; - } - - private void multiplyMonty(int[] iArr, int[] iArr2, int[] iArr3, int[] iArr4, long j) { - int length = iArr4.length; - int i = length - 1; - long j2 = ((long) iArr3[length - 1]) & IMASK; - for (int i2 = 0; i2 <= length; i2++) { - iArr[i2] = 0; - } - for (int i3 = length; i3 > 0; i3--) { - long j3 = ((long) iArr2[i3 - 1]) & IMASK; - long j4 = ((((((long) iArr[length]) & IMASK) + ((j3 * j2) & IMASK)) & IMASK) * j) & IMASK; - long j5 = j3 * j2; - long j6 = j4 * (((long) iArr4[length - 1]) & IMASK); - long j7 = (j5 >>> 32) + (j6 >>> 32) + ((((((long) iArr[length]) & IMASK) + (IMASK & j5)) + (IMASK & j6)) >>> 32); - for (int i4 = i; i4 > 0; i4--) { - long j8 = j3 * (((long) iArr3[i4 - 1]) & IMASK); - long j9 = j4 * (((long) iArr4[i4 - 1]) & IMASK); - long j10 = (((long) iArr[i4]) & IMASK) + (IMASK & j8) + (IMASK & j9) + (IMASK & j7); - j7 = (j7 >>> 32) + (j8 >>> 32) + (j9 >>> 32) + (j10 >>> 32); - iArr[i4 + 1] = (int) j10; - } - long j11 = j7 + (((long) iArr[0]) & IMASK); - iArr[1] = (int) j11; - iArr[0] = (int) (j11 >>> 32); - } - if (compareTo(0, iArr, 0, iArr4) >= 0) { - subtract(0, iArr, 0, iArr4); - } - System.arraycopy(iArr, 1, iArr2, 0, length); - } - - private void nextRndBytes(Random random, byte[] bArr) { - int length = bArr.length; - int i = 0; - int i2 = 0; - while (true) { - int i3 = 0; - while (i3 < 4) { - if (i != length) { - i2 = i3 == 0 ? random.nextInt() : i2 >> 8; - i++; - bArr[i] = (byte) i2; - i3++; - } else { - return; - } - } - i = i; - } - } - - public static VzwBigInt probablePrime(int i, Random random) { - return new VzwBigInt(i, 100, random); - } - - private boolean quickPow2Check() { - return this.sign > 0 && this.nBits == 1; - } - - private int remainder(int i) { - long j = 0; - for (int i2 = 0; i2 < this.magnitude.length; i2++) { - j = ((j << 32) | (((long) this.magnitude[i2]) & IMASK)) % ((long) i); - } - return (int) j; - } - - private int[] remainder(int[] iArr, int[] iArr2) { - int[] iArr3; - int i = 0; - while (i < iArr.length && iArr[i] == 0) { - i++; - } - int i2 = 0; - while (i2 < iArr2.length && iArr2[i2] == 0) { - i2++; - } - int compareNoLeadingZeroes = compareNoLeadingZeroes(i, iArr, i2, iArr2); - if (compareNoLeadingZeroes > 0) { - int bitLength = bitLength(i2, iArr2); - int bitLength2 = bitLength(i, iArr); - int i3 = bitLength2 - bitLength; - int i4 = 0; - int i5 = bitLength; - if (i3 > 0) { - iArr3 = shiftLeft(iArr2, i3); - i5 += i3; - } else { - int length = iArr2.length - i2; - iArr3 = new int[length]; - System.arraycopy(iArr2, i2, iArr3, 0, length); - } - loop2: - while (true) { - if (i5 < bitLength2 || compareNoLeadingZeroes(i, iArr, i4, iArr3) >= 0) { - subtract(i, iArr, i4, iArr3); - while (true) { - if (iArr[i] == 0) { - i++; - if (i == iArr.length) { - break loop2; - } - } else { - compareNoLeadingZeroes = compareNoLeadingZeroes(i, iArr, i2, iArr2); - if (compareNoLeadingZeroes <= 0) { - break; - } - bitLength2 = (((iArr.length - i) - 1) * 32) + bitLen(iArr[i]); - } - } - } - int i6 = i5 - bitLength2; - if (i6 < 2) { - shiftRightOneInPlace(i4, iArr3); - i5--; - } else { - shiftRightInPlace(i4, iArr3, i6); - i5 -= i6; - } - while (iArr3[i4] == 0) { - i4++; - } - } - } - if (compareNoLeadingZeroes == 0) { - for (int i7 = i; i7 < iArr.length; i7++) { - iArr[i7] = 0; - } - } - return iArr; - } - - private int[] shiftLeft(int[] iArr, int i) { - int[] iArr2; - int i2 = i >>> 5; - int i3 = i & 31; - int length = iArr.length; - if (i3 == 0) { - int[] iArr3 = new int[(length + i2)]; - System.arraycopy(iArr, 0, iArr3, 0, length); - return iArr3; - } - int i4 = 0; - int i5 = 32 - i3; - int i6 = iArr[0] >>> i5; - if (i6 != 0) { - iArr2 = new int[(length + i2 + 1)]; - iArr2[0] = i6; - i4 = 0 + 1; - } else { - iArr2 = new int[(length + i2)]; - } - int i7 = iArr[0]; - for (int i8 = 0; i8 < length - 1; i8++) { - int i9 = iArr[i8 + 1]; - i4++; - iArr2[i4] = (i7 << i3) | (i9 >>> i5); - i7 = i9; - } - iArr2[i4] = iArr[length - 1] << i3; - return iArr2; - } - - private static void shiftRightInPlace(int i, int[] iArr, int i2) { - int i3 = (i2 >>> 5) + i; - int i4 = i2 & 31; - int length = iArr.length - 1; - if (i3 != i) { - int i5 = i3 - i; - for (int i6 = length; i6 >= i3; i6--) { - iArr[i6] = iArr[i6 - i5]; - } - for (int i7 = i3 - 1; i7 >= i; i7--) { - iArr[i7] = 0; - } - } - if (i4 != 0) { - int i8 = 32 - i4; - int i9 = iArr[length]; - for (int i10 = length; i10 >= i3 + 1; i10--) { - int i11 = iArr[i10 - 1]; - iArr[i10] = (i9 >>> i4) | (i11 << i8); - i9 = i11; - } - iArr[i3] = iArr[i3] >>> i4; - } - } - - private static void shiftRightOneInPlace(int i, int[] iArr) { - int length = iArr.length - 1; - int i2 = iArr[length]; - for (int i3 = length; i3 > i; i3--) { - int i4 = iArr[i3 - 1]; - iArr[i3] = (i2 >>> 1) | (i4 << 31); - i2 = i4; - } - iArr[i] = iArr[i] >>> 1; - } - - private int[] square(int[] iArr, int[] iArr2) { - int length = iArr.length - 1; - for (int length2 = iArr2.length - 1; length2 != 0; length2--) { - long j = ((long) iArr2[length2]) & IMASK; - long j2 = j * j; - long j3 = j2 >>> 32; - long j4 = (j2 & IMASK) + (((long) iArr[length]) & IMASK); - iArr[length] = (int) j4; - long j5 = j3 + (j4 >> 32); - for (int i = length2 - 1; i >= 0; i--) { - length--; - long j6 = (((long) iArr2[i]) & IMASK) * j; - long j7 = j6 >>> 31; - long j8 = ((2147483647L & j6) << 1) + (((long) iArr[length]) & IMASK) + j5; - iArr[length] = (int) j8; - j5 = j7 + (j8 >>> 32); - } - int i2 = length - 1; - long j9 = j5 + (((long) iArr[i2]) & IMASK); - iArr[i2] = (int) j9; - int i3 = i2 - 1; - if (i3 >= 0) { - iArr[i3] = (int) (j9 >> 32); - } - length = i3 + length2; - } - long j10 = ((long) iArr2[0]) & IMASK; - long j11 = j10 * j10; - long j12 = j11 >>> 32; - long j13 = (j11 & IMASK) + (((long) iArr[length]) & IMASK); - iArr[length] = (int) j13; - int i4 = length - 1; - if (i4 >= 0) { - iArr[i4] = (int) ((j13 >> 32) + j12 + ((long) iArr[i4])); - } - return iArr; - } - - private int[] subtract(int i, int[] iArr, int i2, int[] iArr2) { - int i3; - int length = iArr.length; - int length2 = iArr2.length; - int i4 = 0; - do { - length--; - length2--; - long j = ((((long) iArr[length]) & IMASK) - (((long) iArr2[length2]) & IMASK)) + ((long) i4); - iArr[length] = (int) j; - i4 = (int) (j >> 63); - } while (length2 > i2); - if (i4 != 0) { - do { - length--; - i3 = iArr[length] - 1; - iArr[length] = i3; - } while (i3 == -1); - } - return iArr; - } - - public static VzwBigInt valueOf(long j) { - if (j == 0) { - return ZERO; - } - if (j < 0) { - return j == Long.MIN_VALUE ? valueOf(-1 ^ j).not() : valueOf(-j).negate(); - } - byte[] bArr = new byte[8]; - for (int i = 0; i < 8; i++) { - bArr[7 - i] = (byte) ((int) j); - j >>= 8; - } - return new VzwBigInt(bArr); - } - - private void zero(int[] iArr) { - for (int i = 0; i != iArr.length; i++) { - iArr[i] = 0; - } - } - - public VzwBigInt abs() { - return this.sign >= 0 ? this : negate(); - } - - public VzwBigInt add(VzwBigInt vzwBigInt) throws ArithmeticException { - if (vzwBigInt.sign == 0 || vzwBigInt.magnitude.length == 0) { - return this; - } - if (this.sign == 0 || this.magnitude.length == 0) { - return vzwBigInt; - } - if (vzwBigInt.sign < 0) { - if (this.sign > 0) { - return subtract(vzwBigInt.negate()); - } - } else if (this.sign < 0) { - return vzwBigInt.subtract(negate()); - } - return addToMagnitude(vzwBigInt.magnitude); - } - - public VzwBigInt and(VzwBigInt vzwBigInt) { - if (this.sign == 0 || vzwBigInt.sign == 0) { - return ZERO; - } - int[] iArr = this.sign > 0 ? this.magnitude : add(ONE).magnitude; - int[] iArr2 = vzwBigInt.sign > 0 ? vzwBigInt.magnitude : vzwBigInt.add(ONE).magnitude; - boolean z = this.sign < 0 && vzwBigInt.sign < 0; - int[] iArr3 = new int[Math.max(iArr.length, iArr2.length)]; - int length = iArr3.length - iArr.length; - int length2 = iArr3.length - iArr2.length; - int i = 0; - while (i < iArr3.length) { - int i2 = i >= length ? iArr[i - length] : 0; - int i3 = i >= length2 ? iArr2[i - length2] : 0; - if (this.sign < 0) { - i2 ^= -1; - } - if (vzwBigInt.sign < 0) { - i3 ^= -1; - } - iArr3[i] = i2 & i3; - if (z) { - iArr3[i] = iArr3[i] ^ -1; - } - i++; - } - VzwBigInt vzwBigInt2 = new VzwBigInt(1, iArr3); - return z ? vzwBigInt2.not() : vzwBigInt2; - } - - public VzwBigInt andNot(VzwBigInt vzwBigInt) { - return and(vzwBigInt.not()); - } - - public int bitCount() { - if (this.nBits == -1) { - if (this.sign < 0) { - this.nBits = not().bitCount(); - } else { - int i = 0; - for (int i2 = 0; i2 < this.magnitude.length; i2++) { - i = i + bitCounts[this.magnitude[i2] & MotionEventCompat.ACTION_MASK] + bitCounts[(this.magnitude[i2] >> 8) & MotionEventCompat.ACTION_MASK] + bitCounts[(this.magnitude[i2] >> 16) & MotionEventCompat.ACTION_MASK] + bitCounts[(this.magnitude[i2] >> 24) & MotionEventCompat.ACTION_MASK]; - } - this.nBits = i; - } - } - return this.nBits; - } - - public int bitLength() { - if (this.nBitLength == -1) { - if (this.sign == 0) { - this.nBitLength = 0; - } else { - this.nBitLength = bitLength(0, this.magnitude); - } - } - return this.nBitLength; - } - - public byte byteValue() { - return (byte) intValue(); - } - - public VzwBigInt clearBit(int i) throws ArithmeticException { - if (i >= 0) { - return !testBit(i) ? this : (this.sign <= 0 || i >= bitLength() + -1) ? andNot(ONE.shiftLeft(i)) : flipExistingBit(i); - } - throw new ArithmeticException("Bit address less than zero"); - } - - public int compareTo(VzwBigInt vzwBigInt) { - if (this.sign < vzwBigInt.sign) { - return -1; - } - if (this.sign > vzwBigInt.sign) { - return 1; - } - if (this.sign == 0) { - return 0; - } - return compareTo(0, this.magnitude, 0, vzwBigInt.magnitude) * this.sign; - } - - public int compareTo(Object obj) { - return compareTo((VzwBigInt) obj); - } - - public VzwBigInt divide(VzwBigInt vzwBigInt) throws ArithmeticException { - if (vzwBigInt.sign == 0) { - throw new ArithmeticException("Divide by zero"); - } else if (this.sign == 0) { - return ZERO; - } else { - if (vzwBigInt.compareTo(ONE) == 0) { - return this; - } - int[] iArr = new int[this.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, 0, iArr.length); - return new VzwBigInt(this.sign * vzwBigInt.sign, divide(iArr, vzwBigInt.magnitude)); - } - } - - public VzwBigInt[] divideAndRemainder(VzwBigInt vzwBigInt) throws ArithmeticException { - if (vzwBigInt.sign == 0) { - throw new ArithmeticException("Divide by zero"); - } - VzwBigInt[] vzwBigIntArr = new VzwBigInt[2]; - if (this.sign == 0) { - VzwBigInt vzwBigInt2 = ZERO; - vzwBigIntArr[1] = vzwBigInt2; - vzwBigIntArr[0] = vzwBigInt2; - } else if (vzwBigInt.compareTo(ONE) == 0) { - vzwBigIntArr[0] = this; - vzwBigIntArr[1] = ZERO; - } else { - int[] iArr = new int[this.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, 0, iArr.length); - vzwBigIntArr[0] = new VzwBigInt(this.sign * vzwBigInt.sign, divide(iArr, vzwBigInt.magnitude)); - vzwBigIntArr[1] = new VzwBigInt(this.sign, iArr); - } - return vzwBigIntArr; - } - - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof VzwBigInt)) { - return false; - } - VzwBigInt vzwBigInt = (VzwBigInt) obj; - if (!(vzwBigInt.sign == this.sign && vzwBigInt.magnitude.length == this.magnitude.length)) { - return false; - } - for (int i = 0; i < this.magnitude.length; i++) { - if (vzwBigInt.magnitude[i] != this.magnitude[i]) { - return false; - } - } - return true; - } - - public VzwBigInt flipBit(int i) throws ArithmeticException { - if (i >= 0) { - return (this.sign <= 0 || i >= bitLength() + -1) ? xor(ONE.shiftLeft(i)) : flipExistingBit(i); - } - throw new ArithmeticException("Bit address less than zero"); - } - - public VzwBigInt gcd(VzwBigInt vzwBigInt) { - if (vzwBigInt.sign == 0) { - return abs(); - } - if (this.sign == 0) { - return vzwBigInt.abs(); - } - VzwBigInt vzwBigInt2 = this; - VzwBigInt vzwBigInt3 = vzwBigInt; - while (vzwBigInt3.sign != 0) { - VzwBigInt mod = vzwBigInt2.mod(vzwBigInt3); - vzwBigInt2 = vzwBigInt3; - vzwBigInt3 = mod; - } - return vzwBigInt2; - } - - public int getLowestSetBit() { - if (this.sign == 0) { - return -1; - } - int length = this.magnitude.length; - do { - length--; - if (length <= 0) { - break; - } - } while (this.magnitude[length] == 0); - int i = this.magnitude[length]; - int i2 = (65535 & i) == 0 ? (16711680 & i) == 0 ? 7 : 15 : (i & MotionEventCompat.ACTION_MASK) == 0 ? 23 : 31; - while (i2 > 0 && (i << i2) != Integer.MIN_VALUE) { - i2--; - } - return ((this.magnitude.length - length) * 32) - (i2 + 1); - } - - public int hashCode() { - int length = this.magnitude.length; - if (this.magnitude.length > 0) { - length ^= this.magnitude[0]; - if (this.magnitude.length > 1) { - length ^= this.magnitude[this.magnitude.length - 1]; - } - } - return this.sign < 0 ? length ^ -1 : length; - } - - public int intValue() { - if (this.magnitude.length == 0) { - return 0; - } - return this.sign < 0 ? -this.magnitude[this.magnitude.length - 1] : this.magnitude[this.magnitude.length - 1]; - } - - public boolean isProbablePrime(int i) { - if (i <= 0) { - return true; - } - if (this.sign == 0) { - return false; - } - VzwBigInt abs = abs(); - if (!abs.testBit(0)) { - return abs.equals(TWO); - } - if (abs.equals(ONE)) { - return false; - } - int min = Math.min(abs.bitLength() - 1, primeLists.length); - for (int i2 = 0; i2 < min; i2++) { - int remainder = abs.remainder(primeProducts[i2]); - int[] iArr = primeLists[i2]; - for (int i3 = 0; i3 < iArr.length; i3++) { - int i4 = iArr[i3]; - if (remainder % i4 == 0) { - return abs.bitLength() < 16 && abs.intValue() == i4; - } - } - } - VzwBigInt subtract = abs.subtract(ONE); - int lowestSetBit = subtract.getLowestSetBit(); - VzwBigInt shiftRight = subtract.shiftRight(lowestSetBit); - Random random = new Random(); - while (true) { - VzwBigInt vzwBigInt = new VzwBigInt(abs.bitLength(), random); - if (vzwBigInt.compareTo(ONE) > 0 && vzwBigInt.compareTo(subtract) < 0) { - VzwBigInt modPow = vzwBigInt.modPow(shiftRight, abs); - if (!modPow.equals(ONE)) { - int i5 = 0; - while (!modPow.equals(subtract)) { - i5++; - if (i5 == lowestSetBit) { - return false; - } - modPow = modPow.modPow(TWO, abs); - if (modPow.equals(ONE)) { - return false; - } - } - } - i -= 2; - if (i <= 0) { - return true; - } - } - } - } - - public long longValue() { - if (this.magnitude.length == 0) { - return 0; - } - long j = this.magnitude.length > 1 ? (((long) this.magnitude[this.magnitude.length - 2]) << 32) | (((long) this.magnitude[this.magnitude.length - 1]) & IMASK) : ((long) this.magnitude[this.magnitude.length - 1]) & IMASK; - return this.sign < 0 ? -j : j; - } - - public VzwBigInt max(VzwBigInt vzwBigInt) { - return compareTo(vzwBigInt) > 0 ? this : vzwBigInt; - } - - public VzwBigInt min(VzwBigInt vzwBigInt) { - return compareTo(vzwBigInt) < 0 ? this : vzwBigInt; - } - - public VzwBigInt mod(VzwBigInt vzwBigInt) throws ArithmeticException { - if (vzwBigInt.sign <= 0) { - throw new ArithmeticException("BigInteger: modulus is not positive"); - } - VzwBigInt remainder = remainder(vzwBigInt); - return remainder.sign >= 0 ? remainder : remainder.add(vzwBigInt); - } - - public VzwBigInt modInverse(VzwBigInt vzwBigInt) throws ArithmeticException { - if (vzwBigInt.sign != 1) { - throw new ArithmeticException("Modulus must be positive"); - } - VzwBigInt vzwBigInt2 = new VzwBigInt(); - if (extEuclid(this, vzwBigInt, vzwBigInt2, null).equals(ONE)) { - return vzwBigInt2.compareTo(ZERO) < 0 ? vzwBigInt2.add(vzwBigInt) : vzwBigInt2; - } - throw new ArithmeticException("Numbers not relatively prime."); - } - - public VzwBigInt modPow(VzwBigInt vzwBigInt, VzwBigInt vzwBigInt2) throws ArithmeticException { - if (vzwBigInt2.sign < 1) { - throw new ArithmeticException("Modulus must be positive"); - } else if (vzwBigInt2.equals(ONE)) { - return ZERO; - } else { - if (vzwBigInt.sign == 0) { - return ONE; - } - if (this.sign == 0) { - return ZERO; - } - int[] iArr = null; - int[] iArr2 = null; - boolean z = (vzwBigInt2.magnitude[vzwBigInt2.magnitude.length + -1] & 1) == 1; - long j = 0; - if (z) { - j = vzwBigInt2.getMQuote(); - iArr = shiftLeft(vzwBigInt2.magnitude.length * 32).mod(vzwBigInt2).magnitude; - z = iArr.length <= vzwBigInt2.magnitude.length; - if (z) { - iArr2 = new int[(vzwBigInt2.magnitude.length + 1)]; - if (iArr.length < vzwBigInt2.magnitude.length) { - int[] iArr3 = new int[vzwBigInt2.magnitude.length]; - System.arraycopy(iArr, 0, iArr3, iArr3.length - iArr.length, iArr.length); - iArr = iArr3; - } - } - } - if (!z) { - if (this.magnitude.length <= vzwBigInt2.magnitude.length) { - iArr = new int[vzwBigInt2.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, iArr.length - this.magnitude.length, this.magnitude.length); - } else { - VzwBigInt remainder = remainder(vzwBigInt2); - iArr = new int[vzwBigInt2.magnitude.length]; - System.arraycopy(remainder.magnitude, 0, iArr, iArr.length - remainder.magnitude.length, remainder.magnitude.length); - } - iArr2 = new int[(vzwBigInt2.magnitude.length * 2)]; - } - int[] iArr4 = new int[vzwBigInt2.magnitude.length]; - for (int i = 0; i < vzwBigInt.magnitude.length; i++) { - int i2 = vzwBigInt.magnitude[i]; - int i3 = 0; - if (i == 0) { - while (i2 > 0) { - i2 <<= 1; - i3++; - } - System.arraycopy(iArr, 0, iArr4, 0, iArr.length); - i2 <<= 1; - i3++; - } - while (i2 != 0) { - if (z) { - multiplyMonty(iArr2, iArr4, iArr4, vzwBigInt2.magnitude, j); - } else { - square(iArr2, iArr4); - remainder(iArr2, vzwBigInt2.magnitude); - System.arraycopy(iArr2, iArr2.length - iArr4.length, iArr4, 0, iArr4.length); - zero(iArr2); - } - i3++; - if (i2 < 0) { - if (z) { - multiplyMonty(iArr2, iArr4, iArr, vzwBigInt2.magnitude, j); - } else { - multiply(iArr2, iArr4, iArr); - remainder(iArr2, vzwBigInt2.magnitude); - System.arraycopy(iArr2, iArr2.length - iArr4.length, iArr4, 0, iArr4.length); - zero(iArr2); - } - } - i2 <<= 1; - } - while (i3 < 32) { - if (z) { - multiplyMonty(iArr2, iArr4, iArr4, vzwBigInt2.magnitude, j); - } else { - square(iArr2, iArr4); - remainder(iArr2, vzwBigInt2.magnitude); - System.arraycopy(iArr2, iArr2.length - iArr4.length, iArr4, 0, iArr4.length); - zero(iArr2); - } - i3++; - } - } - if (z) { - zero(iArr); - iArr[iArr.length - 1] = 1; - multiplyMonty(iArr2, iArr4, iArr, vzwBigInt2.magnitude, j); - } - VzwBigInt vzwBigInt3 = new VzwBigInt(1, iArr4); - return vzwBigInt.sign <= 0 ? vzwBigInt3.modInverse(vzwBigInt2) : vzwBigInt3; - } - } - - public VzwBigInt multiply(VzwBigInt vzwBigInt) { - if (this.sign == 0 || vzwBigInt.sign == 0) { - return ZERO; - } - int[] iArr = new int[(((bitLength() + vzwBigInt.bitLength()) / 32) + 1)]; - if (vzwBigInt == this) { - square(iArr, this.magnitude); - } else { - multiply(iArr, this.magnitude, vzwBigInt.magnitude); - } - return new VzwBigInt(this.sign * vzwBigInt.sign, iArr); - } - - public VzwBigInt negate() { - return this.sign == 0 ? this : new VzwBigInt(-this.sign, this.magnitude); - } - - public VzwBigInt not() { - return add(ONE).negate(); - } - - public VzwBigInt or(VzwBigInt vzwBigInt) { - if (this.sign == 0) { - return vzwBigInt; - } - if (vzwBigInt.sign == 0) { - return this; - } - int[] iArr = this.sign > 0 ? this.magnitude : add(ONE).magnitude; - int[] iArr2 = vzwBigInt.sign > 0 ? vzwBigInt.magnitude : vzwBigInt.add(ONE).magnitude; - boolean z = this.sign < 0 || vzwBigInt.sign < 0; - int[] iArr3 = new int[Math.max(iArr.length, iArr2.length)]; - int length = iArr3.length - iArr.length; - int length2 = iArr3.length - iArr2.length; - int i = 0; - while (i < iArr3.length) { - int i2 = i >= length ? iArr[i - length] : 0; - int i3 = i >= length2 ? iArr2[i - length2] : 0; - if (this.sign < 0) { - i2 ^= -1; - } - if (vzwBigInt.sign < 0) { - i3 ^= -1; - } - iArr3[i] = i2 | i3; - if (z) { - iArr3[i] = iArr3[i] ^ -1; - } - i++; - } - VzwBigInt vzwBigInt2 = new VzwBigInt(1, iArr3); - if (z) { - vzwBigInt2 = vzwBigInt2.not(); - } - return vzwBigInt2; - } - - public VzwBigInt pow(int i) throws ArithmeticException { - if (i < 0) { - throw new ArithmeticException("Negative exponent"); - } else if (this.sign == 0) { - return i == 0 ? ONE : this; - } else { - VzwBigInt vzwBigInt = ONE; - VzwBigInt vzwBigInt2 = this; - while (i != 0) { - if ((i & 1) == 1) { - vzwBigInt = vzwBigInt.multiply(vzwBigInt2); - } - i >>= 1; - if (i != 0) { - vzwBigInt2 = vzwBigInt2.multiply(vzwBigInt2); - } - } - return vzwBigInt; - } - } - - public VzwBigInt remainder(VzwBigInt vzwBigInt) throws ArithmeticException { - int[] remainder; - int i; - if (vzwBigInt.sign == 0) { - throw new ArithmeticException("BigInteger: Divide by zero"); - } else if (this.sign == 0) { - return ZERO; - } else { - if (vzwBigInt.magnitude.length != 1 || (i = vzwBigInt.magnitude[0]) <= 0) { - if (compareTo(0, this.magnitude, 0, vzwBigInt.magnitude) < 0) { - return this; - } - if (vzwBigInt.quickPow2Check()) { - remainder = lastNBits(vzwBigInt.abs().bitLength() - 1); - } else { - int[] iArr = new int[this.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, 0, iArr.length); - remainder = remainder(iArr, vzwBigInt.magnitude); - } - return new VzwBigInt(this.sign, remainder); - } else if (i == 1) { - return ZERO; - } else { - int remainder2 = remainder(i); - return remainder2 == 0 ? ZERO : new VzwBigInt(this.sign, new int[]{remainder2}); - } - } - } - - public VzwBigInt setBit(int i) throws ArithmeticException { - if (i >= 0) { - return testBit(i) ? this : (this.sign <= 0 || i >= bitLength() + -1) ? or(ONE.shiftLeft(i)) : flipExistingBit(i); - } - throw new ArithmeticException("Bit address less than zero"); - } - - public VzwBigInt shiftLeft(int i) { - if (this.sign == 0 || this.magnitude.length == 0) { - return ZERO; - } - if (i == 0) { - return this; - } - if (i < 0) { - return shiftRight(-i); - } - VzwBigInt vzwBigInt = new VzwBigInt(this.sign, shiftLeft(this.magnitude, i)); - if (this.nBits != -1) { - vzwBigInt.nBits = this.sign > 0 ? this.nBits : this.nBits + i; - } - if (this.nBitLength != -1) { - vzwBigInt.nBitLength = this.nBitLength + i; - } - return vzwBigInt; - } - - public VzwBigInt shiftRight(int i) { - if (i == 0) { - return this; - } - if (i < 0) { - return shiftLeft(-i); - } - if (i >= bitLength()) { - return this.sign < 0 ? valueOf(-1) : ZERO; - } - int[] iArr = new int[this.magnitude.length]; - System.arraycopy(this.magnitude, 0, iArr, 0, iArr.length); - shiftRightInPlace(0, iArr, i); - return new VzwBigInt(this.sign, iArr); - } - - public int signum() { - return this.sign; - } - - public VzwBigInt subtract(VzwBigInt vzwBigInt) { - VzwBigInt vzwBigInt2; - VzwBigInt vzwBigInt3; - if (vzwBigInt.sign == 0 || vzwBigInt.magnitude.length == 0) { - return this; - } - if (this.sign == 0 || this.magnitude.length == 0) { - return vzwBigInt.negate(); - } - if (this.sign != vzwBigInt.sign) { - return add(vzwBigInt.negate()); - } - int compareTo = compareTo(0, this.magnitude, 0, vzwBigInt.magnitude); - if (compareTo == 0) { - return ZERO; - } - if (compareTo < 0) { - vzwBigInt2 = vzwBigInt; - vzwBigInt3 = this; - } else { - vzwBigInt2 = this; - vzwBigInt3 = vzwBigInt; - } - int[] iArr = new int[vzwBigInt2.magnitude.length]; - System.arraycopy(vzwBigInt2.magnitude, 0, iArr, 0, iArr.length); - return new VzwBigInt(this.sign * compareTo, subtract(0, iArr, 0, vzwBigInt3.magnitude)); - } - - public boolean testBit(int i) throws ArithmeticException { - if (i < 0) { - throw new ArithmeticException("Bit position must not be negative"); - } else if (this.sign < 0) { - return !not().testBit(i); - } else { - int i2 = i / 32; - return i2 < this.magnitude.length && ((this.magnitude[(this.magnitude.length + -1) - i2] >> (i % 32)) & 1) > 0; - } - } - - public byte[] toByteArray() { - if (this.sign == 0) { - return new byte[1]; - } - byte[] bArr = new byte[((bitLength() / 8) + 1)]; - int length = this.magnitude.length; - int length2 = bArr.length; - if (this.sign > 0) { - while (length > 1) { - length--; - int i = this.magnitude[length]; - int i2 = length2 - 1; - bArr[i2] = (byte) i; - int i3 = i2 - 1; - bArr[i3] = (byte) (i >>> 8); - int i4 = i3 - 1; - bArr[i4] = (byte) (i >>> 16); - length2 = i4 - 1; - bArr[length2] = (byte) (i >>> 24); - } - int i5 = this.magnitude[0]; - while ((i5 & -256) != 0) { - length2--; - bArr[length2] = (byte) i5; - i5 >>>= 8; - } - bArr[length2 - 1] = (byte) i5; - return bArr; - } - boolean z = true; - while (length > 1) { - length--; - int i6 = this.magnitude[length] ^ -1; - if (z) { - i6++; - z = i6 == 0; - } - int i7 = length2 - 1; - bArr[i7] = (byte) i6; - int i8 = i7 - 1; - bArr[i8] = (byte) (i6 >>> 8); - int i9 = i8 - 1; - bArr[i9] = (byte) (i6 >>> 16); - length2 = i9 - 1; - bArr[length2] = (byte) (i6 >>> 24); - } - int i10 = this.magnitude[0]; - if (z) { - i10--; - } - while ((i10 & -256) != 0) { - length2--; - bArr[length2] = (byte) (i10 ^ -1); - i10 >>>= 8; - } - int i11 = length2 - 1; - bArr[i11] = (byte) (i10 ^ -1); - if (i11 <= 0) { - return bArr; - } - bArr[i11 - 1] = -1; - return bArr; - } - - public String toString() { - return toString(10); - } - - public String toString(int i) { - if (this.magnitude == null) { - return "null"; - } - if (this.sign == 0) { - return Global.NOTIFICATION_DICTIONARY_RESULT_FAIL; - } - StringBuffer stringBuffer = new StringBuffer(); - if (i == 16) { - for (int i2 = 0; i2 < this.magnitude.length; i2++) { - String str = "0000000" + Integer.toHexString(this.magnitude[i2]); - stringBuffer.append(str.substring(str.length() - 8)); - } - } else if (i == 2) { - stringBuffer.append('1'); - for (int bitLength = bitLength() - 2; bitLength >= 0; bitLength--) { - stringBuffer.append(testBit(bitLength) ? '1' : '0'); - } - } else { - Stack stack = new Stack(); - VzwBigInt vzwBigInt = new VzwBigInt(Integer.toString(i, i), i); - for (VzwBigInt abs = abs(); !abs.equals(ZERO); abs = abs.divide(vzwBigInt)) { - VzwBigInt mod = abs.mod(vzwBigInt); - if (mod.equals(ZERO)) { - stack.push(Global.NOTIFICATION_DICTIONARY_RESULT_FAIL); - } else { - stack.push(Integer.toString(mod.magnitude[0], i)); - } - } - while (!stack.empty()) { - stringBuffer.append((String) stack.pop()); - } - } - String stringBuffer2 = stringBuffer.toString(); - while (stringBuffer2.length() > 1 && stringBuffer2.charAt(0) == '0') { - stringBuffer2 = stringBuffer2.substring(1); - } - return stringBuffer2.length() == 0 ? Global.NOTIFICATION_DICTIONARY_RESULT_FAIL : this.sign == -1 ? "-" + stringBuffer2 : stringBuffer2; - } - - public VzwBigInt xor(VzwBigInt vzwBigInt) { - if (this.sign == 0) { - return vzwBigInt; - } - if (vzwBigInt.sign == 0) { - return this; - } - int[] iArr = this.sign > 0 ? this.magnitude : add(ONE).magnitude; - int[] iArr2 = vzwBigInt.sign > 0 ? vzwBigInt.magnitude : vzwBigInt.add(ONE).magnitude; - boolean z = (this.sign < 0 && vzwBigInt.sign >= 0) || (this.sign >= 0 && vzwBigInt.sign < 0); - int[] iArr3 = new int[Math.max(iArr.length, iArr2.length)]; - int length = iArr3.length - iArr.length; - int length2 = iArr3.length - iArr2.length; - int i = 0; - while (i < iArr3.length) { - int i2 = i >= length ? iArr[i - length] : 0; - int i3 = i >= length2 ? iArr2[i - length2] : 0; - if (this.sign < 0) { - i2 ^= -1; - } - if (vzwBigInt.sign < 0) { - i3 ^= -1; - } - iArr3[i] = i2 ^ i3; - if (z) { - iArr3[i] = iArr3[i] ^ -1; - } - i++; - } - VzwBigInt vzwBigInt2 = new VzwBigInt(1, iArr3); - if (z) { - vzwBigInt2 = vzwBigInt2.not(); - } - return vzwBigInt2; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwDigest.java b/app/src/main/java/com/verizon/vcast/apps/VzwDigest.java deleted file mode 100644 index 12d2d3f..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwDigest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public interface VzwDigest { - int doFinal(byte[] bArr, int i); - - String getAlgorithmName(); - - int getByteLength(); - - int getDigestSize(); - - void reset(); - - void update(byte b); - - void update(byte[] bArr, int i, int i2); -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwGenDigest.java b/app/src/main/java/com/verizon/vcast/apps/VzwGenDigest.java deleted file mode 100644 index 0ccddb9..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwGenDigest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public abstract class VzwGenDigest implements VzwDigest { - private static final int BYTE_LENGTH = 64; - private long byteCount; - private byte[] xBuf; - private int xBufOff; - - protected VzwGenDigest() { - this.xBuf = new byte[4]; - this.xBufOff = 0; - } - - protected VzwGenDigest(VzwGenDigest vzwGenDigest) { - this.xBuf = new byte[vzwGenDigest.xBuf.length]; - System.arraycopy(vzwGenDigest.xBuf, 0, this.xBuf, 0, vzwGenDigest.xBuf.length); - this.xBufOff = vzwGenDigest.xBufOff; - this.byteCount = vzwGenDigest.byteCount; - } - - public void finish() { - long j = this.byteCount << 3; - update(Byte.MIN_VALUE); - while (this.xBufOff != 0) { - update((byte) 0); - } - processLength(j); - processBlock(); - } - - @Override // com.verizon.vcast.apps.VzwDigest - public int getByteLength() { - return 64; - } - - /* access modifiers changed from: protected */ - public abstract void processBlock(); - - /* access modifiers changed from: protected */ - public abstract void processLength(long j); - - /* access modifiers changed from: protected */ - public abstract void processWord(byte[] bArr, int i); - - @Override // com.verizon.vcast.apps.VzwDigest - public void reset() { - this.byteCount = 0; - this.xBufOff = 0; - for (int i = 0; i < this.xBuf.length; i++) { - this.xBuf[i] = 0; - } - } - - @Override // com.verizon.vcast.apps.VzwDigest - public void update(byte b) { - byte[] bArr = this.xBuf; - int i = this.xBufOff; - this.xBufOff = i + 1; - bArr[i] = b; - if (this.xBufOff == this.xBuf.length) { - processWord(this.xBuf, 0); - this.xBufOff = 0; - } - this.byteCount++; - } - - @Override // com.verizon.vcast.apps.VzwDigest - public void update(byte[] bArr, int i, int i2) { - while (this.xBufOff != 0 && i2 > 0) { - update(bArr[i]); - i++; - i2--; - } - while (i2 > this.xBuf.length) { - processWord(bArr, i); - i += this.xBuf.length; - i2 -= this.xBuf.length; - this.byteCount += (long) this.xBuf.length; - } - while (i2 > 0) { - update(bArr[i]); - i++; - i2--; - } - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwPKCS1Encd.java b/app/src/main/java/com/verizon/vcast/apps/VzwPKCS1Encd.java deleted file mode 100644 index c32a010..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwPKCS1Encd.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public class VzwPKCS1Encd implements VzwAsymBlkCipher { - private static final int HEADER_LENGTH = 10; - public static final String STRICT_LENGTH_ENABLED_PROPERTY = "org.bouncycastle.pkcs1.strict"; - private VzwAsymBlkCipher engine; - private boolean useStrictLength = useStrict(); - - public VzwPKCS1Encd(VzwAsymBlkCipher vzwAsymBlkCipher) { - this.engine = vzwAsymBlkCipher; - } - - private byte[] decodeBlock(byte[] bArr, int i, int i2) throws Exception { - byte b; - byte[] processBlock = this.engine.processBlock(bArr, i, i2); - if (processBlock.length < getOutputBlockSize()) { - throw new Exception("block truncated"); - } - byte b2 = processBlock[0]; - if (b2 != 1 && b2 != 2) { - throw new Exception("unknown block type"); - } else if (!this.useStrictLength || processBlock.length == this.engine.getOutputBlockSize()) { - int i3 = 1; - while (i3 != processBlock.length && (b = processBlock[i3]) != 0) { - if (b2 != 1 || b == -1) { - i3++; - } else { - throw new Exception("block padding incorrect"); - } - } - int i4 = i3 + 1; - if (i4 > processBlock.length || i4 < 10) { - throw new Exception("no data in block"); - } - byte[] bArr2 = new byte[(processBlock.length - i4)]; - System.arraycopy(processBlock, i4, bArr2, 0, bArr2.length); - return bArr2; - } else { - throw new Exception("block incorrect size"); - } - } - - private boolean useStrict() { - String property = System.getProperty(STRICT_LENGTH_ENABLED_PROPERTY); - return property == null || property.equals("true"); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public int getInputBlockSize() { - return this.engine.getInputBlockSize(); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public int getOutputBlockSize() { - return this.engine.getOutputBlockSize() - 10; - } - - public VzwAsymBlkCipher getUnderlyingCipher() { - return this.engine; - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public void init(boolean z, VzwRSAKyParam vzwRSAKyParam) { - this.engine.init(z, vzwRSAKyParam); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public byte[] processBlock(byte[] bArr, int i, int i2) throws Exception { - return decodeBlock(bArr, i, i2); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwPack.java b/app/src/main/java/com/verizon/vcast/apps/VzwPack.java deleted file mode 100644 index cef3ecb..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwPack.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.verizon.vcast.apps; - -abstract class VzwPack { - VzwPack() { - } - - public static int bigEndianToInt(byte[] bArr, int i) { - int i2 = i + 1; - int i3 = i2 + 1; - return (bArr[i] << 24) | ((bArr[i2] & 255) << 16) | ((bArr[i3] & 255) << 8) | (bArr[i3 + 1] & 255); - } - - public static long bigEndianToLong(byte[] bArr, int i) { - return ((((long) bigEndianToInt(bArr, i)) & 4294967295L) << 32) | (((long) bigEndianToInt(bArr, i + 4)) & 4294967295L); - } - - public static void intToBigEndian(int i, byte[] bArr, int i2) { - bArr[i2] = (byte) (i >>> 24); - int i3 = i2 + 1; - bArr[i3] = (byte) (i >>> 16); - int i4 = i3 + 1; - bArr[i4] = (byte) (i >>> 8); - bArr[i4 + 1] = (byte) i; - } - - public static void longToBigEndian(long j, byte[] bArr, int i) { - intToBigEndian((int) (j >>> 32), bArr, i); - intToBigEndian((int) (4294967295L & j), bArr, i + 4); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwRSACreEng.java b/app/src/main/java/com/verizon/vcast/apps/VzwRSACreEng.java deleted file mode 100644 index ed7f414..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwRSACreEng.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.verizon.vcast.apps; - -class VzwRSACreEng { - private boolean forEncryption; - private VzwRSAKyParam key; - - VzwRSACreEng() { - } - - public VzwBigInt convertInput(byte[] bArr, int i, int i2) { - byte[] bArr2; - if (i2 > getInputBlockSize() + 1) { - throw new IllegalStateException("input too large for RSA cipher."); - } else if (i2 != getInputBlockSize() + 1 || this.forEncryption) { - if (i == 0 && i2 == bArr.length) { - bArr2 = bArr; - } else { - bArr2 = new byte[i2]; - System.arraycopy(bArr, i, bArr2, 0, i2); - } - VzwBigInt vzwBigInt = new VzwBigInt(1, bArr2); - if (vzwBigInt.compareTo(this.key.getModulus()) < 0) { - return vzwBigInt; - } - throw new IllegalStateException("input too large for RSA cipher."); - } else { - throw new IllegalStateException("input too large for RSA cipher."); - } - } - - public byte[] convertOutput(VzwBigInt vzwBigInt) { - byte[] byteArray = vzwBigInt.toByteArray(); - if (this.forEncryption) { - if (byteArray[0] == 0 && byteArray.length > getOutputBlockSize()) { - byte[] bArr = new byte[(byteArray.length - 1)]; - System.arraycopy(byteArray, 1, bArr, 0, bArr.length); - return bArr; - } else if (byteArray.length < getOutputBlockSize()) { - byte[] bArr2 = new byte[getOutputBlockSize()]; - System.arraycopy(byteArray, 0, bArr2, bArr2.length - byteArray.length, byteArray.length); - return bArr2; - } - } else if (byteArray[0] == 0) { - byte[] bArr3 = new byte[(byteArray.length - 1)]; - System.arraycopy(byteArray, 1, bArr3, 0, bArr3.length); - return bArr3; - } - return byteArray; - } - - public int getInputBlockSize() { - int bitLength = this.key.getModulus().bitLength(); - return this.forEncryption ? ((bitLength + 7) / 8) - 1 : (bitLength + 7) / 8; - } - - public int getOutputBlockSize() { - int bitLength = this.key.getModulus().bitLength(); - return this.forEncryption ? (bitLength + 7) / 8 : ((bitLength + 7) / 8) - 1; - } - - public void init(boolean z, VzwRSAKyParam vzwRSAKyParam) { - this.key = vzwRSAKyParam; - this.forEncryption = z; - } - - public VzwBigInt processBlock(VzwBigInt vzwBigInt) { - return vzwBigInt.modPow(this.key.getExponent(), this.key.getModulus()); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwRSAEng.java b/app/src/main/java/com/verizon/vcast/apps/VzwRSAEng.java deleted file mode 100644 index 75e7728..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwRSAEng.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public class VzwRSAEng implements VzwAsymBlkCipher { - private VzwRSACreEng core; - - VzwRSAEng() { - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public int getInputBlockSize() { - return this.core.getInputBlockSize(); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public int getOutputBlockSize() { - return this.core.getOutputBlockSize(); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public void init(boolean z, VzwRSAKyParam vzwRSAKyParam) { - if (this.core == null) { - this.core = new VzwRSACreEng(); - } - this.core.init(z, vzwRSAKyParam); - } - - @Override // com.verizon.vcast.apps.VzwAsymBlkCipher - public byte[] processBlock(byte[] bArr, int i, int i2) { - if (this.core != null) { - return this.core.convertOutput(this.core.processBlock(this.core.convertInput(bArr, i, i2))); - } - throw new IllegalStateException("RSA engine not initialised"); - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwRSAKyParam.java b/app/src/main/java/com/verizon/vcast/apps/VzwRSAKyParam.java deleted file mode 100644 index 4bc1730..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwRSAKyParam.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public class VzwRSAKyParam { - private VzwBigInt exponent; - private VzwBigInt modulus; - boolean privateKey; - - public VzwRSAKyParam(boolean z, VzwBigInt vzwBigInt, VzwBigInt vzwBigInt2) { - this.privateKey = z; - this.modulus = vzwBigInt; - this.exponent = vzwBigInt2; - } - - public VzwBigInt getExponent() { - return this.exponent; - } - - public VzwBigInt getModulus() { - return this.modulus; - } - - public boolean isPrivate() { - return this.privateKey; - } -} diff --git a/app/src/main/java/com/verizon/vcast/apps/VzwSHA.java b/app/src/main/java/com/verizon/vcast/apps/VzwSHA.java deleted file mode 100644 index 32897f6..0000000 --- a/app/src/main/java/com/verizon/vcast/apps/VzwSHA.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.verizon.vcast.apps; - -/* access modifiers changed from: package-private */ -public class VzwSHA extends VzwGenDigest { - private static final int DIGEST_LENGTH = 20; - private static final int Y1 = 1518500249; - private static final int Y2 = 1859775393; - private static final int Y3 = -1894007588; - private static final int Y4 = -899497514; - private int H1; - private int H2; - private int H3; - private int H4; - private int H5; - private int[] X; - private int xOff; - - public VzwSHA() { - this.X = new int[80]; - reset(); - } - - public VzwSHA(VzwSHA vzwSHA) { - super(vzwSHA); - this.X = new int[80]; - this.H1 = vzwSHA.H1; - this.H2 = vzwSHA.H2; - this.H3 = vzwSHA.H3; - this.H4 = vzwSHA.H4; - this.H5 = vzwSHA.H5; - System.arraycopy(vzwSHA.X, 0, this.X, 0, vzwSHA.X.length); - this.xOff = vzwSHA.xOff; - } - - private int f(int i, int i2, int i3) { - return (i & i2) | ((i ^ -1) & i3); - } - - private int g(int i, int i2, int i3) { - return (i & i2) | (i & i3) | (i2 & i3); - } - - private int h(int i, int i2, int i3) { - return (i ^ i2) ^ i3; - } - - @Override // com.verizon.vcast.apps.VzwDigest - public int doFinal(byte[] bArr, int i) { - finish(); - VzwPack.intToBigEndian(this.H1, bArr, i); - VzwPack.intToBigEndian(this.H2, bArr, i + 4); - VzwPack.intToBigEndian(this.H3, bArr, i + 8); - VzwPack.intToBigEndian(this.H4, bArr, i + 12); - VzwPack.intToBigEndian(this.H5, bArr, i + 16); - reset(); - return 20; - } - - @Override // com.verizon.vcast.apps.VzwDigest - public String getAlgorithmName() { - return "SHA-1"; - } - - @Override // com.verizon.vcast.apps.VzwDigest - public int getDigestSize() { - return 20; - } - - /* access modifiers changed from: protected */ - @Override // com.verizon.vcast.apps.VzwGenDigest - public void processBlock() { - int i; - for (int i2 = 16; i2 < 80; i2++) { - int i3 = ((this.X[i2 - 3] ^ this.X[i2 - 8]) ^ this.X[i2 - 14]) ^ this.X[i2 - 16]; - this.X[i2] = (i3 << 1) | (i3 >>> 31); - } - int i4 = this.H1; - int i5 = this.H2; - int i6 = this.H3; - int i7 = this.H4; - int i8 = this.H5; - int i9 = 0; - int i10 = 0; - while (true) { - i = i9; - if (i10 >= 4) { - break; - } - int i11 = i + 1; - int f = i8 + ((i4 << 5) | (i4 >>> 27)) + f(i5, i6, i7) + this.X[i] + Y1; - int i12 = (i5 << 30) | (i5 >>> 2); - int i13 = i11 + 1; - int f2 = i7 + ((f << 5) | (f >>> 27)) + f(i4, i12, i6) + this.X[i11] + Y1; - int i14 = (i4 << 30) | (i4 >>> 2); - int i15 = i13 + 1; - int f3 = i6 + ((f2 << 5) | (f2 >>> 27)) + f(f, i14, i12) + this.X[i13] + Y1; - i8 = (f << 30) | (f >>> 2); - int i16 = i15 + 1; - i5 = i12 + ((f3 << 5) | (f3 >>> 27)) + f(f2, i8, i14) + this.X[i15] + Y1; - i7 = (f2 << 30) | (f2 >>> 2); - i9 = i16 + 1; - i4 = i14 + ((i5 << 5) | (i5 >>> 27)) + f(f3, i7, i8) + this.X[i16] + Y1; - i6 = (f3 << 30) | (f3 >>> 2); - i10++; - } - int i17 = 0; - while (i17 < 4) { - int i18 = i + 1; - int h = i8 + ((i4 << 5) | (i4 >>> 27)) + h(i5, i6, i7) + this.X[i] + Y2; - int i19 = (i5 << 30) | (i5 >>> 2); - int i20 = i18 + 1; - int h2 = i7 + ((h << 5) | (h >>> 27)) + h(i4, i19, i6) + this.X[i18] + Y2; - int i21 = (i4 << 30) | (i4 >>> 2); - int i22 = i20 + 1; - int h3 = i6 + ((h2 << 5) | (h2 >>> 27)) + h(h, i21, i19) + this.X[i20] + Y2; - i8 = (h << 30) | (h >>> 2); - int i23 = i22 + 1; - i5 = i19 + ((h3 << 5) | (h3 >>> 27)) + h(h2, i8, i21) + this.X[i22] + Y2; - i7 = (h2 << 30) | (h2 >>> 2); - i4 = i21 + ((i5 << 5) | (i5 >>> 27)) + h(h3, i7, i8) + this.X[i23] + Y2; - i6 = (h3 << 30) | (h3 >>> 2); - i17++; - i = i23 + 1; - } - int i24 = 0; - while (i24 < 4) { - int i25 = i + 1; - int g = i8 + ((i4 << 5) | (i4 >>> 27)) + g(i5, i6, i7) + this.X[i] + Y3; - int i26 = (i5 << 30) | (i5 >>> 2); - int i27 = i25 + 1; - int g2 = i7 + ((g << 5) | (g >>> 27)) + g(i4, i26, i6) + this.X[i25] + Y3; - int i28 = (i4 << 30) | (i4 >>> 2); - int i29 = i27 + 1; - int g3 = i6 + ((g2 << 5) | (g2 >>> 27)) + g(g, i28, i26) + this.X[i27] + Y3; - i8 = (g << 30) | (g >>> 2); - int i30 = i29 + 1; - i5 = i26 + ((g3 << 5) | (g3 >>> 27)) + g(g2, i8, i28) + this.X[i29] + Y3; - i7 = (g2 << 30) | (g2 >>> 2); - i4 = i28 + ((i5 << 5) | (i5 >>> 27)) + g(g3, i7, i8) + this.X[i30] + Y3; - i6 = (g3 << 30) | (g3 >>> 2); - i24++; - i = i30 + 1; - } - int i31 = 0; - while (i31 <= 3) { - int i32 = i + 1; - int h4 = i8 + ((i4 << 5) | (i4 >>> 27)) + h(i5, i6, i7) + this.X[i] + Y4; - int i33 = (i5 << 30) | (i5 >>> 2); - int i34 = i32 + 1; - int h5 = i7 + ((h4 << 5) | (h4 >>> 27)) + h(i4, i33, i6) + this.X[i32] + Y4; - int i35 = (i4 << 30) | (i4 >>> 2); - int i36 = i34 + 1; - int h6 = i6 + ((h5 << 5) | (h5 >>> 27)) + h(h4, i35, i33) + this.X[i34] + Y4; - i8 = (h4 << 30) | (h4 >>> 2); - int i37 = i36 + 1; - i5 = i33 + ((h6 << 5) | (h6 >>> 27)) + h(h5, i8, i35) + this.X[i36] + Y4; - i7 = (h5 << 30) | (h5 >>> 2); - i4 = i35 + ((i5 << 5) | (i5 >>> 27)) + h(h6, i7, i8) + this.X[i37] + Y4; - i6 = (h6 << 30) | (h6 >>> 2); - i31++; - i = i37 + 1; - } - this.H1 += i4; - this.H2 += i5; - this.H3 += i6; - this.H4 += i7; - this.H5 += i8; - this.xOff = 0; - for (int i38 = 0; i38 < 16; i38++) { - this.X[i38] = 0; - } - } - - /* access modifiers changed from: protected */ - @Override // com.verizon.vcast.apps.VzwGenDigest - public void processLength(long j) { - if (this.xOff > 14) { - processBlock(); - } - this.X[14] = (int) (j >>> 32); - this.X[15] = (int) (-1 & j); - } - - /* access modifiers changed from: protected */ - @Override // com.verizon.vcast.apps.VzwGenDigest - public void processWord(byte[] bArr, int i) { - int i2 = i + 1; - int i3 = i2 + 1; - this.X[this.xOff] = (bArr[i] << 24) | ((bArr[i2] & 255) << 16) | ((bArr[i3] & 255) << 8) | (bArr[i3 + 1] & 255); - int i4 = this.xOff + 1; - this.xOff = i4; - if (i4 == 16) { - processBlock(); - } - } - - @Override // com.verizon.vcast.apps.VzwGenDigest, com.verizon.vcast.apps.VzwDigest - public void reset() { - super.reset(); - this.H1 = 1732584193; - this.H2 = -271733879; - this.H3 = -1732584194; - this.H4 = 271733878; - this.H5 = -1009589776; - this.xOff = 0; - for (int i = 0; i != this.X.length; i++) { - this.X[i] = 0; - } - } -}