From c8fe1ddd6c844ffe4f3da6fe205cea9fe3feff7b Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Thu, 1 Apr 2021 11:23:16 +0200 Subject: [PATCH] adding a public constructor for DeviceProductInfo. Improving javadoc for #getManufacturePnpId Bug: 182424090 Test: atest DisplayTest Change-Id: I99ce9dae6ace765462efa8d495fb845a6d70aa5e --- core/api/current.txt | 1 + .../hardware/display/DeviceProductInfo.java | 30 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index a30191ce63a76..f7bc402b3a9c3 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -18821,6 +18821,7 @@ package android.hardware.camera2.params { package android.hardware.display { public final class DeviceProductInfo implements android.os.Parcelable { + ctor public DeviceProductInfo(@Nullable String, @NonNull String, @NonNull String, @IntRange(from=1990) int, int); method public int describeContents(); method public int getConnectionToSinkType(); method public int getManufactureWeek(); diff --git a/core/java/android/hardware/display/DeviceProductInfo.java b/core/java/android/hardware/display/DeviceProductInfo.java index 9457d8f1aac47..0adcaa5fbcea2 100644 --- a/core/java/android/hardware/display/DeviceProductInfo.java +++ b/core/java/android/hardware/display/DeviceProductInfo.java @@ -17,6 +17,7 @@ package android.hardware.display; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; @@ -73,12 +74,26 @@ public final class DeviceProductInfo implements Parcelable { Integer modelYear, ManufactureDate manufactureDate, int connectionToSinkType) { - this.mName = name; - this.mManufacturerPnpId = manufacturerPnpId; - this.mProductId = productId; - this.mModelYear = modelYear; - this.mManufactureDate = manufactureDate; - this.mConnectionToSinkType = connectionToSinkType; + mName = name; + mManufacturerPnpId = manufacturerPnpId; + mProductId = productId; + mModelYear = modelYear; + mManufactureDate = manufactureDate; + mConnectionToSinkType = connectionToSinkType; + } + + public DeviceProductInfo( + @Nullable String name, + @NonNull String manufacturerPnpId, + @NonNull String productId, + @IntRange(from = 1990) int modelYear, + @ConnectionToSinkType int connectionToSinkType) { + mName = name; + mManufacturerPnpId = Objects.requireNonNull(manufacturerPnpId); + mProductId = Objects.requireNonNull(productId); + mModelYear = modelYear; + mManufactureDate = null; + mConnectionToSinkType = connectionToSinkType; } private DeviceProductInfo(Parcel in) { @@ -99,6 +114,9 @@ public final class DeviceProductInfo implements Parcelable { } /** + * Returns the Manufacturer Plug and Play ID. This ID identifies the manufacture according to + * the list: https://uefi.org/PNP_ID_List. It consist of 3 characters, each character + * is an uppercase letter (A-Z). * @return Manufacturer Plug and Play ID. */ @NonNull