Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f320fa20 authored by WhaleChang's avatar WhaleChang
Browse files

Floss: Implement Ring Central reject call functionality via Drop HID event

Previously, RingCentral calls could not be rejected from
a Bluetooth headset, but could be rejected from a USB headset.

The root cause is that USB headsets send an additional Drop
HID event to RingCentral to reject the call, but Floss did not.

We used to think hook-switch=0 is good enough to represent
rejecting the call in libhidtelephony. Eventually find out it
is not working on RingCentral.

Fixes the problem by having Floss also send a Drop HID input
event to reject incoming RingCentral calls.

Bug: 329304145
Test: Conduct the following manual tests
  pair Bluetooth Headset
  login Ring Central and place an incoming-call
  reject the call by headset
Test: atest bluetooth_test_gd
Tag: #floss
Flag: EXEMPT, no behavior change on Android; Floss-only changes

Change-Id: I2307df0e22cf0e10bb295c0f812416663f553d88
parent 733ee01c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -22,9 +22,9 @@ use bt_topshim::profiles::ProfileConnectionState;
use bt_topshim::{metrics, topstack};
use bt_utils::at_command_parser::{calculate_battery_percent, parse_at_command_data};
use bt_utils::uhid_hfp::{
    OutputEvent, UHidHfp, BLUETOOTH_TELEPHONY_UHID_REPORT_ID, UHID_INPUT_HOOK_SWITCH,
    UHID_INPUT_NONE, UHID_INPUT_PHONE_MUTE, UHID_OUTPUT_MUTE, UHID_OUTPUT_NONE,
    UHID_OUTPUT_OFF_HOOK, UHID_OUTPUT_RING,
    OutputEvent, UHidHfp, BLUETOOTH_TELEPHONY_UHID_REPORT_ID, UHID_INPUT_DROP,
    UHID_INPUT_HOOK_SWITCH, UHID_INPUT_NONE, UHID_INPUT_PHONE_MUTE, UHID_OUTPUT_MUTE,
    UHID_OUTPUT_NONE, UHID_OUTPUT_OFF_HOOK, UHID_OUTPUT_RING,
};
use bt_utils::uinput::UInput;

@@ -1215,6 +1215,8 @@ impl BluetoothMedia {
            let mut data = UHID_INPUT_NONE;
            if hook {
                data |= UHID_INPUT_HOOK_SWITCH;
            } else if self.phone_state.state == CallState::Incoming {
                data |= UHID_INPUT_DROP;
            }
            // Preserve the muted state when sending the hook switch event.
            if uhid.muted {
+6 −3
Original line number Diff line number Diff line
@@ -14,12 +14,13 @@ pub const BLUETOOTH_TELEPHONY_UHID_REPORT_ID: u8 = 1;
pub const UHID_INPUT_NONE: u8 = 0;
pub const UHID_INPUT_HOOK_SWITCH: u8 = 1 << 0;
pub const UHID_INPUT_PHONE_MUTE: u8 = 1 << 1;
pub const UHID_INPUT_DROP: u8 = 1 << 2;
pub const UHID_OUTPUT_NONE: u8 = 0;
pub const UHID_OUTPUT_RING: u8 = 1 << 0;
pub const UHID_OUTPUT_OFF_HOOK: u8 = 1 << 1;
pub const UHID_OUTPUT_MUTE: u8 = 1 << 2;

const RDESC: [u8; 55] = [
const RDESC: [u8; 57] = [
    0x05,
    0x0B, // Usage Page (Telephony)
    0x09,
@@ -38,16 +39,18 @@ const RDESC: [u8; 55] = [
    0x20, //   Usage (Hook Switch)
    0x09,
    0x2f, //   Usage (Phone Mute)
    0x09,
    0x26, //   Usage (Drop)
    0x75,
    0x01, //   Report Size (1)
    0x95,
    0x02, //   Report Count (2)
    0x03, //   Report Count (3)
    0x81,
    0x23, //   Input
    0x75,
    0x01, //   Report Size (1)
    0x95,
    0x06, //   Report Count (6)
    0x05, //   Report Count (5)
    0x81,
    0x01, //   Input
    0x05,