Merge "Bug 5300223 RemoteControlClient uses PendingIntent"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e83f771f0a
@@ -10870,8 +10870,8 @@ package android.media {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class RemoteControlClient {
|
public class RemoteControlClient {
|
||||||
ctor public RemoteControlClient(android.content.ComponentName);
|
ctor public RemoteControlClient(android.app.PendingIntent);
|
||||||
ctor public RemoteControlClient(android.content.ComponentName, android.os.Looper);
|
ctor public RemoteControlClient(android.app.PendingIntent, android.os.Looper);
|
||||||
method public android.media.RemoteControlClient.MetadataEditor editMetadata(boolean);
|
method public android.media.RemoteControlClient.MetadataEditor editMetadata(boolean);
|
||||||
method public void setPlaybackState(int);
|
method public void setPlaybackState(int);
|
||||||
method public void setTransportControlFlags(int);
|
method public void setTransportControlFlags(int);
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package android.media;
|
package android.media;
|
||||||
|
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
@@ -203,6 +205,8 @@ public class RemoteControlClient
|
|||||||
public final static int FLAG_INFORMATION_REQUEST_ALBUM_ART = 1 << 3;
|
public final static int FLAG_INFORMATION_REQUEST_ALBUM_ART = 1 << 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @hide
|
||||||
|
* TODO remove after modifying known (internal) media apps using this API
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
* @param mediaButtonEventReceiver The receiver for the media button events. It needs to have
|
* @param mediaButtonEventReceiver The receiver for the media button events. It needs to have
|
||||||
* been registered with {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)}
|
* been registered with {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)}
|
||||||
@@ -226,6 +230,8 @@ public class RemoteControlClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @hide
|
||||||
|
* TODO remove after modifying known (internal) media apps using this API
|
||||||
* Class constructor for a remote control client whose internal event handling
|
* Class constructor for a remote control client whose internal event handling
|
||||||
* happens on a user-provided Looper.
|
* happens on a user-provided Looper.
|
||||||
* @param mediaButtonEventReceiver The receiver for the media button events. It needs to have
|
* @param mediaButtonEventReceiver The receiver for the media button events. It needs to have
|
||||||
@@ -242,6 +248,56 @@ public class RemoteControlClient
|
|||||||
mEventHandler = new EventHandler(this, looper);
|
mEventHandler = new EventHandler(this, looper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
* @param mediaButtonIntent The intent that will be sent for the media button events sent
|
||||||
|
* by remote controls.
|
||||||
|
* This intent needs to have been constructed with the {@link Intent#ACTION_MEDIA_BUTTON}
|
||||||
|
* action, and have a component that will handle the intent (set with
|
||||||
|
* {@link Intent#setComponent(ComponentName)}) registered with
|
||||||
|
* {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)}
|
||||||
|
* before this new RemoteControlClient can itself be registered with
|
||||||
|
* {@link AudioManager#registerRemoteControlClient(RemoteControlClient)}.
|
||||||
|
* @see AudioManager#registerMediaButtonEventReceiver(ComponentName)
|
||||||
|
* @see AudioManager#registerRemoteControlClient(RemoteControlClient)
|
||||||
|
*/
|
||||||
|
public RemoteControlClient(PendingIntent mediaButtonIntent) {
|
||||||
|
// TODO implement using PendingIntent instead of ComponentName
|
||||||
|
mRcEventReceiver = null;
|
||||||
|
|
||||||
|
Looper looper;
|
||||||
|
if ((looper = Looper.myLooper()) != null) {
|
||||||
|
mEventHandler = new EventHandler(this, looper);
|
||||||
|
} else if ((looper = Looper.getMainLooper()) != null) {
|
||||||
|
mEventHandler = new EventHandler(this, looper);
|
||||||
|
} else {
|
||||||
|
mEventHandler = null;
|
||||||
|
Log.e(TAG, "RemoteControlClient() couldn't find main application thread");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor for a remote control client whose internal event handling
|
||||||
|
* happens on a user-provided Looper.
|
||||||
|
* @param mediaButtonIntent The intent that will be sent for the media button events sent
|
||||||
|
* by remote controls.
|
||||||
|
* This intent needs to have been constructed with the {@link Intent#ACTION_MEDIA_BUTTON}
|
||||||
|
* action, and have a component that will handle the intent (set with
|
||||||
|
* {@link Intent#setComponent(ComponentName)}) registered with
|
||||||
|
* {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)}
|
||||||
|
* before this new RemoteControlClient can itself be registered with
|
||||||
|
* {@link AudioManager#registerRemoteControlClient(RemoteControlClient)}.
|
||||||
|
* @param looper The Looper running the event loop.
|
||||||
|
* @see AudioManager#registerMediaButtonEventReceiver(ComponentName)
|
||||||
|
* @see AudioManager#registerRemoteControlClient(RemoteControlClient)
|
||||||
|
*/
|
||||||
|
public RemoteControlClient(PendingIntent mediaButtonIntent, Looper looper) {
|
||||||
|
// TODO implement using PendingIntent instead of ComponentName
|
||||||
|
mRcEventReceiver = null;
|
||||||
|
|
||||||
|
mEventHandler = new EventHandler(this, looper);
|
||||||
|
}
|
||||||
|
|
||||||
private static final int[] METADATA_KEYS_TYPE_STRING = {
|
private static final int[] METADATA_KEYS_TYPE_STRING = {
|
||||||
MediaMetadataRetriever.METADATA_KEY_ALBUM,
|
MediaMetadataRetriever.METADATA_KEY_ALBUM,
|
||||||
MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
|
MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
|
||||||
|
|||||||
Reference in New Issue
Block a user