Skip to content

Commit 2beb8f0

Browse files
committed
update displaySnapshot
update displaySnapshot to have screenPartStatus. Flag: com.android.tradeinmode.flags.trade_in_mode_2025q4 Test: th Change-Id: I2a0418f24a07b87618108e2c8d2bc899c0b3df9d
1 parent 302cd56 commit 2beb8f0

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

libs/ui/include/ui/StaticDisplayInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <optional>
2020

2121
#include <ui/DeviceProductInfo.h>
22+
#include <ui/DisplayIdentification.h>
2223
#include <ui/Rotation.h>
2324

2425
namespace android::ui {
@@ -32,6 +33,7 @@ struct StaticDisplayInfo {
3233
float density = 0.f;
3334
bool secure = false;
3435
std::optional<DeviceProductInfo> deviceProductInfo;
36+
android::ScreenPartStatus screenPartStatus;
3537
Rotation installOrientation = ROTATION_0;
3638
};
3739

services/surfaceflinger/Display/DisplaySnapshot.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <algorithm>
1818
#include <functional>
1919
#include <utility>
20+
#include <ui/DisplayIdentification.h>
2021

2122
#include <ftl/algorithm.h>
2223
#include <ftl/enum.h>
@@ -27,11 +28,13 @@
2728
namespace android::display {
2829

2930
DisplaySnapshot::DisplaySnapshot(PhysicalDisplayId displayId, uint8_t port,
31+
android::ScreenPartStatus screenPartStatus,
3032
ui::DisplayConnectionType connectionType,
3133
DisplayModes&& displayModes, ui::ColorModes&& colorModes,
3234
std::optional<DeviceProductInfo>&& deviceProductInfo)
3335
: mDisplayId(displayId),
3436
mPort(port),
37+
mScreenPartStatus(screenPartStatus),
3538
mConnectionType(connectionType),
3639
mDisplayModes(std::move(displayModes)),
3740
mColorModes(std::move(colorModes)),

services/surfaceflinger/Display/DisplaySnapshot.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <ui/ColorMode.h>
2323
#include <ui/DisplayId.h>
2424
#include <ui/StaticDisplayInfo.h>
25+
#include <ui/DisplayIdentification.h>
2526

2627
#include "DisplayHardware/DisplayMode.h"
2728
#include "Utils/Dumper.h"
@@ -31,14 +32,16 @@ namespace android::display {
3132
// Immutable state of a physical display, captured on hotplug.
3233
class DisplaySnapshot {
3334
public:
34-
DisplaySnapshot(PhysicalDisplayId, uint8_t, ui::DisplayConnectionType, DisplayModes&&,
35-
ui::ColorModes&&, std::optional<DeviceProductInfo>&&);
35+
DisplaySnapshot(PhysicalDisplayId, uint8_t, android::ScreenPartStatus,
36+
ui::DisplayConnectionType, DisplayModes&&, ui::ColorModes&&,
37+
std::optional<DeviceProductInfo>&&);
3638

3739
DisplaySnapshot(const DisplaySnapshot&) = delete;
3840
DisplaySnapshot(DisplaySnapshot&&) = default;
3941

4042
PhysicalDisplayId displayId() const { return mDisplayId; }
4143
uint8_t port() const { return mPort; }
44+
android::ScreenPartStatus screenPartStatus() const { return mScreenPartStatus; }
4245
ui::DisplayConnectionType connectionType() const { return mConnectionType; }
4346

4447
std::optional<DisplayModeId> translateModeId(hal::HWConfigId) const;
@@ -54,6 +57,7 @@ class DisplaySnapshot {
5457
private:
5558
const PhysicalDisplayId mDisplayId;
5659
const uint8_t mPort;
60+
const android::ScreenPartStatus mScreenPartStatus;
5761
const ui::DisplayConnectionType mConnectionType;
5862

5963
// Effectively const except in move constructor.

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ status_t SurfaceFlinger::getStaticDisplayInfo(int64_t displayId, ui::StaticDispl
11781178
info->connectionType = snapshot.connectionType();
11791179
info->port = snapshot.port();
11801180
info->deviceProductInfo = snapshot.deviceProductInfo();
1181+
info->screenPartStatus = snapshot.screenPartStatus();
11811182

11821183
if (mEmulatedDisplayDensity) {
11831184
info->density = mEmulatedDisplayDensity;
@@ -3782,6 +3783,7 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl
37823783
const auto& display = displayOpt->get();
37833784
const auto& snapshot = display.snapshot();
37843785
const uint8_t port = snapshot.port();
3786+
const android::ScreenPartStatus screenPartStatus = snapshot.screenPartStatus();
37853787

37863788
std::optional<DeviceProductInfo> deviceProductInfo;
37873789
if (getHwComposer().updatesDeviceProductInfoOnHotplugReconnect()) {
@@ -3794,8 +3796,9 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl
37943796
// display on reconnect.
37953797
const auto it =
37963798
mPhysicalDisplays.try_replace(displayId, display.token(), displayId, port,
3797-
snapshot.connectionType(), std::move(displayModes),
3798-
std::move(colorModes), std::move(deviceProductInfo));
3799+
screenPartStatus, snapshot.connectionType(),
3800+
std::move(displayModes), std::move(colorModes),
3801+
std::move(deviceProductInfo));
37993802

38003803
auto& state = mCurrentState.displays.editValueFor(it->second.token());
38013804
state.sequenceId = DisplayDeviceState{}.sequenceId; // Generate new sequenceId.
@@ -3812,8 +3815,8 @@ std::optional<DisplayModeId> SurfaceFlinger::processHotplugConnect(PhysicalDispl
38123815
const ui::DisplayConnectionType connectionType =
38133816
getHwComposer().getDisplayConnectionType(displayId);
38143817

3815-
mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, connectionType,
3816-
std::move(displayModes), std::move(colorModes),
3818+
mPhysicalDisplays.try_emplace(displayId, token, displayId, info.port, info.screenPartStatus,
3819+
connectionType, std::move(displayModes), std::move(colorModes),
38173820
std::move(info.deviceProductInfo));
38183821

38193822
DisplayDeviceState state;
@@ -8965,6 +8968,7 @@ binder::Status SurfaceComposerAIDL::getStaticDisplayInfo(int64_t displayId,
89658968
outInfo->density = info.density;
89668969
outInfo->secure = info.secure;
89678970
outInfo->installOrientation = static_cast<gui::Rotation>(info.installOrientation);
8971+
outInfo->screenPartStatus = static_cast<uint8_t>(info.screenPartStatus);
89688972

89698973
if (const std::optional<DeviceProductInfo> dpi = info.deviceProductInfo) {
89708974
gui::DeviceProductInfo dinfo;

services/surfaceflinger/tests/unittests/DisplayModeControllerTest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <ftl/fake_guard.h>
3131
#include <gmock/gmock.h>
3232
#include <gtest/gtest.h>
33+
#include <ui/DisplayIdentification.h>
3334

3435
#define EXPECT_DISPLAY_MODE_REQUEST(expected, requestOpt) \
3536
ASSERT_TRUE(requestOpt); \
@@ -72,7 +73,9 @@ class DisplayModeControllerTest : public testing::Test {
7273
ASSERT_TRUE(infoOpt);
7374

7475
mDisplayId = infoOpt->id;
75-
mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port, ui::DisplayConnectionType::Internal,
76+
mDisplaySnapshotOpt.emplace(mDisplayId, infoOpt->port,
77+
android::ScreenPartStatus::UNSUPPORTED,
78+
ui::DisplayConnectionType::Internal,
7679
makeModes(kMode60, kMode90, kMode120), ui::ColorModes{},
7780
std::nullopt);
7881

services/surfaceflinger/tests/unittests/SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define LOG_TAG "LibSurfaceFlingerUnittests"
1919

2020
#include <ftl/fake_guard.h>
21+
#include <ui/DisplayIdentification.h>
2122

2223
#include "DisplayHardware/DisplayMode.h"
2324

@@ -263,6 +264,7 @@ void SetupNewDisplayDeviceInternalTest::setupNewDisplayDeviceInternalTest() {
263264

264265
const auto it = mFlinger.mutablePhysicalDisplays()
265266
.emplace_or_replace(*displayId, displayToken, *displayId, *port,
267+
android::ScreenPartStatus::UNSUPPORTED,
266268
*kConnectionTypeOpt, makeModes(activeMode),
267269
std::move(colorModes), std::nullopt)
268270
.first;

services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <ftl/match.h>
2525
#include <gui/LayerMetadata.h>
2626
#include <gui/ScreenCaptureResults.h>
27+
#include <ui/DisplayIdentification.h>
2728
#include <ui/DynamicDisplayInfo.h>
2829

2930
#include <compositionengine/Display.h>
@@ -1121,6 +1122,7 @@ class TestableSurfaceFlinger {
11211122
const auto it =
11221123
mFlinger.mutablePhysicalDisplays()
11231124
.emplace_or_replace(*physicalId, mDisplayToken, *physicalId, *mPort,
1125+
android::ScreenPartStatus::UNSUPPORTED,
11241126
*mConnectionType, std::move(modes),
11251127
ui::ColorModes(), std::nullopt)
11261128
.first;

0 commit comments

Comments
 (0)