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

Commit cb1a2df3 authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz Committed by Automerger Merge Worker
Browse files

Merge changes from topic "avrcp_settings_pts_tests" am: c128d7f7 am:...

Merge changes from topic "avrcp_settings_pts_tests" am: c128d7f7 am: 4e92a308 am: c5834a3a am: c3e108b9

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2540412



Change-Id: Ib1c566e9eb4203e1a5d1e0fb731bb18220f4e659
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4b7cfafc c3e108b9
Loading
Loading
Loading
Loading
+97 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ from pandora_experimental.avrcp_grpc import AVRCP
from pandora.host_grpc import Host
from pandora.host_pb2 import Connection
from pandora_experimental.mediaplayer_grpc import MediaPlayer

from pandora_experimental.mediaplayer_pb2 import NONE, ALL, GROUP

class AVRCPProxy(ProfileProxy):
    """AVRCP proxy.
@@ -617,6 +617,75 @@ class AVRCPProxy(ProfileProxy):

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_list_player_application_setting_values_invalid_attribute(self, **kwargs):
        """
        PTS has sent a List Player Application Setting Values command with an
        invalid Attribute Id.  The IUT must respond with the error code: Invalid
        Parameter (0x01).

        Description: Verify that the IUT can properly reject
        a List Player Application Setting Values command that contains an
        invalid attribute id.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_set_player_application_setting_value_invalid_pair(self, **kwargs):
        """
        PTS has sent a Set Player Application Setting Value command with an
        invalid Attribute and Value.  The IUT must respond with the error code:
        Invalid Parameter (0x01).

        Description: Verify that the IUT can properly
        reject a Set Player Application Setting Value command that contains an
        invalid attribute and value.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_get_current_player_application_setting_value_invalid_attribute(self, **kwargs):
        """
        PTS has sent a Get Current Player Application Setting Value command with
        an invalid Attribute.  The IUT must respond with the error code: Invalid
        Parameter (0x01).

        Description: Verify that the IUT can properly reject
        an Get Current Player Application Setting Value command that contains an
        invalid attribute.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_get_current_player_application_setting_value(self, **kwargs):
        """
        Take action to send a valid response to the [Get Current Player
        Application Setting Value] command sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_list_player_application_setting_attributes(self, **kwargs):
        """
        Take action to send a valid response to the [List Player Application
        Setting Attributes] command sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_accept_list_player_application_setting_values(self, **kwargs):
        """
        Take action to send a valid response to the [List Player Application
        Setting Values] command sent by the PTS.
        """

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_set_addressed_player_invalid_player_id(self, **kwargs):
        """
@@ -628,6 +697,33 @@ class AVRCPProxy(ProfileProxy):

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_initiate_register_notification_changed_player_application_setting_changed(self, **kwargs):
        """
        Take action to trigger a [Register Notification, Changed] response for
        <Player Application Setting Changed> to the PTS from the IUT.  This can
        be accomplished by changing a Player Application Setting (Equalizer,
        Repeat Mode, Shuffle, Scan) on the IUT.

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

        nextShuffleMode = NONE
        self.mediaplayer.StartTestPlayback()
        currentShuffleMode = self.mediaplayer.GetShuffleMode().mode
        if (currentShuffleMode == NONE):
            nextShuffleMode = ALL
        elif (currentShuffleMode == ALL):
            nextShuffleMode = GROUP
        elif (currentShuffleMode == GROUP):
            nextShuffleMode = ALL
        self.mediaplayer.SetShuffleMode(mode=nextShuffleMode)
        self.mediaplayer.StopTestPlayback()

        return "OK"

    @assert_description
    def TSC_AVRCP_mmi_iut_reject_get_folder_items_out_of_range(self, **kwargs):
        """
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ java_library_static {
    ],

    static_libs: [
        "androidx.media_media",
        "androidx.test.core",
        "androidx.test.runner",
        "androidx.test.uiautomator_uiautomator",
+12 −0
Original line number Diff line number Diff line
@@ -153,8 +153,15 @@
    "AVRCP/TG/MPS/BV-09-C",
    "AVRCP/TG/NFY/BI-01-C",
    "AVRCP/TG/NFY/BV-02-C",
    "AVRCP/TG/NFY/BV-03-C",
    "AVRCP/TG/NFY/BV-06-C",
    "AVRCP/TG/NFY/BV-07-C",
    "AVRCP/TG/PAS/BI-02-C",
    "AVRCP/TG/PAS/BI-04-C",
    "AVRCP/TG/PAS/BI-05-C",
    "AVRCP/TG/PAS/BV-02-C",
    "AVRCP/TG/PAS/BV-06-C",
    "AVRCP/TG/PAS/BV-10-C",
    "AVRCP/TG/PTT/BV-01-I",
    "AVRCP/TG/PTT/BV-05-I",
    "AVRCP/TG/RCR/BV-02-C",
@@ -1223,11 +1230,16 @@
    "TSPC_AVRCP_7_6": true,
    "TSPC_AVRCP_7_7": true,
    "TSPC_AVRCP_7_11": true,
    "TSPC_AVRCP_7_12": true,
    "TSPC_AVRCP_7_13": true,
    "TSPC_AVRCP_7_14": true,
    "TSPC_AVRCP_7_15": true,
    "TSPC_AVRCP_7_20": true,
    "TSPC_AVRCP_7_21": true,
    "TSPC_AVRCP_7_22": true,
    "TSPC_AVRCP_7_23": true,
    "TSPC_AVRCP_7_24": true,
    "TSPC_AVRCP_7_30": true,
    "TSPC_AVRCP_7_31": true,
    "TSPC_AVRCP_7_32": true,
    "TSPC_AVRCP_7_36": true,
+361 KiB

File added.

No diff preview for this file type.

+57 −0
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@ package com.android.pandora
import android.content.Context
import android.content.Intent
import android.media.*
import android.support.v4.media.session.PlaybackStateCompat.SHUFFLE_MODE_ALL
import android.support.v4.media.session.PlaybackStateCompat.SHUFFLE_MODE_GROUP
import android.support.v4.media.session.PlaybackStateCompat.SHUFFLE_MODE_NONE
import android.util.Log
import com.google.protobuf.Empty
import io.grpc.stub.StreamObserver
import java.io.Closeable
@@ -27,6 +31,9 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import pandora.MediaPlayerGrpc.MediaPlayerImplBase
import pandora.MediaPlayerProto.*
import pandora.MediaPlayerProto.ShuffleMode
import pandora.MediaPlayerProto.SetShuffleModeRequest
import pandora.MediaPlayerProto.GetShuffleModeResponse

@kotlinx.coroutines.ExperimentalCoroutinesApi
class MediaPlayer(val context: Context) : MediaPlayerImplBase(), Closeable {
@@ -105,6 +112,56 @@ class MediaPlayer(val context: Context) : MediaPlayerImplBase(), Closeable {
    }
  }

  override fun getShuffleMode(
    request: Empty,
    responseObserver: StreamObserver<GetShuffleModeResponse>
  ) {
    grpcUnary(scope, responseObserver) {
      val mode: Int = MediaPlayerBrowserService.instance.getShuffleMode()
      val shuffleMode = when (mode) {
        SHUFFLE_MODE_NONE -> ShuffleMode.NONE
        SHUFFLE_MODE_ALL -> ShuffleMode.ALL
        SHUFFLE_MODE_GROUP -> ShuffleMode.GROUP
        else -> ShuffleMode.NONE
      }
      GetShuffleModeResponse.newBuilder()
        .setMode(shuffleMode)
        .build()
    }
  }

  override fun setShuffleMode(
    request: SetShuffleModeRequest,
    responseObserver: StreamObserver<Empty>
  ) {
    grpcUnary(scope, responseObserver) {
      when (request.mode!!) {
        ShuffleMode.NONE ->
          MediaPlayerBrowserService.instance.setShuffleMode(SHUFFLE_MODE_NONE)
        ShuffleMode.ALL ->
          MediaPlayerBrowserService.instance.setShuffleMode(SHUFFLE_MODE_ALL)
        ShuffleMode.GROUP ->
          MediaPlayerBrowserService.instance.setShuffleMode(SHUFFLE_MODE_GROUP)
        else -> MediaPlayerBrowserService.instance.setShuffleMode(SHUFFLE_MODE_NONE)
      }
      Empty.getDefaultInstance()
    }
  }

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

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

  override fun close() {
    // Deinit the CoroutineScope
    scope.cancel()
Loading