summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sarah Chin <sarahchin@google.com> 2023-01-04 13:33:14 -0800
committer Sarah Chin <sarahchin@google.com> 2023-01-11 22:45:35 +0000
commit54c3e63feaccfa51521235ecd3808901dce1743f (patch)
tree550304537e36d5db8f65526d180323b2c450428f
parent8a06b4ba5163411125756557f4a4eac3568cc501 (diff)
Change app name to carrier name
Slice purchase notification shows the carrier name instead of the application name. Test: manual, unit, CTS Bug: 263429235 Change-Id: I2d8520910d09e0aa6f387a1ea256e6c1eee03f64
-rw-r--r--packages/CarrierDefaultApp/res/values/strings.xml4
-rw-r--r--packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiver.java18
-rw-r--r--packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseActivityTest.java4
-rw-r--r--packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiverTest.java8
4 files changed, 16 insertions, 18 deletions
diff --git a/packages/CarrierDefaultApp/res/values/strings.xml b/packages/CarrierDefaultApp/res/values/strings.xml
index df4705b1efac..6e2927d6e80e 100644
--- a/packages/CarrierDefaultApp/res/values/strings.xml
+++ b/packages/CarrierDefaultApp/res/values/strings.xml
@@ -17,9 +17,9 @@
<!-- Telephony notification channel name for performance boost notifications. -->
<string name="performance_boost_notification_channel">Performance boost</string>
<!-- Notification title text for the performance boost notification. -->
- <string name="performance_boost_notification_title">%s recommends a performance boost</string>
+ <string name="performance_boost_notification_title">Improve your 5G experience</string>
<!-- Notification detail text for the performance boost notification. -->
- <string name="performance_boost_notification_detail">Buy a performance boost for better network performance</string>
+ <string name="performance_boost_notification_detail">%1$s recommends buying a performance boost plan. Tap to buy through %2$s.</string>
<!-- Notification button text to cancel the performance boost notification. -->
<string name="performance_boost_notification_button_not_now">Not now</string>
<!-- Notification button text to manage the performance boost notification. -->
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiver.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiver.java
index 1b02c2b87e4a..d4ce5f5471cb 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiver.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiver.java
@@ -178,9 +178,9 @@ public class SlicePurchaseBroadcastReceiver extends BroadcastReceiver{
return false;
}
- String appName = intent.getStringExtra(SlicePurchaseController.EXTRA_REQUESTING_APP_NAME);
- if (TextUtils.isEmpty(appName)) {
- loge("isIntentValid: empty requesting application name: " + appName);
+ String carrier = intent.getStringExtra(SlicePurchaseController.EXTRA_CARRIER);
+ if (TextUtils.isEmpty(carrier)) {
+ loge("isIntentValid: empty carrier: " + carrier);
return false;
}
@@ -310,14 +310,14 @@ public class SlicePurchaseBroadcastReceiver extends BroadcastReceiver{
channel.setBlockable(true);
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
+ String carrier = intent.getStringExtra(SlicePurchaseController.EXTRA_CARRIER);
+
Notification notification =
new Notification.Builder(context, PERFORMANCE_BOOST_NOTIFICATION_CHANNEL_ID)
- .setContentTitle(String.format(res.getString(
- R.string.performance_boost_notification_title),
- intent.getStringExtra(
- SlicePurchaseController.EXTRA_REQUESTING_APP_NAME)))
- .setContentText(res.getString(
- R.string.performance_boost_notification_detail))
+ .setContentTitle(res.getString(
+ R.string.performance_boost_notification_title))
+ .setContentText(String.format(res.getString(
+ R.string.performance_boost_notification_detail), carrier, carrier))
.setSmallIcon(R.drawable.ic_performance_boost)
.setContentIntent(createContentIntent(context, intent, 1))
.setDeleteIntent(intent.getParcelableExtra(
diff --git a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseActivityTest.java b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseActivityTest.java
index 1bf644eb1fb6..daf0b42dbd7c 100644
--- a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseActivityTest.java
+++ b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseActivityTest.java
@@ -48,7 +48,7 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
public class SlicePurchaseActivityTest extends ActivityUnitTestCase<SlicePurchaseActivity> {
- private static final String TAG = "SlicePurchaseActivityTest";
+ private static final String CARRIER = "Some Carrier";
private static final String URL = "file:///android_asset/slice_purchase_test.html";
private static final int PHONE_ID = 0;
@@ -95,7 +95,7 @@ public class SlicePurchaseActivityTest extends ActivityUnitTestCase<SlicePurchas
TelephonyManager.PREMIUM_CAPABILITY_PRIORITIZE_LATENCY);
intent.putExtra(SlicePurchaseController.EXTRA_PURCHASE_URL,
SlicePurchaseController.SLICE_PURCHASE_TEST_FILE);
- intent.putExtra(SlicePurchaseController.EXTRA_REQUESTING_APP_NAME, TAG);
+ intent.putExtra(SlicePurchaseController.EXTRA_CARRIER, CARRIER);
Intent spiedIntent = spy(intent);
// set up pending intents
diff --git a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiverTest.java b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiverTest.java
index 568d63c90285..952789c56b2e 100644
--- a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiverTest.java
+++ b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/SlicePurchaseBroadcastReceiverTest.java
@@ -62,7 +62,7 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
public class SlicePurchaseBroadcastReceiverTest {
private static final int PHONE_ID = 0;
- private static final String TAG = "SlicePurchaseBroadcastReceiverTest";
+ private static final String CARRIER = "Some Carrier";
private static final String EXTRA = "EXTRA";
@Mock Intent mIntent;
@@ -136,8 +136,7 @@ public class SlicePurchaseBroadcastReceiverTest {
eq(SlicePurchaseController.EXTRA_PREMIUM_CAPABILITY), anyInt());
doReturn(SlicePurchaseController.SLICE_PURCHASE_TEST_FILE).when(mIntent).getStringExtra(
eq(SlicePurchaseController.EXTRA_PURCHASE_URL));
- doReturn(TAG).when(mIntent).getStringExtra(
- eq(SlicePurchaseController.EXTRA_REQUESTING_APP_NAME));
+ doReturn(CARRIER).when(mIntent).getStringExtra(eq(SlicePurchaseController.EXTRA_CARRIER));
assertFalse(SlicePurchaseBroadcastReceiver.isIntentValid(mIntent));
// set up pending intent
@@ -229,8 +228,7 @@ public class SlicePurchaseBroadcastReceiverTest {
eq(SlicePurchaseController.EXTRA_PREMIUM_CAPABILITY), anyInt());
doReturn(SlicePurchaseController.SLICE_PURCHASE_TEST_FILE).when(mIntent).getStringExtra(
eq(SlicePurchaseController.EXTRA_PURCHASE_URL));
- doReturn(TAG).when(mIntent).getStringExtra(
- eq(SlicePurchaseController.EXTRA_REQUESTING_APP_NAME));
+ doReturn(CARRIER).when(mIntent).getStringExtra(eq(SlicePurchaseController.EXTRA_CARRIER));
mSlicePurchaseBroadcastReceiver.onReceive(mContext, mIntent);
}