BaseCommandspublic abstract class BaseCommands extends Object implements CommandsInterface
Fields Summary |
---|
static final String | LOG_TAG | protected android.content.Context | mContext | protected RadioState | mState | protected Object | mStateMonitor | protected android.os.RegistrantList | mRadioStateChangedRegistrants | protected android.os.RegistrantList | mOnRegistrants | protected android.os.RegistrantList | mAvailRegistrants | protected android.os.RegistrantList | mOffOrNotAvailRegistrants | protected android.os.RegistrantList | mNotAvailRegistrants | protected android.os.RegistrantList | mSIMReadyRegistrants | protected android.os.RegistrantList | mSIMLockedRegistrants | protected android.os.RegistrantList | mCallStateRegistrants | protected android.os.RegistrantList | mNetworkStateRegistrants | protected android.os.RegistrantList | mPDPRegistrants | protected android.os.Registrant | mSMSRegistrant | protected android.os.Registrant | mNITZTimeRegistrant | protected android.os.Registrant | mSignalStrengthRegistrant | protected android.os.Registrant | mUSSDRegistrant | protected android.os.Registrant | mSmsOnSimRegistrant | protected android.os.Registrant | mSmsStatusRegistrantRegistrant for handling SMS Status Reports | protected android.os.Registrant | mSsnRegistrantRegistrant for handling Supplementary Service Notifications | protected android.os.Registrant | mStkSessionEndRegistrant | protected android.os.Registrant | mStkProCmdRegistrant | protected android.os.Registrant | mStkEventRegistrant | protected android.os.Registrant | mStkCallSetUpRegistrant | protected android.os.Registrant | mSimSmsFullRegistrantRegistrant for handling SIM SMS storage full messages | protected android.os.Registrant | mSimRefreshRegistrantRegistrant for handling SIM Refresh notifications | protected android.os.Registrant | mRingRegistrantRegistrant for handling RING notifications | protected android.os.Registrant | mRestrictedStateRegistrantRegistrant for handling RESTRICTED STATE changed notification |
Constructors Summary |
---|
public BaseCommands(android.content.Context context)
mContext = context; // May be null (if so we won't log statistics)
|
Methods Summary |
---|
public RadioState | getRadioState()
return mState;
| protected void | onRadioAvailable()
| public void | registerForAvailable(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mAvailRegistrants.add(r);
if (mState.isAvailable()) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | registerForCallStateChanged(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
mCallStateRegistrants.add(r);
| public void | registerForNetworkStateChanged(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
mNetworkStateRegistrants.add(r);
| public void | registerForNotAvailable(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mNotAvailRegistrants.add(r);
if (!mState.isAvailable()) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | registerForOffOrNotAvailable(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mOffOrNotAvailRegistrants.add(r);
if (mState == RadioState.RADIO_OFF || !mState.isAvailable()) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | registerForOn(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mOnRegistrants.add(r);
if (mState.isOn()) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | registerForPDPStateChanged(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
mPDPRegistrants.add(r);
| public void | registerForRadioStateChanged(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mRadioStateChangedRegistrants.add(r);
r.notifyRegistrant();
}
| public void | registerForSIMLockedOrAbsent(android.os.Handler h, int what, java.lang.Object obj)
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mSIMLockedRegistrants.add(r);
if (mState == RadioState.SIM_LOCKED_OR_ABSENT) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | registerForSIMReady(android.os.Handler h, int what, java.lang.Object obj)Any transition into SIM_READY
Registrant r = new Registrant (h, what, obj);
synchronized (mStateMonitor) {
mSIMReadyRegistrants.add(r);
if (mState.isSIMReady()) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
| public void | setOnCallRing(android.os.Handler h, int what, java.lang.Object obj)
mRingRegistrant = new Registrant (h, what, obj);
| public void | setOnNITZTime(android.os.Handler h, int what, java.lang.Object obj)
mNITZTimeRegistrant = new Registrant (h, what, obj);
| public void | setOnNewSMS(android.os.Handler h, int what, java.lang.Object obj)
mSMSRegistrant = new Registrant (h, what, obj);
| public void | setOnRestrictedStateChanged(android.os.Handler h, int what, java.lang.Object obj)
mRestrictedStateRegistrant = new Registrant (h, what, obj);
| public void | setOnSignalStrengthUpdate(android.os.Handler h, int what, java.lang.Object obj)
mSignalStrengthRegistrant = new Registrant (h, what, obj);
| public void | setOnSimRefresh(android.os.Handler h, int what, java.lang.Object obj)
mSimRefreshRegistrant = new Registrant (h, what, obj);
| public void | setOnSimSmsFull(android.os.Handler h, int what, java.lang.Object obj)
mSimSmsFullRegistrant = new Registrant (h, what, obj);
| public void | setOnSmsOnSim(android.os.Handler h, int what, java.lang.Object obj)
mSmsOnSimRegistrant = new Registrant (h, what, obj);
| public void | setOnSmsStatus(android.os.Handler h, int what, java.lang.Object obj)
mSmsStatusRegistrant = new Registrant (h, what, obj);
| public void | setOnStkCallSetUp(android.os.Handler h, int what, java.lang.Object obj)
mStkCallSetUpRegistrant = new Registrant (h, what, obj);
| public void | setOnStkEvent(android.os.Handler h, int what, java.lang.Object obj)
mStkEventRegistrant = new Registrant (h, what, obj);
| public void | setOnStkProactiveCmd(android.os.Handler h, int what, java.lang.Object obj)
mStkProCmdRegistrant = new Registrant (h, what, obj);
| public void | setOnStkSessionEnd(android.os.Handler h, int what, java.lang.Object obj)
mStkSessionEndRegistrant = new Registrant (h, what, obj);
| public void | setOnSuppServiceNotification(android.os.Handler h, int what, java.lang.Object obj)
mSsnRegistrant = new Registrant (h, what, obj);
| public void | setOnUSSD(android.os.Handler h, int what, java.lang.Object obj)
mUSSDRegistrant = new Registrant (h, what, obj);
| protected void | setRadioState(RadioState newState)Store new RadioState and send notification based on the changes
This function is called only by RIL.java when receiving unsolicited
RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED
RadioState has 5 values : RADIO_OFF, RADIO_UNAVAILABLE, SIM_NOT_READY,
SIM_LOCKED_OR_ABSENT, and SIM_READY.
RadioState oldState;
synchronized (mStateMonitor) {
if (Config.LOGV) {
Log.v(LOG_TAG, "setRadioState old: " + mState
+ " new " + newState);
}
oldState = mState;
mState = newState;
if (oldState == mState) {
// no state transition
return;
}
if (mContext != null &&
newState == RadioState.RADIO_UNAVAILABLE &&
oldState != RadioState.RADIO_OFF) {
Checkin.updateStats(mContext.getContentResolver(),
Checkin.Stats.Tag.PHONE_RADIO_RESETS, 1, 0.0);
}
mRadioStateChangedRegistrants.notifyRegistrants();
if (mState.isAvailable() && !oldState.isAvailable()) {
Log.d(LOG_TAG,"Notifying: radio available");
mAvailRegistrants.notifyRegistrants();
onRadioAvailable();
}
if (!mState.isAvailable() && oldState.isAvailable()) {
Log.d(LOG_TAG,"Notifying: radio not available");
mNotAvailRegistrants.notifyRegistrants();
}
if (mState.isSIMReady() && !oldState.isSIMReady()) {
Log.d(LOG_TAG,"Notifying: SIM ready");
mSIMReadyRegistrants.notifyRegistrants();
}
if (mState == RadioState.SIM_LOCKED_OR_ABSENT) {
Log.d(LOG_TAG,"Notifying: SIM locked or absent");
mSIMLockedRegistrants.notifyRegistrants();
}
if (mState.isOn() && !oldState.isOn()) {
Log.d(LOG_TAG,"Notifying: Radio On");
mOnRegistrants.notifyRegistrants();
}
if ((!mState.isOn() || !mState.isAvailable())
&& !((!oldState.isOn() || !oldState.isAvailable()))
) {
Log.d(LOG_TAG,"Notifying: radio off or not available");
mOffOrNotAvailRegistrants.notifyRegistrants();
}
}
|
|