Merge changes Ia3bc5b0d,I26e662ff into lmp-mr1-dev
* changes: Add extras to the PlaybackState Add setRatingType to MediaSession
This commit is contained in:
@@ -16310,6 +16310,7 @@ package android.media.session {
|
|||||||
method public void setPlaybackToRemote(android.media.VolumeProvider);
|
method public void setPlaybackToRemote(android.media.VolumeProvider);
|
||||||
method public void setQueue(java.util.List<android.media.session.MediaSession.QueueItem>);
|
method public void setQueue(java.util.List<android.media.session.MediaSession.QueueItem>);
|
||||||
method public void setQueueTitle(java.lang.CharSequence);
|
method public void setQueueTitle(java.lang.CharSequence);
|
||||||
|
method public void setRatingType(int);
|
||||||
method public void setSessionActivity(android.app.PendingIntent);
|
method public void setSessionActivity(android.app.PendingIntent);
|
||||||
field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
|
field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
|
||||||
field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
|
field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
|
||||||
@@ -16368,6 +16369,7 @@ package android.media.session {
|
|||||||
method public long getBufferedPosition();
|
method public long getBufferedPosition();
|
||||||
method public java.util.List<android.media.session.PlaybackState.CustomAction> getCustomActions();
|
method public java.util.List<android.media.session.PlaybackState.CustomAction> getCustomActions();
|
||||||
method public java.lang.CharSequence getErrorMessage();
|
method public java.lang.CharSequence getErrorMessage();
|
||||||
|
method public android.os.Bundle getExtras();
|
||||||
method public long getLastPositionUpdateTime();
|
method public long getLastPositionUpdateTime();
|
||||||
method public float getPlaybackSpeed();
|
method public float getPlaybackSpeed();
|
||||||
method public long getPosition();
|
method public long getPosition();
|
||||||
@@ -16412,6 +16414,7 @@ package android.media.session {
|
|||||||
method public android.media.session.PlaybackState.Builder setActiveQueueItemId(long);
|
method public android.media.session.PlaybackState.Builder setActiveQueueItemId(long);
|
||||||
method public android.media.session.PlaybackState.Builder setBufferedPosition(long);
|
method public android.media.session.PlaybackState.Builder setBufferedPosition(long);
|
||||||
method public android.media.session.PlaybackState.Builder setErrorMessage(java.lang.CharSequence);
|
method public android.media.session.PlaybackState.Builder setErrorMessage(java.lang.CharSequence);
|
||||||
|
method public android.media.session.PlaybackState.Builder setExtras(android.os.Bundle);
|
||||||
method public android.media.session.PlaybackState.Builder setState(int, long, float, long);
|
method public android.media.session.PlaybackState.Builder setState(int, long, float, long);
|
||||||
method public android.media.session.PlaybackState.Builder setState(int, long, float);
|
method public android.media.session.PlaybackState.Builder setState(int, long, float);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -448,6 +448,27 @@ public final class MediaSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the style of rating used by this session. Apps trying to set the
|
||||||
|
* rating should use this style. Must be one of the following:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link Rating#RATING_NONE}</li>
|
||||||
|
* <li>{@link Rating#RATING_3_STARS}</li>
|
||||||
|
* <li>{@link Rating#RATING_4_STARS}</li>
|
||||||
|
* <li>{@link Rating#RATING_5_STARS}</li>
|
||||||
|
* <li>{@link Rating#RATING_HEART}</li>
|
||||||
|
* <li>{@link Rating#RATING_PERCENTAGE}</li>
|
||||||
|
* <li>{@link Rating#RATING_THUMB_UP_DOWN}</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public void setRatingType(int type) {
|
||||||
|
try {
|
||||||
|
mBinder.setRatingType(type);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error in setRatingType.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set some extras that can be associated with the {@link MediaSession}. No assumptions should
|
* Set some extras that can be associated with the {@link MediaSession}. No assumptions should
|
||||||
* be made as to how a {@link MediaController} will handle these extras.
|
* be made as to how a {@link MediaController} will handle these extras.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package android.media.session;
|
package android.media.session;
|
||||||
|
|
||||||
import android.annotation.DrawableRes;
|
import android.annotation.DrawableRes;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.media.RemoteControlClient;
|
import android.media.RemoteControlClient;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@@ -232,11 +233,12 @@ public final class PlaybackState implements Parcelable {
|
|||||||
private final CharSequence mErrorMessage;
|
private final CharSequence mErrorMessage;
|
||||||
private final long mUpdateTime;
|
private final long mUpdateTime;
|
||||||
private final long mActiveItemId;
|
private final long mActiveItemId;
|
||||||
|
private final Bundle mExtras;
|
||||||
|
|
||||||
private PlaybackState(int state, long position, long updateTime, float speed,
|
private PlaybackState(int state, long position, long updateTime, float speed,
|
||||||
long bufferedPosition, long transportControls,
|
long bufferedPosition, long transportControls,
|
||||||
List<PlaybackState.CustomAction> customActions, long activeItemId,
|
List<PlaybackState.CustomAction> customActions, long activeItemId,
|
||||||
CharSequence error) {
|
CharSequence error, Bundle extras) {
|
||||||
mState = state;
|
mState = state;
|
||||||
mPosition = position;
|
mPosition = position;
|
||||||
mSpeed = speed;
|
mSpeed = speed;
|
||||||
@@ -246,6 +248,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
mCustomActions = new ArrayList<>(customActions);
|
mCustomActions = new ArrayList<>(customActions);
|
||||||
mActiveItemId = activeItemId;
|
mActiveItemId = activeItemId;
|
||||||
mErrorMessage = error;
|
mErrorMessage = error;
|
||||||
|
mExtras = extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlaybackState(Parcel in) {
|
private PlaybackState(Parcel in) {
|
||||||
@@ -258,7 +261,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
mCustomActions = in.createTypedArrayList(CustomAction.CREATOR);
|
mCustomActions = in.createTypedArrayList(CustomAction.CREATOR);
|
||||||
mActiveItemId = in.readLong();
|
mActiveItemId = in.readLong();
|
||||||
mErrorMessage = in.readCharSequence();
|
mErrorMessage = in.readCharSequence();
|
||||||
|
mExtras = in.readBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -293,6 +296,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
dest.writeTypedList(mCustomActions);
|
dest.writeTypedList(mCustomActions);
|
||||||
dest.writeLong(mActiveItemId);
|
dest.writeLong(mActiveItemId);
|
||||||
dest.writeCharSequence(mErrorMessage);
|
dest.writeCharSequence(mErrorMessage);
|
||||||
|
dest.writeBundle(mExtras);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,6 +310,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
* <li> {@link PlaybackState#STATE_REWINDING}</li>
|
* <li> {@link PlaybackState#STATE_REWINDING}</li>
|
||||||
* <li> {@link PlaybackState#STATE_BUFFERING}</li>
|
* <li> {@link PlaybackState#STATE_BUFFERING}</li>
|
||||||
* <li> {@link PlaybackState#STATE_ERROR}</li>
|
* <li> {@link PlaybackState#STATE_ERROR}</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public int getState() {
|
public int getState() {
|
||||||
return mState;
|
return mState;
|
||||||
@@ -393,6 +398,15 @@ public final class PlaybackState implements Parcelable {
|
|||||||
return mActiveItemId;
|
return mActiveItemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get any custom extras that were set on this playback state.
|
||||||
|
*
|
||||||
|
* @return The extras for this state or null.
|
||||||
|
*/
|
||||||
|
public @Nullable Bundle getExtras() {
|
||||||
|
return mExtras;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link PlaybackState} state for the given
|
* Get the {@link PlaybackState} state for the given
|
||||||
* {@link RemoteControlClient} state.
|
* {@link RemoteControlClient} state.
|
||||||
@@ -737,6 +751,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
private CharSequence mErrorMessage;
|
private CharSequence mErrorMessage;
|
||||||
private long mUpdateTime;
|
private long mUpdateTime;
|
||||||
private long mActiveItemId = MediaSession.QueueItem.UNKNOWN_ID;
|
private long mActiveItemId = MediaSession.QueueItem.UNKNOWN_ID;
|
||||||
|
private Bundle mExtras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an initially empty state builder.
|
* Creates an initially empty state builder.
|
||||||
@@ -765,6 +780,7 @@ public final class PlaybackState implements Parcelable {
|
|||||||
mErrorMessage = from.mErrorMessage;
|
mErrorMessage = from.mErrorMessage;
|
||||||
mUpdateTime = from.mUpdateTime;
|
mUpdateTime = from.mUpdateTime;
|
||||||
mActiveItemId = from.mActiveItemId;
|
mActiveItemId = from.mActiveItemId;
|
||||||
|
mExtras = from.mExtras;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -947,13 +963,25 @@ public final class PlaybackState implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build and return the {@link PlaybackState} instance with these values.
|
* Set any custom extras to be included with the playback state.
|
||||||
|
*
|
||||||
|
* @param extras The extras to include.
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public Builder setExtras(Bundle extras) {
|
||||||
|
mExtras = extras;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build and return the {@link PlaybackState} instance with these
|
||||||
|
* values.
|
||||||
*
|
*
|
||||||
* @return A new state instance.
|
* @return A new state instance.
|
||||||
*/
|
*/
|
||||||
public PlaybackState build() {
|
public PlaybackState build() {
|
||||||
return new PlaybackState(mState, mPosition, mUpdateTime, mSpeed, mBufferedPosition,
|
return new PlaybackState(mState, mPosition, mUpdateTime, mSpeed, mBufferedPosition,
|
||||||
mActions, mCustomActions, mActiveItemId, mErrorMessage);
|
mActions, mCustomActions, mActiveItemId, mErrorMessage, mExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user