am 08cb0024: Handle emergency calls only status in ServiceStateTracker.
Merge commit '08cb0024026e0f42612ab569e1e4067d5ede3bf8' into eclair-plus-aosp * commit '08cb0024026e0f42612ab569e1e4067d5ede3bf8': Handle emergency calls only status in ServiceStateTracker.
This commit is contained in:
@@ -96,6 +96,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
*/
|
*/
|
||||||
private boolean mDataRoaming = false;
|
private boolean mDataRoaming = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark when service state is in emergency call only mode
|
||||||
|
*/
|
||||||
|
private boolean mEmergencyOnly = false;
|
||||||
|
private boolean mNewEmergencyOnly = false;
|
||||||
|
|
||||||
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
||||||
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
||||||
private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();
|
private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();
|
||||||
@@ -550,6 +556,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
String spn = phone.mSIMRecords.getServiceProviderName();
|
String spn = phone.mSIMRecords.getServiceProviderName();
|
||||||
String plmn = ss.getOperatorAlphaLong();
|
String plmn = ss.getOperatorAlphaLong();
|
||||||
|
|
||||||
|
// For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN
|
||||||
|
if (mEmergencyOnly && cm.getRadioState().isOn()) {
|
||||||
|
plmn = phone.getContext().getText(com.android.internal.R.string.emergency_calls_only).toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (rule != curSpnRule
|
if (rule != curSpnRule
|
||||||
|| !TextUtils.equals(spn, curSpn)
|
|| !TextUtils.equals(spn, curSpn)
|
||||||
|| !TextUtils.equals(plmn, curPlmn)) {
|
|| !TextUtils.equals(plmn, curPlmn)) {
|
||||||
@@ -557,6 +568,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
(rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
|
(rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
|
||||||
boolean showPlmn =
|
boolean showPlmn =
|
||||||
(rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN;
|
(rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN;
|
||||||
|
|
||||||
|
if (mEmergencyOnly)
|
||||||
|
showPlmn = true;
|
||||||
|
|
||||||
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
|
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
|
||||||
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
|
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
|
||||||
intent.putExtra(Intents.EXTRA_SPN, spn);
|
intent.putExtra(Intents.EXTRA_SPN, spn);
|
||||||
@@ -564,6 +579,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
intent.putExtra(Intents.EXTRA_PLMN, plmn);
|
intent.putExtra(Intents.EXTRA_PLMN, plmn);
|
||||||
phone.getContext().sendStickyBroadcast(intent);
|
phone.getContext().sendStickyBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
curSpnRule = rule;
|
curSpnRule = rule;
|
||||||
curSpn = spn;
|
curSpn = spn;
|
||||||
curPlmn = plmn;
|
curPlmn = plmn;
|
||||||
@@ -629,6 +645,13 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
mGsmRoaming = regCodeIsRoaming(regState);
|
mGsmRoaming = regCodeIsRoaming(regState);
|
||||||
newSS.setState (regCodeToServiceState(regState));
|
newSS.setState (regCodeToServiceState(regState));
|
||||||
|
|
||||||
|
if (regState == 10 || regState == 12 || regState == 13 || regState == 14) {
|
||||||
|
mNewEmergencyOnly = true;
|
||||||
|
} else {
|
||||||
|
mNewEmergencyOnly = false;
|
||||||
|
}
|
||||||
|
|
||||||
// LAC and CID are -1 if not avail
|
// LAC and CID are -1 if not avail
|
||||||
newCellLoc.setLacAndCid(lac, cid);
|
newCellLoc.setLacAndCid(lac, cid);
|
||||||
break;
|
break;
|
||||||
@@ -838,6 +861,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
||||||
|
|
||||||
|
boolean hasEmergencyOnlyChanged = mNewEmergencyOnly != mEmergencyOnly;
|
||||||
|
|
||||||
ServiceState tss;
|
ServiceState tss;
|
||||||
tss = ss;
|
tss = ss;
|
||||||
ss = newSS;
|
ss = newSS;
|
||||||
@@ -849,6 +874,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
cellLoc = newCellLoc;
|
cellLoc = newCellLoc;
|
||||||
newCellLoc = tcl;
|
newCellLoc = tcl;
|
||||||
|
|
||||||
|
mEmergencyOnly = mNewEmergencyOnly;
|
||||||
|
|
||||||
|
|
||||||
// Add an event log when network type switched
|
// Add an event log when network type switched
|
||||||
// TODO: we may add filtering to reduce the event logged,
|
// TODO: we may add filtering to reduce the event logged,
|
||||||
@@ -948,10 +975,13 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
|
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
|
||||||
ss.getRoaming() ? "true" : "false");
|
ss.getRoaming() ? "true" : "false");
|
||||||
|
|
||||||
updateSpnDisplay();
|
|
||||||
phone.notifyServiceStateChanged(ss);
|
phone.notifyServiceStateChanged(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasChanged || hasEmergencyOnlyChanged) {
|
||||||
|
updateSpnDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
if (hasGprsAttached) {
|
if (hasGprsAttached) {
|
||||||
gprsAttachedRegistrants.notifyRegistrants();
|
gprsAttachedRegistrants.notifyRegistrants();
|
||||||
}
|
}
|
||||||
@@ -1198,6 +1228,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
case 2: // 2 is "searching"
|
case 2: // 2 is "searching"
|
||||||
case 3: // 3 is "registration denied"
|
case 3: // 3 is "registration denied"
|
||||||
case 4: // 4 is "unknown" no vaild in current baseband
|
case 4: // 4 is "unknown" no vaild in current baseband
|
||||||
|
case 10:// same as 0, but indicates that emergency call is possible.
|
||||||
|
case 12:// same as 2, but indicates that emergency call is possible.
|
||||||
|
case 13:// same as 3, but indicates that emergency call is possible.
|
||||||
|
case 14:// same as 4, but indicates that emergency call is possible.
|
||||||
return ServiceState.STATE_OUT_OF_SERVICE;
|
return ServiceState.STATE_OUT_OF_SERVICE;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user