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

Commit fad874f8 authored by Thomas Girardier's avatar Thomas Girardier
Browse files

PTS-bot: fix AVDTP/SRC/INT/SIG/SMG/BV-17-C

Add a delay between BluetoothA2dp.STATE_CONNECTED and
audiotrack.play() because sometimes the AVDTP start request
is never sent.

Bug: 234891800
Test: atest pts-bot:AVDTP/SRC/INT/SIG/SMG/BV-17-C -v --iterations=30
Change-Id: Ie5d28789acff428d99a78f67c6a933dc3c142b28
parent cbbb39bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ class IUT:
            description: MMI description.
            style: MMI popup style, unused for now.
        """
        print(f'{profile} mmi: {description}', file=sys.stderr)
        print(f'{profile} mmi: {interaction}', file=sys.stderr)

        # Handles A2DP and AVDTP MMIs.
        if profile in ('A2DP', 'AVDTP'):
+9 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import io.grpc.stub.StreamObserver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.filter
@@ -118,6 +119,10 @@ class A2dp(val context: Context) : A2DPImplBase() {
          throw Status.UNKNOWN.asException()
        }
      }

      //TODO: b/234891800, AVDTP start request sometimes never sent if playback starts too early.
      delay(2000L)

      val source = Source.newBuilder().setCookie(request.connection.cookie).build()
      OpenSourceResponse.newBuilder().setSource(source).build()
    }
@@ -152,6 +157,10 @@ class A2dp(val context: Context) : A2DPImplBase() {
          throw Status.UNKNOWN.asException()
        }
      }

      //TODO: b/234891800, AVDTP start request sometimes never sent if playback starts too early.
      delay(2000L)

      val source = Source.newBuilder().setCookie(request.connection.cookie).build()
      WaitSourceResponse.newBuilder().setSource(source).build()
    }