Further fix for SIM detection.

Refining SIM ready condition on UICC w/ multiple apps.
Also migration for RIL to use SIM_READY indication in case of UICC
presence instead of current NV_READY message.

Change-Id: I3445a628e2d32a24292e6a69785fe72422481221
This commit is contained in:
Kazuhiro Ondo
2011-05-27 17:01:51 -05:00
committed by Wink Saville
parent 8075fe48bf
commit 57675037aa
4 changed files with 39 additions and 8 deletions

View File

@@ -785,7 +785,18 @@ public abstract class IccCard {
if (right == IccCard.State.ABSENT) return left;
if (left == IccCard.State.ABSENT) return right;
// Disregards if either is NOT_READY
// Only if both are ready, return ready
if ((left == IccCard.State.READY) && (right == IccCard.State.READY)) {
return State.READY;
}
// Case one is ready, but the other is not.
if (((right == IccCard.State.NOT_READY) && (left == IccCard.State.READY)) ||
((left == IccCard.State.NOT_READY) && (right == IccCard.State.READY))) {
return IccCard.State.NOT_READY;
}
// At this point, the other state is assumed to be one of locked state
if (right == IccCard.State.NOT_READY) return left;
if (left == IccCard.State.NOT_READY) return right;

View File

@@ -48,22 +48,37 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
super(phone);
cm.registerForSIMReady(this, EVENT_SIM_READY, null);
mCdmaLtePhone = phone;
mLteSS = new ServiceState();
if (DBG) log("CdmaLteServiceStateTracker Constructors");
}
public void dispose() {
cm.unregisterForSIMReady(this);
super.dispose();
}
@Override
public void handleMessage(Message msg) {
AsyncResult ar;
int[] ints;
String[] strings;
if (msg.what == EVENT_POLL_STATE_GPRS) {
switch (msg.what) {
case EVENT_POLL_STATE_GPRS:
if (DBG) log("handleMessage EVENT_POLL_STATE_GPRS");
ar = (AsyncResult)msg.obj;
handlePollStateResult(msg.what, ar);
} else {
break;
case EVENT_SIM_READY:
isSubscriptionFromRuim = false;
cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
pollState();
// Signal strength polling stops when radio is off.
queueNextSignalStrengthPoll();
break;
default:
super.handleMessage(msg);
}
}

View File

@@ -137,7 +137,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
private boolean mIsMinInfoReady = false;
private boolean isEriTextLoaded = false;
private boolean isSubscriptionFromRuim = false;
protected boolean isSubscriptionFromRuim = false;
/* Used only for debugging purposes. */
private String mRegistrationDeniedReason;
@@ -1120,7 +1120,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
* This code should probably be hoisted to the base class so
* the fix, when added, works for both.
*/
private void
protected void
queueNextSignalStrengthPoll() {
if (dontPollSignalStrength || (cm.getRadioState().isGsm())) {
// The radio is telling us about signal strength changes

View File

@@ -181,8 +181,11 @@ public final class SIMRecords extends IccRecords {
// recordsToLoad is set to 0 because no requests are made yet
recordsToLoad = 0;
p.mCM.registerForSIMReady(this, EVENT_SIM_READY, null);
// SIMRecord is used by CDMA+LTE mode, and SIM_READY event
// will be subscribed by CdmaLteServiceStateTracker.
if (phone.getLteOnCdmaMode() != Phone.LTE_ON_CDMA_TRUE) {
p.mCM.registerForSIMReady(this, EVENT_SIM_READY, null);
}
p.mCM.registerForOffOrNotAvailable(
this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
p.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
@@ -196,7 +199,9 @@ public final class SIMRecords extends IccRecords {
@Override
public void dispose() {
//Unregister for all events
phone.mCM.unregisterForSIMReady(this);
if (phone.getLteOnCdmaMode() != Phone.LTE_ON_CDMA_TRUE) {
phone.mCM.unregisterForSIMReady(this);
}
phone.mCM.unregisterForOffOrNotAvailable( this);
phone.mCM.unregisterForIccRefresh(this);
}