Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -421,6 +421,7 @@ filegroup { ":resourcemanager_aidl", ":storaged_aidl", ":vold_aidl", ":deviceproductinfoconstants_aidl", // For the generated R.java and Manifest.java ":framework-res{.aapt.srcjar}", Loading core/api/current.txt +18 −0 Original line number Diff line number Diff line Loading @@ -18569,6 +18569,23 @@ package android.hardware.camera2.params { 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 @NonNull public String getManufacturerPnpId(); method public int getModelYear(); method @Nullable public String getName(); method @NonNull public String getProductId(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.DeviceProductInfo> CREATOR; } public final class DisplayManager { method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int); method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int, @Nullable android.hardware.display.VirtualDisplay.Callback, @Nullable android.os.Handler); Loading Loading @@ -46248,6 +46265,7 @@ package android.view { method public long getAppVsyncOffsetNanos(); method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point); method @Nullable public android.view.DisplayCutout getCutout(); method @Nullable public android.hardware.display.DeviceProductInfo getDeviceProductInfo(); method public int getDisplayId(); method public int getFlags(); method public android.view.Display.HdrCapabilities getHdrCapabilities(); core/java/android/hardware/display/DeviceProductInfo.java +78 −21 Original line number Diff line number Diff line Loading @@ -16,40 +16,69 @@ 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.util.Arrays; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; 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 int[] mRelativeAddress; private final @ConnectionToSinkType int mConnectionToSinkType; /** @hide */ public DeviceProductInfo( String name, String manufacturerPnpId, String productId, Integer modelYear, ManufactureDate manufactureDate, int[] relativeAddress) { int connectionToSinkType) { this.mName = name; this.mManufacturerPnpId = manufacturerPnpId; this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; this.mRelativeAddress = relativeAddress; this.mConnectionToSinkType = connectionToSinkType; } private DeviceProductInfo(Parcel in) { Loading @@ -58,12 +87,13 @@ public final class DeviceProductInfo implements Parcelable { mProductId = (String) in.readValue(null); mModelYear = (Integer) in.readValue(null); mManufactureDate = (ManufactureDate) in.readValue(null); mRelativeAddress = in.createIntArray(); mConnectionToSinkType = in.readInt(); } /** * @return Display name. */ @Nullable public String getName() { return mName; } Loading @@ -71,6 +101,7 @@ public final class DeviceProductInfo implements Parcelable { /** * @return Manufacturer Plug and Play ID. */ @NonNull public String getManufacturerPnpId() { return mManufacturerPnpId; } Loading @@ -78,32 +109,58 @@ public final class DeviceProductInfo implements Parcelable { /** * @return Manufacturer product ID. */ @NonNull public String getProductId() { return mProductId; } /** * @return Model year of the device. Typically exactly one of model year or * manufacture date will be present. * @return Model year of the device. Return -1 if not available. Typically, * one of model year or manufacture year is available. */ public Integer getModelYear() { return mModelYear; 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; } /** * @return Manufacture date. Typically exactly one of model year or manufacture * date will be present. * * @hide */ public ManufactureDate getManufactureDate() { 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]. * @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. */ public int[] getRelativeAddress() { return mRelativeAddress; @ConnectionToSinkType public int getConnectionToSinkType() { return mConnectionToSinkType; } @Override Loading @@ -119,8 +176,8 @@ public final class DeviceProductInfo implements Parcelable { + mModelYear + ", manufactureDate=" + mManufactureDate + ", relativeAddress=" + Arrays.toString(mRelativeAddress) + ", connectionToSinkType=" + mConnectionToSinkType + '}'; } Loading @@ -134,16 +191,16 @@ public final class DeviceProductInfo implements Parcelable { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) && Arrays.equals(mRelativeAddress, that.mRelativeAddress); && mConnectionToSinkType == that.mConnectionToSinkType; } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, Arrays.hashCode(mRelativeAddress)); mConnectionToSinkType); } public static final Creator<DeviceProductInfo> CREATOR = @NonNull public static final Creator<DeviceProductInfo> CREATOR = new Creator<DeviceProductInfo>() { @Override public DeviceProductInfo createFromParcel(Parcel in) { Loading @@ -162,13 +219,13 @@ public final class DeviceProductInfo implements Parcelable { } @Override public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeString(mName); dest.writeString(mManufacturerPnpId); dest.writeValue(mProductId); dest.writeValue(mModelYear); dest.writeValue(mManufactureDate); dest.writeIntArray(mRelativeAddress); dest.writeInt(mConnectionToSinkType); } /** Loading core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.graphics.ColorSpace; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.display.DeviceProductInfo; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManagerGlobal; import android.os.Build; Loading Loading @@ -1180,6 +1181,18 @@ public final class Display { } } /** * Returns the 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. * Returns {@code null} if product information is not available. */ @Nullable public DeviceProductInfo getDeviceProductInfo() { return mDisplayInfo.deviceProductInfo; } /** * Gets display metrics that describe the size and density of this display. * The size returned by this method does not necessarily represent the Loading core/jni/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ cc_library_shared { "android_util_XmlBlock.cpp", "android_util_jar_StrictJarFile.cpp", "com_android_internal_util_VirtualRefBasePtr.cpp", ":deviceproductinfoconstants_aidl", ], include_dirs: [ Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -421,6 +421,7 @@ filegroup { ":resourcemanager_aidl", ":storaged_aidl", ":vold_aidl", ":deviceproductinfoconstants_aidl", // For the generated R.java and Manifest.java ":framework-res{.aapt.srcjar}", Loading
core/api/current.txt +18 −0 Original line number Diff line number Diff line Loading @@ -18569,6 +18569,23 @@ package android.hardware.camera2.params { 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 @NonNull public String getManufacturerPnpId(); method public int getModelYear(); method @Nullable public String getName(); method @NonNull public String getProductId(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1 field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2 field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3 field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0 field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.DeviceProductInfo> CREATOR; } public final class DisplayManager { method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int); method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int, @Nullable android.hardware.display.VirtualDisplay.Callback, @Nullable android.os.Handler); Loading Loading @@ -46248,6 +46265,7 @@ package android.view { method public long getAppVsyncOffsetNanos(); method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point); method @Nullable public android.view.DisplayCutout getCutout(); method @Nullable public android.hardware.display.DeviceProductInfo getDeviceProductInfo(); method public int getDisplayId(); method public int getFlags(); method public android.view.Display.HdrCapabilities getHdrCapabilities();
core/java/android/hardware/display/DeviceProductInfo.java +78 −21 Original line number Diff line number Diff line Loading @@ -16,40 +16,69 @@ 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.util.Arrays; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; 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 int[] mRelativeAddress; private final @ConnectionToSinkType int mConnectionToSinkType; /** @hide */ public DeviceProductInfo( String name, String manufacturerPnpId, String productId, Integer modelYear, ManufactureDate manufactureDate, int[] relativeAddress) { int connectionToSinkType) { this.mName = name; this.mManufacturerPnpId = manufacturerPnpId; this.mProductId = productId; this.mModelYear = modelYear; this.mManufactureDate = manufactureDate; this.mRelativeAddress = relativeAddress; this.mConnectionToSinkType = connectionToSinkType; } private DeviceProductInfo(Parcel in) { Loading @@ -58,12 +87,13 @@ public final class DeviceProductInfo implements Parcelable { mProductId = (String) in.readValue(null); mModelYear = (Integer) in.readValue(null); mManufactureDate = (ManufactureDate) in.readValue(null); mRelativeAddress = in.createIntArray(); mConnectionToSinkType = in.readInt(); } /** * @return Display name. */ @Nullable public String getName() { return mName; } Loading @@ -71,6 +101,7 @@ public final class DeviceProductInfo implements Parcelable { /** * @return Manufacturer Plug and Play ID. */ @NonNull public String getManufacturerPnpId() { return mManufacturerPnpId; } Loading @@ -78,32 +109,58 @@ public final class DeviceProductInfo implements Parcelable { /** * @return Manufacturer product ID. */ @NonNull public String getProductId() { return mProductId; } /** * @return Model year of the device. Typically exactly one of model year or * manufacture date will be present. * @return Model year of the device. Return -1 if not available. Typically, * one of model year or manufacture year is available. */ public Integer getModelYear() { return mModelYear; 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; } /** * @return Manufacture date. Typically exactly one of model year or manufacture * date will be present. * * @hide */ public ManufactureDate getManufactureDate() { 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]. * @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. */ public int[] getRelativeAddress() { return mRelativeAddress; @ConnectionToSinkType public int getConnectionToSinkType() { return mConnectionToSinkType; } @Override Loading @@ -119,8 +176,8 @@ public final class DeviceProductInfo implements Parcelable { + mModelYear + ", manufactureDate=" + mManufactureDate + ", relativeAddress=" + Arrays.toString(mRelativeAddress) + ", connectionToSinkType=" + mConnectionToSinkType + '}'; } Loading @@ -134,16 +191,16 @@ public final class DeviceProductInfo implements Parcelable { && Objects.equals(mProductId, that.mProductId) && Objects.equals(mModelYear, that.mModelYear) && Objects.equals(mManufactureDate, that.mManufactureDate) && Arrays.equals(mRelativeAddress, that.mRelativeAddress); && mConnectionToSinkType == that.mConnectionToSinkType; } @Override public int hashCode() { return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate, Arrays.hashCode(mRelativeAddress)); mConnectionToSinkType); } public static final Creator<DeviceProductInfo> CREATOR = @NonNull public static final Creator<DeviceProductInfo> CREATOR = new Creator<DeviceProductInfo>() { @Override public DeviceProductInfo createFromParcel(Parcel in) { Loading @@ -162,13 +219,13 @@ public final class DeviceProductInfo implements Parcelable { } @Override public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeString(mName); dest.writeString(mManufacturerPnpId); dest.writeValue(mProductId); dest.writeValue(mModelYear); dest.writeValue(mManufactureDate); dest.writeIntArray(mRelativeAddress); dest.writeInt(mConnectionToSinkType); } /** Loading
core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.graphics.ColorSpace; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.display.DeviceProductInfo; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManagerGlobal; import android.os.Build; Loading Loading @@ -1180,6 +1181,18 @@ public final class Display { } } /** * Returns the 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. * Returns {@code null} if product information is not available. */ @Nullable public DeviceProductInfo getDeviceProductInfo() { return mDisplayInfo.deviceProductInfo; } /** * Gets display metrics that describe the size and density of this display. * The size returned by this method does not necessarily represent the Loading
core/jni/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ cc_library_shared { "android_util_XmlBlock.cpp", "android_util_jar_StrictJarFile.cpp", "com_android_internal_util_VirtualRefBasePtr.cpp", ":deviceproductinfoconstants_aidl", ], include_dirs: [ Loading