Revert "Adding public API to expose DisplayInfo.deviceProductInfo"

Revert "Adding aidl file to share deviceProductInfo constants bw..."

Revert "Changes in tvsystem/ DeviceProductInfo to mirror changes..."

Revert "Adding new CTS test for the API display#getDeviceProductInfo"

Revert submission 13552775-expose DisplayInfo.deviceProductInfo

Reason for revert: broken test android.compat.sjp.cts.StrictJavaPackagesTest#testBootClassPathAndSystemServerClasspath_nonDuplicateClasses
    on git_sc-dev on cf_x86_64_phone-userdebug at 7162420

Bug: 181021245

Reverted Changes:
Id6767127f:Adding aidl file to share deviceProductInfo consta...
I6959d2829:Adding public API to expose DisplayInfo.deviceProd...
I720dbfe84:Adding new CTS test for the API display#getDeviceP...
I6c726e12c:Changes in tvsystem/ DeviceProductInfo to mirror c...

Change-Id: I4c8545c651d1e399ed3ca5061d1ef5f526c3929a
This commit is contained in:
Ulyana Trafimovich
2021-02-23 17:14:58 +00:00
parent 0a40860bc1
commit d6bff72799
4 changed files with 28 additions and 125 deletions

View File

@@ -16,69 +16,40 @@
package android.hardware.display;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Objects;
/**
* Product-specific information about the display or the directly connected device on the
* display chain. For example, if the display is transitively connected, this field may contain
* product information about the intermediate device.
* @hide
*/
public final class DeviceProductInfo implements Parcelable {
/** @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 =
IDeviceProductInfoConstants.CONNECTION_TO_SINK_UNKNOWN;
/** The display sink is built-in to the device */
public static final int CONNECTION_TO_SINK_BUILT_IN =
IDeviceProductInfoConstants.CONNECTION_TO_SINK_BUILT_IN;
/** The device is directly connected to the display sink. */
public static final int CONNECTION_TO_SINK_DIRECT =
IDeviceProductInfoConstants.CONNECTION_TO_SINK_DIRECT;
/** The device is transitively connected to the display sink. */
public static final int CONNECTION_TO_SINK_TRANSITIVE =
IDeviceProductInfoConstants.CONNECTION_TO_SINK_TRANSITIVE;
private final String mName;
private final String mManufacturerPnpId;
private final String mProductId;
private final Integer mModelYear;
private final ManufactureDate mManufactureDate;
private final @ConnectionToSinkType int mConnectionToSinkType;
private final int[] mRelativeAddress;
/** @hide */
public DeviceProductInfo(
String name,
String manufacturerPnpId,
String productId,
Integer modelYear,
ManufactureDate manufactureDate,
int connectionToSinkType) {
int[] relativeAddress) {
this.mName = name;
this.mManufacturerPnpId = manufacturerPnpId;
this.mProductId = productId;
this.mModelYear = modelYear;
this.mManufactureDate = manufactureDate;
this.mConnectionToSinkType = connectionToSinkType;
this.mRelativeAddress = relativeAddress;
}
private DeviceProductInfo(Parcel in) {
@@ -87,13 +58,12 @@ public final class DeviceProductInfo implements Parcelable {
mProductId = (String) in.readValue(null);
mModelYear = (Integer) in.readValue(null);
mManufactureDate = (ManufactureDate) in.readValue(null);
mConnectionToSinkType = in.readInt();
mRelativeAddress = in.createIntArray();
}
/**
* @return Display name.
*/
@Nullable
public String getName() {
return mName;
}
@@ -101,7 +71,6 @@ public final class DeviceProductInfo implements Parcelable {
/**
* @return Manufacturer Plug and Play ID.
*/
@NonNull
public String getManufacturerPnpId() {
return mManufacturerPnpId;
}
@@ -109,58 +78,32 @@ public final class DeviceProductInfo implements Parcelable {
/**
* @return Manufacturer product ID.
*/
@NonNull
public String getProductId() {
return mProductId;
}
/**
* @return Model year of the device. Return -1 if not available. Typically,
* one of model year or manufacture year is available.
* @return Model year of the device. Typically exactly one of model year or
* manufacture date will be present.
*/
public int getModelYear() {
return mModelYear != null ? mModelYear : -1;
}
/**
* @return The year of manufacture, or -1 it is not available. Typically,
* one of model year or manufacture year is available.
*/
public int getManufactureYear() {
if (mManufactureDate == null) {
return -1;
}
return mManufactureDate.mYear != null ? mManufactureDate.mYear : -1;
}
/**
* @return The week of manufacture, or -1 it is not available. Typically,
* not present if model year is available.
*/
public int getManufactureWeek() {
if (mManufactureDate == null) {
return -1;
}
return mManufactureDate.mWeek != null ? mManufactureDate.mWeek : -1;
public Integer getModelYear() {
return mModelYear;
}
/**
* @return Manufacture date. Typically exactly one of model year or manufacture
* date will be present.
*
* @hide
*/
public ManufactureDate getManufactureDate() {
return mManufactureDate;
}
/**
* @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.
* @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].
*/
@ConnectionToSinkType
public int getConnectionToSinkType() {
return mConnectionToSinkType;
public int[] getRelativeAddress() {
return mRelativeAddress;
}
@Override
@@ -176,8 +119,8 @@ public final class DeviceProductInfo implements Parcelable {
+ mModelYear
+ ", manufactureDate="
+ mManufactureDate
+ ", connectionToSinkType="
+ mConnectionToSinkType
+ ", relativeAddress="
+ Arrays.toString(mRelativeAddress)
+ '}';
}
@@ -191,16 +134,16 @@ public final class DeviceProductInfo implements Parcelable {
&& Objects.equals(mProductId, that.mProductId)
&& Objects.equals(mModelYear, that.mModelYear)
&& Objects.equals(mManufactureDate, that.mManufactureDate)
&& mConnectionToSinkType == that.mConnectionToSinkType;
&& Arrays.equals(mRelativeAddress, that.mRelativeAddress);
}
@Override
public int hashCode() {
return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate,
mConnectionToSinkType);
Arrays.hashCode(mRelativeAddress));
}
@NonNull public static final Creator<DeviceProductInfo> CREATOR =
public static final Creator<DeviceProductInfo> CREATOR =
new Creator<DeviceProductInfo>() {
@Override
public DeviceProductInfo createFromParcel(Parcel in) {
@@ -219,13 +162,13 @@ public final class DeviceProductInfo implements Parcelable {
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mName);
dest.writeString(mManufacturerPnpId);
dest.writeValue(mProductId);
dest.writeValue(mModelYear);
dest.writeValue(mManufactureDate);
dest.writeInt(mConnectionToSinkType);
dest.writeIntArray(mRelativeAddress);
}
/**