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

Commit b1fe628a authored by Charlie Boutier's avatar Charlie Boutier Committed by Gerrit Code Review
Browse files

Merge "[PTS-Bot] Added 8 AVRCP test cases and 19 skipped/flaky test cases fix"

parents c41a0402 b9be1d71
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -673,6 +673,8 @@ class AVRCPProxy(ProfileProxy):
        the PTS.
        """

        self.mediaplayer.Forward()

        return "OK"

    @assert_description
@@ -752,7 +754,35 @@ class AVRCPProxy(ProfileProxy):
        """
        Is the newly added media item listed below?

        Media Element: Title1
        Media
        Element: Title2
        Media Element: Title3
        Media Element: Title4
        Media
        Element: Title5
        Media Element: Title6
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_confirm_now_playing_list(self, **kwargs):
        """
        Do the following items match the current now playing list?

        Media
        Element: Title1
        Media Element: Title2
        Media Element: Title3
        Media
        Element: Title4
        Media Element: Title5
        Media Element: Title6


        Note: Some
        now playing items may not be listed above.
        """

        return "OK"
@@ -790,6 +820,7 @@ class AVRCPProxy(ProfileProxy):
        Description: Verify that the Implementation Under Test (IUT) can update
        database by sending a valid Now Playing Changed Notification to the PTS.
        """
        self.mediaplayer.UpdateQueue()
        self.mediaplayer.Play()

        return "OK"
+24 −45
Original line number Diff line number Diff line
@@ -110,22 +110,46 @@
    "AVRCP/TG/ICC/BV-02-I",
    "AVRCP/TG/INV/BI-01-C",
    "AVRCP/TG/INV/BI-02-C",
    "AVRCP/TG/MCN/CB/BI-01-C",
    "AVRCP/TG/MCN/CB/BI-03-C",
    "AVRCP/TG/MCN/CB/BI-04-C",
    "AVRCP/TG/MCN/CB/BI-05-C",
    "AVRCP/TG/MCN/CB/BV-02-C",
    "AVRCP/TG/MCN/CB/BV-01-I",
    "AVRCP/TG/MCN/CB/BV-02-I",
    "AVRCP/TG/MCN/CB/BV-03-I",
    "AVRCP/TG/MCN/CB/BV-05-C",
    "AVRCP/TG/MCN/CB/BV-06-C",
    "AVRCP/TG/MCN/CB/BV-06-I",
    "AVRCP/TG/MCN/CB/BV-08-C",
    "AVRCP/TG/MCN/NP/BI-01-C",
    "AVRCP/TG/MCN/NP/BV-02-C",
    "AVRCP/TG/MCN/NP/BV-06-C",
    "AVRCP/TG/MCN/NP/BV-07-C",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MCN/NP/BV-01-I",
    "AVRCP/TG/MCN/NP/BV-04-I",
    "AVRCP/TG/MCN/NP/BV-05-I",
    "AVRCP/TG/MCN/NP/BV-06-I",
    "AVRCP/TG/MDI/BV-02-C",
    "AVRCP/TG/MDI/BV-04-C",
    "AVRCP/TG/MDI/BV-05-C",
    "AVRCP/TG/MPS/BV-01-I",
    "AVRCP/TG/MPS/BI-01-C",
    "AVRCP/TG/MPS/BI-02-C",
    "AVRCP/TG/MPS/BV-02-C",
    "AVRCP/TG/MPS/BV-02-I",
    "AVRCP/TG/MPS/BV-03-I",
    "AVRCP/TG/MPS/BV-04-C",
    "AVRCP/TG/MPS/BV-06-C",
    "AVRCP/TG/MPS/BV-09-C",
    "AVRCP/TG/NFY/BI-01-C",
    "AVRCP/TG/NFY/BV-02-C",
    "AVRCP/TG/NFY/BV-06-C",
    "AVRCP/TG/NFY/BV-07-C",
    "AVRCP/TG/PTT/BV-01-I",
    "AVRCP/TG/PTT/BV-05-I",
    "AVRCP/TG/RCR/BV-02-C",
    "AVRCP/TG/RCR/BV-04-C",
    "GAP/ADV/BV-01-C",
    "GAP/ADV/BV-02-C",
@@ -528,25 +552,6 @@
  ],
  "flaky": [
    "A2DP/SRC/SUS/BV-02-I",
    "AVRCP/TG/RCR/BV-02-C",
    "AVRCP/TG/MCN/CB/BI-01-C",
    "AVRCP/TG/MCN/CB/BV-02-I",
    "AVRCP/TG/MCN/CB/BI-03-C",
    "AVRCP/TG/MCN/CB/BI-04-C",
    "AVRCP/TG/MCN/CB/BI-05-C",
    "AVRCP/TG/MCN/CB/BV-02-C",
    "AVRCP/TG/MCN/CB/BV-03-I",
    "AVRCP/TG/MCN/CB/BV-05-C",
    "AVRCP/TG/MCN/CB/BV-06-C",
    "AVRCP/TG/MCN/CB/BV-06-I",
    "AVRCP/TG/MCN/CB/BV-08-C",
    "AVRCP/TG/MCN/NP/BV-02-C",
    "AVRCP/TG/MCN/NP/BV-04-I",
    "AVRCP/TG/MCN/NP/BV-05-I",
    "AVRCP/TG/MCN/NP/BV-06-C",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MPS/BV-04-C",
    "AVRCP/TG/MPS/BV-06-C",
    "GATT/CL/GAD/BV-07-C",
    "GATT/CL/GAD/BV-08-C"
  ],
@@ -597,36 +602,10 @@
    "AVRCP/CT/CRC/BV-01-I",
    "AVRCP/CT/PTH/BV-01-C",
    "AVRCP/CT/PTT/BV-01-I",
    "AVRCP/TG/MCN/CB/BI-01-C",
    "AVRCP/TG/MCN/CB/BI-02-C",
    "AVRCP/TG/MCN/CB/BI-03-C",
    "AVRCP/TG/MCN/CB/BI-04-C",
    "AVRCP/TG/MCN/CB/BI-05-C",
    "AVRCP/TG/MCN/CB/BV-01-I",
    "AVRCP/TG/MCN/CB/BV-02-C",
    "AVRCP/TG/MCN/CB/BV-02-I",
    "AVRCP/TG/MCN/CB/BV-04-I",
    "AVRCP/TG/MCN/CB/BV-03-I",
    "AVRCP/TG/MCN/CB/BV-05-C",
    "AVRCP/TG/MCN/CB/BV-06-C",
    "AVRCP/TG/MCN/CB/BV-06-I",
    "AVRCP/TG/MCN/CB/BV-08-C",
    "AVRCP/TG/MCN/CB/BV-09-C",
    "AVRCP/TG/MCN/NP/BI-01-C",
    "AVRCP/TG/MCN/NP/BV-01-I",
    "AVRCP/TG/MCN/NP/BV-02-C",
    "AVRCP/TG/MCN/NP/BV-04-I",
    "AVRCP/TG/MCN/NP/BV-05-I",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MCN/NP/BV-06-I",
    "AVRCP/TG/MCN/NP/BV-06-C",
    "AVRCP/TG/MPS/BV-04-C",
    "AVRCP/TG/MPS/BV-06-C",
    "AVRCP/TG/MPS/BV-01-I",
    "AVRCP/TG/NFY/BV-04-C",
    "AVRCP/TG/NFY/BV-06-C",
    "AVRCP/TG/NFY/BV-07-C",
    "AVRCP/TG/RCR/BV-02-C",
    "BNEP/CTRL/BV-02-C",
    "BNEP/RX-C-D/BV-14-C",
    "BNEP/RX-C-S/BV-13-C",
+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@ class Host(
      bluetoothAdapter.clearBluetooth()

      stateFlow.filter { it == BluetoothAdapter.STATE_ON }.first()
      // Delay to initialize the Bluetooth completely and to fix flakiness: b/266611263
      delay(1000L)
      Log.i(TAG, "Shutdown the gRPC Server")
      server.shutdown()

+10 −3
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@ class MediaPlayer(val context: Context) : MediaPlayerImplBase() {
  init {
    // Init the CoroutineScope
    scope = CoroutineScope(Dispatchers.Default)
    if (!MediaPlayerBrowserService.isInitialized()) {
      context.startService(Intent(context, MediaPlayerBrowserService::class.java))
    }
  }

  override fun play(request: Empty, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
@@ -95,10 +97,15 @@ class MediaPlayer(val context: Context) : MediaPlayerImplBase() {
    }
  }

  override fun updateQueue(request: Empty, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      MediaPlayerBrowserService.instance.updateQueue()
      Empty.getDefaultInstance()
    }
  }

  fun deinit() {
    // Deinit the CoroutineScope
    scope.cancel()
    // Stop service
    context.stopService(Intent(context, MediaPlayerBrowserService::class.java))
  }
}
+31 −22
Original line number Diff line number Diff line
@@ -38,17 +38,11 @@ class MediaPlayerBrowserService : MediaBrowserService() {

  override fun onCreate() {
    super.onCreate()
    setupMediaSession()
    initBrowseFolderList()
    setupMediaSession()
    instance = this
  }

  fun deinit() {
    // Releasing MediaSession instance
    mediaSession.setActive(false)
    mediaSession.release()
  }

  private fun setupMediaSession() {
    mediaSession = MediaSession(this, "MediaSession")

@@ -56,13 +50,15 @@ class MediaPlayerBrowserService : MediaBrowserService() {
      MediaSession.FLAG_HANDLES_MEDIA_BUTTONS or MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS
    )
    mediaSession.setCallback(mSessionCallback)
    initQueue()
    mediaSession.setQueue(queue)
    playbackStateBuilder =
      PlaybackState.Builder()
        .setState(PlaybackState.STATE_NONE, 0, 1.0f)
        .setActions(getAvailableActions())
        .setActiveQueueItemId(QUEUE_START_INDEX.toLong())
    mediaSession.setPlaybackState(playbackStateBuilder.build())
    mediaSession.setMetadata(null)
    mediaSession.setQueue(queue)
    mediaSession.setQueueTitle(NOW_PLAYING_PREFIX)
    mediaSession.isActive = true
    sessionToken = mediaSession.sessionToken
@@ -78,16 +74,12 @@ class MediaPlayerBrowserService : MediaBrowserService() {
      PlaybackState.ACTION_PAUSE

  private fun setPlaybackState(state: Int) {
    playbackStateBuilder.setState(state, 0, 1.0f)
    playbackStateBuilder.setState(state, 0, 1.0f).setActiveQueueItemId(currentTrack.toLong())
    mediaSession.setPlaybackState(playbackStateBuilder.build())
  }

  fun play() {
    if (currentTrack == -1) {
      currentTrack = QUEUE_START_INDEX
      initQueue()
      mediaSession.setQueue(queue)
    }
    if (currentTrack == -1 || currentTrack == QUEUE_SIZE) currentTrack = QUEUE_START_INDEX else currentTrack += 1
    setPlaybackState(PlaybackState.STATE_PLAYING)
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
  }
@@ -110,25 +102,38 @@ class MediaPlayerBrowserService : MediaBrowserService() {
  }

  fun forward() {
    if (currentTrack == QUEUE_SIZE) currentTrack = QUEUE_START_INDEX else currentTrack += 1
    if (currentTrack == QUEUE_SIZE || currentTrack == -1) currentTrack = QUEUE_START_INDEX else currentTrack += 1
    setPlaybackState(PlaybackState.STATE_SKIPPING_TO_NEXT)
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
    setPlaybackState(PlaybackState.STATE_PLAYING)
  }

  fun backward() {
    if (currentTrack == QUEUE_START_INDEX) currentTrack = QUEUE_SIZE else currentTrack -= 1
    if (currentTrack == QUEUE_START_INDEX || currentTrack == -1) currentTrack = QUEUE_SIZE else currentTrack -= 1
    setPlaybackState(PlaybackState.STATE_SKIPPING_TO_PREVIOUS)
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
    setPlaybackState(PlaybackState.STATE_PLAYING)
  }

  fun setLargeMetadata() {
    mediaSession.setMetadata(
    currentTrack = QUEUE_SIZE
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
    setPlaybackState(PlaybackState.STATE_PLAYING)
  }

  fun updateQueue() {
    val metaData: MediaMetadata =
      MediaMetadata.Builder()
        .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, "MEDIA_ID")
        .putString(MediaMetadata.METADATA_KEY_TITLE, generateAlphanumericString(512))
        .putString(MediaMetadata.METADATA_KEY_ARTIST, generateAlphanumericString(512))
        .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, NOW_PLAYING_PREFIX + NEW_QUEUE_ITEM_INDEX)
        .putString(MediaMetadata.METADATA_KEY_TITLE, "Title" + NEW_QUEUE_ITEM_INDEX)
        .putString(MediaMetadata.METADATA_KEY_ARTIST, "Artist" + NEW_QUEUE_ITEM_INDEX)
        .putString(MediaMetadata.METADATA_KEY_ALBUM, "Album" + NEW_QUEUE_ITEM_INDEX)
        .putLong(MediaMetadata.METADATA_KEY_TRACK_NUMBER, NEW_QUEUE_ITEM_INDEX.toLong())
        .putLong(MediaMetadata.METADATA_KEY_NUM_TRACKS, NEW_QUEUE_ITEM_INDEX.toLong())
        .build()
    )
    val mediaItem = MediaItem(metaData.description, MediaItem.FLAG_PLAYABLE)
    queue.add(MediaSession.QueueItem(mediaItem.description, NEW_QUEUE_ITEM_INDEX.toLong()))
    mediaSession.setQueue(queue)
  }

  private val mSessionCallback: MediaSession.Callback =
@@ -185,7 +190,8 @@ class MediaPlayerBrowserService : MediaBrowserService() {
        MediaMetadata.Builder()
          .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, NOW_PLAYING_PREFIX + item)
          .putString(MediaMetadata.METADATA_KEY_TITLE, "Title$item")
          .putString(MediaMetadata.METADATA_KEY_ARTIST, "Artist$item")
          .putString(MediaMetadata.METADATA_KEY_ARTIST, if (item != QUEUE_SIZE) "Artist$item" else generateAlphanumericString(512))
          .putString(MediaMetadata.METADATA_KEY_ALBUM, if (item != QUEUE_SIZE) "Album$item" else generateAlphanumericString(512))
          .putLong(MediaMetadata.METADATA_KEY_TRACK_NUMBER, item.toLong())
          .putLong(MediaMetadata.METADATA_KEY_NUM_TRACKS, QUEUE_SIZE.toLong())
          .build()
@@ -244,5 +250,8 @@ class MediaPlayerBrowserService : MediaBrowserService() {
    const val NOW_PLAYING_PREFIX = "NowPlayingId"
    const val QUEUE_START_INDEX = 1
    const val QUEUE_SIZE = 6
    const val NEW_QUEUE_ITEM_INDEX = 7

    fun isInitialized() : Boolean = this::instance.isInitialized
  }
}
Loading