Allow user to disable network boost notification

CarrierDefaultApp notification channels are not able to be disabled by
default. Allow the network boost channel notifications to be blockable
so user can disable them without affecting other notificatons in
CarrierDefaultApp.

Test: manual test
Bug: 258266536
Change-Id: I8907205e905b9fbdab3193f1816074b9ed62e785
This commit is contained in:
Sarah Chin
2022-11-14 15:10:54 -08:00
parent 80c690554a
commit ef53f427f6
2 changed files with 10 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
<string name="ssl_error_continue">Continue anyway via browser</string>
<!-- Telephony notification channel name for network boost notifications. -->
<string name="network_boost_notification_channel">Network Boost</string>
<string name="network_boost_notification_channel">Network boost</string>
<!-- Notification title text for the network boost notification. -->
<string name="network_boost_notification_title">%s recommends a data boost</string>
<!-- Notification detail text for the network boost notification. -->

View File

@@ -240,11 +240,15 @@ public class SlicePurchaseBroadcastReceiver extends BroadcastReceiver{
return;
}
context.getSystemService(NotificationManager.class).createNotificationChannel(
new NotificationChannel(NETWORK_BOOST_NOTIFICATION_CHANNEL_ID,
context.getResources().getString(
R.string.network_boost_notification_channel),
NotificationManager.IMPORTANCE_DEFAULT));
NotificationChannel channel = new NotificationChannel(
NETWORK_BOOST_NOTIFICATION_CHANNEL_ID,
context.getResources().getString(R.string.network_boost_notification_channel),
NotificationManager.IMPORTANCE_DEFAULT);
// CarrierDefaultApp notifications are unblockable by default. Make this channel blockable
// to allow users to disable notifications posted to this channel without affecting other
// notifications in this application.
channel.setBlockable(true);
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
Notification notification =
new Notification.Builder(context, NETWORK_BOOST_NOTIFICATION_CHANNEL_ID)