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

Commit b567ff7c authored by Evan Chen's avatar Evan Chen
Browse files

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
parent bf068a06
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 =