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

Commit 5bc65ded authored by Dhananjaya Gopalakrishna's avatar Dhananjaya Gopalakrishna Committed by Thomas Girardier
Browse files

[PTS-Bot]: Added 6 AVRCP test cases related to Media Content Navigation

Rebased the branch to master

Bug: 245578454
Test: atest pts-bot:AVRCP -v
Ignore-AOSP-First: Cherry-picked from AOSP
Merged-In: I9d09db786754e5d83ded6b9bc78383cb622085e3
Change-Id: I9d09db786754e5d83ded6b9bc78383cb622085e3
parent 8ed4e0fc
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -746,3 +746,50 @@ class AVRCPProxy(ProfileProxy):
        self.mediaplayer.SetLargeMetadata()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_confirm_now_playing_list_updated_with_local(self, **kwargs):
        """
        Is the newly added media item listed below?

        Media Element: Title2
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_action_queue_now_playing(self, **kwargs):
        """
        Take action to populate the now playing list with multiple items.  Then
        make sure a track is playing and press 'OK'.

        Note: If the
        NOW_PLAYING_CONTENT_CHANGED notification has been registered, this
        message will disappear when the notification changed is received.
        """
        self.mediaplayer.Play()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_get_folder_items_now_playing(self, **kwargs):
        """
        Take action to send a valid response to the [Get Folder Items] with the
        scope <Now Playing> command sent by the PTS.
        """
        self.mediaplayer.Forward()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_initiate_register_notification_changed_now_playing_content_changed(self, **kwargs):
        """
        Take action to trigger a [Register Notification, Changed] response for
        <Now Playing Content Changed> to the PTS from the IUT.  This can be
        accomplished by adding tracks to the Now Playing List on the IUT.
        Description: Verify that the Implementation Under Test (IUT) can update
        database by sending a valid Now Playing Changed Notification to the PTS.
        """
        self.mediaplayer.Play()

        return "OK"
+6 −6
Original line number Diff line number Diff line
@@ -118,6 +118,12 @@
    "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-06-C",
    "AVRCP/TG/MCN/NP/BV-07-C",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MCN/NP/BV-04-I",
    "AVRCP/TG/MCN/NP/BV-05-I",
    "AVRCP/TG/MDI/BV-02-C",
    "AVRCP/TG/MDI/BV-04-C",
    "AVRCP/TG/MDI/BV-05-C",
@@ -492,13 +498,7 @@
    "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-06-C",
    "AVRCP/TG/MCN/NP/BV-06-I",
    "AVRCP/TG/MCN/NP/BV-07-C",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MPS/BV-01-I",
    "AVRCP/TG/NFY/BV-04-C",
    "AVRCP/TG/NFY/BV-06-C",
+8 −6
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ class MediaPlayerBrowserService : MediaBrowserService() {

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

@@ -83,13 +84,13 @@ class MediaPlayerBrowserService : MediaBrowserService() {
  }

  fun play() {
    setPlaybackState(PlaybackState.STATE_PLAYING)
    if (currentTrack == -1) {
      currentTrack = 1
      currentTrack = QUEUE_START_INDEX
      initQueue()
      mediaSession.setQueue(queue)
      mediaSession.setMetadata(metadataItems.get("" + currentTrack))
    }
    setPlaybackState(PlaybackState.STATE_PLAYING)
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
  }

  fun stop() {
@@ -110,13 +111,13 @@ class MediaPlayerBrowserService : MediaBrowserService() {
  }

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

  fun backward() {
    if (currentTrack == 1 || currentTrack == -1) currentTrack = QUEUE_SIZE else currentTrack -= 1
    if (currentTrack == QUEUE_START_INDEX) currentTrack = QUEUE_SIZE else currentTrack -= 1
    setPlaybackState(PlaybackState.STATE_SKIPPING_TO_PREVIOUS)
    mediaSession.setMetadata(metadataItems.get("" + currentTrack))
  }
@@ -184,7 +185,7 @@ class MediaPlayerBrowserService : MediaBrowserService() {

  private fun initMediaItems() {
    var mediaItems = mutableListOf<MediaItem>()
    for (item in 1..QUEUE_SIZE) {
    for (item in QUEUE_START_INDEX..QUEUE_SIZE) {
      val metaData: MediaMetadata =
        MediaMetadata.Builder()
          .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, NOW_PLAYING_PREFIX + item)
@@ -246,6 +247,7 @@ class MediaPlayerBrowserService : MediaBrowserService() {
    const val ROOT = "__ROOT__"
    const val EMPTY_FOLDER = "@empty@"
    const val NOW_PLAYING_PREFIX = "NowPlayingId"
    const val QUEUE_START_INDEX = 1
    const val QUEUE_SIZE = 6
  }
}