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

Commit 901ad773 authored by Thomas Girardier's avatar Thomas Girardier Committed by Android (Google) Code Review
Browse files

Merge changes Icee2a268,I41039994,Ibe6d9844,If25bcd20,I2f7b72da into tm-qpr-dev

* changes:
  [PTS-Bot]:Implementation to support accessing Browsing folder and Media Player selection commands
  [Pandora] - Add back two AVDTP/SRC tests
  [Pandora] - Enable skipped HFP tests
  [Pandora] Fix HFP tests (part 1)
  [Avatar] - Add avatar runner
parents b79228b0 361ee895
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ python_library_host {
        "avatar/controllers/*.py",
    ],
    libs: [
        "mobly",
        "pandora_experimental-python",
        "libprotobuf-python",
        "bumble",
+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"
+22 −5
Original line number Diff line number Diff line
@@ -18,17 +18,17 @@ from mmi2grpc._proxy import ProfileProxy

from pandora_experimental.hfp_grpc import HFP
from pandora_experimental.host_grpc import Host
from pandora_experimental.security_grpc import Security

import sys
import threading
import time

# Standard time to wait before asking for waitConnection
WAIT_DELAY_BEFORE_CONNECTION = 2

# The tests needs the MMI to accept pairing confirmation request.
NEEDS_WAIT_CONNECTION_BEFORE_TEST = {
    'HFP/AG/WBS/BV-01-I',
}
NEEDS_WAIT_CONNECTION_BEFORE_TEST = {'HFP/AG/WBS/BV-01-I', 'HFP/AG/SLC/BV-05-I'}


class HFPProxy(ProfileProxy):
@@ -37,6 +37,7 @@ class HFPProxy(ProfileProxy):
        super().__init__(channel)
        self.hfp = HFP(channel)
        self.host = Host(channel)
        self.security = Security(channel)

        self.connection = None

@@ -65,7 +66,7 @@ class HFPProxy(ProfileProxy):
        (IUT), then click Ok.
        """

        self.host.DeletePairing(address=pts_addr)
        self.security.DeletePairing(address=pts_addr)
        return "OK"

    @assert_description
@@ -99,6 +100,17 @@ class HFPProxy(ProfileProxy):
        self.connection = self.host.Connect(address=pts_addr).connection
        return "OK"

    @assert_description
    def TSC_iut_connectable(self, pts_addr: str, test: str, **kwargs):
        """
        Make the Implementation Under Test (IUT) connectable, then click Ok.
        """

        if "HFP/AG/SLC/BV-03-C" in test:
            self.connection = self.host.WaitConnection(pts_addr).connection

        return "OK"

    @assert_description
    def TSC_iut_disable_slc(self, pts_addr: bytes, **kwargs):
        """
@@ -106,7 +118,12 @@ class HFPProxy(ProfileProxy):
        Implementation Under Test (IUT).
        """

        def go():
            time.sleep(2)
            self.hfp.DisableSlc(connection=self.connection)

        threading.Thread(target=go).start()

        return "OK"

    @assert_description
+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" />
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
        <option name="profile" value="AVRCP" />
        <option name="profile" value="GAP" />
        <option name="profile" value="GATT" />
        <option name="profile" value="HFP/AG/PSI" />
        <option name="profile" value="HFP/AG" />
        <option name="profile" value="HID/HOS" />
        <option name="profile" value="HOGP" />
        <option name="profile" value="L2CAP/LE" />
Loading