Fix spinner not shows up
Issue: We reset the deviceList when onCreate in discoveryService
But when user cancel the action, and re-associate, onCreate in
activty is happend before onCreate discoveryService.
How to fix: Reset the deviceList when onDestroy in discoveryService
to make sure to have a fresh start when user re-associate.
Test: atest CtsCompanionDeviceManagerCoreTestCases
atest CtsCompanionDeviceManagerUiAutomationTestCases
atest CtsOsTestCases:CompanionDeviceManagerTest
Fix: 230142340
Change-Id: Idb4fff71f2ef58609e81e77fc3a2e9034c9003ae
This commit is contained in:
@@ -150,8 +150,6 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
mBtAdapter = mBtManager.getAdapter();
|
||||
mBleScanner = mBtAdapter.getBluetoothLeScanner();
|
||||
mWifiManager = getSystemService(WifiManager.class);
|
||||
|
||||
sScanResultsLiveData.setValue(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,6 +173,7 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
sScanResultsLiveData.setValue(Collections.emptyList());
|
||||
super.onDestroy();
|
||||
if (DEBUG) Log.d(TAG, "onDestroy()");
|
||||
}
|
||||
@@ -188,6 +187,7 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
mStopAfterFirstMatch = request.isSingleDevice();
|
||||
mDiscoveryStarted = true;
|
||||
sStateLiveData.setValue(DiscoveryState.DISCOVERY_IN_PROGRESS);
|
||||
sScanResultsLiveData.setValue(Collections.emptyList());
|
||||
|
||||
final List<DeviceFilter<?>> allFilters = request.getDeviceFilters();
|
||||
final List<BluetoothDeviceFilter> btFilters =
|
||||
|
||||
Reference in New Issue
Block a user