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

Commit 6e49fd7d authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by David Duarte
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
(cherry picked from https://android-review.googlesource.com/q/commit:8c02fa7af535428884f57d88e68e479087bec83d)
Merged-In: I2399058997b20ea3534951b25c4a8169211d7052
Change-Id: I2399058997b20ea3534951b25c4a8169211d7052
parent a9c3f12d
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;
            }
        }
    }