On data only devices use data registration state.
Some operators may report that the voice registration state is
not in service on a data only device. So use the Data registration
state for data only devices.
Bug: 8213254
Change-Id: Ieb6eef65fa5afb3d2c1a39b32a5bc5825ccc7f1c
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index dc96c6c..474523c 100644
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -53,6 +53,8 @@
protected PhoneBase mPhoneBase;
+ protected boolean mVoiceCapable;
+
public ServiceState mSS = new ServiceState();
protected ServiceState mNewSS = new ServiceState();
@@ -196,6 +198,8 @@
mPhoneBase = phoneBase;
mCellInfo = cellInfo;
mCi = ci;
+ mVoiceCapable = mPhoneBase.getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_voice_capable);
mUiccController = UiccController.getInstance();
mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
@@ -230,6 +234,22 @@
}
/**
+ * Some operators have been known to report registration failure
+ * data only devices, to fix that use DataRegState.
+ */
+ protected void useDataRegStateForDataOnlyDevices() {
+ if (mVoiceCapable == false) {
+ if (DBG) {
+ log("useDataRegStateForDataOnlyDevice: VoiceRegState=" + mNewSS.getVoiceRegState()
+ + " DataRegState=" + mNewSS.getDataRegState());
+ }
+ // TODO: Consider not lying and instead have callers know the difference.
+ mNewSS.setVoiceRegState(mNewSS.getDataRegState());
+ }
+ }
+
+
+ /**
* Registration point for combined roaming on
* combined roaming is true when roaming is true and ONS differs SPN
*
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index 74fbb61..43b0614 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -251,6 +251,8 @@
protected void pollStateDone() {
log("pollStateDone: lte 1 ss=[" + mSS + "] newSS=[" + mNewSS + "]");
+ useDataRegStateForDataOnlyDevices();
+
boolean hasRegistered = mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
&& mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 9026be6..3936e9e 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -964,6 +964,8 @@
mNewSS.setRoaming(true);
}
+ useDataRegStateForDataOnlyDevices();
+
boolean hasRegistered =
mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
&& mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index d4d2edc..99512f4 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -806,6 +806,8 @@
mNewSS.setRoaming(true);
}
+ useDataRegStateForDataOnlyDevices();
+
boolean hasRegistered =
mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
&& mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;