Commit a9e30a32 authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

💸 Fix minor errors in Digital Goods.

Change-Id: I66384669d3ef45802ca3ae9468f805ba6fed874f
Bug: 1096428
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2320614
Auto-Submit: Peter Conn <peconn@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Reviewed-by: default avatarElla Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792246}
parent abda9bb2
...@@ -47,7 +47,8 @@ public class DigitalGoodsAdapter { ...@@ -47,7 +47,8 @@ public class DigitalGoodsAdapter {
convertGetDetailsParams(itemIds), convertGetDetailsParams(itemIds),
convertGetDetailsCallback(callback)); convertGetDetailsCallback(callback));
boolean success = result.getBoolean(KEY_SUCCESS, false); boolean success = result != null &&
result.getBoolean(KEY_SUCCESS, false);
if (!success) { if (!success) {
returnClientAppError(callback); returnClientAppError(callback);
} }
...@@ -66,11 +67,12 @@ public class DigitalGoodsAdapter { ...@@ -66,11 +67,12 @@ public class DigitalGoodsAdapter {
@Override @Override
public void onConnected(Origin origin, TrustedWebActivityServiceConnection service) public void onConnected(Origin origin, TrustedWebActivityServiceConnection service)
throws RemoteException { throws RemoteException {
Bundle result = service.sendExtraCommand(COMMAND_GET_DETAILS, Bundle result = service.sendExtraCommand(COMMAND_ACKNOWLEDGE,
convertAcknowledgeParams(purchaseToken, makeAvailableAgain), convertAcknowledgeParams(purchaseToken, makeAvailableAgain),
convertAcknowledgeCallback(callback)); convertAcknowledgeCallback(callback));
boolean success = result.getBoolean(KEY_SUCCESS, false); boolean success = result != null &&
result.getBoolean(KEY_SUCCESS, false);
if (!success) { if (!success) {
returnClientAppError(callback); returnClientAppError(callback);
} }
......
...@@ -191,21 +191,21 @@ public class DigitalGoodsConverter { ...@@ -191,21 +191,21 @@ public class DigitalGoodsConverter {
} }
public static void returnClientAppUnavailable(GetDetailsResponse callback) { public static void returnClientAppUnavailable(GetDetailsResponse callback) {
callback.call(BillingResponseCode.CLIENT_APP_ERROR, callback.call(BillingResponseCode.CLIENT_APP_UNAVAILABLE,
new ItemDetails[0]); new ItemDetails[0]);
} }
public static void returnClientAppError(GetDetailsResponse callback) { public static void returnClientAppError(GetDetailsResponse callback) {
callback.call(BillingResponseCode.CLIENT_APP_UNAVAILABLE, callback.call(BillingResponseCode.CLIENT_APP_ERROR,
new ItemDetails[0]); new ItemDetails[0]);
} }
public static void returnClientAppUnavailable(AcknowledgeResponse callback) { public static void returnClientAppUnavailable(AcknowledgeResponse callback) {
callback.call(BillingResponseCode.CLIENT_APP_ERROR); callback.call(BillingResponseCode.CLIENT_APP_UNAVAILABLE);
} }
public static void returnClientAppError(AcknowledgeResponse callback) { public static void returnClientAppError(AcknowledgeResponse callback) {
callback.call(BillingResponseCode.CLIENT_APP_UNAVAILABLE); callback.call(BillingResponseCode.CLIENT_APP_ERROR);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment