Loading services/core/java/com/android/server/audio/BtHelper.java +56 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.media.BluetoothProfileConnectionInfo; import android.os.Binder; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -911,10 +912,65 @@ public class BtHelper { } } /** * Returns the string equivalent for the btDeviceClass class. */ public static String btDeviceClassToString(int btDeviceClass) { switch (btDeviceClass) { case BluetoothClass.Device.AUDIO_VIDEO_UNCATEGORIZED: return "AUDIO_VIDEO_UNCATEGORIZED"; case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET: return "AUDIO_VIDEO_WEARABLE_HEADSET"; case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE: return "AUDIO_VIDEO_HANDSFREE"; case 0x040C: return "AUDIO_VIDEO_RESERVED_0x040C"; // uncommon case BluetoothClass.Device.AUDIO_VIDEO_MICROPHONE: return "AUDIO_VIDEO_MICROPHONE"; case BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER: return "AUDIO_VIDEO_LOUDSPEAKER"; case BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES: return "AUDIO_VIDEO_HEADPHONES"; case BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO: return "AUDIO_VIDEO_PORTABLE_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO: return "AUDIO_VIDEO_CAR_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_SET_TOP_BOX: return "AUDIO_VIDEO_SET_TOP_BOX"; case BluetoothClass.Device.AUDIO_VIDEO_HIFI_AUDIO: return "AUDIO_VIDEO_HIFI_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_VCR: return "AUDIO_VIDEO_VCR"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CAMERA: return "AUDIO_VIDEO_VIDEO_CAMERA"; case BluetoothClass.Device.AUDIO_VIDEO_CAMCORDER: return "AUDIO_VIDEO_CAMCORDER"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_MONITOR: return "AUDIO_VIDEO_VIDEO_MONITOR"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER: return "AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CONFERENCING: return "AUDIO_VIDEO_VIDEO_CONFERENCING"; case 0x0444: return "AUDIO_VIDEO_RESERVED_0x0444"; // uncommon case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_GAMING_TOY: return "AUDIO_VIDEO_VIDEO_GAMING_TOY"; default: // other device classes printed as a hex string. return TextUtils.formatSimple("0x%04x", btDeviceClass); } } //------------------------------------------------------------ /*package*/ void dump(PrintWriter pw, String prefix) { pw.println("\n" + prefix + "mBluetoothHeadset: " + mBluetoothHeadset); pw.println(prefix + "mBluetoothHeadsetDevice: " + mBluetoothHeadsetDevice); if (mBluetoothHeadsetDevice != null) { final BluetoothClass bluetoothClass = mBluetoothHeadsetDevice.getBluetoothClass(); if (bluetoothClass != null) { pw.println(prefix + "mBluetoothHeadsetDevice.DeviceClass: " + btDeviceClassToString(bluetoothClass.getDeviceClass())); } } pw.println(prefix + "mScoAudioState: " + scoAudioStateToString(mScoAudioState)); pw.println(prefix + "mScoAudioMode: " + scoAudioModeToString(mScoAudioMode)); pw.println("\n" + prefix + "mHearingAid: " + mHearingAid); Loading Loading
services/core/java/com/android/server/audio/BtHelper.java +56 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.media.BluetoothProfileConnectionInfo; import android.os.Binder; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -911,10 +912,65 @@ public class BtHelper { } } /** * Returns the string equivalent for the btDeviceClass class. */ public static String btDeviceClassToString(int btDeviceClass) { switch (btDeviceClass) { case BluetoothClass.Device.AUDIO_VIDEO_UNCATEGORIZED: return "AUDIO_VIDEO_UNCATEGORIZED"; case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET: return "AUDIO_VIDEO_WEARABLE_HEADSET"; case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE: return "AUDIO_VIDEO_HANDSFREE"; case 0x040C: return "AUDIO_VIDEO_RESERVED_0x040C"; // uncommon case BluetoothClass.Device.AUDIO_VIDEO_MICROPHONE: return "AUDIO_VIDEO_MICROPHONE"; case BluetoothClass.Device.AUDIO_VIDEO_LOUDSPEAKER: return "AUDIO_VIDEO_LOUDSPEAKER"; case BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES: return "AUDIO_VIDEO_HEADPHONES"; case BluetoothClass.Device.AUDIO_VIDEO_PORTABLE_AUDIO: return "AUDIO_VIDEO_PORTABLE_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO: return "AUDIO_VIDEO_CAR_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_SET_TOP_BOX: return "AUDIO_VIDEO_SET_TOP_BOX"; case BluetoothClass.Device.AUDIO_VIDEO_HIFI_AUDIO: return "AUDIO_VIDEO_HIFI_AUDIO"; case BluetoothClass.Device.AUDIO_VIDEO_VCR: return "AUDIO_VIDEO_VCR"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CAMERA: return "AUDIO_VIDEO_VIDEO_CAMERA"; case BluetoothClass.Device.AUDIO_VIDEO_CAMCORDER: return "AUDIO_VIDEO_CAMCORDER"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_MONITOR: return "AUDIO_VIDEO_VIDEO_MONITOR"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER: return "AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER"; case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_CONFERENCING: return "AUDIO_VIDEO_VIDEO_CONFERENCING"; case 0x0444: return "AUDIO_VIDEO_RESERVED_0x0444"; // uncommon case BluetoothClass.Device.AUDIO_VIDEO_VIDEO_GAMING_TOY: return "AUDIO_VIDEO_VIDEO_GAMING_TOY"; default: // other device classes printed as a hex string. return TextUtils.formatSimple("0x%04x", btDeviceClass); } } //------------------------------------------------------------ /*package*/ void dump(PrintWriter pw, String prefix) { pw.println("\n" + prefix + "mBluetoothHeadset: " + mBluetoothHeadset); pw.println(prefix + "mBluetoothHeadsetDevice: " + mBluetoothHeadsetDevice); if (mBluetoothHeadsetDevice != null) { final BluetoothClass bluetoothClass = mBluetoothHeadsetDevice.getBluetoothClass(); if (bluetoothClass != null) { pw.println(prefix + "mBluetoothHeadsetDevice.DeviceClass: " + btDeviceClassToString(bluetoothClass.getDeviceClass())); } } pw.println(prefix + "mScoAudioState: " + scoAudioStateToString(mScoAudioState)); pw.println(prefix + "mScoAudioMode: " + scoAudioModeToString(mScoAudioMode)); pw.println("\n" + prefix + "mHearingAid: " + mHearingAid); Loading