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

Commit 620c100f authored by Ayan Ghosh's avatar Ayan Ghosh Committed by Linux Build Service Account
Browse files

AVRCP 1.5 implementation

AVRCP 1.5 Implementation

Change-Id: I9a21348ec7e0c21735448ea29b781167f01e1580

Bluetooth: Add Total track number.

Add support to add total number of tracks in
Meta-data

Change-Id: I5b1287f791615adcd4f920fe5c7cae0c7c7b04ea
CRs-Fixed: 627869

Bluetooth: Modify Avrcp 1.5 implementation to adapt to latest AOSP changes

Modify Avrcp 1.5 implementation to adapt to latest AOSP changes.

CRs-Fixed: 719567
Change-Id: I0958fb12f573054f1da16df0ac46f3bec7374222

Move media player list management to Audioservice

Move media player list management to Audioservice so that
list is retained even after BT restart.

Change-Id: Ia2455e6def1900b4af2225c50e1b5325a7ce1a98

Update RemoteController on Session update

Update RemoteController on Session update in order to update
AVRCP player list to honor peer initiated browsing command.
This change fixes AVRCP browing failure due stale entry of
player session upated to AVRCP player list after device reboot.

Change-Id: I529a13e2c8a70e4b53319798c952b41f369b8bec

Introduce new interface class for Avrcp Browsing feature

Separate out Avrcp Browsing Apis from SDK interface class to
ensure compatibility with all available apps implementing the
mentioned SDK interface class.

Change-Id: I713527ee3622ba28fe92d5bc743b9471632299b3
parent 6d08e0ed
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -222,6 +222,26 @@ public class Media extends BaseCommand {
            System.out.println("onVolumeInfoChanged " + info);
        }

        @Override
        public void onPlayItemResponse(boolean success) throws RemoteException {
            System.out.println("onPlayItemResponse ");
        }

        @Override
        public void onUpdateNowPlayingEntries(long[] playList) throws RemoteException {
            System.out.println("onUpdateNowPlayingEntries ");
        }

        @Override
        public void onUpdateFolderInfoBrowsedPlayer(String stringUri) throws RemoteException {
            System.out.println("onUpdateFolderInfoBrowsedPlayer ");
        }

        @Override
        public void onUpdateNowPlayingContentChange() throws RemoteException {
            System.out.println("onUpdateNowPlayingContentChange ");
        }

        void printUsageMessage() {
            try {
                System.out.println("V2Monitoring session " + mController.getTag()
+100 −1
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ public class AudioManager {
    private final boolean mUseFixedVolume;
    private static String TAG = "AudioManager";
    private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler();

    /**
     * Broadcast intent, a hint for applications that audio is about to become
     * 'noisy' due to a change in audio outputs. For example, this intent may
@@ -310,6 +309,32 @@ public class AudioManager {
     */
    public static final String EXTRA_ENCODINGS = "android.media.extra.ENCODINGS";

    /**
     * @hide Broadcast intent when RemoteControlClient list is updated.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String RCC_CHANGED_ACTION =
                "org.codeaurora.bluetooth.RCC_CHANGED_ACTION";

    /**
     * @hide Used for sharing the calling package name
     */
    public static final String EXTRA_CALLING_PACKAGE_NAME =
            "org.codeaurora.bluetooth.EXTRA_CALLING_PACKAGE_NAME";

    /**
     * @hide Used for sharing the focus changed value
     */
    public static final String EXTRA_FOCUS_CHANGED_VALUE =
            "org.codeaurora.bluetooth.EXTRA_FOCUS_CHANGED_VALUE";

    /**
     * @hide Used for sharing the availability changed value
     */
    public static final String EXTRA_AVAILABLITY_CHANGED_VALUE =
            "org.codeaurora.bluetooth.EXTRA_AVAILABLITY_CHANGED_VALUE";


    /** The audio stream for phone calls */
    public static final int STREAM_VOICE_CALL = AudioSystem.STREAM_VOICE_CALL;
    /** The audio stream for system sounds */
@@ -2481,6 +2506,7 @@ public class AudioManager {

    //====================================================================
    // Remote Control

    /**
     * Register a component to be the sole receiver of MEDIA_BUTTON intents.
     * @param eventReceiver identifier of a {@link android.content.BroadcastReceiver}
@@ -2499,6 +2525,7 @@ public class AudioManager {
                    "receiver and context package names don't match");
            return;
        }

        // construct a PendingIntent for the media button and register it
        Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
        //     the associated intent will be handled by the component being registered
@@ -2508,6 +2535,7 @@ public class AudioManager {
        registerMediaButtonIntent(pi, eventReceiver);
    }


    /**
     * Register a component to be the sole receiver of MEDIA_BUTTON intents.  This is like
     * {@link #registerMediaButtonEventReceiver(android.content.ComponentName)}, but allows
@@ -2637,6 +2665,13 @@ public class AudioManager {
            return false;
        }
        rctlr.startListeningToSessions();
        IAudioService service = getService();
        try {
            service.updateRemoteControllerOnExistingMediaPlayers();
        } catch (RemoteException e) {
            Log.e(TAG, "Error in calling Audio service interface" +
                "updateRemoteControllerOnExistingMediaPlayers() due to " + e);
        }
        return true;
    }

@@ -2658,6 +2693,24 @@ public class AudioManager {
        rctlr.stopListeningToSessions();
    }

    /**
     * @hide
     */
    public void updateMediaPlayerList(String packageName, boolean toAdd) {
        IAudioService service = getService();
        try {
            if (toAdd) {
                Log.d(TAG, "updateMediaPlayerList: Add RCC " + packageName + " to List");
                service.addMediaPlayerAndUpdateRemoteController(packageName);
            } else {
                Log.d(TAG, "updateMediaPlayerList: Remove RCC " + packageName + " from List");
                service.removeMediaPlayerAndUpdateRemoteController(packageName);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Exception while executing updateMediaPlayerList: " + e);
        }
    }

    /**
     * @hide
     * Registers a remote control display that will be sent information by remote control clients.
@@ -2811,6 +2864,52 @@ public class AudioManager {
        }
    }

    /**
     * @hide
     * Request the user of a RemoteControlClient to play the requested item.
     * @param generationId the RemoteControlClient generation counter for which this request is
     *     issued.
     * @param uid uid of the song to be played.
     * @scope scope of the file system to use
     */
    public void setRemoteControlClientPlayItem(long uid, int scope) {
        IAudioService service = getService();
        try {
            service.setRemoteControlClientPlayItem(uid, scope);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in setRemoteControlClientPlayItem(" +
                                                    uid + ", " + scope + ")", e);
        }
    }

    /**
     * @hide
     * Request the user of a RemoteControlClient to provide with the now playing list entries.
     * @param generationId the RemoteControlClient generation counter for which this request is
     *     issued.
     */
    public void getRemoteControlClientNowPlayingEntries() {
        IAudioService service = getService();
        try {
            service.getRemoteControlClientNowPlayingEntries();
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in getRemoteControlClientNowPlayingEntries(" + ")", e);
        }
    }

    /**
     * @hide
     * Request the user of a RemoteControlClient to set the music player as current browsed player.
     */
    public void setRemoteControlClientBrowsedPlayer() {
        Log.d(TAG, "setRemoteControlClientBrowsedPlayer: ");
        IAudioService service = getService();
        try {
            service.setRemoteControlClientBrowsedPlayer();
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in setRemoteControlClientBrowsedPlayer(" + ")", e);
        }
    }

    /**
     *  @hide
+12 −0
Original line number Diff line number Diff line
@@ -215,4 +215,16 @@ interface IAudioService {
    int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb);

    void setVolumePolicy(in VolumePolicy policy);

    void setRemoteControlClientBrowsedPlayer();

    void getRemoteControlClientNowPlayingEntries();

    void setRemoteControlClientPlayItem(long uid, int scope);

    void updateRemoteControllerOnExistingMediaPlayers();

    void addMediaPlayerAndUpdateRemoteController(String packageName);

    void removeMediaPlayerAndUpdateRemoteController(String packageName);
}
+4 −1
Original line number Diff line number Diff line
@@ -59,4 +59,7 @@ oneway interface IRemoteControlClient
    void enableRemoteControlDisplay(IRemoteControlDisplay rcd, boolean enabled);
    void seekTo(int clientGeneration, long timeMs);
    void updateMetadata(int clientGeneration, int key, in Rating value);
    void setPlayItem(int scope, long uid);
    void setBrowsedPlayer();
    void getNowPlayingEntries();
}
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -439,7 +439,7 @@ import android.util.SparseIntArray;
    protected static final SparseIntArray METADATA_KEYS_TYPE;

    static {
        METADATA_KEYS_TYPE = new SparseIntArray(17);
        METADATA_KEYS_TYPE = new SparseIntArray(18);
        // NOTE: if adding to the list below, make sure you increment the array initialization size
        // keys with long values
        METADATA_KEYS_TYPE.put(
@@ -465,5 +465,7 @@ import android.util.SparseIntArray;
        // keys with Rating values
        METADATA_KEYS_TYPE.put(RATING_KEY_BY_OTHERS, METADATA_TYPE_RATING);
        METADATA_KEYS_TYPE.put(RATING_KEY_BY_USER, METADATA_TYPE_RATING);
        // Meta data for total number of tracks in Album
        METADATA_KEYS_TYPE.put(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS, METADATA_TYPE_LONG);
    }
}
Loading