diff options
author | Hansong Zhang <hsz@google.com> | 2018-04-03 12:12:53 -0700 |
---|---|---|
committer | Hansong Zhang <hsz@google.com> | 2018-04-03 16:09:40 -0700 |
commit | 7a892c292e47ded6257de80ca60fb6ae4e04075f (patch) | |
tree | c5cac794a3ad5598394f926241b3736a104d238c /framework/java/android/bluetooth/BluetoothHidDevice.java | |
parent | 109ab00fd0aabd4ee2e911ad644cfb20af955093 (diff) |
Bluetooth: Add hidden API to get current user of HID Device (1/3)
Bug: 69136526
Test: test with apps using HID Device profile
Change-Id: If0e49840257c877c975c2da176a08e613668cbc3
(cherry picked from commit 347ef4099e0d2b1334efd22e6ca7d5cc5464b4eb)
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHidDevice.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothHidDevice.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHidDevice.java b/framework/java/android/bluetooth/BluetoothHidDevice.java index af99bf7dfd..3bc8544ebf 100644 --- a/framework/java/android/bluetooth/BluetoothHidDevice.java +++ b/framework/java/android/bluetooth/BluetoothHidDevice.java @@ -701,6 +701,28 @@ public final class BluetoothHidDevice implements BluetoothProfile { } /** + * Gets the application name of the current HidDeviceService user. + * + * @return the current user name, or empty string if cannot get the name + * {@hide} + */ + public String getUserAppName() { + final IBluetoothHidDevice service = mService; + + if (service != null) { + try { + return service.getUserAppName(); + } catch (RemoteException e) { + Log.e(TAG, e.toString()); + } + } else { + Log.w(TAG, "Proxy not attached to service"); + } + + return ""; + } + + /** * Initiates connection to host which is currently paired with this device. If the application * is not registered, #connect(BluetoothDevice) will fail. The connection state should be * tracked by the application by handling callback from Callback#onConnectionStateChanged. The |