Loading core/api/current.txt +18 −0 Original line number Diff line number Diff line Loading @@ -24032,6 +24032,7 @@ package android.media { method @Nullable public android.net.Uri getIconUri(); method @NonNull public String getId(); method @NonNull public CharSequence getName(); method public int getType(); method public int getVolume(); method public int getVolumeHandling(); method public int getVolumeMax(); Loading @@ -24048,6 +24049,22 @@ package android.media { field public static final String FEATURE_REMOTE_VIDEO_PLAYBACK = "android.media.route.feature.REMOTE_VIDEO_PLAYBACK"; field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1 field public static final int TYPE_BLE_HEADSET = 26; // 0x1a field public static final int TYPE_BLUETOOTH_A2DP = 8; // 0x8 field public static final int TYPE_BUILTIN_SPEAKER = 2; // 0x2 field public static final int TYPE_DOCK = 13; // 0xd field public static final int TYPE_GROUP = 2000; // 0x7d0 field public static final int TYPE_HDMI = 9; // 0x9 field public static final int TYPE_HEARING_AID = 23; // 0x17 field public static final int TYPE_REMOTE_AUDIO_VIDEO_RECEIVER = 1003; // 0x3eb field public static final int TYPE_REMOTE_SPEAKER = 1002; // 0x3ea field public static final int TYPE_REMOTE_TV = 1001; // 0x3e9 field public static final int TYPE_UNKNOWN = 0; // 0x0 field public static final int TYPE_USB_ACCESSORY = 12; // 0xc field public static final int TYPE_USB_DEVICE = 11; // 0xb field public static final int TYPE_USB_HEADSET = 22; // 0x16 field public static final int TYPE_WIRED_HEADPHONES = 4; // 0x4 field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } public static final class MediaRoute2Info.Builder { Loading @@ -24063,6 +24080,7 @@ package android.media { method @NonNull public android.media.MediaRoute2Info.Builder setDescription(@Nullable CharSequence); method @NonNull public android.media.MediaRoute2Info.Builder setExtras(@Nullable android.os.Bundle); method @NonNull public android.media.MediaRoute2Info.Builder setIconUri(@Nullable android.net.Uri); method @NonNull public android.media.MediaRoute2Info.Builder setType(int); method @NonNull public android.media.MediaRoute2Info.Builder setVisibilityPublic(); method @NonNull public android.media.MediaRoute2Info.Builder setVisibilityRestricted(@NonNull java.util.Set<java.lang.String>); method @NonNull public android.media.MediaRoute2Info.Builder setVolume(int); media/java/android/media/MediaRoute2Info.java +107 −47 Original line number Diff line number Diff line Loading @@ -108,133 +108,148 @@ public final class MediaRoute2Info implements Parcelable { public static final int PLAYBACK_VOLUME_VARIABLE = 1; /** @hide */ @IntDef({ TYPE_UNKNOWN, TYPE_BUILTIN_SPEAKER, TYPE_WIRED_HEADSET, TYPE_WIRED_HEADPHONES, TYPE_BLUETOOTH_A2DP, TYPE_HDMI, TYPE_USB_DEVICE, TYPE_USB_ACCESSORY, TYPE_DOCK, TYPE_USB_HEADSET, TYPE_HEARING_AID, TYPE_BLE_HEADSET, TYPE_REMOTE_TV, TYPE_REMOTE_SPEAKER, TYPE_GROUP}) @IntDef( prefix = {"TYPE_"}, value = { TYPE_UNKNOWN, TYPE_BUILTIN_SPEAKER, TYPE_WIRED_HEADSET, TYPE_WIRED_HEADPHONES, TYPE_BLUETOOTH_A2DP, TYPE_HDMI, TYPE_USB_DEVICE, TYPE_USB_ACCESSORY, TYPE_DOCK, TYPE_USB_HEADSET, TYPE_HEARING_AID, TYPE_BLE_HEADSET, TYPE_REMOTE_TV, TYPE_REMOTE_SPEAKER, TYPE_REMOTE_AUDIO_VIDEO_RECEIVER, TYPE_GROUP }) @Retention(RetentionPolicy.SOURCE) public @interface Type {} /** * The default route type indicating the type is unknown. * Indicates the route's type is unknown or undefined. * * @see #getType * @hide */ public static final int TYPE_UNKNOWN = 0; /** * A route type describing the speaker system (i.e. a mono speaker or stereo speakers) built * in a device. * Indicates the route is the speaker system (i.e. a mono speaker or stereo speakers) built into * the device. * * @see #getType * @hide */ public static final int TYPE_BUILTIN_SPEAKER = AudioDeviceInfo.TYPE_BUILTIN_SPEAKER; /** * A route type describing a headset, which is the combination of a headphones and microphone. * Indicates the route is a headset, which is the combination of a headphones and a microphone. * * @see #getType * @hide */ public static final int TYPE_WIRED_HEADSET = AudioDeviceInfo.TYPE_WIRED_HEADSET; /** * A route type describing a pair of wired headphones. * Indicates the route is a pair of wired headphones. * * @see #getType * @hide */ public static final int TYPE_WIRED_HEADPHONES = AudioDeviceInfo.TYPE_WIRED_HEADPHONES; /** * A route type indicating the presentation of the media is happening * on a bluetooth device such as a bluetooth speaker. * Indicates the route is a bluetooth device, such as a bluetooth speaker or headphones. * * @see #getType * @hide */ public static final int TYPE_BLUETOOTH_A2DP = AudioDeviceInfo.TYPE_BLUETOOTH_A2DP; /** * A route type describing an HDMI connection. * Indicates the route is an HDMI connection. * * @see #getType * @hide */ public static final int TYPE_HDMI = AudioDeviceInfo.TYPE_HDMI; /** * A route type describing a USB audio device. * Indicates the route is a USB audio device. * * @see #getType * @hide */ public static final int TYPE_USB_DEVICE = AudioDeviceInfo.TYPE_USB_DEVICE; /** * A route type describing a USB audio device in accessory mode. * Indicates the route is a USB audio device in accessory mode. * * @see #getType * @hide */ public static final int TYPE_USB_ACCESSORY = AudioDeviceInfo.TYPE_USB_ACCESSORY; /** * A route type describing the audio device associated with a dock. * Indicates the route is the audio device associated with a dock. * * @see #getType * @hide */ public static final int TYPE_DOCK = AudioDeviceInfo.TYPE_DOCK; /** * A device type describing a USB audio headset. * Indicates the route is a USB audio headset. * * @see #getType * @hide */ public static final int TYPE_USB_HEADSET = AudioDeviceInfo.TYPE_USB_HEADSET; /** * A route type describing a Hearing Aid. * Indicates the route is a hearing aid. * * @see #getType * @hide */ public static final int TYPE_HEARING_AID = AudioDeviceInfo.TYPE_HEARING_AID; /** * A route type describing a BLE HEADSET. * Indicates the route is a Bluetooth Low Energy (BLE) HEADSET. * * @see #getType * @hide */ public static final int TYPE_BLE_HEADSET = AudioDeviceInfo.TYPE_BLE_HEADSET; /** * A route type indicating the presentation of the media is happening on a TV. * Indicates the route is a remote TV. * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType * @hide */ public static final int TYPE_REMOTE_TV = 1001; /** * A route type indicating the presentation of the media is happening on a speaker. * Indicates the route is a remote speaker. * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType * @hide */ public static final int TYPE_REMOTE_SPEAKER = 1002; /** * A route type indicating the presentation of the media is happening on multiple devices. * Indicates the route is a remote Audio/Video Receiver (AVR). * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType */ public static final int TYPE_REMOTE_AUDIO_VIDEO_RECEIVER = 1003; /** * Indicates the route is a group of devices. * * @see #getType * @hide */ public static final int TYPE_GROUP = 2000; Loading Loading @@ -436,16 +451,23 @@ public final class MediaRoute2Info implements Parcelable { } /** * Gets the type of this route. * Returns the type of this route. * * @return The type of this route: * {@link #TYPE_UNKNOWN}, * {@link #TYPE_BUILTIN_SPEAKER}, {@link #TYPE_WIRED_HEADSET}, {@link #TYPE_WIRED_HEADPHONES}, * {@link #TYPE_BLUETOOTH_A2DP}, {@link #TYPE_HDMI}, {@link #TYPE_DOCK}, * {@Link #TYPE_USB_DEVICE}, {@link #TYPE_USB_ACCESSORY}, {@link #TYPE_USB_HEADSET} * {@link #TYPE_HEARING_AID}, * {@link #TYPE_REMOTE_TV}, {@link #TYPE_REMOTE_SPEAKER}, {@link #TYPE_GROUP}. * @hide * @see #TYPE_UNKNOWN * @see #TYPE_BUILTIN_SPEAKER * @see #TYPE_WIRED_HEADSET * @see #TYPE_WIRED_HEADPHONES * @see #TYPE_BLUETOOTH_A2DP * @see #TYPE_HDMI * @see #TYPE_DOCK * @see #TYPE_USB_DEVICE * @see #TYPE_USB_ACCESSORY * @see #TYPE_USB_HEADSET * @see #TYPE_HEARING_AID * @see #TYPE_REMOTE_TV * @see #TYPE_REMOTE_SPEAKER * @see #TYPE_REMOTE_AUDIO_VIDEO_RECEIVER * @see #TYPE_GROUP */ @Type public int getType() { Loading Loading @@ -657,6 +679,7 @@ public final class MediaRoute2Info implements Parcelable { pw.println(indent + "mId=" + mId); pw.println(indent + "mName=" + mName); pw.println(indent + "mFeatures=" + mFeatures); pw.println(indent + "mType=" + getDeviceTypeString(mType)); pw.println(indent + "mIsSystem=" + mIsSystem); pw.println(indent + "mIconUri=" + mIconUri); pw.println(indent + "mDescription=" + mDescription); Loading Loading @@ -787,6 +810,42 @@ public final class MediaRoute2Info implements Parcelable { dest.writeString8Array(mAllowedPackages.toArray(new String[0])); } private static String getDeviceTypeString(@Type int deviceType) { switch (deviceType) { case TYPE_BUILTIN_SPEAKER: return "BUILTIN_SPEAKER"; case TYPE_WIRED_HEADSET: return "WIRED_HEADSET"; case TYPE_WIRED_HEADPHONES: return "WIRED_HEADPHONES"; case TYPE_BLUETOOTH_A2DP: return "BLUETOOTH_A2DP"; case TYPE_HDMI: return "HDMI"; case TYPE_DOCK: return "DOCK"; case TYPE_USB_DEVICE: return "USB_DEVICE"; case TYPE_USB_ACCESSORY: return "USB_ACCESSORY"; case TYPE_USB_HEADSET: return "USB_HEADSET"; case TYPE_HEARING_AID: return "HEARING_AID"; case TYPE_REMOTE_TV: return "REMOTE_TV"; case TYPE_REMOTE_SPEAKER: return "REMOTE_SPEAKER"; case TYPE_REMOTE_AUDIO_VIDEO_RECEIVER: return "REMOTE_AUDIO_VIDEO_RECEIVER"; case TYPE_GROUP: return "GROUP"; case TYPE_UNKNOWN: default: return TextUtils.formatSimple("UNKNOWN(%d)", deviceType); } } /** * Builder for {@link MediaRoute2Info media route info}. */ Loading Loading @@ -932,7 +991,8 @@ public final class MediaRoute2Info implements Parcelable { /** * Sets the route's type. * @hide * * @see MediaRoute2Info#getType() */ @NonNull public Builder setType(@Type int type) { Loading packages/SettingsLib/src/com/android/settingslib/media/InfoMediaDevice.java +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ public class InfoMediaDevice extends MediaDevice { } @VisibleForTesting // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") int getDrawableResId() { int resId; switch (mRouteInfo.getType()) { Loading packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,8 @@ public class InfoMediaManager extends MediaManager { dispatchDeviceListAdded(); } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private void buildAllRoutes() { for (MediaRoute2Info route : mRouterManager.getAllRoutes()) { if (DEBUG) { Loading @@ -462,6 +464,8 @@ public class InfoMediaManager extends MediaManager { return infos; } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private synchronized void buildAvailableRoutes() { for (MediaRoute2Info route : getAvailableRoutes(mPackageName)) { if (DEBUG) { Loading Loading @@ -512,6 +516,8 @@ public class InfoMediaManager extends MediaManager { } } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") @VisibleForTesting void addMediaDevice(MediaRoute2Info route) { //TODO(b/258141461): Attach flag and disable reason in MediaDevice Loading packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java +4 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,8 @@ public abstract class MediaDevice implements Comparable<MediaDevice> { setType(info); } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private void setType(MediaRoute2Info info) { if (info == null) { mType = MediaDeviceType.TYPE_BLUETOOTH_DEVICE; Loading Loading @@ -335,6 +337,8 @@ public abstract class MediaDevice implements Comparable<MediaDevice> { * * @return true if the RouteInfo equals TYPE_BLE_HEADSET. */ // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") public boolean isBLEDevice() { return mRouteInfo.getType() == TYPE_BLE_HEADSET; } Loading Loading
core/api/current.txt +18 −0 Original line number Diff line number Diff line Loading @@ -24032,6 +24032,7 @@ package android.media { method @Nullable public android.net.Uri getIconUri(); method @NonNull public String getId(); method @NonNull public CharSequence getName(); method public int getType(); method public int getVolume(); method public int getVolumeHandling(); method public int getVolumeMax(); Loading @@ -24048,6 +24049,22 @@ package android.media { field public static final String FEATURE_REMOTE_VIDEO_PLAYBACK = "android.media.route.feature.REMOTE_VIDEO_PLAYBACK"; field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1 field public static final int TYPE_BLE_HEADSET = 26; // 0x1a field public static final int TYPE_BLUETOOTH_A2DP = 8; // 0x8 field public static final int TYPE_BUILTIN_SPEAKER = 2; // 0x2 field public static final int TYPE_DOCK = 13; // 0xd field public static final int TYPE_GROUP = 2000; // 0x7d0 field public static final int TYPE_HDMI = 9; // 0x9 field public static final int TYPE_HEARING_AID = 23; // 0x17 field public static final int TYPE_REMOTE_AUDIO_VIDEO_RECEIVER = 1003; // 0x3eb field public static final int TYPE_REMOTE_SPEAKER = 1002; // 0x3ea field public static final int TYPE_REMOTE_TV = 1001; // 0x3e9 field public static final int TYPE_UNKNOWN = 0; // 0x0 field public static final int TYPE_USB_ACCESSORY = 12; // 0xc field public static final int TYPE_USB_DEVICE = 11; // 0xb field public static final int TYPE_USB_HEADSET = 22; // 0x16 field public static final int TYPE_WIRED_HEADPHONES = 4; // 0x4 field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } public static final class MediaRoute2Info.Builder { Loading @@ -24063,6 +24080,7 @@ package android.media { method @NonNull public android.media.MediaRoute2Info.Builder setDescription(@Nullable CharSequence); method @NonNull public android.media.MediaRoute2Info.Builder setExtras(@Nullable android.os.Bundle); method @NonNull public android.media.MediaRoute2Info.Builder setIconUri(@Nullable android.net.Uri); method @NonNull public android.media.MediaRoute2Info.Builder setType(int); method @NonNull public android.media.MediaRoute2Info.Builder setVisibilityPublic(); method @NonNull public android.media.MediaRoute2Info.Builder setVisibilityRestricted(@NonNull java.util.Set<java.lang.String>); method @NonNull public android.media.MediaRoute2Info.Builder setVolume(int);
media/java/android/media/MediaRoute2Info.java +107 −47 Original line number Diff line number Diff line Loading @@ -108,133 +108,148 @@ public final class MediaRoute2Info implements Parcelable { public static final int PLAYBACK_VOLUME_VARIABLE = 1; /** @hide */ @IntDef({ TYPE_UNKNOWN, TYPE_BUILTIN_SPEAKER, TYPE_WIRED_HEADSET, TYPE_WIRED_HEADPHONES, TYPE_BLUETOOTH_A2DP, TYPE_HDMI, TYPE_USB_DEVICE, TYPE_USB_ACCESSORY, TYPE_DOCK, TYPE_USB_HEADSET, TYPE_HEARING_AID, TYPE_BLE_HEADSET, TYPE_REMOTE_TV, TYPE_REMOTE_SPEAKER, TYPE_GROUP}) @IntDef( prefix = {"TYPE_"}, value = { TYPE_UNKNOWN, TYPE_BUILTIN_SPEAKER, TYPE_WIRED_HEADSET, TYPE_WIRED_HEADPHONES, TYPE_BLUETOOTH_A2DP, TYPE_HDMI, TYPE_USB_DEVICE, TYPE_USB_ACCESSORY, TYPE_DOCK, TYPE_USB_HEADSET, TYPE_HEARING_AID, TYPE_BLE_HEADSET, TYPE_REMOTE_TV, TYPE_REMOTE_SPEAKER, TYPE_REMOTE_AUDIO_VIDEO_RECEIVER, TYPE_GROUP }) @Retention(RetentionPolicy.SOURCE) public @interface Type {} /** * The default route type indicating the type is unknown. * Indicates the route's type is unknown or undefined. * * @see #getType * @hide */ public static final int TYPE_UNKNOWN = 0; /** * A route type describing the speaker system (i.e. a mono speaker or stereo speakers) built * in a device. * Indicates the route is the speaker system (i.e. a mono speaker or stereo speakers) built into * the device. * * @see #getType * @hide */ public static final int TYPE_BUILTIN_SPEAKER = AudioDeviceInfo.TYPE_BUILTIN_SPEAKER; /** * A route type describing a headset, which is the combination of a headphones and microphone. * Indicates the route is a headset, which is the combination of a headphones and a microphone. * * @see #getType * @hide */ public static final int TYPE_WIRED_HEADSET = AudioDeviceInfo.TYPE_WIRED_HEADSET; /** * A route type describing a pair of wired headphones. * Indicates the route is a pair of wired headphones. * * @see #getType * @hide */ public static final int TYPE_WIRED_HEADPHONES = AudioDeviceInfo.TYPE_WIRED_HEADPHONES; /** * A route type indicating the presentation of the media is happening * on a bluetooth device such as a bluetooth speaker. * Indicates the route is a bluetooth device, such as a bluetooth speaker or headphones. * * @see #getType * @hide */ public static final int TYPE_BLUETOOTH_A2DP = AudioDeviceInfo.TYPE_BLUETOOTH_A2DP; /** * A route type describing an HDMI connection. * Indicates the route is an HDMI connection. * * @see #getType * @hide */ public static final int TYPE_HDMI = AudioDeviceInfo.TYPE_HDMI; /** * A route type describing a USB audio device. * Indicates the route is a USB audio device. * * @see #getType * @hide */ public static final int TYPE_USB_DEVICE = AudioDeviceInfo.TYPE_USB_DEVICE; /** * A route type describing a USB audio device in accessory mode. * Indicates the route is a USB audio device in accessory mode. * * @see #getType * @hide */ public static final int TYPE_USB_ACCESSORY = AudioDeviceInfo.TYPE_USB_ACCESSORY; /** * A route type describing the audio device associated with a dock. * Indicates the route is the audio device associated with a dock. * * @see #getType * @hide */ public static final int TYPE_DOCK = AudioDeviceInfo.TYPE_DOCK; /** * A device type describing a USB audio headset. * Indicates the route is a USB audio headset. * * @see #getType * @hide */ public static final int TYPE_USB_HEADSET = AudioDeviceInfo.TYPE_USB_HEADSET; /** * A route type describing a Hearing Aid. * Indicates the route is a hearing aid. * * @see #getType * @hide */ public static final int TYPE_HEARING_AID = AudioDeviceInfo.TYPE_HEARING_AID; /** * A route type describing a BLE HEADSET. * Indicates the route is a Bluetooth Low Energy (BLE) HEADSET. * * @see #getType * @hide */ public static final int TYPE_BLE_HEADSET = AudioDeviceInfo.TYPE_BLE_HEADSET; /** * A route type indicating the presentation of the media is happening on a TV. * Indicates the route is a remote TV. * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType * @hide */ public static final int TYPE_REMOTE_TV = 1001; /** * A route type indicating the presentation of the media is happening on a speaker. * Indicates the route is a remote speaker. * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType * @hide */ public static final int TYPE_REMOTE_SPEAKER = 1002; /** * A route type indicating the presentation of the media is happening on multiple devices. * Indicates the route is a remote Audio/Video Receiver (AVR). * * <p>A remote device uses a routing protocol managed by the application, as opposed to the * routing being done by the system. * * @see #getType */ public static final int TYPE_REMOTE_AUDIO_VIDEO_RECEIVER = 1003; /** * Indicates the route is a group of devices. * * @see #getType * @hide */ public static final int TYPE_GROUP = 2000; Loading Loading @@ -436,16 +451,23 @@ public final class MediaRoute2Info implements Parcelable { } /** * Gets the type of this route. * Returns the type of this route. * * @return The type of this route: * {@link #TYPE_UNKNOWN}, * {@link #TYPE_BUILTIN_SPEAKER}, {@link #TYPE_WIRED_HEADSET}, {@link #TYPE_WIRED_HEADPHONES}, * {@link #TYPE_BLUETOOTH_A2DP}, {@link #TYPE_HDMI}, {@link #TYPE_DOCK}, * {@Link #TYPE_USB_DEVICE}, {@link #TYPE_USB_ACCESSORY}, {@link #TYPE_USB_HEADSET} * {@link #TYPE_HEARING_AID}, * {@link #TYPE_REMOTE_TV}, {@link #TYPE_REMOTE_SPEAKER}, {@link #TYPE_GROUP}. * @hide * @see #TYPE_UNKNOWN * @see #TYPE_BUILTIN_SPEAKER * @see #TYPE_WIRED_HEADSET * @see #TYPE_WIRED_HEADPHONES * @see #TYPE_BLUETOOTH_A2DP * @see #TYPE_HDMI * @see #TYPE_DOCK * @see #TYPE_USB_DEVICE * @see #TYPE_USB_ACCESSORY * @see #TYPE_USB_HEADSET * @see #TYPE_HEARING_AID * @see #TYPE_REMOTE_TV * @see #TYPE_REMOTE_SPEAKER * @see #TYPE_REMOTE_AUDIO_VIDEO_RECEIVER * @see #TYPE_GROUP */ @Type public int getType() { Loading Loading @@ -657,6 +679,7 @@ public final class MediaRoute2Info implements Parcelable { pw.println(indent + "mId=" + mId); pw.println(indent + "mName=" + mName); pw.println(indent + "mFeatures=" + mFeatures); pw.println(indent + "mType=" + getDeviceTypeString(mType)); pw.println(indent + "mIsSystem=" + mIsSystem); pw.println(indent + "mIconUri=" + mIconUri); pw.println(indent + "mDescription=" + mDescription); Loading Loading @@ -787,6 +810,42 @@ public final class MediaRoute2Info implements Parcelable { dest.writeString8Array(mAllowedPackages.toArray(new String[0])); } private static String getDeviceTypeString(@Type int deviceType) { switch (deviceType) { case TYPE_BUILTIN_SPEAKER: return "BUILTIN_SPEAKER"; case TYPE_WIRED_HEADSET: return "WIRED_HEADSET"; case TYPE_WIRED_HEADPHONES: return "WIRED_HEADPHONES"; case TYPE_BLUETOOTH_A2DP: return "BLUETOOTH_A2DP"; case TYPE_HDMI: return "HDMI"; case TYPE_DOCK: return "DOCK"; case TYPE_USB_DEVICE: return "USB_DEVICE"; case TYPE_USB_ACCESSORY: return "USB_ACCESSORY"; case TYPE_USB_HEADSET: return "USB_HEADSET"; case TYPE_HEARING_AID: return "HEARING_AID"; case TYPE_REMOTE_TV: return "REMOTE_TV"; case TYPE_REMOTE_SPEAKER: return "REMOTE_SPEAKER"; case TYPE_REMOTE_AUDIO_VIDEO_RECEIVER: return "REMOTE_AUDIO_VIDEO_RECEIVER"; case TYPE_GROUP: return "GROUP"; case TYPE_UNKNOWN: default: return TextUtils.formatSimple("UNKNOWN(%d)", deviceType); } } /** * Builder for {@link MediaRoute2Info media route info}. */ Loading Loading @@ -932,7 +991,8 @@ public final class MediaRoute2Info implements Parcelable { /** * Sets the route's type. * @hide * * @see MediaRoute2Info#getType() */ @NonNull public Builder setType(@Type int type) { Loading
packages/SettingsLib/src/com/android/settingslib/media/InfoMediaDevice.java +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ public class InfoMediaDevice extends MediaDevice { } @VisibleForTesting // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") int getDrawableResId() { int resId; switch (mRouteInfo.getType()) { Loading
packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,8 @@ public class InfoMediaManager extends MediaManager { dispatchDeviceListAdded(); } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private void buildAllRoutes() { for (MediaRoute2Info route : mRouterManager.getAllRoutes()) { if (DEBUG) { Loading @@ -462,6 +464,8 @@ public class InfoMediaManager extends MediaManager { return infos; } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private synchronized void buildAvailableRoutes() { for (MediaRoute2Info route : getAvailableRoutes(mPackageName)) { if (DEBUG) { Loading Loading @@ -512,6 +516,8 @@ public class InfoMediaManager extends MediaManager { } } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") @VisibleForTesting void addMediaDevice(MediaRoute2Info route) { //TODO(b/258141461): Attach flag and disable reason in MediaDevice Loading
packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java +4 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,8 @@ public abstract class MediaDevice implements Comparable<MediaDevice> { setType(info); } // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") private void setType(MediaRoute2Info info) { if (info == null) { mType = MediaDeviceType.TYPE_BLUETOOTH_DEVICE; Loading Loading @@ -335,6 +337,8 @@ public abstract class MediaDevice implements Comparable<MediaDevice> { * * @return true if the RouteInfo equals TYPE_BLE_HEADSET. */ // MediaRoute2Info.getType was made public on API 34, but exists since API 30. @SuppressWarnings("NewApi") public boolean isBLEDevice() { return mRouteInfo.getType() == TYPE_BLE_HEADSET; } Loading