Merge "Tuning parameters for mobile RSSI." into ics-mr1
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 4ac89b2..1fe4ebb 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -43,5 +43,11 @@
     <!-- How many icons may be shown at once in the system bar. Includes any
          slots that may be reused for things like IME control. -->
     <integer name="config_maxNotificationIcons">5</integer>
+
+    <!-- Show phone (voice) signal strength instead of data in mobile RSSI. -->
+    <bool name="config_showPhoneRSSIForData">false</bool>
+
+    <!-- When true, show 1/2G networks as 3G. -->
+    <bool name="config_showMin3G">false</bool>
 </resources>
 
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 1d4b9ba..a305816 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -85,6 +85,8 @@
     boolean mDataActive;
     int mMobileActivityIconId; // overlay arrows for data direction
     int mLastSignalLevel;
+    boolean mShowPhoneRSSIForData = false;
+    boolean mShowAtLeastThreeGees = false;
 
     String mContentDescriptionPhoneSignal;
     String mContentDescriptionWifi;
@@ -151,11 +153,15 @@
      */
     public NetworkController(Context context) {
         mContext = context;
+        final Resources res = context.getResources();
 
         ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService(
                 Context.CONNECTIVITY_SERVICE);
         mHasMobileDataFeature = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
 
+        mShowPhoneRSSIForData = res.getBoolean(R.bool.config_showPhoneRSSIForData);
+        mShowAtLeastThreeGees = res.getBoolean(R.bool.config_showMin3G);
+
         // set up the default wifi icon, used when no radios have ever appeared
         updateWifiIcons();
 
@@ -240,7 +246,7 @@
                 mContentDescriptionWifi);
         cluster.setMobileDataIndicators(
                 mHasMobileDataFeature,
-                mPhoneSignalIconId,
+                mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
                 mMobileActivityIconId,
                 mDataTypeIconId,
                 mContentDescriptionPhoneSignal,
@@ -434,17 +440,25 @@
     private final void updateDataNetType() {
         switch (mDataNetType) {
             case TelephonyManager.NETWORK_TYPE_UNKNOWN:
-                mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
-                mDataTypeIconId = 0;
-                mContentDescriptionDataType = mContext.getString(
-                        R.string.accessibility_data_connection_gprs);
-                break;
+                if (!mShowAtLeastThreeGees) {
+                    mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
+                    mDataTypeIconId = 0;
+                    mContentDescriptionDataType = mContext.getString(
+                            R.string.accessibility_data_connection_gprs);
+                    break;
+                } else {
+                    // fall through
+                }
             case TelephonyManager.NETWORK_TYPE_EDGE:
-                mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
-                mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
-                mContentDescriptionDataType = mContext.getString(
-                        R.string.accessibility_data_connection_edge);
-                break;
+                if (!mShowAtLeastThreeGees) {
+                    mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
+                    mDataTypeIconId = R.drawable.stat_sys_data_connected_e;
+                    mContentDescriptionDataType = mContext.getString(
+                            R.string.accessibility_data_connection_edge);
+                    break;
+                } else {
+                    // fall through
+                }
             case TelephonyManager.NETWORK_TYPE_UMTS:
                 mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
                 mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
@@ -496,10 +510,17 @@
                         R.string.accessibility_data_connection_4g);
                 break;
             default:
-                mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
-                mDataTypeIconId = R.drawable.stat_sys_data_connected_g;
-                mContentDescriptionDataType = mContext.getString(
-                        R.string.accessibility_data_connection_gprs);
+                if (!mShowAtLeastThreeGees) {
+                    mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
+                    mDataTypeIconId = R.drawable.stat_sys_data_connected_g;
+                    mContentDescriptionDataType = mContext.getString(
+                            R.string.accessibility_data_connection_gprs);
+                } else {
+                    mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
+                    mDataTypeIconId = R.drawable.stat_sys_data_connected_3g;
+                    mContentDescriptionDataType = mContext.getString(
+                            R.string.accessibility_data_connection_3g);
+                }
                 break;
         }
         if ((isCdma() && isCdmaEri()) || mPhone.isNetworkRoaming()) {
@@ -877,7 +898,7 @@
                         mContentDescriptionWifi);
                 cluster.setMobileDataIndicators(
                         mHasMobileDataFeature,
-                        mPhoneSignalIconId,
+                        mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
                         mMobileActivityIconId,
                         mDataTypeIconId,
                         mContentDescriptionPhoneSignal,