Loading android/app/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -324,7 +324,7 @@ android:name = ".hid.HidService" android:enabled="@bool/profile_supported_hid"> <intent-filter> <action android:name="android.bluetooth.IBluetoothInputDevice" /> <action android:name="android.bluetooth.IBluetoothHidHost" /> </intent-filter> </service> <service Loading Loading @@ -386,7 +386,7 @@ android:name = ".hid.HidDevService" android:enabled="@bool/profile_supported_hidd"> <intent-filter> <action android:name="android.bluetooth.IBluetoothInputHost" /> <action android:name="android.bluetooth.IBluetoothHidDevice" /> </intent-filter> </service> </application> Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +8 −8 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import android.bluetooth.BluetoothAvrcpController; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothHeadsetClient; import android.bluetooth.BluetoothInputDevice; import android.bluetooth.BluetoothInputHost; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothHidHost; import android.bluetooth.BluetoothMap; import android.bluetooth.BluetoothMapClient; import android.bluetooth.BluetoothPan; Loading Loading @@ -115,11 +115,11 @@ class AdapterProperties { case BluetoothA2dpSink.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.A2DP_SINK, intent); break; case BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.INPUT_HOST, intent); case BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.HID_DEVICE, intent); break; case BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.INPUT_DEVICE, intent); case BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.HID_HOST, intent); break; case BluetoothAvrcpController.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.AVRCP_CONTROLLER, intent); Loading Loading @@ -168,8 +168,8 @@ class AdapterProperties { filter.addAction(BluetoothHeadsetClient.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothA2dpSink.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothAvrcpController.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothPan.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothMap.ACTION_CONNECTION_STATE_CHANGED); Loading android/app/src/com/android/bluetooth/btservice/Config.java +2 −2 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ public class Config { } else if (profile == A2dpSinkService.class) { profileIndex = BluetoothProfile.A2DP_SINK; } else if (profile == HidService.class) { profileIndex = BluetoothProfile.INPUT_DEVICE; profileIndex = BluetoothProfile.HID_HOST; } else if (profile == HealthService.class) { profileIndex = BluetoothProfile.HEALTH; } else if (profile == PanService.class) { Loading @@ -176,7 +176,7 @@ public class Config { } else if (profile == MapClientService.class) { profileIndex = BluetoothProfile.MAP_CLIENT; } else if (profile == HidDevService.class) { profileIndex = BluetoothProfile.INPUT_HOST; profileIndex = BluetoothProfile.HID_DEVICE; } return profileIndex; Loading android/app/src/com/android/bluetooth/hid/HidDevService.java +8 −8 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHidDeviceAppConfiguration; import android.bluetooth.BluetoothHidDeviceAppQosSettings; import android.bluetooth.BluetoothHidDeviceAppSdpSettings; import android.bluetooth.BluetoothInputHost; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothHidDeviceCallback; import android.bluetooth.IBluetoothInputHost; import android.bluetooth.IBluetoothHidDevice; import android.content.Intent; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -58,7 +58,7 @@ public class HidDevService extends ProfileService { private BluetoothDevice mHidDevice = null; private int mHidDeviceState = BluetoothInputHost.STATE_DISCONNECTED; private int mHidDeviceState = BluetoothHidDevice.STATE_DISCONNECTED; private BluetoothHidDeviceAppConfiguration mAppConfig = null; Loading Loading @@ -139,7 +139,7 @@ public class HidDevService extends ProfileService { int halState = msg.arg1; int state = convertHalState(halState); if (state != BluetoothInputHost.STATE_DISCONNECTED) { if (state != BluetoothHidDevice.STATE_DISCONNECTED) { mHidDevice = device; } Loading Loading @@ -245,7 +245,7 @@ public class HidDevService extends ProfileService { } } private static class BluetoothHidDeviceBinder extends IBluetoothInputHost.Stub private static class BluetoothHidDeviceBinder extends IBluetoothHidDevice.Stub implements IProfileServiceBinder { private static final String TAG = BluetoothHidDeviceBinder.class.getSimpleName(); Loading Loading @@ -397,7 +397,7 @@ public class HidDevService extends ProfileService { HidDevService service = getService(); if (service == null) { return BluetoothInputHost.STATE_DISCONNECTED; return BluetoothHidDevice.STATE_DISCONNECTED; } return service.getConnectionState(device); Loading Loading @@ -585,7 +585,7 @@ public class HidDevService extends ProfileService { if (mHidDevice != null && mHidDevice.equals(device)) { return mHidDeviceState; } return BluetoothInputHost.STATE_DISCONNECTED; return BluetoothHidDevice.STATE_DISCONNECTED; } List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { Loading Loading @@ -705,7 +705,7 @@ public class HidDevService extends ProfileService { return; } Intent intent = new Intent(BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED); Intent intent = new Intent(BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); Loading android/app/src/com/android/bluetooth/hid/HidService.java +51 −51 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ package com.android.bluetooth.hid; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothInputDevice; import android.bluetooth.BluetoothHidHost; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothInputDevice; import android.bluetooth.IBluetoothHidHost; import android.content.Intent; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -79,7 +79,7 @@ public class HidService extends ProfileService { @Override public IProfileServiceBinder initBinder() { return new BluetoothInputDeviceBinder(this); return new BluetoothHidHostBinder(this); } @Override Loading Loading @@ -190,14 +190,14 @@ public class HidService extends ProfileService { int halState = msg.arg1; Integer prevStateInteger = mInputDevices.get(device); int prevState = (prevStateInteger == null) ? BluetoothInputDevice.STATE_DISCONNECTED (prevStateInteger == null) ? BluetoothHidHost.STATE_DISCONNECTED : prevStateInteger; if (DBG) { Log.d(TAG, "MESSAGE_CONNECT_STATE_CHANGED newState:" + convertHalState( halState) + ", prevState:" + prevState); } if (halState == CONN_STATE_CONNECTED && prevState == BluetoothInputDevice.STATE_DISCONNECTED && prevState == BluetoothHidHost.STATE_DISCONNECTED && (!okToConnect(device))) { if (DBG) { Log.d(TAG, "Incoming HID connection rejected"); Loading Loading @@ -249,9 +249,9 @@ public class HidService extends ProfileService { case MESSAGE_GET_REPORT: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte reportType = data.getByte(BluetoothInputDevice.EXTRA_REPORT_TYPE); byte reportId = data.getByte(BluetoothInputDevice.EXTRA_REPORT_ID); int bufferSize = data.getInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE); byte reportType = data.getByte(BluetoothHidHost.EXTRA_REPORT_TYPE); byte reportId = data.getByte(BluetoothHidHost.EXTRA_REPORT_ID); int bufferSize = data.getInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE); if (!getReportNative(Utils.getByteAddress(device), reportType, reportId, bufferSize)) { Log.e(TAG, "Error: get report native returns false"); Loading @@ -261,8 +261,8 @@ public class HidService extends ProfileService { case MESSAGE_ON_GET_REPORT: { BluetoothDevice device = getDevice((byte[]) msg.obj); Bundle data = msg.getData(); byte[] report = data.getByteArray(BluetoothInputDevice.EXTRA_REPORT); int bufferSize = data.getInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE); byte[] report = data.getByteArray(BluetoothHidHost.EXTRA_REPORT); int bufferSize = data.getInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE); broadcastReport(device, report, bufferSize); } break; Loading @@ -275,8 +275,8 @@ public class HidService extends ProfileService { case MESSAGE_SET_REPORT: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte reportType = data.getByte(BluetoothInputDevice.EXTRA_REPORT_TYPE); String report = data.getString(BluetoothInputDevice.EXTRA_REPORT); byte reportType = data.getByte(BluetoothHidHost.EXTRA_REPORT_TYPE); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!setReportNative(Utils.getByteAddress(device), reportType, report)) { Log.e(TAG, "Error: set report native returns false"); } Loading @@ -285,7 +285,7 @@ public class HidService extends ProfileService { case MESSAGE_SEND_DATA: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); String report = data.getString(BluetoothInputDevice.EXTRA_REPORT); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!sendDataNative(Utils.getByteAddress(device), report)) { Log.e(TAG, "Error: send data native returns false"); } Loading Loading @@ -313,7 +313,7 @@ public class HidService extends ProfileService { case MESSAGE_SET_IDLE_TIME: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte idleTime = data.getByte(BluetoothInputDevice.EXTRA_IDLE_TIME); byte idleTime = data.getByte(BluetoothHidHost.EXTRA_IDLE_TIME); if (!setIdleTimeNative(Utils.getByteAddress(device), idleTime)) { Log.e(TAG, "Error: get idle time native returns false"); } Loading @@ -326,11 +326,11 @@ public class HidService extends ProfileService { /** * Handlers for incoming service calls */ private static class BluetoothInputDeviceBinder extends IBluetoothInputDevice.Stub private static class BluetoothHidHostBinder extends IBluetoothHidHost.Stub implements IProfileServiceBinder { private HidService mService; BluetoothInputDeviceBinder(HidService svc) { BluetoothHidHostBinder(HidService svc) { mService = svc; } Loading Loading @@ -375,7 +375,7 @@ public class HidService extends ProfileService { public int getConnectionState(BluetoothDevice device) { HidService service = getService(); if (service == null) { return BluetoothInputDevice.STATE_DISCONNECTED; return BluetoothHidHost.STATE_DISCONNECTED; } return service.getConnectionState(device); } Loading Loading @@ -493,11 +493,11 @@ public class HidService extends ProfileService { boolean connect(BluetoothDevice device) { if (DBG) Log.d(TAG, "connect: " + device.getAddress()); enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (getConnectionState(device) != BluetoothInputDevice.STATE_DISCONNECTED) { if (getConnectionState(device) != BluetoothHidHost.STATE_DISCONNECTED) { Log.e(TAG, "Hid Device not disconnected: " + device); return false; } if (getPriority(device) == BluetoothInputDevice.PRIORITY_OFF) { if (getPriority(device) == BluetoothHidHost.PRIORITY_OFF) { Log.e(TAG, "Hid Device PRIORITY_OFF: " + device); return false; } Loading @@ -518,7 +518,7 @@ public class HidService extends ProfileService { int getConnectionState(BluetoothDevice device) { if (DBG) Log.d(TAG, "getConnectionState: " + device.getAddress()); if (mInputDevices.get(device) == null) { return BluetoothInputDevice.STATE_DISCONNECTED; return BluetoothHidHost.STATE_DISCONNECTED; } return mInputDevices.get(device); } Loading Loading @@ -546,7 +546,7 @@ public class HidService extends ProfileService { Log.d(TAG, "setPriority: " + device.getAddress()); } Settings.Global.putInt(getContentResolver(), Settings.Global.getBluetoothInputDevicePriorityKey(device.getAddress()), priority); Settings.Global.getBluetoothHidHostPriorityKey(device.getAddress()), priority); if (DBG) { Log.d(TAG, "Saved priority " + device + " = " + priority); } Loading @@ -559,7 +559,7 @@ public class HidService extends ProfileService { Log.d(TAG, "getPriority: " + device.getAddress()); } int priority = Settings.Global.getInt(getContentResolver(), Settings.Global.getBluetoothInputDevicePriorityKey(device.getAddress()), Settings.Global.getBluetoothHidHostPriorityKey(device.getAddress()), BluetoothProfile.PRIORITY_UNDEFINED); return priority; } Loading @@ -571,7 +571,7 @@ public class HidService extends ProfileService { Log.d(TAG, "getProtocolMode: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_PROTOCOL_MODE, device); Loading @@ -587,7 +587,7 @@ public class HidService extends ProfileService { Log.d(TAG, "virtualUnplug: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_VIRTUAL_UNPLUG, device); Loading @@ -601,7 +601,7 @@ public class HidService extends ProfileService { Log.d(TAG, "setProtocolMode: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_PROTOCOL_MODE); Loading @@ -617,15 +617,15 @@ public class HidService extends ProfileService { Log.d(TAG, "getReport: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_REPORT); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_REPORT_TYPE, reportType); data.putByte(BluetoothInputDevice.EXTRA_REPORT_ID, reportId); data.putInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, bufferSize); data.putByte(BluetoothHidHost.EXTRA_REPORT_TYPE, reportType); data.putByte(BluetoothHidHost.EXTRA_REPORT_ID, reportId); data.putInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, bufferSize); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -637,14 +637,14 @@ public class HidService extends ProfileService { Log.d(TAG, "setReport: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_REPORT); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_REPORT_TYPE, reportType); data.putString(BluetoothInputDevice.EXTRA_REPORT, report); data.putByte(BluetoothHidHost.EXTRA_REPORT_TYPE, reportType); data.putString(BluetoothHidHost.EXTRA_REPORT, report); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -657,7 +657,7 @@ public class HidService extends ProfileService { Log.d(TAG, "sendData: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Loading @@ -668,7 +668,7 @@ public class HidService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); if (DBG) Log.d(TAG, "getIdleTime: " + device.getAddress()); int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_IDLE_TIME, device); Loading @@ -680,13 +680,13 @@ public class HidService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); if (DBG) Log.d(TAG, "setIdleTime: " + device.getAddress()); int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_IDLE_TIME); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_IDLE_TIME, idleTime); data.putByte(BluetoothHidHost.EXTRA_IDLE_TIME, idleTime); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -713,8 +713,8 @@ public class HidService extends ProfileService { Message msg = mHandler.obtainMessage(MESSAGE_ON_GET_REPORT); msg.obj = address; Bundle data = new Bundle(); data.putByteArray(BluetoothInputDevice.EXTRA_REPORT, report); data.putInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, rptSize); data.putByteArray(BluetoothHidHost.EXTRA_REPORT, report); data.putInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, rptSize); msg.setData(data); mHandler.sendMessage(msg); } Loading Loading @@ -746,7 +746,7 @@ public class HidService extends ProfileService { // This method does not check for error conditon (newState == prevState) private void broadcastConnectionState(BluetoothDevice device, int newState) { Integer prevStateInteger = mInputDevices.get(device); int prevState = (prevStateInteger == null) ? BluetoothInputDevice.STATE_DISCONNECTED int prevState = (prevStateInteger == null) ? BluetoothHidHost.STATE_DISCONNECTED : prevStateInteger; if (prevState == newState) { Log.w(TAG, "no state change: " + newState); Loading @@ -758,7 +758,7 @@ public class HidService extends ProfileService { connection state change, as it was causing a race condition, with the UI not being updated with the correct connection state. */ log("Connection state " + device + ": " + prevState + "->" + newState); Intent intent = new Intent(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); Loading @@ -767,17 +767,17 @@ public class HidService extends ProfileService { } private void broadcastHandshake(BluetoothDevice device, int status) { Intent intent = new Intent(BluetoothInputDevice.ACTION_HANDSHAKE); Intent intent = new Intent(BluetoothHidHost.ACTION_HANDSHAKE); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_STATUS, status); intent.putExtra(BluetoothHidHost.EXTRA_STATUS, status); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastProtocolMode(BluetoothDevice device, int protocolMode) { Intent intent = new Intent(BluetoothInputDevice.ACTION_PROTOCOL_MODE_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_PROTOCOL_MODE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_PROTOCOL_MODE, protocolMode); intent.putExtra(BluetoothHidHost.EXTRA_PROTOCOL_MODE, protocolMode); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); if (DBG) { Loading @@ -786,26 +786,26 @@ public class HidService extends ProfileService { } private void broadcastReport(BluetoothDevice device, byte[] report, int rptSize) { Intent intent = new Intent(BluetoothInputDevice.ACTION_REPORT); Intent intent = new Intent(BluetoothHidHost.ACTION_REPORT); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_REPORT, report); intent.putExtra(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, rptSize); intent.putExtra(BluetoothHidHost.EXTRA_REPORT, report); intent.putExtra(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, rptSize); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastVirtualUnplugStatus(BluetoothDevice device, int status) { Intent intent = new Intent(BluetoothInputDevice.ACTION_VIRTUAL_UNPLUG_STATUS); Intent intent = new Intent(BluetoothHidHost.ACTION_VIRTUAL_UNPLUG_STATUS); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_VIRTUAL_UNPLUG_STATUS, status); intent.putExtra(BluetoothHidHost.EXTRA_VIRTUAL_UNPLUG_STATUS, status); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastIdleTime(BluetoothDevice device, int idleTime) { Intent intent = new Intent(BluetoothInputDevice.ACTION_IDLE_TIME_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_IDLE_TIME_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_IDLE_TIME, idleTime); intent.putExtra(BluetoothHidHost.EXTRA_IDLE_TIME, idleTime); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); if (DBG) { Loading Loading
android/app/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -324,7 +324,7 @@ android:name = ".hid.HidService" android:enabled="@bool/profile_supported_hid"> <intent-filter> <action android:name="android.bluetooth.IBluetoothInputDevice" /> <action android:name="android.bluetooth.IBluetoothHidHost" /> </intent-filter> </service> <service Loading Loading @@ -386,7 +386,7 @@ android:name = ".hid.HidDevService" android:enabled="@bool/profile_supported_hidd"> <intent-filter> <action android:name="android.bluetooth.IBluetoothInputHost" /> <action android:name="android.bluetooth.IBluetoothHidDevice" /> </intent-filter> </service> </application> Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +8 −8 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import android.bluetooth.BluetoothAvrcpController; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothHeadsetClient; import android.bluetooth.BluetoothInputDevice; import android.bluetooth.BluetoothInputHost; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothHidHost; import android.bluetooth.BluetoothMap; import android.bluetooth.BluetoothMapClient; import android.bluetooth.BluetoothPan; Loading Loading @@ -115,11 +115,11 @@ class AdapterProperties { case BluetoothA2dpSink.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.A2DP_SINK, intent); break; case BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.INPUT_HOST, intent); case BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.HID_DEVICE, intent); break; case BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.INPUT_DEVICE, intent); case BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.HID_HOST, intent); break; case BluetoothAvrcpController.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.AVRCP_CONTROLLER, intent); Loading Loading @@ -168,8 +168,8 @@ class AdapterProperties { filter.addAction(BluetoothHeadsetClient.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothA2dpSink.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothAvrcpController.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothPan.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothMap.ACTION_CONNECTION_STATE_CHANGED); Loading
android/app/src/com/android/bluetooth/btservice/Config.java +2 −2 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ public class Config { } else if (profile == A2dpSinkService.class) { profileIndex = BluetoothProfile.A2DP_SINK; } else if (profile == HidService.class) { profileIndex = BluetoothProfile.INPUT_DEVICE; profileIndex = BluetoothProfile.HID_HOST; } else if (profile == HealthService.class) { profileIndex = BluetoothProfile.HEALTH; } else if (profile == PanService.class) { Loading @@ -176,7 +176,7 @@ public class Config { } else if (profile == MapClientService.class) { profileIndex = BluetoothProfile.MAP_CLIENT; } else if (profile == HidDevService.class) { profileIndex = BluetoothProfile.INPUT_HOST; profileIndex = BluetoothProfile.HID_DEVICE; } return profileIndex; Loading
android/app/src/com/android/bluetooth/hid/HidDevService.java +8 −8 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHidDeviceAppConfiguration; import android.bluetooth.BluetoothHidDeviceAppQosSettings; import android.bluetooth.BluetoothHidDeviceAppSdpSettings; import android.bluetooth.BluetoothInputHost; import android.bluetooth.BluetoothHidDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothHidDeviceCallback; import android.bluetooth.IBluetoothInputHost; import android.bluetooth.IBluetoothHidDevice; import android.content.Intent; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -58,7 +58,7 @@ public class HidDevService extends ProfileService { private BluetoothDevice mHidDevice = null; private int mHidDeviceState = BluetoothInputHost.STATE_DISCONNECTED; private int mHidDeviceState = BluetoothHidDevice.STATE_DISCONNECTED; private BluetoothHidDeviceAppConfiguration mAppConfig = null; Loading Loading @@ -139,7 +139,7 @@ public class HidDevService extends ProfileService { int halState = msg.arg1; int state = convertHalState(halState); if (state != BluetoothInputHost.STATE_DISCONNECTED) { if (state != BluetoothHidDevice.STATE_DISCONNECTED) { mHidDevice = device; } Loading Loading @@ -245,7 +245,7 @@ public class HidDevService extends ProfileService { } } private static class BluetoothHidDeviceBinder extends IBluetoothInputHost.Stub private static class BluetoothHidDeviceBinder extends IBluetoothHidDevice.Stub implements IProfileServiceBinder { private static final String TAG = BluetoothHidDeviceBinder.class.getSimpleName(); Loading Loading @@ -397,7 +397,7 @@ public class HidDevService extends ProfileService { HidDevService service = getService(); if (service == null) { return BluetoothInputHost.STATE_DISCONNECTED; return BluetoothHidDevice.STATE_DISCONNECTED; } return service.getConnectionState(device); Loading Loading @@ -585,7 +585,7 @@ public class HidDevService extends ProfileService { if (mHidDevice != null && mHidDevice.equals(device)) { return mHidDeviceState; } return BluetoothInputHost.STATE_DISCONNECTED; return BluetoothHidDevice.STATE_DISCONNECTED; } List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { Loading Loading @@ -705,7 +705,7 @@ public class HidDevService extends ProfileService { return; } Intent intent = new Intent(BluetoothInputHost.ACTION_CONNECTION_STATE_CHANGED); Intent intent = new Intent(BluetoothHidDevice.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); Loading
android/app/src/com/android/bluetooth/hid/HidService.java +51 −51 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ package com.android.bluetooth.hid; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothInputDevice; import android.bluetooth.BluetoothHidHost; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothInputDevice; import android.bluetooth.IBluetoothHidHost; import android.content.Intent; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -79,7 +79,7 @@ public class HidService extends ProfileService { @Override public IProfileServiceBinder initBinder() { return new BluetoothInputDeviceBinder(this); return new BluetoothHidHostBinder(this); } @Override Loading Loading @@ -190,14 +190,14 @@ public class HidService extends ProfileService { int halState = msg.arg1; Integer prevStateInteger = mInputDevices.get(device); int prevState = (prevStateInteger == null) ? BluetoothInputDevice.STATE_DISCONNECTED (prevStateInteger == null) ? BluetoothHidHost.STATE_DISCONNECTED : prevStateInteger; if (DBG) { Log.d(TAG, "MESSAGE_CONNECT_STATE_CHANGED newState:" + convertHalState( halState) + ", prevState:" + prevState); } if (halState == CONN_STATE_CONNECTED && prevState == BluetoothInputDevice.STATE_DISCONNECTED && prevState == BluetoothHidHost.STATE_DISCONNECTED && (!okToConnect(device))) { if (DBG) { Log.d(TAG, "Incoming HID connection rejected"); Loading Loading @@ -249,9 +249,9 @@ public class HidService extends ProfileService { case MESSAGE_GET_REPORT: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte reportType = data.getByte(BluetoothInputDevice.EXTRA_REPORT_TYPE); byte reportId = data.getByte(BluetoothInputDevice.EXTRA_REPORT_ID); int bufferSize = data.getInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE); byte reportType = data.getByte(BluetoothHidHost.EXTRA_REPORT_TYPE); byte reportId = data.getByte(BluetoothHidHost.EXTRA_REPORT_ID); int bufferSize = data.getInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE); if (!getReportNative(Utils.getByteAddress(device), reportType, reportId, bufferSize)) { Log.e(TAG, "Error: get report native returns false"); Loading @@ -261,8 +261,8 @@ public class HidService extends ProfileService { case MESSAGE_ON_GET_REPORT: { BluetoothDevice device = getDevice((byte[]) msg.obj); Bundle data = msg.getData(); byte[] report = data.getByteArray(BluetoothInputDevice.EXTRA_REPORT); int bufferSize = data.getInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE); byte[] report = data.getByteArray(BluetoothHidHost.EXTRA_REPORT); int bufferSize = data.getInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE); broadcastReport(device, report, bufferSize); } break; Loading @@ -275,8 +275,8 @@ public class HidService extends ProfileService { case MESSAGE_SET_REPORT: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte reportType = data.getByte(BluetoothInputDevice.EXTRA_REPORT_TYPE); String report = data.getString(BluetoothInputDevice.EXTRA_REPORT); byte reportType = data.getByte(BluetoothHidHost.EXTRA_REPORT_TYPE); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!setReportNative(Utils.getByteAddress(device), reportType, report)) { Log.e(TAG, "Error: set report native returns false"); } Loading @@ -285,7 +285,7 @@ public class HidService extends ProfileService { case MESSAGE_SEND_DATA: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); String report = data.getString(BluetoothInputDevice.EXTRA_REPORT); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!sendDataNative(Utils.getByteAddress(device), report)) { Log.e(TAG, "Error: send data native returns false"); } Loading Loading @@ -313,7 +313,7 @@ public class HidService extends ProfileService { case MESSAGE_SET_IDLE_TIME: { BluetoothDevice device = (BluetoothDevice) msg.obj; Bundle data = msg.getData(); byte idleTime = data.getByte(BluetoothInputDevice.EXTRA_IDLE_TIME); byte idleTime = data.getByte(BluetoothHidHost.EXTRA_IDLE_TIME); if (!setIdleTimeNative(Utils.getByteAddress(device), idleTime)) { Log.e(TAG, "Error: get idle time native returns false"); } Loading @@ -326,11 +326,11 @@ public class HidService extends ProfileService { /** * Handlers for incoming service calls */ private static class BluetoothInputDeviceBinder extends IBluetoothInputDevice.Stub private static class BluetoothHidHostBinder extends IBluetoothHidHost.Stub implements IProfileServiceBinder { private HidService mService; BluetoothInputDeviceBinder(HidService svc) { BluetoothHidHostBinder(HidService svc) { mService = svc; } Loading Loading @@ -375,7 +375,7 @@ public class HidService extends ProfileService { public int getConnectionState(BluetoothDevice device) { HidService service = getService(); if (service == null) { return BluetoothInputDevice.STATE_DISCONNECTED; return BluetoothHidHost.STATE_DISCONNECTED; } return service.getConnectionState(device); } Loading Loading @@ -493,11 +493,11 @@ public class HidService extends ProfileService { boolean connect(BluetoothDevice device) { if (DBG) Log.d(TAG, "connect: " + device.getAddress()); enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (getConnectionState(device) != BluetoothInputDevice.STATE_DISCONNECTED) { if (getConnectionState(device) != BluetoothHidHost.STATE_DISCONNECTED) { Log.e(TAG, "Hid Device not disconnected: " + device); return false; } if (getPriority(device) == BluetoothInputDevice.PRIORITY_OFF) { if (getPriority(device) == BluetoothHidHost.PRIORITY_OFF) { Log.e(TAG, "Hid Device PRIORITY_OFF: " + device); return false; } Loading @@ -518,7 +518,7 @@ public class HidService extends ProfileService { int getConnectionState(BluetoothDevice device) { if (DBG) Log.d(TAG, "getConnectionState: " + device.getAddress()); if (mInputDevices.get(device) == null) { return BluetoothInputDevice.STATE_DISCONNECTED; return BluetoothHidHost.STATE_DISCONNECTED; } return mInputDevices.get(device); } Loading Loading @@ -546,7 +546,7 @@ public class HidService extends ProfileService { Log.d(TAG, "setPriority: " + device.getAddress()); } Settings.Global.putInt(getContentResolver(), Settings.Global.getBluetoothInputDevicePriorityKey(device.getAddress()), priority); Settings.Global.getBluetoothHidHostPriorityKey(device.getAddress()), priority); if (DBG) { Log.d(TAG, "Saved priority " + device + " = " + priority); } Loading @@ -559,7 +559,7 @@ public class HidService extends ProfileService { Log.d(TAG, "getPriority: " + device.getAddress()); } int priority = Settings.Global.getInt(getContentResolver(), Settings.Global.getBluetoothInputDevicePriorityKey(device.getAddress()), Settings.Global.getBluetoothHidHostPriorityKey(device.getAddress()), BluetoothProfile.PRIORITY_UNDEFINED); return priority; } Loading @@ -571,7 +571,7 @@ public class HidService extends ProfileService { Log.d(TAG, "getProtocolMode: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_PROTOCOL_MODE, device); Loading @@ -587,7 +587,7 @@ public class HidService extends ProfileService { Log.d(TAG, "virtualUnplug: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_VIRTUAL_UNPLUG, device); Loading @@ -601,7 +601,7 @@ public class HidService extends ProfileService { Log.d(TAG, "setProtocolMode: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_PROTOCOL_MODE); Loading @@ -617,15 +617,15 @@ public class HidService extends ProfileService { Log.d(TAG, "getReport: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_REPORT); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_REPORT_TYPE, reportType); data.putByte(BluetoothInputDevice.EXTRA_REPORT_ID, reportId); data.putInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, bufferSize); data.putByte(BluetoothHidHost.EXTRA_REPORT_TYPE, reportType); data.putByte(BluetoothHidHost.EXTRA_REPORT_ID, reportId); data.putInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, bufferSize); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -637,14 +637,14 @@ public class HidService extends ProfileService { Log.d(TAG, "setReport: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_REPORT); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_REPORT_TYPE, reportType); data.putString(BluetoothInputDevice.EXTRA_REPORT, report); data.putByte(BluetoothHidHost.EXTRA_REPORT_TYPE, reportType); data.putString(BluetoothHidHost.EXTRA_REPORT, report); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -657,7 +657,7 @@ public class HidService extends ProfileService { Log.d(TAG, "sendData: " + device.getAddress()); } int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Loading @@ -668,7 +668,7 @@ public class HidService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); if (DBG) Log.d(TAG, "getIdleTime: " + device.getAddress()); int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_GET_IDLE_TIME, device); Loading @@ -680,13 +680,13 @@ public class HidService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); if (DBG) Log.d(TAG, "setIdleTime: " + device.getAddress()); int state = this.getConnectionState(device); if (state != BluetoothInputDevice.STATE_CONNECTED) { if (state != BluetoothHidHost.STATE_CONNECTED) { return false; } Message msg = mHandler.obtainMessage(MESSAGE_SET_IDLE_TIME); msg.obj = device; Bundle data = new Bundle(); data.putByte(BluetoothInputDevice.EXTRA_IDLE_TIME, idleTime); data.putByte(BluetoothHidHost.EXTRA_IDLE_TIME, idleTime); msg.setData(data); mHandler.sendMessage(msg); return true; Loading @@ -713,8 +713,8 @@ public class HidService extends ProfileService { Message msg = mHandler.obtainMessage(MESSAGE_ON_GET_REPORT); msg.obj = address; Bundle data = new Bundle(); data.putByteArray(BluetoothInputDevice.EXTRA_REPORT, report); data.putInt(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, rptSize); data.putByteArray(BluetoothHidHost.EXTRA_REPORT, report); data.putInt(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, rptSize); msg.setData(data); mHandler.sendMessage(msg); } Loading Loading @@ -746,7 +746,7 @@ public class HidService extends ProfileService { // This method does not check for error conditon (newState == prevState) private void broadcastConnectionState(BluetoothDevice device, int newState) { Integer prevStateInteger = mInputDevices.get(device); int prevState = (prevStateInteger == null) ? BluetoothInputDevice.STATE_DISCONNECTED int prevState = (prevStateInteger == null) ? BluetoothHidHost.STATE_DISCONNECTED : prevStateInteger; if (prevState == newState) { Log.w(TAG, "no state change: " + newState); Loading @@ -758,7 +758,7 @@ public class HidService extends ProfileService { connection state change, as it was causing a race condition, with the UI not being updated with the correct connection state. */ log("Connection state " + device + ": " + prevState + "->" + newState); Intent intent = new Intent(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); Loading @@ -767,17 +767,17 @@ public class HidService extends ProfileService { } private void broadcastHandshake(BluetoothDevice device, int status) { Intent intent = new Intent(BluetoothInputDevice.ACTION_HANDSHAKE); Intent intent = new Intent(BluetoothHidHost.ACTION_HANDSHAKE); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_STATUS, status); intent.putExtra(BluetoothHidHost.EXTRA_STATUS, status); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastProtocolMode(BluetoothDevice device, int protocolMode) { Intent intent = new Intent(BluetoothInputDevice.ACTION_PROTOCOL_MODE_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_PROTOCOL_MODE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_PROTOCOL_MODE, protocolMode); intent.putExtra(BluetoothHidHost.EXTRA_PROTOCOL_MODE, protocolMode); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); if (DBG) { Loading @@ -786,26 +786,26 @@ public class HidService extends ProfileService { } private void broadcastReport(BluetoothDevice device, byte[] report, int rptSize) { Intent intent = new Intent(BluetoothInputDevice.ACTION_REPORT); Intent intent = new Intent(BluetoothHidHost.ACTION_REPORT); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_REPORT, report); intent.putExtra(BluetoothInputDevice.EXTRA_REPORT_BUFFER_SIZE, rptSize); intent.putExtra(BluetoothHidHost.EXTRA_REPORT, report); intent.putExtra(BluetoothHidHost.EXTRA_REPORT_BUFFER_SIZE, rptSize); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastVirtualUnplugStatus(BluetoothDevice device, int status) { Intent intent = new Intent(BluetoothInputDevice.ACTION_VIRTUAL_UNPLUG_STATUS); Intent intent = new Intent(BluetoothHidHost.ACTION_VIRTUAL_UNPLUG_STATUS); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_VIRTUAL_UNPLUG_STATUS, status); intent.putExtra(BluetoothHidHost.EXTRA_VIRTUAL_UNPLUG_STATUS, status); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); } private void broadcastIdleTime(BluetoothDevice device, int idleTime) { Intent intent = new Intent(BluetoothInputDevice.ACTION_IDLE_TIME_CHANGED); Intent intent = new Intent(BluetoothHidHost.ACTION_IDLE_TIME_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_IDLE_TIME, idleTime); intent.putExtra(BluetoothHidHost.EXTRA_IDLE_TIME, idleTime); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); sendBroadcast(intent, BLUETOOTH_PERM); if (DBG) { Loading