Merge "Don't record network name in metrics log" into pi-dev
diff --git a/src/com/android/phone/NetworkSelectListPreference.java b/src/com/android/phone/NetworkSelectListPreference.java
index a8f29c9..00f58b8 100644
--- a/src/com/android/phone/NetworkSelectListPreference.java
+++ b/src/com/android/phone/NetworkSelectListPreference.java
@@ -19,7 +19,6 @@
 import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.metrics.LogMaker;
 import android.os.AsyncResult;
 import android.os.Handler;
 import android.os.Message;
@@ -97,7 +96,6 @@
 
     @Override
     protected void onClick() {
-        sendMetricsEvent(null);
         // Scan the network with setting the isIncrementalResult as true via TelephonyManager first.
         loadNetworksList(true);
     }
@@ -474,7 +472,8 @@
         mCellInfo = mCellInfoList.get(operatorIndex);
         if (DBG) logd("selected network: " + mCellInfo.toString());
 
-        sendMetricsEvent(getNetworkTitle(mCellInfo));
+        MetricsLogger.action(getContext(),
+                MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
 
         Message msg = mHandler.obtainMessage(EVENT_NETWORK_SELECTION_DONE);
         Phone phone = PhoneFactory.getPhone(mPhoneId);
@@ -675,21 +674,6 @@
                 };
     }
 
-    private void sendMetricsEvent(String network) {
-        final LogMaker logMaker =
-                new LogMaker(MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK)
-                        .setType(MetricsEvent.TYPE_ACTION);
-
-        if (network != null) {
-            // Since operator list is loaded dynamically from modem, we cannot know which network
-            // user chooses if we only record integer index of newValue. So a new tag and a string
-            // value (network) is added in this MetricsEvent.
-            logMaker.addTaggedData(MetricsEvent.FIELD_MOBILE_NETWORK, network);
-        }
-
-        MetricsLogger.action(logMaker);
-    }
-
     private void logd(String msg) {
         Log.d(LOG_TAG, "[NetworksList] " + msg);
     }
diff --git a/src/com/android/phone/NetworkSelectSetting.java b/src/com/android/phone/NetworkSelectSetting.java
index ff918e2..efa8684 100644
--- a/src/com/android/phone/NetworkSelectSetting.java
+++ b/src/com/android/phone/NetworkSelectSetting.java
@@ -21,7 +21,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
-import android.metrics.LogMaker;
 import android.os.AsyncResult;
 import android.os.Bundle;
 import android.os.Handler;
@@ -45,7 +44,7 @@
 import android.view.ViewGroup;
 
 import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.telephony.OperatorInfo;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneFactory;
@@ -184,17 +183,8 @@
             if (DBG) logd("User click a NetworkOperatorPreference: " + cellInfo.toString());
 
             // Send metrics event
-            final LogMaker logMaker = new LogMaker(
-                    MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK)
-                    .setType(MetricsProto.MetricsEvent.TYPE_ACTION);
-            if (CellInfoUtil.getNetworkTitle(cellInfo) != null) {
-                // Since operator list is loaded dynamically from modem, we cannot know which
-                // network user chooses if we only record integer index of newValue. So a new tag
-                // and a string value (network) is added in this MetricsEvent.
-                logMaker.addTaggedData(MetricsProto.MetricsEvent.FIELD_MOBILE_NETWORK,
-                        CellInfoUtil.getNetworkTitle(cellInfo));
-            }
-            MetricsLogger.action(logMaker);
+            MetricsLogger.action(getContext(),
+                    MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
 
             // Connect to the network
             Message msg = mHandler.obtainMessage(EVENT_NETWORK_SELECTION_DONE);