summaryrefslogtreecommitdiff
path: root/libs/gui/ISurfaceComposer.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-09-17 19:51:45 -0700
committer Vishnu Nair <vishnun@google.com> 2021-09-20 16:46:23 -0700
commit8c8db54b9ddc917ccc3a43a0be06581cfb76518f (patch)
tree5647cdb4bf3a2a94a1bda68aa379d79924495366 /libs/gui/ISurfaceComposer.cpp
parent133b3bc5a2bb7dec195a571ce718410d3b45d800 (diff)
SF: Temporarily expose primary display id
WM needs to know the address of the primary display in order to consume ro.surface_flinger.primary_display_orientation correctly. This path will be removed in the future once we support per display install orientations. Bug: 196167822 Test: check initial buffer transforms on displays with a different install orientation Change-Id: I2b0a92196a8a1f05f7d99b531775b9979f07af98
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r--libs/gui/ISurfaceComposer.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 3bf63062f6..3c8289fe2a 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -297,6 +297,20 @@ public:
return {};
}
+ status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId* displayId) const override {
+ Parcel data, reply;
+ SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
+ SAFE_PARCEL(remote()->transact, BnSurfaceComposer::GET_PRIMARY_PHYSICAL_DISPLAY_ID, data,
+ &reply);
+ uint64_t rawId;
+ SAFE_PARCEL(reply.readUint64, &rawId);
+ if (const auto id = DisplayId::fromValue<PhysicalDisplayId>(rawId)) {
+ *displayId = *id;
+ return NO_ERROR;
+ }
+ return NAME_NOT_FOUND;
+ }
+
sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -1738,6 +1752,16 @@ status_t BnSurfaceComposer::onTransact(
[](PhysicalDisplayId id) { return id.value; });
return reply->writeUint64Vector(rawIds);
}
+ case GET_PRIMARY_PHYSICAL_DISPLAY_ID: {
+ CHECK_INTERFACE(ISurfaceComposer, data, reply);
+ PhysicalDisplayId id;
+ status_t result = getPrimaryPhysicalDisplayId(&id);
+ if (result != NO_ERROR) {
+ ALOGE("getPrimaryPhysicalDisplayId: Failed to get id");
+ return result;
+ }
+ return reply->writeUint64(id.value);
+ }
case ADD_REGION_SAMPLING_LISTENER: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
Rect samplingArea;