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

Commit 09b4d998 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

DO NOT MERGE Fix 5389442 RemoteControlClient javadoc

Extend RemoteControlClient class description with an example
 of instance creation showing how the PendingIntent is created
 and how it uses the same ComponentName as the one used
 in AudioManager.registerMediaButtonEventReceiver()

Change-Id: I1af61ddbf5cfb9160ea5b814bed7b881d51b7eff
parent 99f36683
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -35,14 +35,27 @@ import android.util.Log;
import java.lang.IllegalArgumentException;
import java.lang.IllegalArgumentException;


/**
/**
 * TODO javadoc update for ComponentName - PendingIntent change
 * RemoteControlClient enables exposing information meant to be consumed by remote controls
 * RemoteControlClient enables exposing information meant to be consumed by remote controls
 * capable of displaying metadata, artwork and media transport control buttons.
 * capable of displaying metadata, artwork and media transport control buttons.
 * A remote control client object is associated with a media button event receiver. This
 *
 * <p>A remote control client object is associated with a media button event receiver. This
 * event receiver must have been previously registered with
 * event receiver must have been previously registered with
 * {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)} before the
 * {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)} before the
 * RemoteControlClient can be registered through
 * RemoteControlClient can be registered through
 * {@link AudioManager#registerRemoteControlClient(RemoteControlClient)}.
 * {@link AudioManager#registerRemoteControlClient(RemoteControlClient)}.
 *
 * <p>Here is an example of creating a RemoteControlClient instance after registering a media
 * button event receiver:
 * <pre>ComponentName myEventReceiver = new ComponentName(getPackageName(), MyRemoteControlEventReceiver.class.getName());
 * AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
 * myAudioManager.registerMediaButtonEventReceiver(myEventReceiver);
 * // build the PendingIntent for the remote control client
 * Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
 * mediaButtonIntent.setComponent(myEventReceiver);
 * PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
 * // create and register the remote control client
 * RemoteControlClient myRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
 * myAudioManager.registerRemoteControlClient(myRemoteControlClient);</pre>
 */
 */
public class RemoteControlClient
public class RemoteControlClient
{
{