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

Commit 60319831 authored by Seongho Kim's avatar Seongho Kim Committed by Jordan Liu
Browse files

Add carrier's option to cancel CS reject cause notification

Some carrier still want to cancel CS reject notification automatically
when it gets service. So, we need a way to set carrier's option for it.

Bug: 79889307
Test: Manunal

Change-Id: I7ad95fddc6c753c2769c2a4b733380733659a8aa
Merged-In: I7ad95fddc6c753c2769c2a4b733380733659a8aa
parent d8d48d0b
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -422,6 +422,7 @@ public class ServiceStateTracker extends Handler {
    public static final int CS_NORMAL_ENABLED = 1005;     // Access Control blocks normal voice/sms service
    public static final int CS_EMERGENCY_ENABLED = 1006;  // Access Control blocks emergency call service
    public static final int CS_REJECT_CAUSE_ENABLED = 2001;     // Notify MM rejection cause
    public static final int CS_REJECT_CAUSE_DISABLED = 2002;    // Cancel MM rejection cause
    /** Notification id. */
    public static final int PS_NOTIFICATION = 888;  // Id to update and cancel PS restricted
    public static final int CS_NOTIFICATION = 999;  // Id to update and cancel CS restricted
@@ -3873,6 +3874,8 @@ public class ServiceStateTracker extends Handler {

        Context context = mPhone.getContext();

        boolean autoCancelCsRejectNotification = false;

        CarrierConfigManager configManager = (CarrierConfigManager)
                context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager != null) {
@@ -3886,6 +3889,8 @@ public class ServiceStateTracker extends Handler {
                    if (DBG) log("Voice/emergency call barred notification disabled");
                    return;
                }
                autoCancelCsRejectNotification = bundle.getBoolean(
                        CarrierConfigManager.KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION, false);
            }
        }

@@ -3946,8 +3951,12 @@ public class ServiceStateTracker extends Handler {
                notificationId = CS_REJECT_CAUSE_NOTIFICATION;
                int resId = selectResourceForRejectCode(mRejectCode, multipleSubscriptions);
                if (0 == resId) {
                    if (autoCancelCsRejectNotification) {
                        notifyType = CS_REJECT_CAUSE_DISABLED;
                    } else {
                        loge("setNotification: mRejectCode=" + mRejectCode + " is not handled.");
                        return;
                    }
                } else {
                    icon = com.android.internal.R.drawable.stat_notify_mmcc_indication_icn;
                    // if using the single SIM resource, simNumber will be ignored
@@ -3978,7 +3987,8 @@ public class ServiceStateTracker extends Handler {
        NotificationManager notificationManager = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);

        if (notifyType == PS_DISABLED || notifyType == CS_DISABLED) {
        if (notifyType == PS_DISABLED || notifyType == CS_DISABLED
                || notifyType == CS_REJECT_CAUSE_DISABLED) {
            // cancel previous post notification
            notificationManager.cancel(Integer.toString(mSubId), notificationId);
        } else {