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

Commit 7c7a573a authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I951ae0ab,I0c1f7c31 into main

* changes:
  Remove flag save_initial_hid_connection_policy
  Remove flag prevent_hogp_reconnect_when_connected
parents ef7b596f 4c94dab3
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -9,26 +9,6 @@ flag {
    bug: "320762367"
}

flag {
    name: "prevent_hogp_reconnect_when_connected"
    namespace: "bluetooth"
    description: "Do not request GATT connection while the HOGP is already connected"
    bug: "329720661"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "save_initial_hid_connection_policy"
    namespace: "bluetooth"
    description: "Save HID connection policy on initial successful connection"
    bug: "335904609"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "suppress_hid_rejection_broadcast"
    namespace: "bluetooth"
+2 −8
Original line number Diff line number Diff line
@@ -292,10 +292,7 @@ public class HidHeadTrackerTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void connectWithoutHidServiceTest() {

        registerIntentActions(
@@ -388,10 +385,7 @@ public class HidHeadTrackerTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void connectWithHidServiceTest() {

        registerIntentActions(
+6 −24
Original line number Diff line number Diff line
@@ -392,10 +392,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void setPreferredTransportTest() {
        // BR/EDR transport
        mHidService.setPreferredTransport(mDevice, TRANSPORT_BREDR);
@@ -413,10 +410,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hogpGetReportTest() throws Exception {
        // Keyboard report
        mReportData = new byte[0];
@@ -450,10 +444,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hogpGetProtocolModeTest() {
        mHidService.getProtocolMode(mDevice);
        verifyIntentReceived(
@@ -472,10 +463,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hogpSetProtocolModeTest() throws Exception {
        mHidService.setProtocolMode(mDevice, BluetoothHidHost.PROTOCOL_BOOT_MODE);
        // Must cast ERROR_RSP_SUCCESS, otherwise, it won't match with the int extra
@@ -494,10 +482,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hogpSetReportTest() throws Exception {
        // Keyboard report
        mHidService.setReport(mDevice, BluetoothHidHost.REPORT_TYPE_INPUT, "010203040506070809");
@@ -524,10 +509,7 @@ public class HidHostDualModeTest {
     * </ol>
     */
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hogpVirtualUnplugFromHidHostTest() throws Exception {
        mHidService.virtualUnplug(mDevice);
        verifyIntentReceived(
+8 −20
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ public class HidHostTest {
                                    mDevice, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN))
                    .isTrue();
        }
        if (Flags.allowSwitchingHidAndHogp() && Flags.saveInitialHidConnectionPolicy()) {
        if (Flags.allowSwitchingHidAndHogp()) {
            verifyConnectionState(mDevice, equalTo(TRANSPORT_BREDR), equalTo(STATE_CONNECTING));
            verifyConnectionState(mDevice, equalTo(TRANSPORT_BREDR), equalTo(STATE_CONNECTED));
            assertThat(mHidService.getPreferredTransport(mDevice)).isEqualTo(TRANSPORT_BREDR);
@@ -381,10 +381,7 @@ public class HidHostTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hidReconnectionWhenConnectionPolicyChangeTest() throws Exception {

        assertThat(mHidService.getConnectionPolicy(mDevice))
@@ -440,10 +437,7 @@ public class HidHostTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hidReconnectionAfterBTrestartWithConnectionPolicyAllowedTest() throws Exception {

        assertThat(mHidService.getConnectionPolicy(mDevice))
@@ -468,10 +462,7 @@ public class HidHostTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hidReconnectionAfterBTrestartWithConnectionPolicyiDisallowedTest()
            throws Exception {

@@ -499,10 +490,7 @@ public class HidHostTest {
     */
    @SuppressLint("MissingPermission")
    @Test
    @RequiresFlagsEnabled({
        Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP,
        Flags.FLAG_SAVE_INITIAL_HID_CONNECTION_POLICY
    })
    @RequiresFlagsEnabled({Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP})
    public void hidReconnectionAfterDeviceRemovedTest() throws Exception {

        assertThat(mHidService.getConnectionPolicy(mDevice))
@@ -743,7 +731,7 @@ public class HidHostTest {
    private void verifyConnectionState(
            BluetoothDevice device, Matcher<Integer> transport, Matcher<Integer> state) {

        if (Flags.allowSwitchingHidAndHogp() && Flags.saveInitialHidConnectionPolicy()) {
        if (Flags.allowSwitchingHidAndHogp()) {
            verifyIntentReceived(
                    hasAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED),
                    hasExtra(BluetoothDevice.EXTRA_DEVICE, device),
@@ -761,7 +749,7 @@ public class HidHostTest {
    private void verifyIncomingProfileConnectionState() {
        // for incoming connection, connection state transit
        // from STATE_ACCEPTING -->STATE_CONNECTED
        if (Flags.allowSwitchingHidAndHogp() && Flags.saveInitialHidConnectionPolicy()) {
        if (Flags.allowSwitchingHidAndHogp()) {
            verifyIntentReceived(
                    hasAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED),
                    hasExtra(BluetoothDevice.EXTRA_DEVICE, mDevice),
@@ -777,7 +765,7 @@ public class HidHostTest {
    }

    private void verifyProfileDisconnectionState() {
        if (Flags.allowSwitchingHidAndHogp() && Flags.saveInitialHidConnectionPolicy()) {
        if (Flags.allowSwitchingHidAndHogp()) {
            verifyIntentReceived(
                    hasAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED),
                    hasExtra(BluetoothDevice.EXTRA_DEVICE, mDevice),
+0 −17
Original line number Diff line number Diff line
@@ -67,16 +67,6 @@ using bluetooth::Uuid;
using std::vector;
using namespace bluetooth;

/* TODO: b/329720661 Remove this namespace entirely when
 * prevent_hogp_reconnect_when_connected flag is shipped */
namespace {
#ifndef BTA_HH_LE_RECONN
constexpr bool kBTA_HH_LE_RECONN = true;
#else
constexpr bool kBTA_HH_LE_RECONN = false;
#endif
}  // namespace

#define BTA_HH_APP_ID_LE 0xff

#define BTA_HH_LE_PROTO_BOOT_MODE 0x00
@@ -647,13 +637,6 @@ static void bta_hh_le_open_cmpl(tBTA_HH_DEV_CB* p_cb) {
                                         p_cb->dscp_info.product_id)) {
      BTA_GATTC_ConfigureMTU(p_cb->conn_id, GATT_MAX_MTU_SIZE);
    }

    if (!com::android::bluetooth::flags::prevent_hogp_reconnect_when_connected()) {
      if (kBTA_HH_LE_RECONN && p_cb->status == BTA_HH_OK) {
        bta_hh_le_add_dev_bg_conn(p_cb);
      }
      return;
    }
  }
}

Loading