Loading libs/ui/include/ui/StaticDisplayInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <optional> #include <ui/DeviceProductInfo.h> #include <ui/DisplayIdentification.h> #include <ui/Rotation.h> namespace android::ui { Loading @@ -32,6 +33,7 @@ struct StaticDisplayInfo { float density = 0.f; bool secure = false; std::optional<DeviceProductInfo> deviceProductInfo; android::ScreenPartStatus screenPartStatus; Rotation installOrientation = ROTATION_0; }; Loading services/surfaceflinger/Display/DisplaySnapshot.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <algorithm> #include <functional> #include <utility> #include <ui/DisplayIdentification.h> #include <ftl/algorithm.h> #include <ftl/enum.h> Loading @@ -27,11 +28,13 @@ namespace android::display { DisplaySnapshot::DisplaySnapshot(PhysicalDisplayId displayId, uint8_t port, android::ScreenPartStatus screenPartStatus, ui::DisplayConnectionType connectionType, DisplayModes&& displayModes, ui::ColorModes&& colorModes, std::optional<DeviceProductInfo>&& deviceProductInfo) : mDisplayId(displayId), mPort(port), mScreenPartStatus(screenPartStatus), mConnectionType(connectionType), mDisplayModes(std::move(displayModes)), mColorModes(std::move(colorModes)), Loading services/surfaceflinger/Display/DisplaySnapshot.h +6 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <ui/ColorMode.h> #include <ui/DisplayId.h> #include <ui/StaticDisplayInfo.h> #include <ui/DisplayIdentification.h> #include "DisplayHardware/DisplayMode.h" #include "Utils/Dumper.h" Loading @@ -31,14 +32,16 @@ namespace android::display { // Immutable state of a physical display, captured on hotplug. class DisplaySnapshot { public: DisplaySnapshot(PhysicalDisplayId, uint8_t, ui::DisplayConnectionType, DisplayModes&&, ui::ColorModes&&, std::optional<DeviceProductInfo>&&); DisplaySnapshot(PhysicalDisplayId, uint8_t, android::ScreenPartStatus, ui::DisplayConnectionType, DisplayModes&&, ui::ColorModes&&, std::optional<DeviceProductInfo>&&); DisplaySnapshot(const DisplaySnapshot&) = delete; DisplaySnapshot(DisplaySnapshot&&) = default; PhysicalDisplayId displayId() const { return mDisplayId; } uint8_t port() const { return mPort; } android::ScreenPartStatus screenPartStatus() const { return mScreenPartStatus; } ui::DisplayConnectionType connectionType() const { return mConnectionType; } std::optional<DisplayModeId> translateModeId(hal::HWConfigId) const; Loading @@ -54,6 +57,7 @@ public: private: const PhysicalDisplayId mDisplayId; const uint8_t mPort; const android::ScreenPartStatus mScreenPartStatus; const ui::DisplayConnectionType mConnectionType; // Effectively const except in move constructor. Loading services/surfaceflinger/SurfaceFlinger.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -1178,6 +1178,7 @@ status_t SurfaceFlinger::getStaticDisplayInfo(int64_t displayId, ui::StaticDispl info->connectionType = snapshot.connectionType(); info->port = snapshot.port(); info->deviceProductInfo = snapshot.deviceProductInfo(); info->screenPartStatus = snapshot.screenPartStatus(); if (mEmulatedDisplayDensity) { info->density = mEmulatedDisplayDensity; Loading Loading @@ -3782,6 +3783,7 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl const auto& display = displayOpt->get(); const auto& snapshot = display.snapshot(); const uint8_t port = snapshot.port(); const android::ScreenPartStatus screenPartStatus = snapshot.screenPartStatus(); std::optional<DeviceProductInfo> deviceProductInfo; if (getHwComposer().updatesDeviceProductInfoOnHotplugReconnect()) { Loading @@ -3794,8 +3796,9 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl // display on reconnect. const auto it = mPhysicalDisplays.try_replace(displayId, display.token(), displayId, port, snapshot.connectionType(), std::move(displayModes), std::move(colorModes), std::move(deviceProductInfo)); screenPartStatus, snapshot.connectionType(), std::move(displayModes), std::move(colorModes), std::move(deviceProductInfo)); auto& state = mCurrentState.displays.editValueFor(it->second.token()); state.sequenceId = DisplayDeviceState{}.sequenceId; // Generate new sequenceId. Loading @@ -3812,8 +3815,8 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl const ui::DisplayConnectionType connectionType = getHwComposer().getDisplayConnectionType(displayId); mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, connectionType, std::move(displayModes), std::move(colorModes), mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, info.screenPartStatus, connectionType, std::move(displayModes), std::move(colorModes), std::move(info.deviceProductInfo)); DisplayDeviceState state; Loading Loading @@ -8965,6 +8968,7 @@ binder::Status SurfaceComposerAIDL::getStaticDisplayInfo(int64_t displayId, outInfo->density = info.density; outInfo->secure = info.secure; outInfo->installOrientation = static_cast<gui::Rotation>(info.installOrientation); outInfo->screenPartStatus = static_cast<uint8_t>(info.screenPartStatus); if (const std::optional<DeviceProductInfo> dpi = info.deviceProductInfo) { gui::DeviceProductInfo dinfo; Loading services/surfaceflinger/tests/unittests/DisplayModeControllerTest.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <ftl/fake_guard.h> #include <gmock/gmock.h> #include <gtest/gtest.h> #include <ui/DisplayIdentification.h> #define EXPECT_DISPLAY_MODE_REQUEST(expected, requestOpt) \ ASSERT_TRUE(requestOpt); \ Loading Loading @@ -72,7 +73,9 @@ public: ASSERT_TRUE(infoOpt); mDisplayId = infoOpt->id; mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port, ui::DisplayConnectionType::Internal, mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port, android::ScreenPartStatus::UNSUPPORTED, ui::DisplayConnectionType::Internal, makeModes(kMode60, kMode90, kMode120), ui::ColorModes{}, std::nullopt); Loading Loading
libs/ui/include/ui/StaticDisplayInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <optional> #include <ui/DeviceProductInfo.h> #include <ui/DisplayIdentification.h> #include <ui/Rotation.h> namespace android::ui { Loading @@ -32,6 +33,7 @@ struct StaticDisplayInfo { float density = 0.f; bool secure = false; std::optional<DeviceProductInfo> deviceProductInfo; android::ScreenPartStatus screenPartStatus; Rotation installOrientation = ROTATION_0; }; Loading
services/surfaceflinger/Display/DisplaySnapshot.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <algorithm> #include <functional> #include <utility> #include <ui/DisplayIdentification.h> #include <ftl/algorithm.h> #include <ftl/enum.h> Loading @@ -27,11 +28,13 @@ namespace android::display { DisplaySnapshot::DisplaySnapshot(PhysicalDisplayId displayId, uint8_t port, android::ScreenPartStatus screenPartStatus, ui::DisplayConnectionType connectionType, DisplayModes&& displayModes, ui::ColorModes&& colorModes, std::optional<DeviceProductInfo>&& deviceProductInfo) : mDisplayId(displayId), mPort(port), mScreenPartStatus(screenPartStatus), mConnectionType(connectionType), mDisplayModes(std::move(displayModes)), mColorModes(std::move(colorModes)), Loading
services/surfaceflinger/Display/DisplaySnapshot.h +6 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <ui/ColorMode.h> #include <ui/DisplayId.h> #include <ui/StaticDisplayInfo.h> #include <ui/DisplayIdentification.h> #include "DisplayHardware/DisplayMode.h" #include "Utils/Dumper.h" Loading @@ -31,14 +32,16 @@ namespace android::display { // Immutable state of a physical display, captured on hotplug. class DisplaySnapshot { public: DisplaySnapshot(PhysicalDisplayId, uint8_t, ui::DisplayConnectionType, DisplayModes&&, ui::ColorModes&&, std::optional<DeviceProductInfo>&&); DisplaySnapshot(PhysicalDisplayId, uint8_t, android::ScreenPartStatus, ui::DisplayConnectionType, DisplayModes&&, ui::ColorModes&&, std::optional<DeviceProductInfo>&&); DisplaySnapshot(const DisplaySnapshot&) = delete; DisplaySnapshot(DisplaySnapshot&&) = default; PhysicalDisplayId displayId() const { return mDisplayId; } uint8_t port() const { return mPort; } android::ScreenPartStatus screenPartStatus() const { return mScreenPartStatus; } ui::DisplayConnectionType connectionType() const { return mConnectionType; } std::optional<DisplayModeId> translateModeId(hal::HWConfigId) const; Loading @@ -54,6 +57,7 @@ public: private: const PhysicalDisplayId mDisplayId; const uint8_t mPort; const android::ScreenPartStatus mScreenPartStatus; const ui::DisplayConnectionType mConnectionType; // Effectively const except in move constructor. Loading
services/surfaceflinger/SurfaceFlinger.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -1178,6 +1178,7 @@ status_t SurfaceFlinger::getStaticDisplayInfo(int64_t displayId, ui::StaticDispl info->connectionType = snapshot.connectionType(); info->port = snapshot.port(); info->deviceProductInfo = snapshot.deviceProductInfo(); info->screenPartStatus = snapshot.screenPartStatus(); if (mEmulatedDisplayDensity) { info->density = mEmulatedDisplayDensity; Loading Loading @@ -3782,6 +3783,7 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl const auto& display = displayOpt->get(); const auto& snapshot = display.snapshot(); const uint8_t port = snapshot.port(); const android::ScreenPartStatus screenPartStatus = snapshot.screenPartStatus(); std::optional<DeviceProductInfo> deviceProductInfo; if (getHwComposer().updatesDeviceProductInfoOnHotplugReconnect()) { Loading @@ -3794,8 +3796,9 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl // display on reconnect. const auto it = mPhysicalDisplays.try_replace(displayId, display.token(), displayId, port, snapshot.connectionType(), std::move(displayModes), std::move(colorModes), std::move(deviceProductInfo)); screenPartStatus, snapshot.connectionType(), std::move(displayModes), std::move(colorModes), std::move(deviceProductInfo)); auto& state = mCurrentState.displays.editValueFor(it->second.token()); state.sequenceId = DisplayDeviceState{}.sequenceId; // Generate new sequenceId. Loading @@ -3812,8 +3815,8 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl const ui::DisplayConnectionType connectionType = getHwComposer().getDisplayConnectionType(displayId); mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, connectionType, std::move(displayModes), std::move(colorModes), mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, info.screenPartStatus, connectionType, std::move(displayModes), std::move(colorModes), std::move(info.deviceProductInfo)); DisplayDeviceState state; Loading Loading @@ -8965,6 +8968,7 @@ binder::Status SurfaceComposerAIDL::getStaticDisplayInfo(int64_t displayId, outInfo->density = info.density; outInfo->secure = info.secure; outInfo->installOrientation = static_cast<gui::Rotation>(info.installOrientation); outInfo->screenPartStatus = static_cast<uint8_t>(info.screenPartStatus); if (const std::optional<DeviceProductInfo> dpi = info.deviceProductInfo) { gui::DeviceProductInfo dinfo; Loading
services/surfaceflinger/tests/unittests/DisplayModeControllerTest.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <ftl/fake_guard.h> #include <gmock/gmock.h> #include <gtest/gtest.h> #include <ui/DisplayIdentification.h> #define EXPECT_DISPLAY_MODE_REQUEST(expected, requestOpt) \ ASSERT_TRUE(requestOpt); \ Loading Loading @@ -72,7 +73,9 @@ public: ASSERT_TRUE(infoOpt); mDisplayId = infoOpt->id; mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port, ui::DisplayConnectionType::Internal, mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port, android::ScreenPartStatus::UNSUPPORTED, ui::DisplayConnectionType::Internal, makeModes(kMode60, kMode90, kMode120), ui::ColorModes{}, std::nullopt); Loading