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

Commit 8c02fa7a authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

LeAudioService: Fix starting scanner

Make sure to retry when registration does not happen, and in other case
clear the callback which indicates scan is ongoing.

Bug: 283228408
Test: manual
Tag: #feature
Change-Id: I2399058997b20ea3534951b25c4a8169211d7052
parent fe1322e6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1182,15 +1182,20 @@ public class LeAudioService extends ProfileService {

        @Override
        public void onScanFailed(int errorCode) {
            Log.w(TAG, "Scan failed " + errorCode + " scan retries: " + mScanRetries);
            Log.w(TAG, "Scan failed err: " + errorCode + " scan retries: " + mScanRetries);
            switch(errorCode) {
                case SCAN_FAILED_INTERNAL_ERROR: {
                case SCAN_FAILED_INTERNAL_ERROR:
                case SCAN_FAILED_APPLICATION_REGISTRATION_FAILED:
                    if (mScanRetries < mMaxScanRetires) {
                        mScanRetries++;
                        Log.w(TAG, "Failed to start. Let's retry");
                        mHandler.post(() -> startAudioServersBackgroundScan(/* retry = */ true));
                    }
                }
                    break;
                default:
                    /* Indicate scan is no running */
                    mScanCallback = null;
                    break;
            }
        }
    }