diff options
| author | 2015-12-10 02:57:29 +0000 | |
|---|---|---|
| committer | 2015-12-10 02:57:29 +0000 | |
| commit | 880677bdda8a75137b7a15c9722fbf4b21bcd23f (patch) | |
| tree | 993cd453ac42878230aa05052e4c15540497dad0 | |
| parent | 1030ca69a26b7caac2bf14d4e97f9d4cca95e179 (diff) | |
| parent | 9dd66417ea984e4ff809ecdba78e3f55a8a17467 (diff) | |
Merge "MediaRouter: Add getDeviceType() to RouteInfo"
| -rw-r--r-- | api/current.txt | 5 | ||||
| -rw-r--r-- | api/system-current.txt | 5 | ||||
| -rw-r--r-- | api/test-current.txt | 5 | ||||
| -rw-r--r-- | media/java/android/media/MediaRouter.java | 56 | ||||
| -rw-r--r-- | media/java/android/media/MediaRouterClientState.java | 6 |
5 files changed, 77 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 1e99d56e44d2..9d9b2f5fa2ce 100644 --- a/api/current.txt +++ b/api/current.txt @@ -20733,6 +20733,7 @@ package android.media { public static class MediaRouter.RouteInfo { method public android.media.MediaRouter.RouteCategory getCategory(); method public java.lang.CharSequence getDescription(); + method public int getDeviceType(); method public android.media.MediaRouter.RouteGroup getGroup(); method public android.graphics.drawable.Drawable getIconDrawable(); method public java.lang.CharSequence getName(); @@ -20751,6 +20752,10 @@ package android.media { method public void requestSetVolume(int); method public void requestUpdateVolume(int); method public void setTag(java.lang.Object); + field public static final int DEVICE_TYPE_BLUETOOTH = 3; // 0x3 + field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2 + field public static final int DEVICE_TYPE_TV = 1; // 0x1 + field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0 field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0 field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1 field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 diff --git a/api/system-current.txt b/api/system-current.txt index 8be751cd383b..f9c81374d648 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -22026,6 +22026,7 @@ package android.media { public static class MediaRouter.RouteInfo { method public android.media.MediaRouter.RouteCategory getCategory(); method public java.lang.CharSequence getDescription(); + method public int getDeviceType(); method public android.media.MediaRouter.RouteGroup getGroup(); method public android.graphics.drawable.Drawable getIconDrawable(); method public java.lang.CharSequence getName(); @@ -22044,6 +22045,10 @@ package android.media { method public void requestSetVolume(int); method public void requestUpdateVolume(int); method public void setTag(java.lang.Object); + field public static final int DEVICE_TYPE_BLUETOOTH = 3; // 0x3 + field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2 + field public static final int DEVICE_TYPE_TV = 1; // 0x1 + field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0 field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0 field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1 field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 diff --git a/api/test-current.txt b/api/test-current.txt index 3e455102a05e..a59d03dab47b 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -20733,6 +20733,7 @@ package android.media { public static class MediaRouter.RouteInfo { method public android.media.MediaRouter.RouteCategory getCategory(); method public java.lang.CharSequence getDescription(); + method public int getDeviceType(); method public android.media.MediaRouter.RouteGroup getGroup(); method public android.graphics.drawable.Drawable getIconDrawable(); method public java.lang.CharSequence getName(); @@ -20751,6 +20752,10 @@ package android.media { method public void requestSetVolume(int); method public void requestUpdateVolume(int); method public void setTag(java.lang.Object); + field public static final int DEVICE_TYPE_BLUETOOTH = 3; // 0x3 + field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2 + field public static final int DEVICE_TYPE_TV = 1; // 0x1 + field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0 field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0 field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1 field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index a046512ef1cb..bcc2b40643be 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -18,6 +18,7 @@ package android.media; import android.Manifest; import android.annotation.DrawableRes; +import android.annotation.IntDef; import android.annotation.NonNull; import android.app.ActivityThread; import android.content.BroadcastReceiver; @@ -41,6 +42,8 @@ import android.text.TextUtils; import android.util.Log; import android.view.Display; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -201,6 +204,7 @@ public class MediaRouter { info.mDescription = sStatic.mResources.getText( com.android.internal.R.string.bluetooth_a2dp_audio_route_name); info.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO; + info.mDeviceType = RouteInfo.DEVICE_TYPE_BLUETOOTH; sStatic.mBluetoothA2dpRoute = info; addRouteStatic(sStatic.mBluetoothA2dpRoute); } else { @@ -480,6 +484,7 @@ public class MediaRouter { route.mName = globalRoute.name; route.mDescription = globalRoute.description; route.mSupportedTypes = globalRoute.supportedTypes; + route.mDeviceType = globalRoute.deviceType; route.mEnabled = globalRoute.enabled; route.setRealStatusCode(globalRoute.statusCode); route.mPlaybackType = globalRoute.playbackType; @@ -1411,6 +1416,7 @@ public class MediaRouter { newRoute.mDescription = sStatic.mResources.getText( com.android.internal.R.string.wireless_display_route_description); newRoute.updatePresentationDisplay(); + newRoute.mDeviceType = RouteInfo.DEVICE_TYPE_TV; return newRoute; } @@ -1470,6 +1476,7 @@ public class MediaRouter { CharSequence mDescription; private CharSequence mStatus; int mSupportedTypes; + int mDeviceType; RouteGroup mGroup; final RouteCategory mCategory; Drawable mIcon; @@ -1502,6 +1509,42 @@ public class MediaRouter { /** @hide */ public static final int STATUS_IN_USE = 5; /** @hide */ public static final int STATUS_CONNECTED = 6; + /** @hide */ + @IntDef({DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_TV, DEVICE_TYPE_SPEAKER, DEVICE_TYPE_BLUETOOTH}) + @Retention(RetentionPolicy.SOURCE) + public @interface DeviceType {} + + /** + * The default receiver device type of the route indicating the type is unknown. + * + * @see #getDeviceType + */ + public static final int DEVICE_TYPE_UNKNOWN = 0; + + /** + * A receiver device type of the route indicating the presentation of the media is happening + * on a TV. + * + * @see #getDeviceType + */ + public static final int DEVICE_TYPE_TV = 1; + + /** + * A receiver device type of the route indicating the presentation of the media is happening + * on a speaker. + * + * @see #getDeviceType + */ + public static final int DEVICE_TYPE_SPEAKER = 2; + + /** + * A receiver device type of the route indicating the presentation of the media is happening + * on a bluetooth device such as a bluetooth speaker. + * + * @see #getDeviceType + */ + public static final int DEVICE_TYPE_BLUETOOTH = 3; + private Object mTag; /** @@ -1533,6 +1576,7 @@ public class MediaRouter { RouteInfo(RouteCategory category) { mCategory = category; + mDeviceType = DEVICE_TYPE_UNKNOWN; } /** @@ -1670,6 +1714,18 @@ public class MediaRouter { return mSupportedTypes; } + /** + * Gets the type of the receiver device associated with this route. + * + * @return The type of the receiver device associated with this route: + * {@link #DEVICE_TYPE_BLUETOOTH}, {@link #DEVICE_TYPE_TV}, {@link #DEVICE_TYPE_SPEAKER}, + * or {@link #DEVICE_TYPE_UNKNOWN}. + */ + @DeviceType + public int getDeviceType() { + return mDeviceType; + } + /** @hide */ public boolean matchesTypes(int types) { return (mSupportedTypes & types) != 0; diff --git a/media/java/android/media/MediaRouterClientState.java b/media/java/android/media/MediaRouterClientState.java index 54b827631b5b..34e18f6c6094 100644 --- a/media/java/android/media/MediaRouterClientState.java +++ b/media/java/android/media/MediaRouterClientState.java @@ -104,6 +104,7 @@ public final class MediaRouterClientState implements Parcelable { public int volumeMax; public int volumeHandling; public int presentationDisplayId; + public @MediaRouter.RouteInfo.DeviceType int deviceType; public RouteInfo(String id) { this.id = id; @@ -113,6 +114,7 @@ public final class MediaRouterClientState implements Parcelable { playbackStream = -1; volumeHandling = MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED; presentationDisplayId = -1; + deviceType = MediaRouter.RouteInfo.DEVICE_TYPE_UNKNOWN; } public RouteInfo(RouteInfo other) { @@ -128,6 +130,7 @@ public final class MediaRouterClientState implements Parcelable { volumeMax = other.volumeMax; volumeHandling = other.volumeHandling; presentationDisplayId = other.presentationDisplayId; + deviceType = other.deviceType; } RouteInfo(Parcel in) { @@ -143,6 +146,7 @@ public final class MediaRouterClientState implements Parcelable { volumeMax = in.readInt(); volumeHandling = in.readInt(); presentationDisplayId = in.readInt(); + deviceType = in.readInt(); } @Override @@ -164,6 +168,7 @@ public final class MediaRouterClientState implements Parcelable { dest.writeInt(volumeMax); dest.writeInt(volumeHandling); dest.writeInt(presentationDisplayId); + dest.writeInt(deviceType); } @Override @@ -180,6 +185,7 @@ public final class MediaRouterClientState implements Parcelable { + ", volumeMax=" + volumeMax + ", volumeHandling=" + volumeHandling + ", presentationDisplayId=" + presentationDisplayId + + ", deviceType=" + deviceType + " }"; } |