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

Commit 3a2207a1 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Jakub Pawlowski
Browse files

mcp: Add implementation of Generic Media Control Service

Media Control Profile implements the Generic Media Control Service
and media playback controls by hooking into the Media Session Framework.
It represents the global media state and allows to controll it,
similar to AVRCP.

Bug: 150670922
Tag: #feature
Test: atest McpServiceManagerTest McpServiceTest MediaControlProfileTest
Sponsor: jpawlowski@
Merged-In: Ie2cd94f050251cf7df2c65cfd46c312bcf303b5f
Change-Id: Ie2cd94f050251cf7df2c65cfd46c312bcf303b5f
parent 5cade3eb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -372,6 +372,14 @@
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name = ".mcp.McpServiceManager"
             android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothMcpServiceManager" />
            </intent-filter>
        </service>
        <service
             android:process="@string/process"
             android:name=".pan.PanService"
             android:enabled="@bool/profile_supported_pan"
             android:exported="true">
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
    <bool name="profile_supported_mapmce">false</bool>
    <bool name="profile_supported_hid_device">true</bool>
    <bool name="profile_supported_vc">false</bool>
    <bool name="profile_supported_mcp_server">true</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
+15 −0
Original line number Diff line number Diff line
@@ -175,6 +175,16 @@ public class MediaPlayerWrapper {
        controller.seekTo(position);
    }

    public void fastForward() {
        MediaController.TransportControls controller = mMediaController.getTransportControls();
        controller.fastForward();
    }

    public void rewind() {
        MediaController.TransportControls controller = mMediaController.getTransportControls();
        controller.rewind();
    }

    public void skipToPrevious() {
        MediaController.TransportControls controller = mMediaController.getTransportControls();
        controller.skipToPrevious();
@@ -185,6 +195,11 @@ public class MediaPlayerWrapper {
        controller.skipToNext();
    }

    public void setPlaybackSpeed(float speed) {
        MediaController.TransportControls controller = mMediaController.getTransportControls();
        controller.setPlaybackSpeed(speed);
    }

    // TODO (apanicke): Implement shuffle and repeat support. Right now these use custom actions
    // and it may only be possible to do this with Google Play Music
    public boolean isShuffleSupported() {
+7 −0
Original line number Diff line number Diff line
@@ -379,6 +379,13 @@ public class MediaController {
            mTransportDelegate.setRating(rating);
        }

        /**
         * Wrapper for MediaController.TransportControls.setPlaybackSpeed(float speed)
         */
        public void setPlaybackSpeed(float speed) {
            mTransportDelegate.setPlaybackSpeed(speed);
        }

        /**
         * Wrapper for MediaController.TransportControls.sendCustomAction()
         */
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.bluetooth.hid.HidDeviceService;
import com.android.bluetooth.hid.HidHostService;
import com.android.bluetooth.map.BluetoothMapService;
import com.android.bluetooth.mapclient.MapClientService;
import com.android.bluetooth.mcp.McpServiceManager;
import com.android.bluetooth.opp.BluetoothOppService;
import com.android.bluetooth.pan.PanService;
import com.android.bluetooth.pbap.BluetoothPbapService;
@@ -107,6 +108,8 @@ public class Config {
                    (1 << BluetoothProfile.PBAP)),
            new ProfileConfig(VolumeControlService.class, R.bool.profile_supported_vc,
                    (1 << BluetoothProfile.VOLUME_CONTROL)),
            new ProfileConfig(McpServiceManager.class, R.bool.profile_supported_mcp_server,
                    (1 << BluetoothProfile.MCP_SERVER)),
            new ProfileConfig(HearingAidService.class,
                    com.android.internal.R.bool.config_hearing_aid_profile_supported,
                    (1 << BluetoothProfile.HEARING_AID))
Loading