Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a83230a8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Change app name to carrier name"

parents 1bc35430 54c3e63f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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. -->
+9 −9
Original line number Diff line number Diff line
@@ -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(
+2 −2
Original line number Diff line number Diff line
@@ -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
+3 −5
Original line number Diff line number Diff line
@@ -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);
    }