diff options
author | Kriti Dang <kritidang@google.com> | 2021-02-22 13:37:56 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-22 13:37:56 +0000 |
commit | c1ee93795d62b6f87d96d71f549b7e64c9aeeda5 (patch) | |
tree | e3a07cb7a9ef549582f7207648c4b8d4f07c7026 | |
parent | 47dd33d6d97720831e03a5bc389f0616236ca941 (diff) | |
parent | 344a0b4d7af31404aa7f69ace75524fa2ef065d0 (diff) | |
download | tvsystem-c1ee93795d62b6f87d96d71f549b7e64c9aeeda5.tar.gz |
Merge "Changes in tvsystem/ DeviceProductInfo to mirror changes in frameworks/base/ DeviceProductInfo" into sc-dev am: 344a0b4d7a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/tv/tvsystem/+/13552775
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ieea7d192dbcdcadbf6246764bbe3863442e82f3b
-rw-r--r-- | api/current.txt | 10 | ||||
-rw-r--r-- | java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java | 72 | ||||
-rw-r--r-- | java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java | 2 |
3 files changed, 73 insertions, 11 deletions
diff --git a/api/current.txt b/api/current.txt index 09cb6e8..fd59a47 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2,13 +2,19 @@ package com.android.libraries.tv.tvsystem.display { public final class DeviceProductInfo { - ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + ctor @Deprecated public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int[]); + ctor public DeviceProductInfo(String, String, String, Integer, com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate, int); + method public int getConnectionToSinkType(); method public com.android.libraries.tv.tvsystem.display.DeviceProductInfo.ManufactureDate getManufactureDate(); method public String getManufacturerPnpId(); method public Integer getModelYear(); method public String getName(); method public String getProductId(); - method public int[] getRelativeAddress(); + method @Deprecated public int[] getRelativeAddress(); + field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 + field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 + field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 + field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 } public static class DeviceProductInfo.ManufactureDate { diff --git a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java index 6e78253..5620f45 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java +++ b/java/com/android/libraries/tv/tvsystem/display/DeviceProductInfo.java @@ -16,7 +16,10 @@ package com.android.libraries.tv.tvsystem.display; -import java.util.Arrays; +import android.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** @@ -25,13 +28,39 @@ import java.util.Objects; * product information about the intermediate device. */ public final class DeviceProductInfo { + /** @hide */ + @IntDef(prefix = {"CONNECTION_TO_SINK_"}, value = { + CONNECTION_TO_SINK_UNKNOWN, + CONNECTION_TO_SINK_BUILT_IN, + CONNECTION_TO_SINK_DIRECT, + CONNECTION_TO_SINK_TRANSITIVE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ConnectionToSinkType { } + + /** The device connection to the display sink is unknown. */ + public static final int CONNECTION_TO_SINK_UNKNOWN = 0; + + /** The display sink is built-in to the device */ + public static final int CONNECTION_TO_SINK_BUILT_IN = 1; + + /** The device is directly connected to the display sink. */ + public static final int CONNECTION_TO_SINK_DIRECT = 2; + + /** The device is transitively connected to the display sink. */ + public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; + private final String mName; private final String mManufacturerPnpId; private final String mProductId; private final Integer mModelYear; private final ManufactureDate mManufactureDate; - private final int[] mRelativeAddress; + private final @ConnectionToSinkType int mConnectionToSinkType; + /** @deprecated use + * {@link #DeviceProductInfo(String, String, String, Integer, ManufactureDate, int)} ()} + * instead.*/ + @Deprecated public DeviceProductInfo( String name, String manufacturerPnpId, @@ -44,7 +73,22 @@ public final class DeviceProductInfo { this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; - this.mRelativeAddress = relativeAddress; + this.mConnectionToSinkType = CONNECTION_TO_SINK_UNKNOWN; + } + + public DeviceProductInfo( + String name, + String manufacturerPnpId, + String productId, + Integer modelYear, + ManufactureDate manufactureDate, + int connectionToSinkType) { + this.mName = name; + this.mManufacturerPnpId = manufacturerPnpId; + this.mProductId = productId; + this.mModelYear = modelYear; + this.mManufactureDate = manufactureDate; + this.mConnectionToSinkType = connectionToSinkType; } /** @@ -87,9 +131,21 @@ public final class DeviceProductInfo { /** * @return Relative address in the display network. For example, for HDMI connected devices this * can be its physical address. Each component of the address is in the range [0, 255]. + * + * @deprecated use {@link #getConnectionToSinkType()} instead. */ + @Deprecated public int[] getRelativeAddress() { - return mRelativeAddress; + return null; + } + + /** + * @return How the current device is connected to the display sink. For example, the display + * can be connected immediately to the device or there can be a receiver in between. + */ + @ConnectionToSinkType + public int getConnectionToSinkType() { + return mConnectionToSinkType; } @Override @@ -105,8 +161,8 @@ public final class DeviceProductInfo { + mModelYear + ", manufactureDate=" + mManufactureDate - + ", relativeAddress=" - + Arrays.toString(mRelativeAddress) + + ", connectionToSinkType=" + + mConnectionToSinkType + '}'; } @@ -120,13 +176,13 @@ public final class DeviceProductInfo { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) - && Arrays.equals(mRelativeAddress, that.mRelativeAddress); + && mConnectionToSinkType == that.mConnectionToSinkType; } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, - mRelativeAddress); + mConnectionToSinkType); } /** diff --git a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java index fb19f98..746f90b 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java +++ b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java @@ -64,7 +64,7 @@ public final class DisplayCompatUtil { } return new DeviceProductInfo(info.getName(), info.getManufacturerPnpId(), info.getProductId(), info.getModelYear(), manufactureDate, - info.getRelativeAddress()); + info.getConnectionToSinkType()); } private DisplayCompatUtil() {} |