diff options
| author | Marin Shalamanov <shalamanov@google.com> | 2020-04-06 19:45:32 +0200 |
|---|---|---|
| committer | Marin Shalamanov <shalamanov@google.com> | 2020-04-14 16:52:11 +0200 |
| commit | 443c4d047afb779f574639314e133d781d28c355 (patch) | |
| tree | 8638629d496ec11f6a48f23138fb728fcd33d4ef /core/java | |
| parent | 0131d5018826d995f434be52a53f52189f127a71 (diff) | |
[RESTRICT AUTOMERGE] Add relative address to DeviceProductInfo.
This CL adds a field relativeAddress to DeviceProductInfo which
contains the device address in the display network. For example,
for HDMI connections the field is populated with the physical address.
Bug: 147994746
Test: adb shell dumpsys display
Change-Id: I87d9fd00bd16abc7594dc3f6b6d4e00c8968af07
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/hardware/display/DeviceProductInfo.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/core/java/android/hardware/display/DeviceProductInfo.java b/core/java/android/hardware/display/DeviceProductInfo.java index ed50d7cae8cc..94c5dd884eab 100644 --- a/core/java/android/hardware/display/DeviceProductInfo.java +++ b/core/java/android/hardware/display/DeviceProductInfo.java @@ -19,6 +19,7 @@ package android.hardware.display; import android.os.Parcel; import android.os.Parcelable; +import java.util.Arrays; import java.util.Objects; /** @@ -33,18 +34,21 @@ public final class DeviceProductInfo implements Parcelable { private final String mProductId; private final Integer mModelYear; private final ManufactureDate mManufactureDate; + private final int[] mRelativeAddress; public DeviceProductInfo( String name, String manufacturerPnpId, String productId, Integer modelYear, - ManufactureDate manufactureDate) { + ManufactureDate manufactureDate, + int[] relativeAddress) { this.mName = name; this.mManufacturerPnpId = manufacturerPnpId; this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; + this.mRelativeAddress = relativeAddress; } private DeviceProductInfo(Parcel in) { @@ -53,6 +57,7 @@ public final class DeviceProductInfo implements Parcelable { mProductId = (String) in.readValue(null); mModelYear = (Integer) in.readValue(null); mManufactureDate = (ManufactureDate) in.readValue(null); + mRelativeAddress = in.createIntArray(); } /** @@ -92,6 +97,14 @@ public final class DeviceProductInfo implements Parcelable { return mManufactureDate; } + /** + * @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]. + */ + public int[] getRelativeAddress() { + return mRelativeAddress; + } + @Override public String toString() { return "DeviceProductInfo{" @@ -105,6 +118,8 @@ public final class DeviceProductInfo implements Parcelable { + mModelYear + ", manufactureDate=" + mManufactureDate + + ", relativeAddress=" + + Arrays.toString(mRelativeAddress) + '}'; } @@ -117,12 +132,14 @@ public final class DeviceProductInfo implements Parcelable { && Objects.equals(mManufacturerPnpId, that.mManufacturerPnpId) && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) - && Objects.equals(mManufactureDate, that.mManufactureDate); + && Objects.equals(mManufactureDate, that.mManufactureDate) + && Arrays.equals(mRelativeAddress, that.mRelativeAddress); } @Override public int hashCode() { - return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate); + return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, + mRelativeAddress); } public static final Creator<DeviceProductInfo> CREATOR = @@ -150,6 +167,7 @@ public final class DeviceProductInfo implements Parcelable { dest.writeValue(mProductId); dest.writeValue(mModelYear); dest.writeValue(mManufactureDate); + dest.writeIntArray(mRelativeAddress); } /** |
