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

Commit 695cf5ab authored by bait_dispatcher_monitor_system's avatar bait_dispatcher_monitor_system Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Reset CFI on sim deactivation"

parents 2213b2ca 032f3046
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -19,8 +19,12 @@

package com.android.internal.telephony.gsm;

import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.SQLException;
import android.net.Uri;
@@ -76,6 +80,7 @@ import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.SubscriptionController;

import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.imsphone.ImsPhone;
@@ -121,6 +126,9 @@ public class GSMPhone extends PhoneBase {
    // Event constant for checking if Call Forwarding is enabled
    private static final int CHECK_CALLFORWARDING_STATUS = 75;

    private static final int CALL_FORWARD_NOTIFICATION = 4;
    private static final int NOTIFICATION_ID_OFFSET = 50;

    // Instance Variables
    GsmCallTracker mCT;
    GsmServiceStateTracker mSST;
@@ -128,6 +136,7 @@ public class GSMPhone extends PhoneBase {
    protected SimPhoneBookInterfaceManager mSimPhoneBookIntManager;
    PhoneSubInfo mSubInfo;

    NotificationManager mNotificationManager;
    Registrant mPostDialHandler;

    /** List of Registrants to receive Supplementary Service Notifications. */
@@ -155,6 +164,28 @@ public class GSMPhone extends PhoneBase {
        }
    }

    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (TelephonyIntents.ACTION_SUBSCRIPTION_SET_UICC_RESULT.
                    equals(intent.getAction())) {
                long subId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
                        SubscriptionManager.INVALID_SUB_ID);
                int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY,
                        PhoneConstants.PHONE_ID1);
                int status = intent.getIntExtra(TelephonyIntents.EXTRA_RESULT,
                        PhoneConstants.FAILURE);
                int state = intent.getIntExtra(TelephonyIntents.EXTRA_NEW_SUB_STATE,
                        SubscriptionManager.INACTIVE);
                log("Received ACTION_SUBSCRIPTION_SET_UICC_RESULT on subId: " + subId
                        + "phoneId " + phoneId + " status: " + status);
                if ((status == PhoneConstants.SUCCESS) && (state == SubscriptionManager.INACTIVE)) {
                    resetSubSpecifics();
                }
            }

        }};

    // Constructors

    public
@@ -216,6 +247,11 @@ public class GSMPhone extends PhoneBase {
            mSubInfo = new PhoneSubInfo(this);
        }

        mNotificationManager = (NotificationManager) mContext
                .getSystemService(Context.NOTIFICATION_SERVICE);
        IntentFilter filter =
                new IntentFilter(TelephonyIntents.ACTION_SUBSCRIPTION_SET_UICC_RESULT);
        context.registerReceiver(mReceiver, filter);
        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
        mCi.registerForOn(this, EVENT_RADIO_ON, null);
@@ -2112,6 +2148,12 @@ public class GSMPhone extends PhoneBase {
    }

    public void resetSubSpecifics() {
        log("resetSubSpecifics");
        if (getCallForwardingIndicator()) {
            int notificationId = CALL_FORWARD_NOTIFICATION +
                    (getPhoneId() * NOTIFICATION_ID_OFFSET);
            mNotificationManager.cancel(notificationId);
        }
    }

    /** gets the voice mail count from preferences */