Loading core/java/android/hardware/OverlayProperties.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware; parcelable OverlayProperties; No newline at end of file core/java/android/hardware/OverlayProperties.java +81 −17 Original line number Diff line number Diff line Loading @@ -16,32 +16,96 @@ package android.hardware; import java.util.List; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import libcore.util.NativeAllocationRegistry; /** * // TODO(b/242588489): Continue work, the class needs a jni-specific constructor and DisplayInfo * // side constructs the object. * The class provides overlay properties of the device. OverlayProperties * exposes some capabilities from HWC e.g. if fp16 can be supported for HWUI. * * In the future, more capabilities can be added, e.g., whether or not * per-layer colorspaces are supported. * * @hide */ public final class OverlayProperties { private final SupportedBufferCombinations[] mCombinations = null; private final boolean mSupportFp16ForHdr = false; public final class OverlayProperties implements Parcelable { private static final NativeAllocationRegistry sRegistry = NativeAllocationRegistry.createMalloced(OverlayProperties.class.getClassLoader(), nGetDestructor()); private long mNativeObject; // Invoked on destruction private Runnable mCloser; static class SupportedBufferCombinations { @HardwareBuffer.Format List<Integer> mHardwareBufferFormats; @DataSpace.NamedDataSpace List<Integer> mDataSpaces; SupportedBufferCombinations(@HardwareBuffer.Format List<Integer> hardwareBufferFormats, @DataSpace.NamedDataSpace List<Integer> dataSpaces) { mHardwareBufferFormats = hardwareBufferFormats; mDataSpaces = dataSpaces; public OverlayProperties(long nativeObject) { if (nativeObject != 0) { mCloser = sRegistry.registerNativeAllocation(this, nativeObject); } mNativeObject = nativeObject; } /*** * @return if the device can support fp16. /** * @return True if the device can support fp16, false otherwise. */ public boolean supportFp16ForHdr() { return mSupportFp16ForHdr; if (mNativeObject == 0) { return false; } return nSupportFp16ForHdr(mNativeObject); } /** * Release the local reference. */ public void release() { if (mNativeObject != 0) { mCloser.run(); mNativeObject = 0; } } @Override public int describeContents() { return 0; } /** * Flatten this object in to a Parcel. * * @param dest The Parcel in which the object should be written. * @param flags Additional flags about how the object should be written. * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. */ @Override public void writeToParcel(@NonNull Parcel dest, int flags) { if (mNativeObject == 0) { dest.writeInt(0); return; } dest.writeInt(1); nWriteOverlayPropertiesToParcel(mNativeObject, dest); } public static final @NonNull Parcelable.Creator<OverlayProperties> CREATOR = new Parcelable.Creator<OverlayProperties>() { public OverlayProperties createFromParcel(Parcel in) { if (in.readInt() != 0) { return new OverlayProperties(nReadOverlayPropertiesFromParcel(in)); } return null; } public OverlayProperties[] newArray(int size) { return new OverlayProperties[size]; } }; private static native long nGetDestructor(); private static native boolean nSupportFp16ForHdr(long nativeObject); private static native void nWriteOverlayPropertiesToParcel(long nativeObject, Parcel dest); private static native long nReadOverlayPropertiesFromParcel(Parcel in); } core/java/android/hardware/display/DisplayManagerGlobal.java +7 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public final class DisplayManagerGlobal { private final SparseArray<DisplayInfo> mDisplayInfoCache = new SparseArray<>(); private final ColorSpace mWideColorSpace; private final OverlayProperties mOverlayProperties = new OverlayProperties(); private final OverlayProperties mOverlayProperties; private int[] mDisplayIdCache; private int mWifiDisplayScanNestCount; Loading @@ -125,6 +125,7 @@ public final class DisplayManagerGlobal { mWideColorSpace = ColorSpace.get( ColorSpace.Named.values()[mDm.getPreferredWideGamutColorSpaceId()]); mOverlayProperties = mDm.getOverlaySupport(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading Loading @@ -728,7 +729,11 @@ public final class DisplayManagerGlobal { return mWideColorSpace; } /** @hide */ /** * Gets the overlay properties for all displays. * * @hide */ public OverlayProperties getOverlaySupport() { return mOverlayProperties; } Loading core/java/android/hardware/display/IDisplayManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.hardware.display; import android.content.pm.ParceledListSlice; import android.graphics.Point; import android.hardware.OverlayProperties; import android.hardware.display.BrightnessConfiguration; import android.hardware.display.BrightnessInfo; import android.hardware.display.Curve; Loading Loading @@ -192,4 +193,7 @@ interface IDisplayManager { // to set the layerStack after the display was created, which is not something we support in // DMS. This should be deleted in V release. void setDisplayIdToMirror(in IBinder token, int displayId); // Query overlay properties of the device OverlayProperties getOverlaySupport(); } core/java/android/view/Display.java +5 −2 Original line number Diff line number Diff line Loading @@ -1291,7 +1291,10 @@ public final class Display { } } /** @hide */ /** * Returns null if it's virtual display. * @hide */ @Nullable public OverlayProperties getOverlaySupport() { synchronized (mLock) { Loading @@ -1299,7 +1302,7 @@ public final class Display { if (mDisplayInfo.type != TYPE_VIRTUAL) { return mGlobal.getOverlaySupport(); } return new OverlayProperties(); return null; } } Loading Loading
core/java/android/hardware/OverlayProperties.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware; parcelable OverlayProperties; No newline at end of file
core/java/android/hardware/OverlayProperties.java +81 −17 Original line number Diff line number Diff line Loading @@ -16,32 +16,96 @@ package android.hardware; import java.util.List; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import libcore.util.NativeAllocationRegistry; /** * // TODO(b/242588489): Continue work, the class needs a jni-specific constructor and DisplayInfo * // side constructs the object. * The class provides overlay properties of the device. OverlayProperties * exposes some capabilities from HWC e.g. if fp16 can be supported for HWUI. * * In the future, more capabilities can be added, e.g., whether or not * per-layer colorspaces are supported. * * @hide */ public final class OverlayProperties { private final SupportedBufferCombinations[] mCombinations = null; private final boolean mSupportFp16ForHdr = false; public final class OverlayProperties implements Parcelable { private static final NativeAllocationRegistry sRegistry = NativeAllocationRegistry.createMalloced(OverlayProperties.class.getClassLoader(), nGetDestructor()); private long mNativeObject; // Invoked on destruction private Runnable mCloser; static class SupportedBufferCombinations { @HardwareBuffer.Format List<Integer> mHardwareBufferFormats; @DataSpace.NamedDataSpace List<Integer> mDataSpaces; SupportedBufferCombinations(@HardwareBuffer.Format List<Integer> hardwareBufferFormats, @DataSpace.NamedDataSpace List<Integer> dataSpaces) { mHardwareBufferFormats = hardwareBufferFormats; mDataSpaces = dataSpaces; public OverlayProperties(long nativeObject) { if (nativeObject != 0) { mCloser = sRegistry.registerNativeAllocation(this, nativeObject); } mNativeObject = nativeObject; } /*** * @return if the device can support fp16. /** * @return True if the device can support fp16, false otherwise. */ public boolean supportFp16ForHdr() { return mSupportFp16ForHdr; if (mNativeObject == 0) { return false; } return nSupportFp16ForHdr(mNativeObject); } /** * Release the local reference. */ public void release() { if (mNativeObject != 0) { mCloser.run(); mNativeObject = 0; } } @Override public int describeContents() { return 0; } /** * Flatten this object in to a Parcel. * * @param dest The Parcel in which the object should be written. * @param flags Additional flags about how the object should be written. * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. */ @Override public void writeToParcel(@NonNull Parcel dest, int flags) { if (mNativeObject == 0) { dest.writeInt(0); return; } dest.writeInt(1); nWriteOverlayPropertiesToParcel(mNativeObject, dest); } public static final @NonNull Parcelable.Creator<OverlayProperties> CREATOR = new Parcelable.Creator<OverlayProperties>() { public OverlayProperties createFromParcel(Parcel in) { if (in.readInt() != 0) { return new OverlayProperties(nReadOverlayPropertiesFromParcel(in)); } return null; } public OverlayProperties[] newArray(int size) { return new OverlayProperties[size]; } }; private static native long nGetDestructor(); private static native boolean nSupportFp16ForHdr(long nativeObject); private static native void nWriteOverlayPropertiesToParcel(long nativeObject, Parcel dest); private static native long nReadOverlayPropertiesFromParcel(Parcel in); }
core/java/android/hardware/display/DisplayManagerGlobal.java +7 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public final class DisplayManagerGlobal { private final SparseArray<DisplayInfo> mDisplayInfoCache = new SparseArray<>(); private final ColorSpace mWideColorSpace; private final OverlayProperties mOverlayProperties = new OverlayProperties(); private final OverlayProperties mOverlayProperties; private int[] mDisplayIdCache; private int mWifiDisplayScanNestCount; Loading @@ -125,6 +125,7 @@ public final class DisplayManagerGlobal { mWideColorSpace = ColorSpace.get( ColorSpace.Named.values()[mDm.getPreferredWideGamutColorSpaceId()]); mOverlayProperties = mDm.getOverlaySupport(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading Loading @@ -728,7 +729,11 @@ public final class DisplayManagerGlobal { return mWideColorSpace; } /** @hide */ /** * Gets the overlay properties for all displays. * * @hide */ public OverlayProperties getOverlaySupport() { return mOverlayProperties; } Loading
core/java/android/hardware/display/IDisplayManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.hardware.display; import android.content.pm.ParceledListSlice; import android.graphics.Point; import android.hardware.OverlayProperties; import android.hardware.display.BrightnessConfiguration; import android.hardware.display.BrightnessInfo; import android.hardware.display.Curve; Loading Loading @@ -192,4 +193,7 @@ interface IDisplayManager { // to set the layerStack after the display was created, which is not something we support in // DMS. This should be deleted in V release. void setDisplayIdToMirror(in IBinder token, int displayId); // Query overlay properties of the device OverlayProperties getOverlaySupport(); }
core/java/android/view/Display.java +5 −2 Original line number Diff line number Diff line Loading @@ -1291,7 +1291,10 @@ public final class Display { } } /** @hide */ /** * Returns null if it's virtual display. * @hide */ @Nullable public OverlayProperties getOverlaySupport() { synchronized (mLock) { Loading @@ -1299,7 +1302,7 @@ public final class Display { if (mDisplayInfo.type != TYPE_VIRTUAL) { return mGlobal.getOverlaySupport(); } return new OverlayProperties(); return null; } } Loading