Do not merge: Clean up LTE code change
Promoting RestrictedState so fewer callsites need be technology specific. Promoting ServiceState change registration code. bug:3487388 Change-Id: Iac3abca1a2943c1626553e1fd4bdd5baace86492
This commit is contained in:
committed by
Wink Saville
parent
04cac40ff8
commit
88d852969a
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.internal.telephony.gsm;
|
||||
package com.android.internal.telephony;
|
||||
|
||||
import android.telephony.ServiceState;
|
||||
|
||||
@@ -55,6 +55,9 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
|
||||
public SignalStrength mSignalStrength;
|
||||
|
||||
// TODO - this should not be public
|
||||
public RestrictedState mRestrictedState = new RestrictedState();
|
||||
|
||||
/* The otaspMode passed to PhoneStateListener#onOtaspChanged */
|
||||
static public final int OTASP_UNINITIALIZED = 0;
|
||||
static public final int OTASP_UNKNOWN = 1;
|
||||
@@ -76,9 +79,14 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
*/
|
||||
protected boolean dontPollSignalStrength = false;
|
||||
|
||||
protected RegistrantList networkAttachedRegistrants = new RegistrantList();
|
||||
protected RegistrantList roamingOnRegistrants = new RegistrantList();
|
||||
protected RegistrantList roamingOffRegistrants = new RegistrantList();
|
||||
protected RegistrantList mRoamingOnRegistrants = new RegistrantList();
|
||||
protected RegistrantList mRoamingOffRegistrants = new RegistrantList();
|
||||
protected RegistrantList mAttachedRegistrants = new RegistrantList();
|
||||
protected RegistrantList mDetachedRegistrants = new RegistrantList();
|
||||
protected RegistrantList mNetworkAttachedRegistrants = new RegistrantList();
|
||||
protected RegistrantList mPsRestrictEnabledRegistrants = new RegistrantList();
|
||||
protected RegistrantList mPsRestrictDisabledRegistrants = new RegistrantList();
|
||||
|
||||
|
||||
protected static final boolean DBG = true;
|
||||
|
||||
@@ -165,7 +173,6 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
protected static final String REGISTRATION_DENIED_AUTH = "Authentication Failure";
|
||||
|
||||
public ServiceStateTracker() {
|
||||
|
||||
}
|
||||
|
||||
public boolean getDesiredPowerState() {
|
||||
@@ -182,7 +189,7 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
*/
|
||||
public void registerForRoamingOn(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
roamingOnRegistrants.add(r);
|
||||
mRoamingOnRegistrants.add(r);
|
||||
|
||||
if (ss.getRoaming()) {
|
||||
r.notifyRegistrant();
|
||||
@@ -190,7 +197,7 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
}
|
||||
|
||||
public void unregisterForRoamingOn(Handler h) {
|
||||
roamingOnRegistrants.remove(h);
|
||||
mRoamingOnRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,7 +210,7 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
*/
|
||||
public void registerForRoamingOff(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
roamingOffRegistrants.add(r);
|
||||
mRoamingOffRegistrants.add(r);
|
||||
|
||||
if (!ss.getRoaming()) {
|
||||
r.notifyRegistrant();
|
||||
@@ -211,7 +218,7 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
}
|
||||
|
||||
public void unregisterForRoamingOff(Handler h) {
|
||||
roamingOffRegistrants.remove(h);
|
||||
mRoamingOffRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,43 +289,99 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
protected abstract void setPowerStateToDesired();
|
||||
protected abstract void log(String s);
|
||||
|
||||
private void logUnexpectedGsmMethodCall(String name) {
|
||||
log("SSST" + "Error! " + name + "() in ServiceStateTracker should not be " +
|
||||
"called, GsmServiceStateTracker inactive.");
|
||||
}
|
||||
|
||||
public abstract int getCurrentDataConnectionState();
|
||||
public abstract boolean isConcurrentVoiceAndDataAllowed();
|
||||
|
||||
/**
|
||||
* Registration point for transition into DataConnection attached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForDataConnectionAttached(Handler h, int what, Object obj) {
|
||||
logUnexpectedGsmMethodCall("registerForDataConnectionAttached");
|
||||
}
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
mAttachedRegistrants.add(r);
|
||||
|
||||
if (getCurrentDataConnectionState() == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
public void unregisterForDataConnectionAttached(Handler h) {
|
||||
logUnexpectedGsmMethodCall("unregisterForDataConnectionAttached");
|
||||
mAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into DataConnection detached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForDataConnectionDetached(Handler h, int what, Object obj) {
|
||||
logUnexpectedGsmMethodCall("registerForDataConnectionDetached");
|
||||
}
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
mDetachedRegistrants.add(r);
|
||||
|
||||
if (getCurrentDataConnectionState() == ServiceState.STATE_OUT_OF_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
public void unregisterForDataConnectionDetached(Handler h) {
|
||||
logUnexpectedGsmMethodCall("unregisterForDataConnectionDetached");
|
||||
mDetachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into network attached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj in Message.obj
|
||||
*/
|
||||
public void registerForNetworkAttached(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
|
||||
mNetworkAttachedRegistrants.add(r);
|
||||
if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
public void unregisterForNetworkAttached(Handler h) {
|
||||
mNetworkAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into packet service restricted zone.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
|
||||
logUnexpectedGsmMethodCall("registerForPsRestrictedEnabled");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
mPsRestrictEnabledRegistrants.add(r);
|
||||
|
||||
if (mRestrictedState.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedEnabled(Handler h) {
|
||||
logUnexpectedGsmMethodCall("unregisterForPsRestrictedEnabled");
|
||||
mPsRestrictEnabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition out of packet service restricted zone.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
|
||||
logUnexpectedGsmMethodCall("registerForPsRestrictedDisabled");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
mPsRestrictDisabledRegistrants.add(r);
|
||||
|
||||
if (mRestrictedState.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedDisabled(Handler h) {
|
||||
logUnexpectedGsmMethodCall("registerForPsRestrictedDisabled");
|
||||
mPsRestrictDisabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -173,7 +173,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mCM.registerForOn(this, EVENT_RADIO_ON, null);
|
||||
mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
|
||||
mSST.registerForNetworkAttach(this, EVENT_REGISTERED_TO_NETWORK, null);
|
||||
mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
|
||||
mCM.registerForNVReady(this, EVENT_NV_READY, null);
|
||||
mCM.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
|
||||
|
||||
@@ -225,7 +225,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
|
||||
mCM.unregisterForOn(this); //EVENT_RADIO_ON
|
||||
mCM.unregisterForNVReady(this); //EVENT_NV_READY
|
||||
mSST.unregisterForNetworkAttach(this); //EVENT_REGISTERED_TO_NETWORK
|
||||
mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
|
||||
mCM.unSetOnSuppServiceNotification(this);
|
||||
removeCallbacks(mExitEcmRunnable);
|
||||
|
||||
|
||||
@@ -104,8 +104,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null);
|
||||
p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null);
|
||||
p.mCT.registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null);
|
||||
p.mSST.registerForCdmaDataConnectionAttached(this, EVENT_TRY_SETUP_DATA, null);
|
||||
p.mSST.registerForCdmaDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
|
||||
p.mSST.registerForDataConnectionAttached(this, EVENT_TRY_SETUP_DATA, null);
|
||||
p.mSST.registerForDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
|
||||
p.mSST.registerForRoamingOn(this, EVENT_ROAMING_ON, null);
|
||||
p.mSST.registerForRoamingOff(this, EVENT_ROAMING_OFF, null);
|
||||
p.mCM.registerForCdmaOtaProvision(this, EVENT_CDMA_OTA_PROVISION, null);
|
||||
@@ -128,8 +128,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
mPhone.mCM.unregisterForDataNetworkStateChanged(this);
|
||||
mCdmaPhone.mCT.unregisterForVoiceCallEnded(this);
|
||||
mCdmaPhone.mCT.unregisterForVoiceCallStarted(this);
|
||||
mCdmaPhone.mSST.unregisterForCdmaDataConnectionAttached(this);
|
||||
mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
|
||||
mCdmaPhone.mSST.unregisterForDataConnectionAttached(this);
|
||||
mCdmaPhone.mSST.unregisterForDataConnectionDetached(this);
|
||||
mCdmaPhone.mSST.unregisterForRoamingOn(this);
|
||||
mCdmaPhone.mSST.unregisterForRoamingOff(this);
|
||||
mPhone.mCM.unregisterForCdmaOtaProvision(this);
|
||||
|
||||
@@ -36,7 +36,7 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.util.EventLog;
|
||||
|
||||
import com.android.internal.telephony.gsm.RestrictedState;
|
||||
import com.android.internal.telephony.RestrictedState;
|
||||
import com.android.internal.telephony.gsm.GsmDataConnectionTracker;
|
||||
|
||||
public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
@@ -44,112 +44,16 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
|
||||
CDMALTEPhone mCdmaLtePhone;
|
||||
|
||||
private RestrictedState rs;
|
||||
|
||||
private int gprsState = ServiceState.STATE_OUT_OF_SERVICE;
|
||||
|
||||
private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
|
||||
|
||||
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
||||
|
||||
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
||||
|
||||
private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();
|
||||
|
||||
private RegistrantList psRestrictDisabledRegistrants = new RegistrantList();
|
||||
|
||||
public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
|
||||
super(phone);
|
||||
mCdmaLtePhone = phone;
|
||||
rs = new RestrictedState();
|
||||
log("CdmaLteServiceStateTracker Constructors");
|
||||
}
|
||||
|
||||
// Added 9 new functions needed in GsmDataConnectionTracker, functions were
|
||||
// copied over from GsmServiceStateTracker.
|
||||
/**
|
||||
* Registration point for transition into GPRS attached.
|
||||
*
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForDataConnectionAttached(Handler h, int what, Object obj) {
|
||||
log("registerForDataConnectionAttached ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
gprsAttachedRegistrants.add(r);
|
||||
|
||||
if (gprsState == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForDataConnectionAttached(Handler h) {
|
||||
gprsAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into GPRS detached.
|
||||
*
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForDataConnectionDetached(Handler h, int what, Object obj) {
|
||||
log("registerForDataConnectionDetached ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
gprsDetachedRegistrants.add(r);
|
||||
if (gprsState == ServiceState.STATE_OUT_OF_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForDataConnectionDetached(Handler h) {
|
||||
gprsDetachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into packet service restricted zone.
|
||||
*
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
|
||||
log("registerForPsRestrictedEnabled ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
psRestrictEnabledRegistrants.add(r);
|
||||
|
||||
if (rs.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedEnabled(Handler h) {
|
||||
psRestrictEnabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition out of packet service restricted zone.
|
||||
*
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
|
||||
log("registerForPsRestrictedDisabled ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
psRestrictDisabledRegistrants.add(r);
|
||||
|
||||
if (rs.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedDisabled(Handler h) {
|
||||
psRestrictDisabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current GPRS state. IN_SERVICE is the same as "attached" and
|
||||
* OUT_OF_SERVICE is the same as detached.
|
||||
@@ -426,7 +330,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRegistered) {
|
||||
networkAttachedRegistrants.notifyRegistrants();
|
||||
mNetworkAttachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
@@ -484,12 +388,12 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
|
||||
if (hasCdmaDataConnectionAttached) {
|
||||
cdmaDataConnectionAttachedRegistrants.notifyRegistrants();
|
||||
gprsAttachedRegistrants.notifyRegistrants();
|
||||
mAttachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasCdmaDataConnectionDetached) {
|
||||
cdmaDataConnectionDetachedRegistrants.notifyRegistrants();
|
||||
gprsDetachedRegistrants.notifyRegistrants();
|
||||
mDetachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if ((hasCdmaDataConnectionChanged || hasNetworkTypeChanged)
|
||||
@@ -498,11 +402,11 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRoamingOn) {
|
||||
roamingOnRegistrants.notifyRegistrants();
|
||||
mRoamingOnRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasRoamingOff) {
|
||||
roamingOffRegistrants.notifyRegistrants();
|
||||
mRoamingOffRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasLocationChanged) {
|
||||
|
||||
@@ -232,57 +232,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
if (DBG) log("CdmaServiceStateTracker finalized");
|
||||
}
|
||||
|
||||
void registerForNetworkAttach(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
networkAttachedRegistrants.add(r);
|
||||
|
||||
if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
void unregisterForNetworkAttach(Handler h) {
|
||||
networkAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into Data attached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
void registerForCdmaDataConnectionAttached(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
cdmaDataConnectionAttachedRegistrants.add(r);
|
||||
|
||||
if (cdmaDataConnectionState == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
void unregisterForCdmaDataConnectionAttached(Handler h) {
|
||||
cdmaDataConnectionAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into Data detached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
void registerForCdmaDataConnectionDetached(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
cdmaDataConnectionDetachedRegistrants.add(r);
|
||||
|
||||
if (cdmaDataConnectionState != ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
void unregisterForCdmaDataConnectionDetached(Handler h) {
|
||||
cdmaDataConnectionDetachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for subscription info ready
|
||||
* @param h handler to notify
|
||||
@@ -1094,7 +1043,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRegistered) {
|
||||
networkAttachedRegistrants.notifyRegistrants();
|
||||
mNetworkAttachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
@@ -1161,11 +1110,11 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRoamingOn) {
|
||||
roamingOnRegistrants.notifyRegistrants();
|
||||
mRoamingOnRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasRoamingOff) {
|
||||
roamingOffRegistrants.notifyRegistrants();
|
||||
mRoamingOffRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasLocationChanged) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public class GSMPhone extends PhoneBase {
|
||||
mCM.registerForOn(this, EVENT_RADIO_ON, null);
|
||||
mCM.setOnUSSD(this, EVENT_USSD, null);
|
||||
mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
|
||||
mSST.registerForNetworkAttach(this, EVENT_REGISTERED_TO_NETWORK, null);
|
||||
mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
|
||||
|
||||
if (false) {
|
||||
try {
|
||||
@@ -209,7 +209,7 @@ public class GSMPhone extends PhoneBase {
|
||||
mSIMRecords.unregisterForRecordsLoaded(this); //EVENT_SIM_RECORDS_LOADED
|
||||
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
|
||||
mCM.unregisterForOn(this); //EVENT_RADIO_ON
|
||||
mSST.unregisterForNetworkAttach(this); //EVENT_REGISTERED_TO_NETWORK
|
||||
mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
|
||||
mCM.unSetOnUSSD(this);
|
||||
mCM.unSetOnSuppServiceNotification(this);
|
||||
|
||||
|
||||
@@ -374,11 +374,11 @@ public class GsmConnection extends Connection {
|
||||
} else if (phone.getIccCard().getState() != SimCard.State.READY) {
|
||||
return DisconnectCause.ICC_ERROR;
|
||||
} else if (causeCode == CallFailCause.ERROR_UNSPECIFIED) {
|
||||
if (phone.mSST.rs.isCsRestricted()) {
|
||||
if (phone.mSST.mRestrictedState.isCsRestricted()) {
|
||||
return DisconnectCause.CS_RESTRICTED;
|
||||
} else if (phone.mSST.rs.isCsEmergencyRestricted()) {
|
||||
} else if (phone.mSST.mRestrictedState.isCsEmergencyRestricted()) {
|
||||
return DisconnectCause.CS_RESTRICTED_EMERGENCY;
|
||||
} else if (phone.mSST.rs.isCsNormalRestricted()) {
|
||||
} else if (phone.mSST.mRestrictedState.isCsNormalRestricted()) {
|
||||
return DisconnectCause.CS_RESTRICTED_NORMAL;
|
||||
} else {
|
||||
return DisconnectCause.ERROR_UNSPECIFIED;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.android.internal.telephony.EventLogTags;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.MccTable;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.RestrictedState;
|
||||
import com.android.internal.telephony.RILConstants;
|
||||
import com.android.internal.telephony.ServiceStateTracker;
|
||||
import com.android.internal.telephony.TelephonyIntents;
|
||||
@@ -75,7 +76,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
GsmCellLocation cellLoc;
|
||||
GsmCellLocation newCellLoc;
|
||||
int mPreferredNetworkType;
|
||||
RestrictedState rs;
|
||||
|
||||
private int gprsState = ServiceState.STATE_OUT_OF_SERVICE;
|
||||
private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
|
||||
@@ -107,11 +107,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
*/
|
||||
private boolean mEmergencyOnly = false;
|
||||
|
||||
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
||||
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
||||
private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();
|
||||
private RegistrantList psRestrictDisabledRegistrants = new RegistrantList();
|
||||
|
||||
/**
|
||||
* Sometimes we get the NITZ time before we know what country we
|
||||
* are in. Keep the time zone information from the NITZ string so
|
||||
@@ -206,7 +201,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
newSS = new ServiceState();
|
||||
cellLoc = new GsmCellLocation();
|
||||
newCellLoc = new GsmCellLocation();
|
||||
rs = new RestrictedState();
|
||||
mSignalStrength = new SignalStrength();
|
||||
|
||||
PowerManager powerManager =
|
||||
@@ -272,99 +266,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
return phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into GPRS attached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
@Override
|
||||
public void registerForDataConnectionAttached(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
gprsAttachedRegistrants.add(r);
|
||||
|
||||
if (gprsState == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterForDataConnectionAttached(Handler h) {
|
||||
gprsAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
void registerForNetworkAttach(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
networkAttachedRegistrants.add(r);
|
||||
|
||||
if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
void unregisterForNetworkAttach(Handler h) {
|
||||
networkAttachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into GPRS detached.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
void registerForGprsDetached(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
gprsDetachedRegistrants.add(r);
|
||||
|
||||
if (gprsState == ServiceState.STATE_OUT_OF_SERVICE) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
void unregisterForGprsDetached(Handler h) {
|
||||
gprsDetachedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition into packet service restricted zone.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedEnabled ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
psRestrictEnabledRegistrants.add(r);
|
||||
|
||||
if (rs.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedEnabled(Handler h) {
|
||||
psRestrictEnabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration point for transition out of packet service restricted zone.
|
||||
* @param h handler to notify
|
||||
* @param what what code of message when delivered
|
||||
* @param obj placed in Message.obj
|
||||
*/
|
||||
public void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedDisabled ");
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
psRestrictDisabledRegistrants.add(r);
|
||||
|
||||
if (rs.isPsRestricted()) {
|
||||
r.notifyRegistrant();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForPsRestrictedDisabled(Handler h) {
|
||||
psRestrictDisabledRegistrants.remove(h);
|
||||
}
|
||||
|
||||
public void handleMessage (Message msg) {
|
||||
AsyncResult ar;
|
||||
int[] ints;
|
||||
@@ -978,7 +879,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRegistered) {
|
||||
networkAttachedRegistrants.notifyRegistrants();
|
||||
mNetworkAttachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
@@ -1055,11 +956,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasGprsAttached) {
|
||||
gprsAttachedRegistrants.notifyRegistrants();
|
||||
mAttachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasGprsDetached) {
|
||||
gprsDetachedRegistrants.notifyRegistrants();
|
||||
mDetachedRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasNetworkTypeChanged) {
|
||||
@@ -1067,11 +968,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
|
||||
if (hasRoamingOn) {
|
||||
roamingOnRegistrants.notifyRegistrants();
|
||||
mRoamingOnRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasRoamingOff) {
|
||||
roamingOffRegistrants.notifyRegistrants();
|
||||
mRoamingOffRegistrants.notifyRegistrants();
|
||||
}
|
||||
|
||||
if (hasLocationChanged) {
|
||||
@@ -1219,7 +1120,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "onRestrictedStateChanged");
|
||||
RestrictedState newRs = new RestrictedState();
|
||||
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "current rs at enter "+ rs);
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "current rs at enter "+ mRestrictedState);
|
||||
|
||||
if (ar.exception == null) {
|
||||
int[] ints = (int[])ar.result;
|
||||
@@ -1239,11 +1140,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "new rs "+ newRs);
|
||||
|
||||
if (!rs.isPsRestricted() && newRs.isPsRestricted()) {
|
||||
psRestrictEnabledRegistrants.notifyRegistrants();
|
||||
if (!mRestrictedState.isPsRestricted() && newRs.isPsRestricted()) {
|
||||
mPsRestrictEnabledRegistrants.notifyRegistrants();
|
||||
setNotification(PS_ENABLED);
|
||||
} else if (rs.isPsRestricted() && !newRs.isPsRestricted()) {
|
||||
psRestrictDisabledRegistrants.notifyRegistrants();
|
||||
} else if (mRestrictedState.isPsRestricted() && !newRs.isPsRestricted()) {
|
||||
mPsRestrictDisabledRegistrants.notifyRegistrants();
|
||||
setNotification(PS_DISABLED);
|
||||
}
|
||||
|
||||
@@ -1252,7 +1153,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
* there are 4 x 4 combinations in current and new restricted states
|
||||
* and we only need to notify when state is changed.
|
||||
*/
|
||||
if (rs.isCsRestricted()) {
|
||||
if (mRestrictedState.isCsRestricted()) {
|
||||
if (!newRs.isCsRestricted()) {
|
||||
// remove all restriction
|
||||
setNotification(CS_DISABLED);
|
||||
@@ -1263,7 +1164,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
// remove emergency restriction
|
||||
setNotification(CS_NORMAL_ENABLED);
|
||||
}
|
||||
} else if (rs.isCsEmergencyRestricted() && !rs.isCsNormalRestricted()) {
|
||||
} else if (mRestrictedState.isCsEmergencyRestricted() &&
|
||||
!mRestrictedState.isCsNormalRestricted()) {
|
||||
if (!newRs.isCsRestricted()) {
|
||||
// remove all restriction
|
||||
setNotification(CS_DISABLED);
|
||||
@@ -1274,7 +1176,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
// remove emergency restriction and enable normal restriction
|
||||
setNotification(CS_NORMAL_ENABLED);
|
||||
}
|
||||
} else if (!rs.isCsEmergencyRestricted() && rs.isCsNormalRestricted()) {
|
||||
} else if (!mRestrictedState.isCsEmergencyRestricted() &&
|
||||
mRestrictedState.isCsNormalRestricted()) {
|
||||
if (!newRs.isCsRestricted()) {
|
||||
// remove all restriction
|
||||
setNotification(CS_DISABLED);
|
||||
@@ -1298,9 +1201,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
}
|
||||
}
|
||||
|
||||
rs = newRs;
|
||||
mRestrictedState = newRs;
|
||||
}
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "current rs at return "+ rs);
|
||||
Log.d(LOG_TAG, "[DSAC DEB] " + "current rs at return "+ mRestrictedState);
|
||||
}
|
||||
|
||||
/** code is registration state 0-5 from TS 27.007 7.2 */
|
||||
|
||||
Reference in New Issue
Block a user