Broadcast SIM Refresh to all registered components

There could be multiple registrants like SIM, STK.
Port of 6228 from partner repo.

Change-Id: I0756d8b69e30058409e0279f65a99a1aa091e13d
This commit is contained in:
Robert Greenwalt
2011-05-09 16:46:39 -07:00
parent 5d03239063
commit a142512a50
5 changed files with 14 additions and 14 deletions

View File

@@ -72,6 +72,7 @@ public abstract class BaseCommands implements CommandsInterface {
protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList();
protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList();
protected RegistrantList mRilConnectedRegistrants = new RegistrantList();
protected RegistrantList mIccRefreshRegistrants = new RegistrantList();
protected Registrant mSMSRegistrant;
protected Registrant mNITZTimeRegistrant;
@@ -86,7 +87,6 @@ public abstract class BaseCommands implements CommandsInterface {
protected Registrant mCatCallSetUpRegistrant;
protected Registrant mIccSmsFullRegistrant;
protected Registrant mEmergencyCallbackModeRegistrant;
protected Registrant mIccRefreshRegistrant;
protected Registrant mRingRegistrant;
protected Registrant mRestrictedStateRegistrant;
protected Registrant mGsmBroadcastSmsRegistrant;
@@ -455,16 +455,17 @@ public abstract class BaseCommands implements CommandsInterface {
mIccSmsFullRegistrant.clear();
}
public void setOnIccRefresh(Handler h, int what, Object obj) {
mIccRefreshRegistrant = new Registrant (h, what, obj);
public void registerForIccRefresh(Handler h, int what, Object obj) {
Registrant r = new Registrant (h, what, obj);
mIccRefreshRegistrants.add(r);
}
public void setEmergencyCallbackMode(Handler h, int what, Object obj) {
mEmergencyCallbackModeRegistrant = new Registrant (h, what, obj);
}
public void unSetOnIccRefresh(Handler h) {
mIccRefreshRegistrant.clear();
public void unregisterForIccRefresh(Handler h) {
mIccRefreshRegistrants.remove(h);
}
public void setOnCallRing(Handler h, int what, Object obj) {

View File

@@ -352,14 +352,13 @@ public interface CommandsInterface {
/**
* Sets the handler for SIM Refresh notifications.
* Unlike the register* methods, there's only one notification handler
*
* @param h Handler for notification message.
* @param what User-defined message code.
* @param obj User object.
*/
void setOnIccRefresh(Handler h, int what, Object obj);
void unSetOnIccRefresh(Handler h);
void registerForIccRefresh(Handler h, int what, Object obj);
void unregisterForIccRefresh(Handler h);
/**
* Sets the handler for RING notifications.

View File

@@ -2602,8 +2602,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_SIM_REFRESH:
if (RILJ_LOGD) unsljLogRet(response, ret);
if (mIccRefreshRegistrant != null) {
mIccRefreshRegistrant.notifyRegistrant(
if (mIccRefreshRegistrants != null) {
mIccRefreshRegistrants.notifyRegistrants(
new AsyncResult (null, ret, null));
}
break;

View File

@@ -87,7 +87,7 @@ public final class RuimRecords extends IccRecords {
p.mCM.registerForRUIMReady(this, EVENT_RUIM_READY, null);
p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
// NOTE the EVENT_SMS_ON_RUIM is not registered
p.mCM.setOnIccRefresh(this, EVENT_RUIM_REFRESH, null);
p.mCM.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
// Start off by setting empty state
onRadioOffOrNotAvailable();
@@ -98,7 +98,7 @@ public final class RuimRecords extends IccRecords {
//Unregister for all events
phone.mCM.unregisterForRUIMReady(this);
phone.mCM.unregisterForOffOrNotAvailable( this);
phone.mCM.unSetOnIccRefresh(this);
phone.mCM.unregisterForIccRefresh(this);
}
@Override

View File

@@ -184,7 +184,7 @@ public final class SIMRecords extends IccRecords {
p.mCM.registerForOffOrNotAvailable(
this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
p.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
p.mCM.setOnIccRefresh(this, EVENT_SIM_REFRESH, null);
p.mCM.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
// Start off by setting empty state
onRadioOffOrNotAvailable();
@@ -195,7 +195,7 @@ public final class SIMRecords extends IccRecords {
//Unregister for all events
phone.mCM.unregisterForSIMReady(this);
phone.mCM.unregisterForOffOrNotAvailable( this);
phone.mCM.unSetOnIccRefresh(this);
phone.mCM.unregisterForIccRefresh(this);
}
protected void finalize() {