Loading src/java/com/android/internal/telephony/BaseCommands.java +31 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import android.os.Registrant; import android.os.RegistrantList; import android.telephony.Annotation.RadioPowerState; import android.telephony.TelephonyManager; import android.telephony.emergency.EmergencyNumber; import java.util.ArrayList; import java.util.List; /** * {@hide} Loading Loading @@ -144,6 +148,11 @@ public abstract class BaseCommands implements CommandsInterface { protected Registrant mSsRegistrant; protected Registrant mRegistrationFailedRegistrant; // Lock that mLastEmergencyNumberListIndication uses. private Object mLastEmergencyNumberListIndicationLock = new Object(); // Cache last emergency number list indication from radio private final List<EmergencyNumber> mLastEmergencyNumberListIndication = new ArrayList<>(); // Preferred network type received from PhoneFactory. // This is used when establishing a connection to the // vendor ril so it starts up in the correct mode. Loading Loading @@ -803,6 +812,14 @@ public abstract class BaseCommands implements CommandsInterface { @Override public void registerForEmergencyNumberList(Handler h, int what, Object obj) { mEmergencyNumberListRegistrants.addUnique(h, what, obj); // Notify the last emergency number list from radio to new registrants because they may // miss the latest indication (e.g. constructed in a delay after HAL is registrated). List<EmergencyNumber> lastEmergencyNumberListIndication = getLastEmergencyNumberListIndication(); if (lastEmergencyNumberListIndication != null) { mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult( null, getLastEmergencyNumberListIndication(), null)); } } @Override Loading Loading @@ -860,6 +877,20 @@ public abstract class BaseCommands implements CommandsInterface { } } protected void cacheEmergencyNumberListIndication( List<EmergencyNumber> emergencyNumberListIndication) { synchronized (mLastEmergencyNumberListIndicationLock) { mLastEmergencyNumberListIndication.clear(); mLastEmergencyNumberListIndication.addAll(emergencyNumberListIndication); } } private List<EmergencyNumber> getLastEmergencyNumberListIndication() { synchronized (mLastEmergencyNumberListIndicationLock) { return new ArrayList<>(mLastEmergencyNumberListIndication); } } /** * {@inheritDoc} */ Loading src/java/com/android/internal/telephony/RadioIndication.java +4 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,10 @@ public class RadioIndication extends IRadioIndication.Stub { if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response); // Cache emergency number list from last indication. mRil.cacheEmergencyNumberListIndication(response); // Notify emergency number list from radio to registrants mRil.mEmergencyNumberListRegistrants.notifyRegistrants( new AsyncResult(null, response, null)); } Loading Loading
src/java/com/android/internal/telephony/BaseCommands.java +31 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import android.os.Registrant; import android.os.RegistrantList; import android.telephony.Annotation.RadioPowerState; import android.telephony.TelephonyManager; import android.telephony.emergency.EmergencyNumber; import java.util.ArrayList; import java.util.List; /** * {@hide} Loading Loading @@ -144,6 +148,11 @@ public abstract class BaseCommands implements CommandsInterface { protected Registrant mSsRegistrant; protected Registrant mRegistrationFailedRegistrant; // Lock that mLastEmergencyNumberListIndication uses. private Object mLastEmergencyNumberListIndicationLock = new Object(); // Cache last emergency number list indication from radio private final List<EmergencyNumber> mLastEmergencyNumberListIndication = new ArrayList<>(); // Preferred network type received from PhoneFactory. // This is used when establishing a connection to the // vendor ril so it starts up in the correct mode. Loading Loading @@ -803,6 +812,14 @@ public abstract class BaseCommands implements CommandsInterface { @Override public void registerForEmergencyNumberList(Handler h, int what, Object obj) { mEmergencyNumberListRegistrants.addUnique(h, what, obj); // Notify the last emergency number list from radio to new registrants because they may // miss the latest indication (e.g. constructed in a delay after HAL is registrated). List<EmergencyNumber> lastEmergencyNumberListIndication = getLastEmergencyNumberListIndication(); if (lastEmergencyNumberListIndication != null) { mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult( null, getLastEmergencyNumberListIndication(), null)); } } @Override Loading Loading @@ -860,6 +877,20 @@ public abstract class BaseCommands implements CommandsInterface { } } protected void cacheEmergencyNumberListIndication( List<EmergencyNumber> emergencyNumberListIndication) { synchronized (mLastEmergencyNumberListIndicationLock) { mLastEmergencyNumberListIndication.clear(); mLastEmergencyNumberListIndication.addAll(emergencyNumberListIndication); } } private List<EmergencyNumber> getLastEmergencyNumberListIndication() { synchronized (mLastEmergencyNumberListIndicationLock) { return new ArrayList<>(mLastEmergencyNumberListIndication); } } /** * {@inheritDoc} */ Loading
src/java/com/android/internal/telephony/RadioIndication.java +4 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,10 @@ public class RadioIndication extends IRadioIndication.Stub { if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response); // Cache emergency number list from last indication. mRil.cacheEmergencyNumberListIndication(response); // Notify emergency number list from radio to registrants mRil.mEmergencyNumberListRegistrants.notifyRegistrants( new AsyncResult(null, response, null)); } Loading