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

Commit 65e6c18c authored by fionaxu's avatar fionaxu
Browse files

downgrade roaming notification channel importance

delete the old channel and create a new one with downgraded low
importance to suppress default sound and vibration since its
irritating when users are on the edge of the network
(ping pong between roaming and non-roaming).

Bug: 63910379
Test: Manual test adb shell setprop telephony.test.forceRoaming true
Change-Id: I50c25399d451545a8893424a33f6938ad77a2437
parent 42705ae4
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.telephony.SubscriptionManager;
import com.android.internal.R;

import java.util.Arrays;
import java.util.List;


public class NotificationChannelController {
@@ -39,11 +38,14 @@ public class NotificationChannelController {
     */
    public static final String CHANNEL_ID_ALERT = "alert";
    public static final String CHANNEL_ID_CALL_FORWARD = "callForward";
    public static final String CHANNEL_ID_MOBILE_DATA_ALERT = "mobileDataAlert";
    public static final String CHANNEL_ID_MOBILE_DATA_ALERT = "mobileDataAlertNew";
    public static final String CHANNEL_ID_SMS = "sms";
    public static final String CHANNEL_ID_VOICE_MAIL = "voiceMail";
    public static final String CHANNEL_ID_WFC = "wfc";

    /** deprecated channel, replaced with @see #CHANNEL_ID_MOBILE_DATA_ALERT */
    private static final String CHANNEL_ID_MOBILE_DATA_ALERT_DEPRECATED = "mobileDataAlert";

    /**
     * Creates all notification channels and registers with NotificationManager. If a channel
     * with the same ID is already registered, NotificationManager will ignore this call.
@@ -63,7 +65,7 @@ public class NotificationChannelController {
                        NotificationManager.IMPORTANCE_LOW),
                new NotificationChannel(CHANNEL_ID_MOBILE_DATA_ALERT,
                        context.getText(R.string.notification_channel_mobile_data_alert),
                        NotificationManager.IMPORTANCE_DEFAULT),
                        NotificationManager.IMPORTANCE_LOW),
                new NotificationChannel(CHANNEL_ID_SMS,
                        context.getText(R.string.notification_channel_sms),
                        NotificationManager.IMPORTANCE_HIGH),
@@ -75,6 +77,12 @@ public class NotificationChannelController {
        if (getChannel(CHANNEL_ID_VOICE_MAIL, context) != null) {
            migrateVoicemailNotificationSettings(context);
        }
        // after channel has been created there is no way to change the channel setting
        // programmatically. delete the old channel and create a new one with a new ID.
        if (getChannel(CHANNEL_ID_MOBILE_DATA_ALERT_DEPRECATED, context) != null) {
            context.getSystemService(NotificationManager.class)
                    .deleteNotificationChannel(CHANNEL_ID_MOBILE_DATA_ALERT_DEPRECATED);
        }
    }

    public NotificationChannelController(Context context) {