am 5404812d: Merge "When out of range, show device-appropriate no-signal bars." into honeycomb

* commit '5404812dee9dccbbd43df81752f3061742235982':
  When out of range, show device-appropriate no-signal bars.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 42868db..f2c838a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -34,6 +34,7 @@
 import android.net.wifi.WifiManager;
 import android.os.Binder;
 import android.os.RemoteException;
+import android.os.SystemProperties;
 import android.provider.Settings;
 import android.provider.Telephony;
 import android.telephony.PhoneStateListener;
@@ -85,7 +86,7 @@
     boolean mWifiEnabled, mWifiConnected;
     int mWifiLevel;
     String mWifiSsid;
-    int mWifiIconId;
+    int mWifiIconId = 0;
 
     // bluetooth
     private boolean mBluetoothTethered = false;
@@ -123,6 +124,9 @@
     public NetworkController(Context context) {
         mContext = context;
 
+        // set up the default wifi icon, used when no radios have ever appeared
+        updateWifiIcons();
+
         // telephony
         mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
         mPhone.listen(mPhoneStateListener,
@@ -256,6 +260,10 @@
             }
             mDataState = state;
             mDataNetType = networkType;
+            if (state < 0) {
+                // device without a data connection
+                mSignalStrength = null;
+            }
             updateDataNetType();
             updateDataIcon();
             refreshViews();
@@ -321,6 +329,11 @@
         }
     }
 
+    private boolean hasMobileDataFeature() {
+        // XXX: HAX: replace when a more reliable method is available
+        return (! "wifi-only".equals(SystemProperties.get("ro.carrier")));
+    }
+
     private int getCdmaLevel() {
         if (mSignalStrength == null) return 0;
         final int cdmaDbm = mSignalStrength.getCdmaDbm();
@@ -723,11 +736,13 @@
             dataTypeIconId = 0;
         } else {
             label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
-            combinedSignalIconId = mDataSignalIconId;
+            // On devices without mobile radios, we want to show the wifi icon
+            combinedSignalIconId =
+                hasMobileDataFeature() ? mDataSignalIconId : mWifiIconId;
             dataTypeIconId = 0;
         }
 
-        if (false) {
+        if (DEBUG) {
             Slog.d(TAG, "refreshViews combinedSignalIconId=0x"
                     + Integer.toHexString(combinedSignalIconId)
                     + "/" + getResourceName(combinedSignalIconId)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java
index 0787289..8d72eba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiIcons.java
@@ -20,11 +20,13 @@
 
 class WifiIcons {
     static final int[][] WIFI_SIGNAL_STRENGTH = {
-            { R.drawable.stat_sys_wifi_signal_1,
+            { R.drawable.stat_sys_wifi_signal_0,
+              R.drawable.stat_sys_wifi_signal_1,
               R.drawable.stat_sys_wifi_signal_2,
               R.drawable.stat_sys_wifi_signal_3,
               R.drawable.stat_sys_wifi_signal_4 },
-            { R.drawable.stat_sys_wifi_signal_1_fully,
+            { R.drawable.stat_sys_wifi_signal_0,
+              R.drawable.stat_sys_wifi_signal_1_fully,
               R.drawable.stat_sys_wifi_signal_2_fully,
               R.drawable.stat_sys_wifi_signal_3_fully,
               R.drawable.stat_sys_wifi_signal_4_fully }