OSDN Git Service

Display signal strength on data-only SIMs.
authorLorenzo Colitti <lorenzo@google.com>
Mon, 12 Aug 2013 11:12:37 +0000 (20:12 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Mon, 19 Aug 2013 11:46:15 +0000 (20:46 +0900)
On SIM cards that support data but not voice, we currently
display a null signal strength icon, which is confusing because
data is actually working.

Fix this by displaying signal bars as well as showing the
"emergency calls only" or "no service" text which indicates that
voice service is not available.

Bug: 3339315
Change-Id: I7d888721e8dc5e22fefd1b8fa85ba046d46a8fba

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java

index fb2348e..34e3013 100644 (file)
@@ -430,7 +430,8 @@ public class NetworkController extends BroadcastReceiver {
         @Override
         public void onServiceStateChanged(ServiceState state) {
             if (DEBUG) {
-                Log.d(TAG, "onServiceStateChanged state=" + state.getState());
+                Log.d(TAG, "onServiceStateChanged voiceState=" + state.getVoiceRegState()
+                        + " dataState=" + state.getDataRegState());
             }
             mServiceState = state;
             updateTelephonySignalStrength();
@@ -506,10 +507,16 @@ public class NetworkController extends BroadcastReceiver {
 
     private boolean hasService() {
         if (mServiceState != null) {
-            switch (mServiceState.getState()) {
-                case ServiceState.STATE_OUT_OF_SERVICE:
+            // Consider the device to be in service if either voice or data service is available.
+            // Some SIM cards are marketed as data-only and do not support voice service, and on
+            // these SIM cards, we want to show signal bars for data service as well as the "no
+            // service" or "emergency calls only" text that indicates that voice is not available.
+            switch(mServiceState.getVoiceRegState()) {
                 case ServiceState.STATE_POWER_OFF:
                     return false;
+                case ServiceState.STATE_OUT_OF_SERVICE:
+                case ServiceState.STATE_EMERGENCY_ONLY:
+                    return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
                 default:
                     return true;
             }