Loading libs/gui/ISurfaceComposer.cpp +21 −0 Original line number Original line Diff line number Diff line Loading @@ -292,6 +292,17 @@ public: return {}; 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); *displayId = PhysicalDisplayId(rawId); return NO_ERROR; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override { sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override { Parcel data, reply; Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -1730,6 +1741,16 @@ status_t BnSurfaceComposer::onTransact( [](PhysicalDisplayId id) { return id.value; }); [](PhysicalDisplayId id) { return id.value; }); return reply->writeUint64Vector(rawIds); 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: { case ADD_REGION_SAMPLING_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); CHECK_INTERFACE(ISurfaceComposer, data, reply); Rect samplingArea; Rect samplingArea; Loading libs/gui/SurfaceComposerClient.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -937,6 +937,10 @@ std::vector<PhysicalDisplayId> SurfaceComposerClient::getPhysicalDisplayIds() { return ComposerService::getComposerService()->getPhysicalDisplayIds(); return ComposerService::getComposerService()->getPhysicalDisplayIds(); } } status_t SurfaceComposerClient::getPrimaryPhysicalDisplayId(PhysicalDisplayId* id) { return ComposerService::getComposerService()->getPrimaryPhysicalDisplayId(id); } std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { return ComposerService::getComposerService()->getInternalDisplayId(); return ComposerService::getComposerService()->getInternalDisplayId(); } } Loading libs/gui/include/gui/ISurfaceComposer.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -141,6 +141,8 @@ public: */ */ virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0; virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0; virtual status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*) const = 0; // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic. // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic. std::optional<PhysicalDisplayId> getInternalDisplayId() const { std::optional<PhysicalDisplayId> getInternalDisplayId() const { const auto displayIds = getPhysicalDisplayIds(); const auto displayIds = getPhysicalDisplayIds(); Loading Loading @@ -632,6 +634,7 @@ public: REMOVE_TUNNEL_MODE_ENABLED_LISTENER, REMOVE_TUNNEL_MODE_ENABLED_LISTENER, ADD_WINDOW_INFOS_LISTENER, ADD_WINDOW_INFOS_LISTENER, REMOVE_WINDOW_INFOS_LISTENER, REMOVE_WINDOW_INFOS_LISTENER, GET_PRIMARY_PHYSICAL_DISPLAY_ID, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading libs/gui/include/gui/SurfaceComposerClient.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -308,6 +308,7 @@ public: //! Get stable IDs for connected physical displays //! Get stable IDs for connected physical displays static std::vector<PhysicalDisplayId> getPhysicalDisplayIds(); static std::vector<PhysicalDisplayId> getPhysicalDisplayIds(); static status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*); static std::optional<PhysicalDisplayId> getInternalDisplayId(); static std::optional<PhysicalDisplayId> getInternalDisplayId(); //! Get token for a physical display given its stable ID //! Get token for a physical display given its stable ID Loading libs/gui/tests/Surface_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -694,6 +694,7 @@ public: bool /*secure*/) override { return nullptr; } bool /*secure*/) override { return nullptr; } void destroyDisplay(const sp<IBinder>& /*display */) override {} void destroyDisplay(const sp<IBinder>& /*display */) override {} std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const override { return {}; } std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const override { return {}; } status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*) const override { return NO_ERROR; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId) const override { return nullptr; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId) const override { return nullptr; } status_t setTransactionState(const FrameTimelineInfo& /*frameTimelineInfo*/, status_t setTransactionState(const FrameTimelineInfo& /*frameTimelineInfo*/, const Vector<ComposerState>& /*state*/, const Vector<ComposerState>& /*state*/, Loading Loading
libs/gui/ISurfaceComposer.cpp +21 −0 Original line number Original line Diff line number Diff line Loading @@ -292,6 +292,17 @@ public: return {}; 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); *displayId = PhysicalDisplayId(rawId); return NO_ERROR; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override { sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override { Parcel data, reply; Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -1730,6 +1741,16 @@ status_t BnSurfaceComposer::onTransact( [](PhysicalDisplayId id) { return id.value; }); [](PhysicalDisplayId id) { return id.value; }); return reply->writeUint64Vector(rawIds); 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: { case ADD_REGION_SAMPLING_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); CHECK_INTERFACE(ISurfaceComposer, data, reply); Rect samplingArea; Rect samplingArea; Loading
libs/gui/SurfaceComposerClient.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -937,6 +937,10 @@ std::vector<PhysicalDisplayId> SurfaceComposerClient::getPhysicalDisplayIds() { return ComposerService::getComposerService()->getPhysicalDisplayIds(); return ComposerService::getComposerService()->getPhysicalDisplayIds(); } } status_t SurfaceComposerClient::getPrimaryPhysicalDisplayId(PhysicalDisplayId* id) { return ComposerService::getComposerService()->getPrimaryPhysicalDisplayId(id); } std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { std::optional<PhysicalDisplayId> SurfaceComposerClient::getInternalDisplayId() { return ComposerService::getComposerService()->getInternalDisplayId(); return ComposerService::getComposerService()->getInternalDisplayId(); } } Loading
libs/gui/include/gui/ISurfaceComposer.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -141,6 +141,8 @@ public: */ */ virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0; virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0; virtual status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*) const = 0; // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic. // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic. std::optional<PhysicalDisplayId> getInternalDisplayId() const { std::optional<PhysicalDisplayId> getInternalDisplayId() const { const auto displayIds = getPhysicalDisplayIds(); const auto displayIds = getPhysicalDisplayIds(); Loading Loading @@ -632,6 +634,7 @@ public: REMOVE_TUNNEL_MODE_ENABLED_LISTENER, REMOVE_TUNNEL_MODE_ENABLED_LISTENER, ADD_WINDOW_INFOS_LISTENER, ADD_WINDOW_INFOS_LISTENER, REMOVE_WINDOW_INFOS_LISTENER, REMOVE_WINDOW_INFOS_LISTENER, GET_PRIMARY_PHYSICAL_DISPLAY_ID, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading
libs/gui/include/gui/SurfaceComposerClient.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -308,6 +308,7 @@ public: //! Get stable IDs for connected physical displays //! Get stable IDs for connected physical displays static std::vector<PhysicalDisplayId> getPhysicalDisplayIds(); static std::vector<PhysicalDisplayId> getPhysicalDisplayIds(); static status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*); static std::optional<PhysicalDisplayId> getInternalDisplayId(); static std::optional<PhysicalDisplayId> getInternalDisplayId(); //! Get token for a physical display given its stable ID //! Get token for a physical display given its stable ID Loading
libs/gui/tests/Surface_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -694,6 +694,7 @@ public: bool /*secure*/) override { return nullptr; } bool /*secure*/) override { return nullptr; } void destroyDisplay(const sp<IBinder>& /*display */) override {} void destroyDisplay(const sp<IBinder>& /*display */) override {} std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const override { return {}; } std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const override { return {}; } status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*) const override { return NO_ERROR; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId) const override { return nullptr; } sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId) const override { return nullptr; } status_t setTransactionState(const FrameTimelineInfo& /*frameTimelineInfo*/, status_t setTransactionState(const FrameTimelineInfo& /*frameTimelineInfo*/, const Vector<ComposerState>& /*state*/, const Vector<ComposerState>& /*state*/, Loading