Loading android/app/src/com/android/bluetooth/hid/HidHostService.java +33 −2 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class HidHostService extends ProfileService { private static final int MESSAGE_ON_GET_IDLE_TIME = 15; private static final int MESSAGE_SET_IDLE_TIME = 16; private static final int MESSAGE_SET_PREFERRED_TRANSPORT = 17; private static final int MESSAGE_SEND_DATA = 18; public static final int STATE_DISCONNECTED = BluetoothProfile.STATE_DISCONNECTED; public static final int STATE_CONNECTING = BluetoothProfile.STATE_CONNECTING; Loading Loading @@ -433,10 +434,28 @@ public class HidHostService extends ProfileService { case MESSAGE_SET_PREFERRED_TRANSPORT: handleMessageSetPreferredTransport(msg); break; case MESSAGE_SEND_DATA: handleMessageSendData(msg); break; } } }; private void handleMessageSendData(Message msg) { if (!Flags.allowSwitchingHidAndHogp()) { return; } BluetoothDevice device = mAdapterService.getDeviceFromByte((byte[]) msg.obj); Bundle data = msg.getData(); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!mNativeInterface.sendData( getByteAddress(device), getAddressType(device), getTransport(device), report)) { Log.e(TAG, "handleMessageSendData: Failed to send data"); } } private void handleMessageSetPreferredTransport(Message msg) { BluetoothDevice device = (BluetoothDevice) msg.obj; int transport = msg.arg1; Loading Loading @@ -1323,8 +1342,20 @@ public class HidHostService extends ProfileService { return false; } if (!Flags.allowSwitchingHidAndHogp()) { return mNativeInterface.sendData( getByteAddress(device), getAddressType(device), getTransport(device), report); getByteAddress(device), getAddressType(device), getTransport(device), report); } Message msg = mHandler.obtainMessage(MESSAGE_SEND_DATA, device); Bundle data = new Bundle(); data.putString(BluetoothHidHost.EXTRA_REPORT, report); msg.setData(data); mHandler.sendMessage(msg); return true; } boolean getIdleTime(BluetoothDevice device) { Loading Loading
android/app/src/com/android/bluetooth/hid/HidHostService.java +33 −2 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class HidHostService extends ProfileService { private static final int MESSAGE_ON_GET_IDLE_TIME = 15; private static final int MESSAGE_SET_IDLE_TIME = 16; private static final int MESSAGE_SET_PREFERRED_TRANSPORT = 17; private static final int MESSAGE_SEND_DATA = 18; public static final int STATE_DISCONNECTED = BluetoothProfile.STATE_DISCONNECTED; public static final int STATE_CONNECTING = BluetoothProfile.STATE_CONNECTING; Loading Loading @@ -433,10 +434,28 @@ public class HidHostService extends ProfileService { case MESSAGE_SET_PREFERRED_TRANSPORT: handleMessageSetPreferredTransport(msg); break; case MESSAGE_SEND_DATA: handleMessageSendData(msg); break; } } }; private void handleMessageSendData(Message msg) { if (!Flags.allowSwitchingHidAndHogp()) { return; } BluetoothDevice device = mAdapterService.getDeviceFromByte((byte[]) msg.obj); Bundle data = msg.getData(); String report = data.getString(BluetoothHidHost.EXTRA_REPORT); if (!mNativeInterface.sendData( getByteAddress(device), getAddressType(device), getTransport(device), report)) { Log.e(TAG, "handleMessageSendData: Failed to send data"); } } private void handleMessageSetPreferredTransport(Message msg) { BluetoothDevice device = (BluetoothDevice) msg.obj; int transport = msg.arg1; Loading Loading @@ -1323,8 +1342,20 @@ public class HidHostService extends ProfileService { return false; } if (!Flags.allowSwitchingHidAndHogp()) { return mNativeInterface.sendData( getByteAddress(device), getAddressType(device), getTransport(device), report); getByteAddress(device), getAddressType(device), getTransport(device), report); } Message msg = mHandler.obtainMessage(MESSAGE_SEND_DATA, device); Bundle data = new Bundle(); data.putString(BluetoothHidHost.EXTRA_REPORT, report); msg.setData(data); mHandler.sendMessage(msg); return true; } boolean getIdleTime(BluetoothDevice device) { Loading