Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47aefdfb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add logging for output chooser."

parents 451832a5 8b46ef2f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
+12 −0
Original line number Diff line number Diff line
@@ -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