mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
composer: add getDisplayPhysicalOrientation
Add an API to query the physical display orientation. Bug: 213237830 Test: VTS Change-Id: I4ea9ee5c8655be283e19156b0ce68e35674ac321
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
package android.hardware.graphics.common;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum Transform {
|
||||
NONE = 0,
|
||||
FLIP_H = 1,
|
||||
FLIP_V = 2,
|
||||
ROT_90 = 4,
|
||||
|
||||
@@ -22,6 +22,11 @@ package android.hardware.graphics.common;
|
||||
@VintfStability
|
||||
@Backing(type="int")
|
||||
enum Transform {
|
||||
/**
|
||||
* Identity transform (i.e. no rotation or flip).
|
||||
*/
|
||||
NONE = 0,
|
||||
|
||||
/**
|
||||
* Horizontal flip. FLIP_H/FLIP_V is applied before ROT_90.
|
||||
*/
|
||||
|
||||
@@ -51,6 +51,7 @@ interface IComposerClient {
|
||||
int getDisplayVsyncPeriod(long display);
|
||||
android.hardware.graphics.composer3.DisplayContentSample getDisplayedContentSample(long display, long maxFrames, long timestamp);
|
||||
android.hardware.graphics.composer3.DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display);
|
||||
android.hardware.graphics.common.Transform getDisplayPhysicalOrientation(long display);
|
||||
android.hardware.graphics.composer3.HdrCapabilities getHdrCapabilities(long display);
|
||||
int getMaxVirtualDisplayCount();
|
||||
android.hardware.graphics.composer3.PerFrameMetadataKey[] getPerFrameMetadataKeys(long display);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.hardware.graphics.composer3;
|
||||
|
||||
import android.hardware.graphics.common.Transform;
|
||||
import android.hardware.graphics.composer3.ClientTargetProperty;
|
||||
import android.hardware.graphics.composer3.ColorMode;
|
||||
import android.hardware.graphics.composer3.CommandResultPayload;
|
||||
@@ -353,6 +354,23 @@ interface IComposerClient {
|
||||
*/
|
||||
DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display);
|
||||
|
||||
/**
|
||||
* Queries the physical orientation of a display. Orientation 'Transform::NONE'
|
||||
* represents a display that doesn't require any transformation on layers
|
||||
* to be presented at their natural orientation.
|
||||
*
|
||||
* @param display is the display where the physical orientation is queried.
|
||||
*
|
||||
* @return is one of the below values:
|
||||
* Transform::NONE
|
||||
* Transform::ROT_90
|
||||
* Transform::ROT_180
|
||||
* Transform::ROT_270
|
||||
*
|
||||
* @exception EX_BAD_DISPLAY when an invalid display was passed in.
|
||||
*/
|
||||
Transform getDisplayPhysicalOrientation(long display);
|
||||
|
||||
/**
|
||||
* Returns the high dynamic range (HDR) capabilities of the given display,
|
||||
* which are invariant with regard to the active configuration.
|
||||
|
||||
@@ -904,6 +904,33 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) {
|
||||
EXPECT_TRUE(mComposerClient->getDisplayName(mPrimaryDisplay, &displayName).isOk());
|
||||
}
|
||||
|
||||
TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientationBadDisplay) {
|
||||
Transform displayOrientation;
|
||||
const auto error =
|
||||
mComposerClient->getDisplayPhysicalOrientation(mInvalidDisplayId, &displayOrientation);
|
||||
|
||||
EXPECT_FALSE(error.isOk());
|
||||
ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
|
||||
}
|
||||
|
||||
TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation) {
|
||||
const auto allowedDisplayOrientations = std::array<Transform, 4>{
|
||||
Transform::NONE,
|
||||
Transform::ROT_90,
|
||||
Transform::ROT_180,
|
||||
Transform::ROT_270,
|
||||
};
|
||||
|
||||
Transform displayOrientation;
|
||||
const auto error =
|
||||
mComposerClient->getDisplayPhysicalOrientation(mPrimaryDisplay, &displayOrientation);
|
||||
|
||||
EXPECT_TRUE(error.isOk());
|
||||
EXPECT_NE(std::find(allowedDisplayOrientations.begin(), allowedDisplayOrientations.end(),
|
||||
displayOrientation),
|
||||
allowedDisplayOrientations.end());
|
||||
}
|
||||
|
||||
TEST_P(GraphicsComposerAidlTest, SetClientTargetSlotCount) {
|
||||
EXPECT_TRUE(
|
||||
mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kBufferSlotCount).isOk());
|
||||
|
||||
Reference in New Issue
Block a user