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

Commit 4c94dab3 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Remove flag save_initial_hid_connection_policy

Change-Id: I951ae0abf3b6731633c85ef3b28995a8f04d8c49
Test: mmm packages/modules/Bluetooth
Flag: com.android.bluetooth.flags.save_initial_hid_connection_policy
Bug: 335904609
parent b0b9a4b9
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -9,16 +9,6 @@ flag {
    bug: "320762367"
}

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),
+1 −2
Original line number Diff line number Diff line
@@ -819,8 +819,7 @@ static void hh_get_dscp_handler(tBTA_HH_DEV_DSCP_INFO& dscp_info) {
            dscp_info.descriptor.dsc_list);

    // Allow incoming connections
    if (com::android::bluetooth::flags::allow_switching_hid_and_hogp() &&
        com::android::bluetooth::flags::save_initial_hid_connection_policy()) {
    if (com::android::bluetooth::flags::allow_switching_hid_and_hogp()) {
      btif_storage_set_hid_connection_policy(p_dev->link_spec, true);
    }