From a142512a5009d7b4c422d23b1d7bab8d219eb50b Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Mon, 9 May 2011 16:46:39 -0700 Subject: [PATCH] Broadcast SIM Refresh to all registered components There could be multiple registrants like SIM, STK. Port of 6228 from partner repo. Change-Id: I0756d8b69e30058409e0279f65a99a1aa091e13d --- .../com/android/internal/telephony/BaseCommands.java | 11 ++++++----- .../android/internal/telephony/CommandsInterface.java | 5 ++--- .../java/com/android/internal/telephony/RIL.java | 4 ++-- .../android/internal/telephony/cdma/RuimRecords.java | 4 ++-- .../android/internal/telephony/gsm/SIMRecords.java | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index 076db8b20385a..0c6a7472bf8f0 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -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) { diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 1d574cadd8e82..f87d1880206e9 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -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. diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 6edd0b6280d93..242a322eea92b 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -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; diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java index 87b0c6060cd21..a6fd9669290d0 100644 --- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java @@ -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 diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index 8b032ff6ccafa..7fb250f4769a9 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -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() {