Send userdata from ES response to slice purchase app
Test: atest SlicePurchaseControllerTest
Bug: 278504655
Change-Id: Iea7bcf1bf43b9d19ef92f10f7c3e97e04ca95d8f
diff --git a/src/com/android/phone/slice/SlicePurchaseController.java b/src/com/android/phone/slice/SlicePurchaseController.java
index e7d6390..b1abe56 100644
--- a/src/com/android/phone/slice/SlicePurchaseController.java
+++ b/src/com/android/phone/slice/SlicePurchaseController.java
@@ -205,10 +205,10 @@
/** Extra for the human-readable reason why the premium capability purchase failed. */
public static final String EXTRA_FAILURE_REASON =
"com.android.phone.slice.extra.FAILURE_REASON";
- /**
- * Extra for the user's carrier.
- */
+ /** Extra for the user's carrier. */
public static final String EXTRA_CARRIER = "com.android.phone.slice.extra.CARRIER";
+ /** Extra for the user data received from the entitlement service to send to the webapp. */
+ public static final String EXTRA_USER_DATA = "com.android.phone.slice.extra.USER_DATA";
/**
* Extra for the canceled PendingIntent that the slice purchase application can send as a
* response if the performance boost notification or WebView was canceled by the user.
@@ -725,6 +725,7 @@
return;
}
+ String userData = premiumNetworkEntitlementResponse.mServiceFlowUserData;
String purchaseUrl = getPurchaseUrl(premiumNetworkEntitlementResponse);
String carrier = getSimOperator();
if (TextUtils.isEmpty(purchaseUrl) || TextUtils.isEmpty(carrier)) {
@@ -760,6 +761,9 @@
intent.putExtra(EXTRA_PREMIUM_CAPABILITY, capability);
intent.putExtra(EXTRA_PURCHASE_URL, purchaseUrl);
intent.putExtra(EXTRA_CARRIER, carrier);
+ if (!TextUtils.isEmpty(userData)) {
+ intent.putExtra(EXTRA_USER_DATA, userData);
+ }
intent.putExtra(EXTRA_INTENT_CANCELED, createPendingIntent(
ACTION_SLICE_PURCHASE_APP_RESPONSE_CANCELED, capability, false));
intent.putExtra(EXTRA_INTENT_CARRIER_ERROR, createPendingIntent(