Fix non-hearing devices show in pair new hearing devices page
Non-hearing devices are listed in "pair new hearing devices page" if we click the "See more devices" button and go back from "general pair new devices page". Root cause: Two types of Bluetooth scanning happen simultaneously and the scanning results of different scanning methods are handled in the same place. Currently the BLE scanning callback “onScanResult()” directly calls “onDeviceAdded()” method to handle the new scanned devices. This method is mainly called when receiving a broadcast of a new device found in Bluetooth classic scanning. The general pair new devices page uses Bluetooth classic scanning and the pair new hearing devices page uses Bluetooth LE scanning. The life cycle ordering when going back from general pair new devices page to pair new hearing devices page will be "pair new hearing devices page".onStart() -> "general pair new devices page".onStop(). It means the classic scanning is not stopped while the BLE scanning starts and this causes the scanning results from classic scanning unexpectedly added to the list which should only show the scanning results from BLE scanning. Solution: Separates the handling part of two scanning methods. Leaves "onDeviceAdded" handling Bluetooth classic scanning results only, and handles BLE scanning results in the “onScanResult” callback directly. Bug: 279374435 Test: checks the result by switching back from "general pair new devices page" to "pair new hearing devices page" Test: make RunSettingsRoboTests ROBOTEST_FILTER=DeviceListPreferenceFragmentTest Change-Id: Iebdde401ffb3dc0569478730a140a5dd7add115b
Loading
Please register or sign in to comment