Merge "Add "name" to RoutingSessionInfo" into rvc-dev am: a448f383d0 am: 1e6d587d12
Change-Id: Id32af246fba4d8994ef020efde7ce08becc16711
This commit is contained in:
@@ -27477,6 +27477,7 @@ package android.media {
|
|||||||
method @Nullable public android.os.Bundle getControlHints();
|
method @Nullable public android.os.Bundle getControlHints();
|
||||||
method @NonNull public java.util.List<java.lang.String> getDeselectableRoutes();
|
method @NonNull public java.util.List<java.lang.String> getDeselectableRoutes();
|
||||||
method @NonNull public String getId();
|
method @NonNull public String getId();
|
||||||
|
method @Nullable public CharSequence getName();
|
||||||
method @NonNull public java.util.List<java.lang.String> getSelectableRoutes();
|
method @NonNull public java.util.List<java.lang.String> getSelectableRoutes();
|
||||||
method @NonNull public java.util.List<java.lang.String> getSelectedRoutes();
|
method @NonNull public java.util.List<java.lang.String> getSelectedRoutes();
|
||||||
method @NonNull public java.util.List<java.lang.String> getTransferableRoutes();
|
method @NonNull public java.util.List<java.lang.String> getTransferableRoutes();
|
||||||
@@ -27504,6 +27505,7 @@ package android.media {
|
|||||||
method @NonNull public android.media.RoutingSessionInfo.Builder removeSelectedRoute(@NonNull String);
|
method @NonNull public android.media.RoutingSessionInfo.Builder removeSelectedRoute(@NonNull String);
|
||||||
method @NonNull public android.media.RoutingSessionInfo.Builder removeTransferableRoute(@NonNull String);
|
method @NonNull public android.media.RoutingSessionInfo.Builder removeTransferableRoute(@NonNull String);
|
||||||
method @NonNull public android.media.RoutingSessionInfo.Builder setControlHints(@Nullable android.os.Bundle);
|
method @NonNull public android.media.RoutingSessionInfo.Builder setControlHints(@Nullable android.os.Bundle);
|
||||||
|
method @NonNull public android.media.RoutingSessionInfo.Builder setName(@Nullable CharSequence);
|
||||||
method @NonNull public android.media.RoutingSessionInfo.Builder setVolume(int);
|
method @NonNull public android.media.RoutingSessionInfo.Builder setVolume(int);
|
||||||
method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeHandling(int);
|
method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeHandling(int);
|
||||||
method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeMax(int);
|
method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeMax(int);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
private static final String TAG = "RoutingSessionInfo";
|
private static final String TAG = "RoutingSessionInfo";
|
||||||
|
|
||||||
final String mId;
|
final String mId;
|
||||||
|
final CharSequence mName;
|
||||||
final String mClientPackageName;
|
final String mClientPackageName;
|
||||||
@Nullable
|
@Nullable
|
||||||
final String mProviderId;
|
final String mProviderId;
|
||||||
@@ -69,6 +70,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
Objects.requireNonNull(builder, "builder must not be null.");
|
Objects.requireNonNull(builder, "builder must not be null.");
|
||||||
|
|
||||||
mId = builder.mId;
|
mId = builder.mId;
|
||||||
|
mName = builder.mName;
|
||||||
mClientPackageName = builder.mClientPackageName;
|
mClientPackageName = builder.mClientPackageName;
|
||||||
mProviderId = builder.mProviderId;
|
mProviderId = builder.mProviderId;
|
||||||
|
|
||||||
@@ -94,6 +96,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
Objects.requireNonNull(src, "src must not be null.");
|
Objects.requireNonNull(src, "src must not be null.");
|
||||||
|
|
||||||
mId = ensureString(src.readString());
|
mId = ensureString(src.readString());
|
||||||
|
mName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(src);
|
||||||
mClientPackageName = ensureString(src.readString());
|
mClientPackageName = ensureString(src.readString());
|
||||||
mProviderId = src.readString();
|
mProviderId = src.readString();
|
||||||
|
|
||||||
@@ -111,10 +114,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String ensureString(String str) {
|
private static String ensureString(String str) {
|
||||||
if (str != null) {
|
return str != null ? str : "";
|
||||||
return str;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> List<T> ensureList(List<? extends T> list) {
|
private static <T> List<T> ensureList(List<? extends T> list) {
|
||||||
@@ -142,6 +142,14 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the user-visible name of the session. It may be {@code null}.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public CharSequence getName() {
|
||||||
|
return mName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the original id set by {@link Builder#Builder(String, String)}.
|
* Gets the original id set by {@link Builder#Builder(String, String)}.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -169,7 +177,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of ids of selected routes for the session. It shouldn't be empty.
|
* Gets the list of IDs of selected routes for the session. It shouldn't be empty.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getSelectedRoutes() {
|
public List<String> getSelectedRoutes() {
|
||||||
@@ -177,7 +185,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of ids of selectable routes for the session.
|
* Gets the list of IDs of selectable routes for the session.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getSelectableRoutes() {
|
public List<String> getSelectableRoutes() {
|
||||||
@@ -185,7 +193,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of ids of deselectable routes for the session.
|
* Gets the list of IDs of deselectable routes for the session.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getDeselectableRoutes() {
|
public List<String> getDeselectableRoutes() {
|
||||||
@@ -193,7 +201,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of ids of transferable routes for the session.
|
* Gets the list of IDs of transferable routes for the session.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getTransferableRoutes() {
|
public List<String> getTransferableRoutes() {
|
||||||
@@ -255,6 +263,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
dest.writeString(mId);
|
dest.writeString(mId);
|
||||||
|
dest.writeCharSequence(mName);
|
||||||
dest.writeString(mClientPackageName);
|
dest.writeString(mClientPackageName);
|
||||||
dest.writeString(mProviderId);
|
dest.writeString(mProviderId);
|
||||||
dest.writeStringList(mSelectedRoutes);
|
dest.writeStringList(mSelectedRoutes);
|
||||||
@@ -279,6 +288,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
|
|
||||||
RoutingSessionInfo other = (RoutingSessionInfo) obj;
|
RoutingSessionInfo other = (RoutingSessionInfo) obj;
|
||||||
return Objects.equals(mId, other.mId)
|
return Objects.equals(mId, other.mId)
|
||||||
|
&& Objects.equals(mName, other.mName)
|
||||||
&& Objects.equals(mClientPackageName, other.mClientPackageName)
|
&& Objects.equals(mClientPackageName, other.mClientPackageName)
|
||||||
&& Objects.equals(mProviderId, other.mProviderId)
|
&& Objects.equals(mProviderId, other.mProviderId)
|
||||||
&& Objects.equals(mSelectedRoutes, other.mSelectedRoutes)
|
&& Objects.equals(mSelectedRoutes, other.mSelectedRoutes)
|
||||||
@@ -292,7 +302,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mId, mClientPackageName, mProviderId,
|
return Objects.hash(mId, mName, mClientPackageName, mProviderId,
|
||||||
mSelectedRoutes, mSelectableRoutes, mDeselectableRoutes, mTransferableRoutes,
|
mSelectedRoutes, mSelectableRoutes, mDeselectableRoutes, mTransferableRoutes,
|
||||||
mVolumeMax, mVolumeHandling, mVolume);
|
mVolumeMax, mVolumeHandling, mVolume);
|
||||||
}
|
}
|
||||||
@@ -302,6 +312,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
StringBuilder result = new StringBuilder()
|
StringBuilder result = new StringBuilder()
|
||||||
.append("RoutingSessionInfo{ ")
|
.append("RoutingSessionInfo{ ")
|
||||||
.append("sessionId=").append(mId)
|
.append("sessionId=").append(mId)
|
||||||
|
.append(", name=").append(mName)
|
||||||
.append(", selectedRoutes={")
|
.append(", selectedRoutes={")
|
||||||
.append(String.join(",", mSelectedRoutes))
|
.append(String.join(",", mSelectedRoutes))
|
||||||
.append("}")
|
.append("}")
|
||||||
@@ -345,6 +356,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
// TODO: Reorder these (important ones first)
|
// TODO: Reorder these (important ones first)
|
||||||
final String mId;
|
final String mId;
|
||||||
|
CharSequence mName;
|
||||||
final String mClientPackageName;
|
final String mClientPackageName;
|
||||||
String mProviderId;
|
String mProviderId;
|
||||||
final List<String> mSelectedRoutes;
|
final List<String> mSelectedRoutes;
|
||||||
@@ -357,6 +369,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
Bundle mControlHints;
|
Bundle mControlHints;
|
||||||
boolean mIsSystemSession;
|
boolean mIsSystemSession;
|
||||||
|
|
||||||
|
//TODO: Remove this.
|
||||||
/**
|
/**
|
||||||
* Constructor for builder to create {@link RoutingSessionInfo}.
|
* Constructor for builder to create {@link RoutingSessionInfo}.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -374,10 +387,10 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
if (TextUtils.isEmpty(id)) {
|
if (TextUtils.isEmpty(id)) {
|
||||||
throw new IllegalArgumentException("id must not be empty");
|
throw new IllegalArgumentException("id must not be empty");
|
||||||
}
|
}
|
||||||
Objects.requireNonNull(clientPackageName, "clientPackageName must not be null");
|
|
||||||
|
|
||||||
mId = id;
|
mId = id;
|
||||||
mClientPackageName = clientPackageName;
|
mClientPackageName =
|
||||||
|
Objects.requireNonNull(clientPackageName, "clientPackageName must not be null");
|
||||||
mSelectedRoutes = new ArrayList<>();
|
mSelectedRoutes = new ArrayList<>();
|
||||||
mSelectableRoutes = new ArrayList<>();
|
mSelectableRoutes = new ArrayList<>();
|
||||||
mDeselectableRoutes = new ArrayList<>();
|
mDeselectableRoutes = new ArrayList<>();
|
||||||
@@ -394,6 +407,7 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");
|
Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");
|
||||||
|
|
||||||
mId = sessionInfo.mId;
|
mId = sessionInfo.mId;
|
||||||
|
mName = sessionInfo.mName;
|
||||||
mClientPackageName = sessionInfo.mClientPackageName;
|
mClientPackageName = sessionInfo.mClientPackageName;
|
||||||
mProviderId = sessionInfo.mProviderId;
|
mProviderId = sessionInfo.mProviderId;
|
||||||
|
|
||||||
@@ -410,6 +424,15 @@ public final class RoutingSessionInfo implements Parcelable {
|
|||||||
mIsSystemSession = sessionInfo.mIsSystemSession;
|
mIsSystemSession = sessionInfo.mIsSystemSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user-visible name of the session.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder setName(@Nullable CharSequence name) {
|
||||||
|
mName = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the provider ID of the session.
|
* Sets the provider ID of the session.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user