Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,142 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Log;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class GooglePlayCatalogItem extends NimbleCatalogItem implements Externalizable {
Map<String, Object> mAdditionalInfo;
String mDescription;
boolean mIsFree;
NimbleCatalogItem.ItemType mItemType;
float mPriceDecimal;
String mPriceWithCurrencyAndFormat;
String mSku;
String mTitle;
String mUrl;
public GooglePlayCatalogItem() {
Log.Helper.LOGPUBLICFUNC(this);
this.mSku = "";
this.mTitle = "";
this.mDescription = "";
this.mPriceDecimal = 0.0f;
this.mPriceWithCurrencyAndFormat = "";
this.mItemType = NimbleCatalogItem.ItemType.UNKNOWN;
this.mUrl = "";
this.mIsFree = false;
this.mAdditionalInfo = new HashMap();
}
public GooglePlayCatalogItem(GooglePlayCatalogItem googlePlayCatalogItem) {
this.mSku = googlePlayCatalogItem.mSku;
this.mTitle = googlePlayCatalogItem.mTitle;
this.mDescription = googlePlayCatalogItem.mDescription;
this.mPriceDecimal = googlePlayCatalogItem.mPriceDecimal;
this.mPriceWithCurrencyAndFormat = googlePlayCatalogItem.mPriceWithCurrencyAndFormat;
this.mItemType = googlePlayCatalogItem.mItemType;
this.mUrl = googlePlayCatalogItem.mUrl;
this.mIsFree = googlePlayCatalogItem.mIsFree;
this.mAdditionalInfo = new HashMap(googlePlayCatalogItem.mAdditionalInfo);
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSku() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mSku;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSellId() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) {
return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString();
}
return null;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getTitle() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTitle;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getDescription() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mDescription;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public float getPriceDecimal() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceDecimal;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getPriceWithCurrencyAndFormat() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceWithCurrencyAndFormat;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public NimbleCatalogItem.ItemType getItemType() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mItemType;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getMetaDataUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mUrl;
}
public boolean isFree() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mIsFree;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public Map<String, Object> getAdditionalInfo() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mAdditionalInfo;
}
public String toString() {
Log.Helper.LOGPUBLICFUNC(this);
return "SKU(" + this.mSku + ") Title(" + this.mTitle + ") Price(" + this.mPriceDecimal + ") Currency(" + this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_CURRENCY) + ") PriceStr(" + this.mPriceWithCurrencyAndFormat + ") ItemType(" + this.mItemType + ")";
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
Log.Helper.LOGPUBLICFUNC(this);
objectOutput.writeUTF(this.mSku);
objectOutput.writeUTF(this.mTitle);
objectOutput.writeUTF(this.mDescription);
objectOutput.writeFloat(this.mPriceDecimal);
objectOutput.writeUTF(this.mPriceWithCurrencyAndFormat);
objectOutput.writeObject(this.mItemType);
objectOutput.writeBoolean(this.mIsFree);
objectOutput.writeObject(this.mAdditionalInfo);
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
Log.Helper.LOGPUBLICFUNC(this);
this.mSku = objectInput.readUTF();
this.mTitle = objectInput.readUTF();
this.mDescription = objectInput.readUTF();
this.mPriceDecimal = objectInput.readFloat();
this.mPriceWithCurrencyAndFormat = objectInput.readUTF();
this.mItemType = (NimbleCatalogItem.ItemType) objectInput.readObject();
this.mIsFree = objectInput.readBoolean();
this.mAdditionalInfo = (Map) objectInput.readObject();
}
}

View File

@@ -0,0 +1,46 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Error;
/* loaded from: classes2.dex */
class GooglePlayError extends Error {
public static final String ERROR_DOMAIN = "GooglePlayError";
private static final long serialVersionUID = 1;
public enum Code {
BILLING_RESPONSE_RESULT_OK(0),
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_FEATURE_NOT_SUPPORTED(-2),
BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED(7),
BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED(8),
BILLING_RESPONSE_RESULT_SERVICE_DISCONNECTED(-1),
BILLING_RESPONSE_RESULT_SERVICE_UNAVAILABLE(2),
BILLING_RESPONSE_RESULT_NETWORK_ERROR(12),
UNKNOWN(10003);
private int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public GooglePlayError() {
}
public GooglePlayError(Code code, String str, Throwable th) {
super(ERROR_DOMAIN, code.intValue(), str, th);
}
public GooglePlayError(Code code, String str) {
super(ERROR_DOMAIN, code.intValue(), str);
}
}

View File

@@ -0,0 +1,20 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
/* loaded from: classes2.dex */
public abstract class GooglePlayNetworkConnectionCallback implements NetworkConnectionCallback {
String mParameter;
GooglePlay mParentGooglePlay;
String mTransactionId;
@Override // com.ea.nimble.NetworkConnectionCallback
public abstract void callback(NetworkConnectionHandle networkConnectionHandle);
public GooglePlayNetworkConnectionCallback(GooglePlay googlePlay, String str, String str2) {
this.mParentGooglePlay = googlePlay;
this.mTransactionId = str;
this.mParameter = str2;
}
}

View File

@@ -0,0 +1,243 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Utility;
import com.ea.nimble.mtx.INimbleMTX;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.NimbleMTX;
import com.ea.nimble.mtx.NimbleMTXTransaction;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public class GooglePlayTransaction implements NimbleMTXTransaction, Externalizable {
String mTransactionId = "";
String mReceipt = "";
String mItemSku = "";
float mPriceDecimal = 0.0f;
Date mTimeStamp = null;
String mNonce = "";
Exception mError = null;
GooglePlayCatalogItem mCatalogItem = null;
GooglePlayTransactionState mGooglePlayTransactionState = GooglePlayTransactionState.UNDEFINED;
GooglePlayTransactionState mFailedState = null;
INimbleMTX.PurchaseTransactionCallback mPurchaseCallback = null;
INimbleMTX.FinalizeTransactionCallback mFinalizeCallback = null;
INimbleMTX.ItemGrantedCallback mItemGrantedCallback = null;
NimbleMTXTransaction.TransactionType mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE;
String mDeveloperPayload = "";
boolean mIsRecorded = false;
Map<String, Serializable> mAdditionalInfo = new HashMap();
public enum GooglePlayTransactionState {
UNDEFINED,
WAITING_FOR_PREPURCHASE_INFO,
WAITING_FOR_NONCE,
WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE,
WAITING_FOR_SYNERGY_VERIFICATION,
WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT,
WAITING_FOR_GOOGLEPLAY_CONSUMPTION,
COMPLETE
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getTransactionId() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTransactionId;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getItemSku() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mItemSku;
}
/* renamed from: com.ea.nimble.mtx.googleplay.GooglePlayTransaction$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState;
static {
int[] iArr = new int[GooglePlayTransactionState.values().length];
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState = iArr;
try {
iArr[GooglePlayTransactionState.WAITING_FOR_PREPURCHASE_INFO.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_NONCE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.COMPLETE.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.UNDEFINED.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
}
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public NimbleMTXTransaction.TransactionState getTransactionState() {
Log.Helper.LOGPUBLICFUNC(this);
switch (AnonymousClass1.$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[this.mGooglePlayTransactionState.ordinal()]) {
}
return NimbleMTXTransaction.TransactionState.UNDEFINED;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public NimbleMTXTransaction.TransactionType getTransactionType() {
Log.Helper.LOGPUBLICFUNC(this);
NimbleMTXTransaction.TransactionType transactionType = this.mTransactionType;
return transactionType == null ? NimbleMTXTransaction.TransactionType.PURCHASE : transactionType;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public float getPriceDecimal() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceDecimal;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getItemSellId() {
Log.Helper.LOGPUBLICFUNC(this);
List<NimbleCatalogItem> availableCatalogItems = NimbleMTX.getComponent().getAvailableCatalogItems();
String itemSku = getItemSku();
if (availableCatalogItems != null) {
for (NimbleCatalogItem nimbleCatalogItem : availableCatalogItems) {
if (nimbleCatalogItem.getSku().equals(itemSku)) {
String sellId = nimbleCatalogItem.getSellId();
if (Utility.validString(sellId)) {
return sellId;
}
}
}
}
if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) {
return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString();
}
Log.Helper.LOGW(this, "getItemSellId(): Unable to acquire sell id for transaction with SKU: " + itemSku, new Object[0]);
return "";
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Date getTimeStamp() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTimeStamp;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getReceipt() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mReceipt;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Map<String, Object> getAdditionalInfo() {
Log.Helper.LOGPUBLICFUNC(this);
return new HashMap(this.mAdditionalInfo);
}
public String getNonce() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mNonce;
}
public String getDeveloperPayload() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mDeveloperPayload;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Exception getError() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mError;
}
public GooglePlayCatalogItem getCatalogItem() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mCatalogItem;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("GooglePlayTransaction: SKU(");
sb.append(getItemSku());
sb.append(") State(");
GooglePlayTransactionState googlePlayTransactionState = this.mGooglePlayTransactionState;
sb.append(googlePlayTransactionState == null ? "null" : googlePlayTransactionState.toString());
sb.append(") Receipt(");
sb.append(getReceipt());
sb.append(") TimeStamp(");
sb.append(getTimeStamp());
sb.append(")");
return sb.toString();
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
Log.Helper.LOGPUBLICFUNC(this);
objectOutput.writeUTF(Utility.safeString(this.mTransactionId));
objectOutput.writeUTF(Utility.safeString(this.mItemSku));
objectOutput.writeObject(this.mGooglePlayTransactionState);
objectOutput.writeObject(this.mTransactionType);
objectOutput.writeFloat(this.mPriceDecimal);
objectOutput.writeObject(this.mTimeStamp);
objectOutput.writeUTF(Utility.safeString(this.mReceipt));
objectOutput.writeUTF(Utility.safeString(this.mNonce));
objectOutput.writeObject(this.mError);
objectOutput.writeObject(this.mCatalogItem);
objectOutput.writeObject(this.mAdditionalInfo);
objectOutput.writeUTF(Utility.safeString(this.mDeveloperPayload));
objectOutput.writeObject(this.mFailedState);
objectOutput.writeBoolean(this.mIsRecorded);
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
Log.Helper.LOGPUBLICFUNC(this);
this.mTransactionId = objectInput.readUTF();
this.mItemSku = objectInput.readUTF();
this.mGooglePlayTransactionState = (GooglePlayTransactionState) objectInput.readObject();
this.mTransactionType = (NimbleMTXTransaction.TransactionType) objectInput.readObject();
this.mPriceDecimal = objectInput.readFloat();
this.mTimeStamp = (Date) objectInput.readObject();
this.mReceipt = objectInput.readUTF();
this.mNonce = objectInput.readUTF();
this.mError = (Error) objectInput.readObject();
this.mCatalogItem = (GooglePlayCatalogItem) objectInput.readObject();
this.mAdditionalInfo = (Map) objectInput.readObject();
this.mDeveloperPayload = objectInput.readUTF();
try {
this.mFailedState = (GooglePlayTransactionState) objectInput.readObject();
this.mIsRecorded = objectInput.readBoolean();
} catch (IOException unused) {
}
}
}

View File

@@ -0,0 +1,7 @@
package com.ea.nimble.mtx.googleplay;
/* loaded from: classes2.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,177 @@
package com.ea.nimble.mtx.googleplay.billing;
import android.app.Activity;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.billingclient.api.AcknowledgePurchaseParams;
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClientStateListener;
import com.android.billingclient.api.BillingFlowParams;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.ConsumeParams;
import com.android.billingclient.api.ConsumeResponseListener;
import com.android.billingclient.api.ProductDetails;
import com.android.billingclient.api.ProductDetailsResponseListener;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.PurchasesResponseListener;
import com.android.billingclient.api.PurchasesUpdatedListener;
import com.android.billingclient.api.QueryProductDetailsParams;
import com.android.billingclient.api.QueryPurchasesParams;
import com.ea.nimble.Log;
import com.ea.nimble.LogSource;
import com.firemonkeys.cloudcellapi.Consts;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/* loaded from: classes2.dex */
public class BillingHelper implements LogSource, PurchasesUpdatedListener, ProductDetailsResponseListener, PurchasesResponseListener {
private String m_base64PublicKey;
private BillingClient m_billingClient;
ProductDetailsResponseListener m_productDetailsClientListener;
PurchasesResponseListener m_purchaseResponseListener;
PurchasesUpdatedListener m_purchasesUpdatedListener;
private int m_catalogQueryRequests = 0;
private int m_purchaseHistoryRequests = 0;
List<ProductDetails> m_CatalogItemsList = new LinkedList();
List<Purchase> m_PurchasesList = new LinkedList();
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "MTX Google BillingHelper";
}
public BillingHelper(Context context, String str) {
this.m_billingClient = BillingClient.newBuilder(context).enablePendingPurchases().setListener(this).build();
this.m_base64PublicKey = str;
}
public boolean isBillingAvailable() {
return this.m_billingClient.isReady();
}
public void startSetup(@NonNull BillingClientStateListener billingClientStateListener, @NonNull PurchasesUpdatedListener purchasesUpdatedListener) {
this.m_purchasesUpdatedListener = purchasesUpdatedListener;
Log.Helper.LOGFUNC(this);
if (this.m_billingClient.isReady()) {
throw new IllegalStateException("Billing Client is already setup");
}
Log.Helper.LOGV(this, "Starting Billing Setup", new Object[0]);
this.m_billingClient.startConnection(billingClientStateListener);
}
public void dispose() {
Log.Helper.LOGFUNC(this);
Log.Helper.LOGV(this, "Disposing Billing Client Service", new Object[0]);
BillingClient billingClient = this.m_billingClient;
if (billingClient != null) {
billingClient.endConnection();
this.m_billingClient = null;
}
}
public void queryProductDetailsAsync(@NonNull List<QueryProductDetailsParams.Product> list, @NonNull List<QueryProductDetailsParams.Product> list2, @NonNull ProductDetailsResponseListener productDetailsResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_CatalogItemsList.clear();
if (list.size() == 0 && list2.size() == 0) {
Log.Helper.LOGW(this, "Empty Product List passed to queryProductDetails", new Object[0]);
return;
}
this.m_productDetailsClientListener = productDetailsResponseListener;
this.m_billingClient.queryProductDetailsAsync(QueryProductDetailsParams.newBuilder().setProductList(list).build(), this);
this.m_catalogQueryRequests++;
this.m_billingClient.queryProductDetailsAsync(QueryProductDetailsParams.newBuilder().setProductList(list2).build(), this);
this.m_catalogQueryRequests++;
}
public void queryPurchasesAsync(@NonNull PurchasesResponseListener purchasesResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_PurchasesList.clear();
this.m_purchaseResponseListener = purchasesResponseListener;
if (isBillingAvailable()) {
this.m_billingClient.queryPurchasesAsync(QueryPurchasesParams.newBuilder().setProductType(Consts.ITEM_TYPE_SUBSCRIPTION).build(), this);
this.m_purchaseHistoryRequests++;
this.m_billingClient.queryPurchasesAsync(QueryPurchasesParams.newBuilder().setProductType("inapp").build(), this);
this.m_purchaseHistoryRequests++;
return;
}
Log.Helper.LOGE(this, "Billing not available", new Object[0]);
}
@Override // com.android.billingclient.api.PurchasesResponseListener
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
Log.Helper.LOGFUNC(this);
this.m_purchaseHistoryRequests--;
if (billingResult.getResponseCode() == 0) {
for (Purchase purchase : list) {
if (isSignatureValid(purchase)) {
this.m_PurchasesList.add(purchase);
} else {
Log.Helper.LOGW(this, "Purchase signature verification **FAILED**. Not adding item.", new Object[0]);
Log.Helper.LOGD(this, " Purchase data: " + purchase.getOriginalJson(), new Object[0]);
Log.Helper.LOGD(this, " Signature: " + purchase.getSignature(), new Object[0]);
}
}
}
if (billingResult.getResponseCode() != 0 || this.m_purchaseHistoryRequests == 0) {
this.m_purchaseHistoryRequests = 0;
PurchasesResponseListener purchasesResponseListener = this.m_purchaseResponseListener;
if (purchasesResponseListener != null) {
purchasesResponseListener.onQueryPurchasesResponse(billingResult, this.m_PurchasesList);
this.m_purchaseResponseListener = null;
}
}
}
@Override // com.android.billingclient.api.ProductDetailsResponseListener
public void onProductDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<ProductDetails> list) {
Log.Helper.LOGFUNC(this);
this.m_catalogQueryRequests--;
if (billingResult.getResponseCode() == 0) {
for (ProductDetails productDetails : list) {
Log.Helper.LOGV(this, "onProductDetailsResponse: " + productDetails, new Object[0]);
this.m_CatalogItemsList.add(productDetails);
}
}
if (this.m_catalogQueryRequests == 0) {
this.m_productDetailsClientListener.onProductDetailsResponse(billingResult, this.m_CatalogItemsList);
}
}
public void launchPurchaseFlow(@NonNull Activity activity, @NonNull ProductDetails productDetails) {
Log.Helper.LOGFUNC(this);
ArrayList arrayList = new ArrayList();
if (Consts.ITEM_TYPE_SUBSCRIPTION.equals(productDetails.getProductType())) {
arrayList.add(BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(productDetails).setOfferToken(((ProductDetails.SubscriptionOfferDetails) productDetails.getSubscriptionOfferDetails().get(0)).getOfferToken()).build());
} else {
arrayList.add(BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(productDetails).build());
}
this.m_billingClient.launchBillingFlow(activity, BillingFlowParams.newBuilder().setProductDetailsParamsList(arrayList).build());
}
@Override // com.android.billingclient.api.PurchasesUpdatedListener
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> list) {
Log.Helper.LOGFUNC(this);
this.m_purchasesUpdatedListener.onPurchasesUpdated(billingResult, list);
}
public void consumeAsync(@NonNull String str, @NonNull ConsumeResponseListener consumeResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_billingClient.consumeAsync(ConsumeParams.newBuilder().setPurchaseToken(str).build(), consumeResponseListener);
}
public void acknowledgeAsync(@NonNull String str, @NonNull AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_billingClient.acknowledgePurchase(AcknowledgePurchaseParams.newBuilder().setPurchaseToken(str).build(), acknowledgePurchaseResponseListener);
}
private boolean isSignatureValid(@NonNull Purchase purchase) {
String str = this.m_base64PublicKey;
if (str != null) {
return Security.verifyPurchase(str, purchase.getOriginalJson(), purchase.getSignature());
}
return true;
}
}

View File

@@ -0,0 +1,73 @@
package com.ea.nimble.mtx.googleplay.billing;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
/* loaded from: classes2.dex */
class Security {
private static final String KEY_FACTORY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
private static final String TAG = "IABUtil/Security";
public static boolean verifyPurchase(String str, String str2, String str3) {
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
Log.w(TAG, "Purchase verification failed: missing data.");
return false;
}
try {
return verify(generatePublicKey(str), str2, str3).booleanValue();
} catch (IOException e) {
Log.e(TAG, "Error generating PublicKey from encoded key: " + e.getMessage());
return false;
}
}
private static PublicKey generatePublicKey(String str) throws IOException {
try {
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str, 0)));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e2) {
String str2 = "Invalid key specification: " + e2;
Log.w(TAG, str2);
throw new IOException(str2);
}
}
private static Boolean verify(PublicKey publicKey, String str, String str2) {
try {
byte[] decode = Base64.decode(str2, 0);
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(str.getBytes());
if (signature.verify(decode)) {
return Boolean.TRUE;
}
Log.w(TAG, "Signature verification failed...");
return Boolean.FALSE;
} catch (InvalidKeyException unused) {
Log.e(TAG, "Invalid key specification.");
return Boolean.FALSE;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (SignatureException unused2) {
Log.e(TAG, "Signature exception.");
return Boolean.FALSE;
}
} catch (IllegalArgumentException unused3) {
Log.w(TAG, "Base64 decoding failed.");
return Boolean.FALSE;
}
}
}