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

Commit 2328077d authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "reset carrier actions on sim loaded"

parents d110bd5b f8787648
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -15,6 +15,10 @@
 */
package com.android.internal.telephony;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -25,7 +29,6 @@ import android.util.LocalLog;
import android.util.Log;

import com.android.internal.util.IndentingPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;

@@ -49,6 +52,7 @@ public class CarrierActionAgent extends Handler {
    /** A list of carrier actions */
    public static final int CARRIER_ACTION_SET_METERED_APNS_ENABLED      = 0;
    public static final int CARRIER_ACTION_SET_RADIO_ENABLED             = 1;
    public static final int CARRIER_ACTION_RESET                         = 2;

    /** Member variables */
    private final Phone mPhone;
@@ -62,9 +66,24 @@ public class CarrierActionAgent extends Handler {
    private Boolean mCarrierActionOnMeteredApnEnabled = true;
    private Boolean mCarrierActionOnRadioEnabled = true;

    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            final String action = intent.getAction();
            if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)){
                if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(
                        intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE))) {
                    sendEmptyMessage(CARRIER_ACTION_RESET);
                }
            }
        }
    };

    /** Constructor */
    public CarrierActionAgent(Phone phone) {
        mPhone = phone;
        mPhone.getContext().registerReceiver(mReceiver,
                new IntentFilter(TelephonyIntents.ACTION_SIM_STATE_CHANGED));
        if (DBG) log("Creating CarrierActionAgent");
    }

@@ -86,6 +105,11 @@ public class CarrierActionAgent extends Handler {
                mRadioEnableRegistrants.notifyRegistrants(
                        new AsyncResult(null, mCarrierActionOnRadioEnabled, null));
                break;
            case CARRIER_ACTION_RESET:
                log("CARRIER_ACTION_RESET");
                carrierActionSetMeteredApnsEnabled(true);
                carrierActionSetRadioEnabled(true);
                break;
            default:
                loge("Unknown carrier action: " + msg.what);
        }
+0 −4
Original line number Diff line number Diff line
@@ -4066,10 +4066,6 @@ public class DcTracker extends Handler {
                    mIccRecords.set(newIccRecords);
                    newIccRecords.registerForRecordsLoaded(
                            this, DctConstants.EVENT_RECORDS_LOADED, null);
                    // reset carrier actions on sim loaded
                    final ServiceStateTracker sst = mPhone.getServiceStateTracker();
                    sst.setRadioPowerFromCarrier(true);
                    mDataEnabledSettings.setCarrierDataEnabled(true);
                }
            } else {
                onSimNotReady();