Revert "CHROMIUM: bluetooth: fix hci_cs_disconnect with proper cleanup"

This reverts commit 1d3b932a630fc1a89762a8a2ac7ef97d3f7dfedc.

Reason for revert: b/77874824

Original change's description:
> CHROMIUM: bluetooth: fix hci_cs_disconnect with proper cleanup
> 
> In bluetooth core specification 4.2,
> Vol 2, Part E, 7.8.9 LE Set Advertise Enable Command, it says
> 
>     The Controller shall continue advertising until ...
>     or until a connection is created or ...
>     In these cases, advertising is then disabled.
> 
> Hence, advertising would be disabled before a connection is
> established. In current kernel implementation, advertising would
> be re-enabled when all connections are terminated.
> 
> The correct disconnection flow looks like
> 
>   < HCI Command: Disconnect
> 
>   > HCI Event: Command Status
>       Status: Success
> 
>   > HCI Event: Disconnect Complete
>       Status: Success
> 
> Specifically, the last Disconnect Complete Event would trigger a
> callback function hci_event.c:hci_disconn_complete_evt() to
> cleanup the connection and re-enable advertising when proper.
> 
> However, sometimes, there might occur an exception in the controller
> when disconnection is being executed. The disconnection flow might
> then look like
> 
>   < HCI Command: Disconnect
> 
>   > HCI Event: Command Status
>       Status: Unknown Connection Identifier
> 
>   Note that "> HCI Event: Disconnect Complete" is missing when such an
> exception occurs. This would result in advertising staying disabled
> forever since the connection in question is not cleaned up correctly.
> 
> To fix the controller exception issue, we need to do some connection
> cleanup when the disconnect command status indicates an error.
> 
> BUG=b:70903583
> TEST=Run magic tethering without a SIM card.
> Sometimes, an "Unknown Connection Identifier" controller error would
> show up in the disconnect command status event in the btsnoop log.
> This would end up with the missing of Disconnect Complete Event
> which looks like
> 
> < HCI Command: Disconnect (0x01|0x0006) plen 3 [hci0] 17:23:55.037679
>         Handle: 3585
>         Reason: Remote User Terminated Connection (0x13)
> > HCI Event: Command Status (0x0f) plen 4      [hci0] 17:23:55.038612
>       Disconnect (0x01|0x0006) ncmd 1
>         Status: Unknown Connection Identifier (0x02)
> @ MGMT Event: Command Compl.. (0x0001) plen 10 [hci0] 17:23:55.038663
>       Disconnect (0x0014) plen 7
>         Status: Not Connected (0x02)
>         LE Address: 76:1D:6E:C2:5B:AC (Resolvable)
> 
> However, observe that the advertising would still be re-enabled
> as follows
> 
> < HCI Command: LE Set Advertise... (0x08|0x000a) [hci0] 17:23:55.141659
>       Advertising: Enabled (0x01)
> 
> Change-Id: If286c6694bbec8de61e4d931fb7e7575a8a70e09
> Signed-off-by: Joseph Hwang <josephsih@chromium.org>
> Reviewed-on: https://chromium-review.googlesource.com/877684
> Commit-Ready: Shyh-In Hwang <josephsih@chromium.org>
> Tested-by: Shyh-In Hwang <josephsih@chromium.org>
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> (cherry picked from commit 3730ff1728c1fdbc550611c303fa3e0b6c6c2857)
> Reviewed-on: https://chromium-review.googlesource.com/885674

Bug: b:70903583
Change-Id: I0b69a7b918995e748078d61313af1eae4a8a736f
Reviewed-on: https://chromium-review.googlesource.com/1008781
Commit-Queue: Dmitry Grinberg <dmitrygr@google.com>
Trybot-Ready: Dmitry Grinberg <dmitrygr@google.com>
Tested-by: Dmitry Grinberg <dmitrygr@google.com>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
1 file changed