WiFi Calling: Show different operator name string in Data usage dialog.

Bug: 19950657
Change-Id: I9999d58e78154ed2d6d824973c40011875de15ef
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index aaa8323..9711f93 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -255,6 +255,8 @@
     <string-array name="wfcOperatorErrorNotificationMessages" />
     <!-- Template for showing cellular network operator name while WFC is active -->
     <string name="wfcSpnFormat">%s</string>
+    <!-- Template for showing operator name for data connection while WFC is active -->
+    <string name="wfcDataSpnFormat">%s</string>
     <!-- WFC, summary for Disabled -->
     <string name="wifi_calling_off_summary">Off</string>
     <!-- WFC, summary for Wi-Fi Preferred -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 6a998e4..816d203 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -750,6 +750,7 @@
   <java-symbol type="array" name="wfcOperatorErrorAlertMessages" />
   <java-symbol type="array" name="wfcOperatorErrorNotificationMessages" />
   <java-symbol type="string" name="wfcSpnFormat" />
+  <java-symbol type="string" name="wfcDataSpnFormat" />
   <java-symbol type="string" name="wifi_calling_off_summary" />
   <java-symbol type="string" name="wfc_mode_wifi_preferred_summary" />
   <java-symbol type="string" name="wfc_mode_cellular_preferred_summary" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java
index f2b2f66..a7fdadc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataControllerImpl.java
@@ -162,7 +162,7 @@
                 usage.warningLevel = DEFAULT_WARNING_LEVEL;
             }
             if (usage != null) {
-                usage.carrier = mNetworkController.getMobileNetworkName();
+                usage.carrier = mNetworkController.getMobileDataNetworkName();
             }
             return usage;
         } catch (RemoteException e) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 9a7f21e..07ba04e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -277,9 +277,9 @@
         return mDefaultSignalController;
     }
 
-    public String getMobileNetworkName() {
+    public String getMobileDataNetworkName() {
         MobileSignalController controller = getDataController();
-        return controller != null ? controller.getState().networkName : "";
+        return controller != null ? controller.getState().networkNameData : "";
     }
 
     public boolean isEmergencyOnly() {
@@ -1039,6 +1039,7 @@
             mapIconSets();
 
             mLastState.networkName = mCurrentState.networkName = mNetworkNameDefault;
+            mLastState.networkNameData = mCurrentState.networkNameData = mNetworkNameDefault;
             mLastState.enabled = mCurrentState.enabled = hasMobileData;
             mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
             // Get initial data sim state.
@@ -1274,6 +1275,7 @@
             if (action.equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) {
                 updateNetworkName(intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false),
                         intent.getStringExtra(TelephonyIntents.EXTRA_SPN),
+                        intent.getStringExtra(TelephonyIntents.EXTRA_DATA_SPN),
                         intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false),
                         intent.getStringExtra(TelephonyIntents.EXTRA_PLMN));
                 notifyListenersIfNecessary();
@@ -1302,14 +1304,18 @@
         /**
          * Updates the network's name based on incoming spn and plmn.
          */
-        void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn) {
+        void updateNetworkName(boolean showSpn, String spn, String dataSpn,
+                boolean showPlmn, String plmn) {
             if (CHATTY) {
-                Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn
+                Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn
+                        + " spn=" + spn + " dataSpn=" + dataSpn
                         + " showPlmn=" + showPlmn + " plmn=" + plmn);
             }
             StringBuilder str = new StringBuilder();
+            StringBuilder strData = new StringBuilder();
             if (showPlmn && plmn != null) {
                 str.append(plmn);
+                strData.append(plmn);
             }
             if (showSpn && spn != null) {
                 if (str.length() != 0) {
@@ -1322,6 +1328,17 @@
             } else {
                 mCurrentState.networkName = mNetworkNameDefault;
             }
+            if (showSpn && dataSpn != null) {
+                if (strData.length() != 0) {
+                    strData.append(mNetworkNameSeparator);
+                }
+                strData.append(dataSpn);
+            }
+            if (strData.length() != 0) {
+                mCurrentState.networkNameData = strData.toString();
+            } else {
+                mCurrentState.networkNameData = mNetworkNameDefault;
+            }
         }
 
         /**
@@ -1450,6 +1467,7 @@
 
         static class MobileState extends SignalController.State {
             String networkName;
+            String networkNameData;
             boolean dataSim;
             boolean dataConnected;
             boolean isEmergency;
@@ -1462,6 +1480,7 @@
                 MobileState state = (MobileState) s;
                 dataSim = state.dataSim;
                 networkName = state.networkName;
+                networkNameData = state.networkNameData;
                 dataConnected = state.dataConnected;
                 inetForNetwork = state.inetForNetwork;
                 isEmergency = state.isEmergency;
@@ -1474,6 +1493,7 @@
                 builder.append(',');
                 builder.append("dataSim=").append(dataSim).append(',');
                 builder.append("networkName=").append(networkName).append(',');
+                builder.append("networkNameData=").append(networkNameData).append(',');
                 builder.append("dataConnected=").append(dataConnected).append(',');
                 builder.append("inetForNetwork=").append(inetForNetwork).append(',');
                 builder.append("isEmergency=").append(isEmergency).append(',');
@@ -1484,6 +1504,7 @@
             public boolean equals(Object o) {
                 return super.equals(o)
                         && Objects.equals(((MobileState) o).networkName, networkName)
+                        && Objects.equals(((MobileState) o).networkNameData, networkNameData)
                         && ((MobileState) o).dataSim == dataSim
                         && ((MobileState) o).dataConnected == dataConnected
                         && ((MobileState) o).isEmergency == isEmergency
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 92cd4682..26faaba 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -319,6 +319,7 @@
     public static final String EXTRA_PLMN       = "plmn";
     public static final String EXTRA_SHOW_SPN   = "showSpn";
     public static final String EXTRA_SPN        = "spn";
+    public static final String EXTRA_DATA_SPN   = "spnData";
 
     /**
      * <p>Broadcast Action: It indicates one column of a subinfo record has been changed