OSDN Git Service

Add logging for output chooser.
authorJulia Reynolds <juliacr@google.com>
Tue, 6 Feb 2018 19:47:30 +0000 (14:47 -0500)
committerJulia Reynolds <juliacr@google.com>
Tue, 6 Feb 2018 21:15:12 +0000 (16:15 -0500)
Show, hide, connect, and disconnect

Test: compare eventlog to action history
Fixes: 72999809
Change-Id: I545916c66b82703eb769b3264a7e920dde9c40ee

packages/SystemUI/src/com/android/systemui/volume/OutputChooserDialog.java
proto/src/metrics_constants.proto

index 46c43c2..6ed07f8 100644 (file)
@@ -49,6 +49,8 @@ import android.util.Pair;
 import android.view.Window;
 import android.view.WindowManager;
 
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto;
 import com.android.settingslib.Utils;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.systemui.Dependency;
@@ -202,6 +204,7 @@ public class OutputChooserDialog extends Dialog
     @Override
     public void show() {
         super.show();
+        Dependency.get(MetricsLogger.class).visible(MetricsProto.MetricsEvent.OUTPUT_CHOOSER);
         mHardwareLayout.setTranslationX(getAnimTranslation());
         mHardwareLayout.setAlpha(0);
         mHardwareLayout.animate()
@@ -215,6 +218,7 @@ public class OutputChooserDialog extends Dialog
 
     @Override
     public void dismiss() {
+        Dependency.get(MetricsLogger.class).hidden(MetricsProto.MetricsEvent.OUTPUT_CHOOSER);
         mHardwareLayout.setTranslationX(0);
         mHardwareLayout.setAlpha(1);
         mHardwareLayout.animate()
@@ -237,11 +241,15 @@ public class OutputChooserDialog extends Dialog
         if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_BT) {
             final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
             if (device.getMaxConnectionState() == BluetoothProfile.STATE_DISCONNECTED) {
+                Dependency.get(MetricsLogger.class).action(
+                        MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_CONNECT);
                 mBluetoothController.connect(device);
             }
         } else if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_MEDIA_ROUTER) {
             final MediaRouter.RouteInfo route = (MediaRouter.RouteInfo) item.tag;
             if (route.isEnabled()) {
+                Dependency.get(MetricsLogger.class).action(
+                        MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_CONNECT);
                 route.select();
             }
         }
@@ -252,8 +260,12 @@ public class OutputChooserDialog extends Dialog
         if (item == null || item.tag == null) return;
         if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_BT) {
             final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
+            Dependency.get(MetricsLogger.class).action(
+                    MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_DISCONNECT);
             mBluetoothController.disconnect(device);
         } else if (item.deviceType == OutputChooserLayout.Item.DEVICE_TYPE_MEDIA_ROUTER) {
+            Dependency.get(MetricsLogger.class).action(
+                    MetricsProto.MetricsEvent.ACTION_OUTPUT_CHOOSER_DISCONNECT);
             mRouter.unselect(UNSELECT_REASON_DISCONNECTED);
         }
     }
index f232feb..ae5e133 100644 (file)
@@ -5201,6 +5201,18 @@ message MetricsEvent {
     // OS: P
     ACCESSIBILITY_VIBRATION_TOUCH = 1294;
 
+    // OPEN: Volume panel > output chooser dialog
+    // OS: P
+    OUTPUT_CHOOSER = 1295;
+
+    // Action: Volume panel > output chooser dialog > tap on device
+    // OS: P
+    ACTION_OUTPUT_CHOOSER_CONNECT = 1296;
+
+    // Action: Volume panel > output chooser dialog > tap on X next to connected device
+    // OS: P
+    ACTION_OUTPUT_CHOOSER_DISCONNECT = 1297;
+
     // ---- End P Constants, all P constants go above this line ----
     // Add new aosp constants above this line.
     // END OF AOSP CONSTANTS