summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telephony/java/com/android/internal/telephony/RestrictedState.java (renamed from telephony/java/com/android/internal/telephony/gsm/RestrictedState.java)2
-rw-r--r--telephony/java/com/android/internal/telephony/ServiceStateTracker.java109
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CDMAPhone.java4
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java8
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java108
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java57
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GSMPhone.java4
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmConnection.java6
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java133
9 files changed, 125 insertions, 306 deletions
diff --git a/telephony/java/com/android/internal/telephony/gsm/RestrictedState.java b/telephony/java/com/android/internal/telephony/RestrictedState.java
index 3f7d5d75e5b9..ad2b88d584da 100644
--- a/telephony/java/com/android/internal/telephony/gsm/RestrictedState.java
+++ b/telephony/java/com/android/internal/telephony/RestrictedState.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.internal.telephony.gsm;
+package com.android.internal.telephony;
import android.telephony.ServiceState;
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index 0acbfe30403d..912f75eec358 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -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);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 2c7243e7037f..3772dacb62c5 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -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);
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 8307a485be59..0751d81dd915 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -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);
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index 5883555c23cb..2f4bd5bc895a 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -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) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 31250ad217e4..f2b84ee1f87b 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -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) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index 3f1a91b7ea1f..261a61adae17 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -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);
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
index 7dc25044eb16..0870d5bab201 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
@@ -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;
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 416184dfcfa4..277980a5e9a4 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -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 */