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

Commit 03f9d205 authored by Rakesh Pallerla's avatar Rakesh Pallerla Committed by Preeti Ahuja
Browse files

Send external state again after updating siminfo table

Send external SIM state again after record is updated
in siminfo table.

Change-Id: Ia8f13880aa3c75ec4f729d89162dbf01eae02481
CRs-Fixed: 747191
parent ab21d428
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -19,8 +19,10 @@ package com.android.internal.telephony.uicc;
import static android.Manifest.permission.READ_PHONE_STATE;
import static android.Manifest.permission.READ_PHONE_STATE;


import android.app.ActivityManagerNative;
import android.app.ActivityManagerNative;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncResult;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
@@ -127,6 +129,19 @@ public class IccCardProxy extends Handler implements IccCard {
    private boolean mIsCardStatusAvailable = false;
    private boolean mIsCardStatusAvailable = false;
    private PersoSubState mPersoSubState = PersoSubState.PERSOSUBSTATE_UNKNOWN;
    private PersoSubState mPersoSubState = PersoSubState.PERSOSUBSTATE_UNKNOWN;


    // Sim State events may be broadcasted before the siminfo table update has been
    // completed. Due to this such events may be broadcasted with dummy subId for a
    // particular slotId. Therefore, setExternalState once the siminfo table has been updated.
    // For example, if the UI receives the sim state broadcast with the state as pin locked
    // with dummy subId, the pin lock screen will not be displayed.
    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (TelephonyIntents.ACTION_SUBINFO_RECORD_UPDATED.equals(intent.getAction())) {
                    setExternalState(mExternalState, true);
                }
            }};

    public IccCardProxy(Context context, CommandsInterface ci) {
    public IccCardProxy(Context context, CommandsInterface ci) {
        log("Creating");
        log("Creating");
        mContext = context;
        mContext = context;
@@ -137,6 +152,9 @@ public class IccCardProxy extends Handler implements IccCard {
        mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
        mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
        ci.registerForOn(this,EVENT_RADIO_ON, null);
        ci.registerForOn(this,EVENT_RADIO_ON, null);
        ci.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_UNAVAILABLE, null);
        ci.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_UNAVAILABLE, null);
        IntentFilter filter =
                new IntentFilter(TelephonyIntents.ACTION_SUBINFO_RECORD_UPDATED);
        mContext.registerReceiver(mReceiver, filter);
        setExternalState(State.NOT_READY);
        setExternalState(State.NOT_READY);
    }
    }


@@ -152,6 +170,7 @@ public class IccCardProxy extends Handler implements IccCard {
    public void dispose() {
    public void dispose() {
        synchronized (mLock) {
        synchronized (mLock) {
            log("Disposing");
            log("Disposing");
            mContext.unregisterReceiver(mReceiver);
            //Cleanup icc references
            //Cleanup icc references
            mUiccController.unregisterForIccChanged(this);
            mUiccController.unregisterForIccChanged(this);
            mUiccController = null;
            mUiccController = null;