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

Commit fa5e9552 authored by Vlad Popa's avatar Vlad Popa Committed by Android (Google) Code Review
Browse files

Merge "Use constants when Bt flag is not enabled" into main

parents 69bd616f 6dc967b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ aconfig_declarations_group {
        "android.widget.flags-aconfig-java",
        "backstage_power_flags_lib",
        "backup_flags_lib",
        "bluetooth_exported_flags_java_lib",
        "camera_platform_flags_core_java_lib",
        "com.android.hardware.input-aconfig-java",
        "com.android.input.flags-aconfig-java",
+40 −15
Original line number Diff line number Diff line
@@ -1249,6 +1249,8 @@ public class BtHelper {
            return AUDIO_DEVICE_CATEGORY_UNKNOWN;
        }
        String deviceCategory = new String(deviceType);

        if (com.android.bluetooth.flags.Flags.supportMetadataDeviceTypesApis()) {
            switch (deviceCategory) {
                case DEVICE_TYPE_HEARING_AID:
                    return AUDIO_DEVICE_CATEGORY_HEARING_AID;
@@ -1262,8 +1264,31 @@ public class BtHelper {
                case DEVICE_TYPE_WATCH:
                    return AUDIO_DEVICE_CATEGORY_WATCH;
                case DEVICE_TYPE_DEFAULT:
                    // fall through
                default:
                    break;
            }
        } else {
            // Duplicate switch for now to cover the cases when the flag is not rolled out
            // This will cover the cases in which clients could write directly to these
            // metadata keys
            switch (deviceCategory) {
                case "HearingAid":
                    return AUDIO_DEVICE_CATEGORY_HEARING_AID;
                case "Carkit":
                    return AUDIO_DEVICE_CATEGORY_CARKIT;
                case "Headset":
                case DEVICE_TYPE_UNTETHERED_HEADSET:
                    return AUDIO_DEVICE_CATEGORY_HEADPHONES;
                case "Speaker":
                    return AUDIO_DEVICE_CATEGORY_SPEAKER;
                case "Watch":
                    return AUDIO_DEVICE_CATEGORY_WATCH;
                case "Default":
                    // fall through
                default:
                    break;
            }
        }

        BluetoothClass deviceClass = device.getBluetoothClass();