Merge "add int range on #getManufactureYear and #getManufactureWeek in DeviceProductInfo" into sc-dev

This commit is contained in:
Kriti Dang
2021-04-07 13:49:36 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 5 deletions

View File

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

View File

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