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

Commit 2d382361 authored by Thomas Girardier's avatar Thomas Girardier Committed by Gerrit Code Review
Browse files

Merge "[PTS-Bot]:Implementation to support accessing Browsing folder and Media...

Merge "[PTS-Bot]:Implementation to support accessing Browsing folder and Media Player selection commands"
parents 9da0c31a 7ba9e5e2
Loading
Loading
Loading
Loading
+210 −8
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ from pandora_experimental.a2dp_pb2 import Sink, Source
from pandora_experimental.avrcp_grpc import AVRCP
from pandora_experimental.host_grpc import Host
from pandora_experimental.host_pb2 import Connection
from pandora_experimental.mediaplayer_grpc import MediaPlayer


class AVRCPProxy(ProfileProxy):
@@ -44,6 +45,7 @@ class AVRCPProxy(ProfileProxy):
        self.host = Host(channel)
        self.a2dp = A2DP(channel)
        self.avrcp = AVRCP(channel)
        self.mediaplayer = MediaPlayer(channel)

    @assert_description
    def TSC_AVDTP_mmi_iut_accept_connect(self, test: str, pts_addr: bytes, **kwargs):
@@ -59,15 +61,13 @@ class AVRCPProxy(ProfileProxy):
        the IUT connects to PTS to establish pairing.

        """
        if ("TG" in test and "TG/VLH" not in test) or "CT/VLH" in test:

        self.connection = self.host.WaitConnection(address=pts_addr).connection
        if ("TG" in test and "TG/VLH" not in test) or "CT/VLH" in test:
            try:
                self.source = self.a2dp.WaitSource(connection=self.connection).source
            except RpcError:
                pass
        else:
            self.connection = self.host.WaitConnection(address=pts_addr).connection
            try:
                self.sink = self.a2dp.WaitSink(connection=self.connection).sink
            except RpcError:
@@ -149,8 +149,10 @@ class AVRCPProxy(ProfileProxy):
        Take action to disconnect all A2DP and/or AVRCP connections.

        """
        self.a2dp.Close(source=self.source)
        self.source = None
        if self.connection is None:
            self.connection = self.host.GetConnection(address=pts_addr).connection
        self.host.Disconnect(connection=self.connection)

        return "OK"

    @assert_description
@@ -221,6 +223,7 @@ class AVRCPProxy(ProfileProxy):
        Tester and the L2CAP_ConnectReq from the Lower Tester, the IUT issues an
        L2CAP_ConnectRsp to the Lower Tester.
        """

        return "OK"

    @assert_description
@@ -362,7 +365,7 @@ class AVRCPProxy(ProfileProxy):
        return "OK"

    @assert_description
    def TSC_AVDTP_mmi_iut_initiate_connect(self, pts_addr: bytes, **kwargs):
    def TSC_AVDTP_mmi_iut_initiate_connect(self, test: str, pts_addr: bytes, **kwargs):
        """
        Create an AVDTP signaling channel.

@@ -370,7 +373,9 @@ class AVRCPProxy(ProfileProxy):
        connection with PTS.
        """
        self.connection = self.host.Connect(address=pts_addr).connection
        if ("TG" in test and "TG/VLH" not in test) or "CT/VLH" in test:
            self.source = self.a2dp.OpenSource(connection=self.connection).source

        return "OK"

    @assert_description
@@ -542,3 +547,200 @@ class AVRCPProxy(ProfileProxy):
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_set_browsed_player(self, **kwargs):
        """
        Take action to send a valid response to the [Set Browsed Player] command
        sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_get_folder_items_virtual_file_system(self, **kwargs):
        """
        Take action to send a valid response to the [Get Folder Items] with the
        scope <Virtual File System> command sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_confirm_virtual_file_system(self, **kwargs):
        """
        Are the following items found in the current folder?
    
        Folder:
        com.android.pandora
    
    
        Note: Some media elements and folders may not be
        listed above.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_change_path_down(self, **kwargs):
        """
        Take action to send a valid response to the [Change Path] <Down> command
        sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_change_path_up(self, **kwargs):
        """
        Take action to send a valid response to the [Change Path] <Up> command
        sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_action_track_playing(self, **kwargs):
        """
        Place the IUT into a state where a track is currently playing, then
        press 'OK' to continue.
        """
        self.mediaplayer.Play()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_get_item_attributes(self, **kwargs):
        """
        Take action to send a valid response to the [Get Item Attributes]
        command sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_set_addressed_player_invalid_player_id(self, **kwargs):
        """
        PTS has sent a Set Addressed Player command with an invalid Player Id.
        The IUT must respond with the error code: Invalid Player Id (0x11).
        Description: Verify that the IUT can properly reject a Set Addressed
        Player command that contains an invalid player id.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_get_folder_items_out_of_range(self, **kwargs):
        """
        PTS has sent a Get Folder Items command with invalid values for Start
        and End.  The IUT must respond with the error code: Range Out Of Bounds
        (0x0B).
    
        Description: Verify that the IUT can properly reject a Get
        Folder Items command that contains an invalid start and end index.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_change_path_down_invalid_uid(self, **kwargs):
        """
        PTS has sent a Change Path Down command with an invalid folder UID.  The
        IUT must respond with the error code: Does Not Exist (0x09).
        Description: Verify that the IUT can properly reject an Change Path Down
        command that contains an invalid UID.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_get_item_attributes_invalid_uid_counter(self, **kwargs):
        """
        PTS has sent a Get Item Attributes command with an invalid UID Counter.
        The IUT must respond with the error code: UID Changed (0x05).
        Description: Verify that the IUT can properly reject a Get Item
        Attributes command that contains an invalid UID Counter.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_play_item(self, **kwargs):
        """
        Take action to send a valid response to the [Play Item] command sent by
        the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_play_item_invalid_uid(self, **kwargs):
        """
        PTS has sent a Play Item command with an invalid UID.  The IUT must
        respond with the error code: Does Not Exist (0x09).
    
        Description: Verify
        that the IUT can properly reject a Play Item command that contains an
        invalid UID.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_initiate_register_notification_changed_track_changed(self, **kwargs):
        """
        Take action to trigger a [Register Notification, Changed] response for
        <Track Changed> to the PTS from the IUT.  This can be accomplished by
        changing the currently playing track on the IUT.

        Description: Verify
        that the Implementation Under Test (IUT) can update database by sending
        a valid Track Changed Notification to the PTS.
        """

        self.mediaplayer.Play()
        self.mediaplayer.Forward()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_action_change_track(self, **kwargs):
        """
        Take action to change the currently playing track.
        """
        self.mediaplayer.Forward()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_set_browsed_player_invalid_player_id(self, **kwargs):
        """
        PTS has sent a Set Browsed Player command with an invalid Player Id.
        The IUT must respond with the error code: Invalid Player Id (0x11).
        Description: Verify that the IUT can properly reject a Set Browsed
        Player command that contains an invalid player id.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_register_notification_notify_invalid_event_id(self, **kwargs):
        """
        PTS has sent a Register Notification command with an invalid Event Id.
        The IUT must respond with the error code: Invalid Parameter (0x01).
        Description: Verify that the IUT can properly reject a Register
        Notification command that contains an invalid event Id.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_user_action_play_large_metadata_media(self, **kwargs):
        """
        Start playing a media item with more than 512 bytes worth of metadata,
        then press 'OK'.
        """

        self.mediaplayer.SetLargeMetadata()

        return "OK"
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@

    <application>
        <uses-library android:name="android.test.runner" />

          <service android:name=".MediaPlayerBrowserService"
               android:exported="true">
               <intent-filter>
                    <action android:name="android.media.browse.MediaBrowserService"/>
               </intent-filter>
          </service>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
+24 −22
Original line number Diff line number Diff line
@@ -107,15 +107,36 @@
    "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-01-I",
    "AVRCP/TG/MCN/CB/BV-02-C",
    "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/MDI/BV-02-C",
    "AVRCP/TG/MDI/BV-04-C",
    "AVRCP/TG/MDI/BV-05-C",
    "AVRCP/TG/MPS/BI-01-C",
    "AVRCP/TG/MPS/BI-02-C",
    "AVRCP/TG/MPS/BV-01-I",
    "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/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",
    "GAP/ADV/BV-03-C",
@@ -399,20 +420,8 @@
    "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-03-I",
    "AVRCP/TG/MCN/CB/BV-04-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",
@@ -423,18 +432,9 @@
    "AVRCP/TG/MCN/NP/BV-06-I",
    "AVRCP/TG/MCN/NP/BV-07-C",
    "AVRCP/TG/MCN/NP/BV-09-C",
    "AVRCP/TG/MPS/BI-01-C",
    "AVRCP/TG/MPS/BI-02-C",
    "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-04-C",
    "AVRCP/TG/NFY/BV-06-C",
    "AVRCP/TG/NFY/BV-07-C",
    "AVRCP/TG/RCR/BV-02-C",
    "AVRCP/TG/RCR/BV-04-C",
    "GAP/BOND/BON/BV-01-C",
    "GAP/BOND/BON/BV-02-C",
    "GAP/BOND/BON/BV-03-C",
@@ -1646,7 +1646,9 @@
    "ATT": {},
    "AVCTP": {},
    "AVDTP": {},
    "AVRCP": {},
    "AVRCP": {
      "TSPX_player_feature_bitmask": "0000000000B7010C0A00000000000000"
    },
    "BNEP": {},
    "DID": {},
    "GAP": {},
+0 −23
Original line number Diff line number Diff line
@@ -70,28 +70,6 @@ class A2dp(val context: Context) : A2DPImplBase() {
    scope.cancel()
  }

  fun buildAudioTrack(): AudioTrack? {
    audioTrack =
      AudioTrack.Builder()
        .setAudioAttributes(
          AudioAttributes.Builder()
            .setUsage(AudioAttributes.USAGE_MEDIA)
            .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
            .build()
        )
        .setAudioFormat(
          AudioFormat.Builder()
            .setEncoding(AudioFormat.ENCODING_PCM_16BIT)
            .setSampleRate(44100)
            .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
            .build()
        )
        .setTransferMode(AudioTrack.MODE_STREAM)
        .setBufferSizeInBytes(44100 * 2 * 2)
        .build()
    return audioTrack
  }

  override fun openSource(
    request: OpenSourceRequest,
    responseObserver: StreamObserver<OpenSourceResponse>
@@ -332,5 +310,4 @@ class A2dp(val context: Context) : A2DPImplBase() {
        .build()
    }
  }

}
+2 −6
Original line number Diff line number Diff line
@@ -18,15 +18,11 @@ package com.android.pandora

import android.bluetooth.BluetoothManager
import android.content.Context

import pandora.AVRCPGrpc.AVRCPImplBase
import pandora.AvrcpProto.*
import com.google.protobuf.Empty

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel

import pandora.AVRCPGrpc.AVRCPImplBase
import pandora.AvrcpProto.*

@kotlinx.coroutines.ExperimentalCoroutinesApi
class Avrcp(val context: Context) : AVRCPImplBase() {
Loading