add int range on #getManufactureYear and #getManufactureWeek in

DeviceProductInfo

Bug: 182914930
Test: N/A
Change-Id: I1988690c135d8357f6ed55958d2977836006d12f
This commit is contained in:
Kriti Dang
2021-03-31 17:33:32 +02:00
parent 579904799b
commit 7efe08a2fa
2 changed files with 9 additions and 5 deletions

View File

@@ -18823,10 +18823,10 @@ package android.hardware.display {
public final class DeviceProductInfo implements android.os.Parcelable {
method public int describeContents();
method public int getConnectionToSinkType();
method public int getManufactureWeek();
method public int getManufactureYear();
method @IntRange(from=0xffffffff, to=53) public int getManufactureWeek();
method @IntRange(from=0xffffffff) public int getManufactureYear();
method @NonNull public String getManufacturerPnpId();
method public int getModelYear();
method @IntRange(from=0xffffffff) public int getModelYear();
method @Nullable public String getName();
method @NonNull public String getProductId();
method public void writeToParcel(@NonNull android.os.Parcel, int);

View File

@@ -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;
@@ -118,6 +119,7 @@ public final class DeviceProductInfo implements Parcelable {
* @return Model year of the device. Return -1 if not available. Typically,
* one of model year or manufacture year is available.
*/
@IntRange(from = -1)
public int getModelYear() {
return mModelYear != null ? mModelYear : -1;
}
@@ -126,6 +128,7 @@ public final class DeviceProductInfo implements Parcelable {
* @return The year of manufacture, or -1 it is not available. Typically,
* one of model year or manufacture year is available.
*/
@IntRange(from = -1)
public int getManufactureYear() {
if (mManufactureDate == null) {
return -1;
@@ -134,9 +137,10 @@ public final class DeviceProductInfo implements Parcelable {
}
/**
* @return The week of manufacture, or -1 it is not available. Typically,
* not present if model year is available.
* @return The week of manufacture which ranges from 1 to 53, or -1 it is not available.
* Typically, it is not present if model year is available.
*/
@IntRange(from = -1, to = 53)
public int getManufactureWeek() {
if (mManufactureDate == null) {
return -1;