diff options
author | Ugo Yu <ugoyu@google.com> | 2019-07-22 15:56:23 +0800 |
---|---|---|
committer | Ugo Yu <ugoyu@google.com> | 2019-11-14 19:23:23 +0800 |
commit | e521618ea3669e1a0d03363e4eb1fd8db2384f97 (patch) | |
tree | 7050f61b75f0d9c931f52583383a3d3e82e6436e /framework/java/android/bluetooth | |
parent | 7ae5773fc8087ea4e432fda86767138166e5d4dc (diff) |
Add method to convert profile ID into human readable string
Bug: 136068566
Test: adb shell dumpsys bluetooth_manager
Change-Id: I9f354ecbe20caf058c9de843180b7a07de7af569
Diffstat (limited to 'framework/java/android/bluetooth')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothProfile.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothProfile.java b/framework/java/android/bluetooth/BluetoothProfile.java index dabe0fdac3..f5aa014584 100644 --- a/framework/java/android/bluetooth/BluetoothProfile.java +++ b/framework/java/android/bluetooth/BluetoothProfile.java @@ -324,4 +324,54 @@ public interface BluetoothProfile { return "STATE_UNKNOWN"; } } + + /** + * Convert an integer value of profile ID into human readable string + * + * @param profile profile ID + * @return profile name as String, UNKOWN_PROFILE if the profile ID is not defined. + * @hide + */ + static String getProfileName(int profile) { + switch(profile) { + case HEADSET: + return "HEADSET"; + case A2DP: + return "A2DP"; + case HID_HOST: + return "HID_HOST"; + case PAN: + return "PAN"; + case PBAP: + return "PBAP"; + case GATT: + return "GATT"; + case GATT_SERVER: + return "GATT_SERVER"; + case MAP: + return "MAP"; + case SAP: + return "SAP"; + case A2DP_SINK: + return "A2DP_SINK"; + case AVRCP_CONTROLLER: + return "AVRCP_CONTROLLER"; + case AVRCP: + return "AVRCP"; + case HEADSET_CLIENT: + return "HEADSET_CLIENT"; + case PBAP_CLIENT: + return "PBAP_CLIENT"; + case MAP_CLIENT: + return "MAP_CLIENT"; + case HID_DEVICE: + return "HID_DEVICE"; + case OPP: + return "OPP"; + case HEARING_AID: + return "HEARING_AID"; + default: + return "UNKNOWN_PROFILE"; + } + } } |