public class ServiceStateTracker extends Handler
Handler.Callback
Modifier and Type | Field and Description |
---|---|
static int |
CS_DISABLED |
static int |
CS_EMERGENCY_ENABLED |
static int |
CS_ENABLED |
static int |
CS_NORMAL_ENABLED |
static int |
CS_NOTIFICATION |
static int |
DEFAULT_GPRS_CHECK_PERIOD_MILLIS
Waiting period before recheck gprs and voice registration.
|
static String |
DEFAULT_MNC |
protected static int |
EVENT_ALL_DATA_DISCONNECTED |
protected static int |
EVENT_CDMA_PRL_VERSION_CHANGED |
protected static int |
EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED |
protected static int |
EVENT_CHANGE_IMS_STATE |
protected static int |
EVENT_CHECK_REPORT_GPRS |
protected static int |
EVENT_ERI_FILE_LOADED |
protected static int |
EVENT_GET_CELL_INFO_LIST |
protected static int |
EVENT_GET_LOC_DONE |
protected static int |
EVENT_GET_PREFERRED_NETWORK_TYPE |
protected static int |
EVENT_GET_SIGNAL_STRENGTH |
static int |
EVENT_ICC_CHANGED |
protected static int |
EVENT_IMS_CAPABILITY_CHANGED |
protected static int |
EVENT_IMS_STATE_CHANGED |
protected static int |
EVENT_IMS_STATE_DONE |
protected static int |
EVENT_LOCATION_UPDATES_ENABLED |
protected static int |
EVENT_NETWORK_STATE_CHANGED |
protected static int |
EVENT_NITZ_TIME |
protected static int |
EVENT_NV_READY |
protected static int |
EVENT_OTA_PROVISION_STATUS_CHANGE |
protected static int |
EVENT_PHONE_TYPE_SWITCHED |
protected static int |
EVENT_POLL_SIGNAL_STRENGTH |
protected static int |
EVENT_POLL_STATE_CDMA_SUBSCRIPTION |
protected static int |
EVENT_POLL_STATE_GPRS |
protected static int |
EVENT_POLL_STATE_NETWORK_SELECTION_MODE |
protected static int |
EVENT_POLL_STATE_OPERATOR |
protected static int |
EVENT_POLL_STATE_REGISTRATION |
protected static int |
EVENT_RADIO_AVAILABLE |
protected static int |
EVENT_RADIO_ON |
protected static int |
EVENT_RADIO_STATE_CHANGED
GSM events
|
protected static int |
EVENT_RESET_PREFERRED_NETWORK_TYPE |
protected static int |
EVENT_RESTRICTED_STATE_CHANGED |
protected static int |
EVENT_RUIM_READY
CDMA events
|
protected static int |
EVENT_RUIM_RECORDS_LOADED |
protected static int |
EVENT_SET_PREFERRED_NETWORK_TYPE |
protected static int |
EVENT_SET_RADIO_POWER_OFF |
protected static int |
EVENT_SIGNAL_STRENGTH_UPDATE |
protected static int |
EVENT_SIM_READY |
protected static int |
EVENT_SIM_RECORDS_LOADED |
protected static int |
EVENT_UNSOL_CELL_INFO_LIST |
protected static String[] |
GMT_COUNTRY_CODES
List of ISO codes for countries that can have an offset of
GMT+0 when not in daylight savings time.
|
static String |
INVALID_MCC |
protected RegistrantList |
mAttachedRegistrants |
CellLocation |
mCellLoc |
protected RegistrantList |
mDetachedRegistrants |
RestrictedState |
mRestrictedState |
static int |
MS_PER_HOUR |
ServiceState |
mSS |
static int |
NITZ_UPDATE_DIFF_DEFAULT
If mNitzUpdateSpacing hasn't been exceeded but update is > mNitzUpdate do the update
|
static int |
NITZ_UPDATE_SPACING_DEFAULT
if time between NITZ updates is less than mNitzUpdateSpacing the update may be ignored.
|
static int |
OTASP_NEEDED |
static int |
OTASP_NOT_NEEDED |
static int |
OTASP_SIM_UNPROVISIONED
OtaUtil has conflict enum 4: OtaUtils.OTASP_FAILURE_SPC_RETRIES
|
static int |
OTASP_UNINITIALIZED |
static int |
OTASP_UNKNOWN |
static int |
PS_DISABLED |
static int |
PS_ENABLED
Notification type.
|
static int |
PS_NOTIFICATION
Notification id.
|
protected static String |
REGISTRATION_DENIED_AUTH |
protected static String |
REGISTRATION_DENIED_GEN
Reason for registration denial.
|
protected static String |
TIMEZONE_PROPERTY |
static String |
UNACTIVATED_MIN_VALUE |
static String |
UNACTIVATED_MIN2_VALUE |
static String |
WAKELOCK_TAG |
Constructor and Description |
---|
ServiceStateTracker(GsmCdmaPhone phone,
CommandsInterface ci) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
alwaysOnHomeNetwork(BaseBundle b)
Check if device is non-roaming and always on home network.
|
protected void |
cancelPollState()
Cancel a pending (if any) pollState() operation
|
protected void |
checkCorrectThread()
Verifies the current thread is the same as the thread originally
used in the initialization of this instance.
|
void |
disableLocationUpdates() |
protected void |
disableSingleLocationUpdate() |
void |
dispose() |
void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args) |
void |
enableLocationUpdates() |
void |
enableSingleLocationUpdate() |
protected void |
fixTimeZone(String isoCountryCode) |
protected String |
fixUnknownMcc(String operatorNumeric,
int sid) |
List<CellInfo> |
getAllCellInfo() |
String |
getCdmaMin() |
CellLocation |
getCellLocation() |
int |
getCurrentDataConnectionState() |
boolean |
getDesiredPowerState() |
protected String |
getHomeOperatorNumeric() |
String |
getImsi()
Returns IMSI as MCC + MNC + MIN
|
String |
getMdnNumber() |
int |
getOtasp()
Returns OTASP_UNKNOWN, OTASP_UNINITIALIZED, OTASP_NEEDED or OTASP_NOT_NEEDED
|
protected Phone |
getPhone() |
protected int |
getPhoneId() |
boolean |
getPowerStateFromCarrier() |
String |
getPrlVersion()
Returns null if NV is not yet ready
|
SignalStrength |
getSignalStrength() |
String |
getSystemProperty(String property,
String defValue) |
void |
handleMessage(Message msg)
Subclasses must implement this to receive messages.
|
protected void |
handlePollStateResult(int what,
AsyncResult ar) |
protected void |
hangupAndPowerOff()
Hang up all voice call and turn off radio.
|
protected boolean |
inSameCountry(String operatorNumeric)
Check ISO country by MCC to see if phone is roaming in same registered country
|
protected boolean |
isCallerOnDifferentThread() |
boolean |
isConcurrentVoiceAndDataAllowed() |
boolean |
isDeviceShuttingDown()
Check if the device is shutting down.
|
boolean |
isImsRegistered() |
protected boolean |
isInvalidOperatorNumeric(String operatorNumeric) |
boolean |
isMinInfoReady()
Check if subscription data has been assigned to mMin
return true if MIN info is ready; false otherwise.
|
protected boolean |
isNonRoamingInCdmaNetwork(BaseBundle b,
String network) |
protected boolean |
isNonRoamingInGsmNetwork(BaseBundle b,
String network) |
boolean |
isRadioOn() |
protected boolean |
isRoamingInCdmaNetwork(BaseBundle b,
String network) |
protected boolean |
isRoamingInGsmNetwork(BaseBundle b,
String network) |
protected boolean |
isSidsAllZeros() |
protected void |
log(String s) |
protected void |
loge(String s) |
protected void |
notifyDataRegStateRilRadioTechnologyChanged()
Notify all mDataConnectionRatChangeRegistrants using an
AsyncResult in msg.obj where AsyncResult#result contains the
new RAT as an Integer Object.
|
protected boolean |
notifySignalStrength() |
void |
onImsCapabilityChanged() |
protected boolean |
onSignalStrengthResult(AsyncResult ar)
send signal-strength-changed notification if changed Called both for
solicited and unsolicited signal strength updates
|
protected void |
onUpdateIccAvailability() |
protected void |
parseSidNid(String sidStr,
String nidStr) |
void |
pollState()
A complete "service state" from our perspective is
composed of a handful of separate requests to the radio.
|
void |
pollState(boolean modemTriggered) |
protected void |
pollStateDoneCdma() |
protected void |
pollStateDoneCdmaLte() |
void |
powerOffRadioSafely(DcTracker dcTracker)
Clean up existing voice and data connection then turn off radio power.
|
boolean |
processPendingRadioPowerOffAfterDataOff()
process the pending request to turn radio off after data is disconnected
return true if there is pending request to process; false otherwise.
|
void |
registerForDataConnectionAttached(Handler h,
int what,
Object obj)
Registration point for transition into DataConnection attached.
|
void |
registerForDataConnectionDetached(Handler h,
int what,
Object obj)
Registration point for transition into DataConnection detached.
|
void |
registerForDataRegStateOrRatChanged(Handler h,
int what,
Object obj)
Registration for DataConnection RIL Data Radio Technology changing.
|
void |
registerForDataRoamingOff(Handler h,
int what,
Object obj)
Registration point for roaming off of mobile data
combined roaming is true when roaming is true and ONS differs SPN
|
void |
registerForDataRoamingOn(Handler h,
int what,
Object obj)
Registration point for combined roaming on of mobile data
combined roaming is true when roaming is true and ONS differs SPN
|
void |
registerForNetworkAttached(Handler h,
int what,
Object obj)
Registration point for transition into network attached.
|
void |
registerForPsRestrictedDisabled(Handler h,
int what,
Object obj)
Registration point for transition out of packet service restricted zone.
|
void |
registerForPsRestrictedEnabled(Handler h,
int what,
Object obj)
Registration point for transition into packet service restricted zone.
|
void |
registerForSubscriptionInfoReady(Handler h,
int what,
Object obj)
Registration point for subscription info ready
|
void |
registerForVoiceRoamingOff(Handler h,
int what,
Object obj)
Registration point for roaming off of mobile voice
combined roaming is true when roaming is true and ONS differs SPN
|
void |
registerForVoiceRoamingOn(Handler h,
int what,
Object obj)
Registration point for combined roaming on of mobile voice
combined roaming is true when roaming is true and ONS differs SPN
|
void |
requestShutdown() |
void |
reRegisterNetwork(Message onComplete)
Re-register network by toggling preferred network type.
|
protected void |
resetServiceStateInIwlanMode() |
void |
setImsRegistrationState(boolean registered) |
protected void |
setOperatorIdd(String operatorNumeric) |
protected void |
setPowerStateToDesired() |
void |
setRadioPower(boolean power) |
void |
setRadioPowerFromCarrier(boolean enable)
Radio power set from carrier action. if set to false means carrier desire to turn radio off
and radio wont be re-enabled unless carrier explicitly turn it back on.
|
protected void |
setRoamingType(ServiceState currentServiceState)
Set both voice and data roaming type,
judging from the ISO country of SIM VS network.
|
protected boolean |
shouldFixTimeZoneNow(Phone phone,
String operatorNumeric,
String prevOperatorNumeric,
boolean needToFixTimeZone)
Return true if time zone needs fixing.
|
void |
unregisterForDataConnectionAttached(Handler h) |
void |
unregisterForDataConnectionDetached(Handler h) |
void |
unregisterForDataRegStateOrRatChanged(Handler h) |
void |
unregisterForDataRoamingOff(Handler h) |
void |
unregisterForDataRoamingOn(Handler h) |
void |
unregisterForNetworkAttached(Handler h) |
void |
unregisterForPsRestrictedDisabled(Handler h) |
void |
unregisterForPsRestrictedEnabled(Handler h) |
void |
unregisterForSubscriptionInfoReady(Handler h) |
void |
unregisterForVoiceRoamingOff(Handler h) |
void |
unregisterForVoiceRoamingOn(Handler h) |
protected void |
updateCarrierMccMncConfiguration(String newOp,
String oldOp,
Context context) |
protected void |
updateOtaspState() |
protected void |
updatePhoneObject() |
void |
updatePhoneType() |
protected void |
updateRoamingState()
Query the carrier configuration to determine if there any network overrides
for roaming or not roaming for the current service state.
|
protected void |
updateSpnDisplay() |
protected void |
useDataRegStateForDataOnlyDevices()
Some operators have been known to report registration failure
data only devices, to fix that use DataRegState.
|
dispatchMessage, dump, getLooper, getMessageName, getTraceName, hasCallbacks, hasMessages, hasMessages, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, post, postAtFrontOfQueue, postAtTime, postAtTime, postDelayed, removeCallbacks, removeCallbacks, removeCallbacksAndMessages, removeMessages, removeMessages, runWithScissors, sendEmptyMessage, sendEmptyMessageAtTime, sendEmptyMessageDelayed, sendMessage, sendMessageAtFrontOfQueue, sendMessageAtTime, sendMessageDelayed, toString
public ServiceState mSS
public RestrictedState mRestrictedState
public static final int OTASP_UNINITIALIZED
public static final int OTASP_UNKNOWN
public static final int OTASP_NEEDED
public static final int OTASP_NOT_NEEDED
public static final int OTASP_SIM_UNPROVISIONED
protected RegistrantList mAttachedRegistrants
protected RegistrantList mDetachedRegistrants
public static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS
protected static final int EVENT_RADIO_STATE_CHANGED
protected static final int EVENT_NETWORK_STATE_CHANGED
protected static final int EVENT_GET_SIGNAL_STRENGTH
protected static final int EVENT_POLL_STATE_REGISTRATION
protected static final int EVENT_POLL_STATE_GPRS
protected static final int EVENT_POLL_STATE_OPERATOR
protected static final int EVENT_POLL_SIGNAL_STRENGTH
protected static final int EVENT_NITZ_TIME
protected static final int EVENT_SIGNAL_STRENGTH_UPDATE
protected static final int EVENT_RADIO_AVAILABLE
protected static final int EVENT_POLL_STATE_NETWORK_SELECTION_MODE
protected static final int EVENT_GET_LOC_DONE
protected static final int EVENT_SIM_RECORDS_LOADED
protected static final int EVENT_SIM_READY
protected static final int EVENT_LOCATION_UPDATES_ENABLED
protected static final int EVENT_GET_PREFERRED_NETWORK_TYPE
protected static final int EVENT_SET_PREFERRED_NETWORK_TYPE
protected static final int EVENT_RESET_PREFERRED_NETWORK_TYPE
protected static final int EVENT_CHECK_REPORT_GPRS
protected static final int EVENT_RESTRICTED_STATE_CHANGED
protected static final int EVENT_RUIM_READY
protected static final int EVENT_RUIM_RECORDS_LOADED
protected static final int EVENT_POLL_STATE_CDMA_SUBSCRIPTION
protected static final int EVENT_NV_READY
protected static final int EVENT_ERI_FILE_LOADED
protected static final int EVENT_OTA_PROVISION_STATUS_CHANGE
protected static final int EVENT_SET_RADIO_POWER_OFF
protected static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED
protected static final int EVENT_CDMA_PRL_VERSION_CHANGED
protected static final int EVENT_RADIO_ON
public static final int EVENT_ICC_CHANGED
protected static final int EVENT_GET_CELL_INFO_LIST
protected static final int EVENT_UNSOL_CELL_INFO_LIST
protected static final int EVENT_CHANGE_IMS_STATE
protected static final int EVENT_IMS_STATE_CHANGED
protected static final int EVENT_IMS_STATE_DONE
protected static final int EVENT_IMS_CAPABILITY_CHANGED
protected static final int EVENT_ALL_DATA_DISCONNECTED
protected static final int EVENT_PHONE_TYPE_SWITCHED
protected static final String TIMEZONE_PROPERTY
protected static final String[] GMT_COUNTRY_CODES
protected static final String REGISTRATION_DENIED_GEN
protected static final String REGISTRATION_DENIED_AUTH
public CellLocation mCellLoc
public static final int MS_PER_HOUR
public static final String WAKELOCK_TAG
public static final int PS_ENABLED
public static final int PS_DISABLED
public static final int CS_ENABLED
public static final int CS_DISABLED
public static final int CS_NORMAL_ENABLED
public static final int CS_EMERGENCY_ENABLED
public static final int PS_NOTIFICATION
public static final int CS_NOTIFICATION
public static final String UNACTIVATED_MIN2_VALUE
public static final String UNACTIVATED_MIN_VALUE
public static final int NITZ_UPDATE_SPACING_DEFAULT
public static final int NITZ_UPDATE_DIFF_DEFAULT
public static final String INVALID_MCC
public static final String DEFAULT_MNC
public ServiceStateTracker(GsmCdmaPhone phone, CommandsInterface ci)
public void updatePhoneType()
public void requestShutdown()
public void dispose()
public boolean getDesiredPowerState()
public boolean getPowerStateFromCarrier()
protected boolean notifySignalStrength()
protected void notifyDataRegStateRilRadioTechnologyChanged()
protected void useDataRegStateForDataOnlyDevices()
protected void updatePhoneObject()
public void registerForVoiceRoamingOn(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForVoiceRoamingOn(Handler h)
public void registerForVoiceRoamingOff(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForVoiceRoamingOff(Handler h)
public void registerForDataRoamingOn(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForDataRoamingOn(Handler h)
public void registerForDataRoamingOff(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForDataRoamingOff(Handler h)
public void reRegisterNetwork(Message onComplete)
onComplete
- is dispatched when this is complete. it will be
an AsyncResult, and onComplete.obj.exception will be non-null
on failure.public void setRadioPower(boolean power)
public void setRadioPowerFromCarrier(boolean enable)
enable
- indicate if radio power is enabled or disabled from carrier action.public void enableSingleLocationUpdate()
public void enableLocationUpdates()
protected void disableSingleLocationUpdate()
public void disableLocationUpdates()
public void handleMessage(Message msg)
Handler
handleMessage
in class Handler
protected boolean isSidsAllZeros()
public String getMdnNumber()
public String getCdmaMin()
public String getPrlVersion()
public String getImsi()
public boolean isMinInfoReady()
public int getOtasp()
protected void updateOtaspState()
protected Phone getPhone()
protected void handlePollStateResult(int what, AsyncResult ar)
protected void updateRoamingState()
protected void updateSpnDisplay()
protected void setPowerStateToDesired()
protected void onUpdateIccAvailability()
protected void log(String s)
protected void loge(String s)
public int getCurrentDataConnectionState()
public boolean isConcurrentVoiceAndDataAllowed()
public void setImsRegistrationState(boolean registered)
public void onImsCapabilityChanged()
public boolean isRadioOn()
public void pollState()
public void pollState(boolean modemTriggered)
protected void pollStateDoneCdma()
protected void pollStateDoneCdmaLte()
protected void setOperatorIdd(String operatorNumeric)
protected boolean isInvalidOperatorNumeric(String operatorNumeric)
protected void fixTimeZone(String isoCountryCode)
public CellLocation getCellLocation()
public void registerForDataConnectionAttached(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForDataConnectionAttached(Handler h)
public void registerForDataConnectionDetached(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForDataConnectionDetached(Handler h)
public void registerForDataRegStateOrRatChanged(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForDataRegStateOrRatChanged(Handler h)
public void registerForNetworkAttached(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- in Message.objpublic void unregisterForNetworkAttached(Handler h)
public void registerForPsRestrictedEnabled(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForPsRestrictedEnabled(Handler h)
public void registerForPsRestrictedDisabled(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForPsRestrictedDisabled(Handler h)
public void powerOffRadioSafely(DcTracker dcTracker)
public boolean processPendingRadioPowerOffAfterDataOff()
protected boolean onSignalStrengthResult(AsyncResult ar)
protected void hangupAndPowerOff()
protected void cancelPollState()
protected boolean shouldFixTimeZoneNow(Phone phone, String operatorNumeric, String prevOperatorNumeric, boolean needToFixTimeZone)
phone
- operatorNumeric
- prevOperatorNumeric
- needToFixTimeZone
- public List<CellInfo> getAllCellInfo()
public SignalStrength getSignalStrength()
public void registerForSubscriptionInfoReady(Handler h, int what, Object obj)
h
- handler to notifywhat
- what code of message when deliveredobj
- placed in Message.objpublic void unregisterForSubscriptionInfoReady(Handler h)
public void dump(FileDescriptor fd, PrintWriter pw, String[] args)
public boolean isImsRegistered()
protected void checkCorrectThread()
RuntimeException
- if the current thread is not
the thread that originally obtained this Phone instance.protected boolean isCallerOnDifferentThread()
protected void updateCarrierMccMncConfiguration(String newOp, String oldOp, Context context)
protected boolean inSameCountry(String operatorNumeric)
protected void setRoamingType(ServiceState currentServiceState)
protected String getHomeOperatorNumeric()
protected int getPhoneId()
protected void resetServiceStateInIwlanMode()
protected final boolean alwaysOnHomeNetwork(BaseBundle b)
b
- carrier config bundle obtained from CarrierConfigManagerCarrierConfigManager
protected final boolean isRoamingInGsmNetwork(BaseBundle b, String network)
protected final boolean isNonRoamingInGsmNetwork(BaseBundle b, String network)
protected final boolean isRoamingInCdmaNetwork(BaseBundle b, String network)
protected final boolean isNonRoamingInCdmaNetwork(BaseBundle b, String network)
public boolean isDeviceShuttingDown()