@@ -31,6 +31,30 @@ static const int HW_TIMEOUT_MULTIPLIER = base::GetIntProperty("ro.hw_timeout_mul
3131
3232} // namespace
3333
34+ DisplayViewport createViewport (ui::LogicalDisplayId displayId, int32_t width, int32_t height,
35+ ui::Rotation orientation, bool isActive, const std::string& uniqueId,
36+ std::optional<uint8_t > physicalPort, ViewportType type) {
37+ const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270;
38+ DisplayViewport v;
39+ v.displayId = displayId;
40+ v.orientation = orientation;
41+ v.logicalLeft = 0 ;
42+ v.logicalTop = 0 ;
43+ v.logicalRight = isRotated ? height : width;
44+ v.logicalBottom = isRotated ? width : height;
45+ v.physicalLeft = 0 ;
46+ v.physicalTop = 0 ;
47+ v.physicalRight = isRotated ? height : width;
48+ v.physicalBottom = isRotated ? width : height;
49+ v.deviceWidth = isRotated ? height : width;
50+ v.deviceHeight = isRotated ? width : height;
51+ v.isActive = isActive;
52+ v.uniqueId = uniqueId;
53+ v.physicalPort = physicalPort;
54+ v.type = type;
55+ return v;
56+ };
57+
3458void FakeInputReaderPolicy::assertInputDevicesChanged () {
3559 waitForInputDevices (
3660 [](bool devicesChanged) {
@@ -115,33 +139,6 @@ void FakeInputReaderPolicy::addDisplayViewport(DisplayViewport viewport) {
115139 mConfig .setDisplayViewports (mViewports );
116140}
117141
118- void FakeInputReaderPolicy::addDisplayViewport (ui::LogicalDisplayId displayId, int32_t width,
119- int32_t height, ui::Rotation orientation,
120- bool isActive, const std::string& uniqueId,
121- std::optional<uint8_t > physicalPort,
122- ViewportType type) {
123- const bool isRotated = orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270;
124- DisplayViewport v;
125- v.displayId = displayId;
126- v.orientation = orientation;
127- v.logicalLeft = 0 ;
128- v.logicalTop = 0 ;
129- v.logicalRight = isRotated ? height : width;
130- v.logicalBottom = isRotated ? width : height;
131- v.physicalLeft = 0 ;
132- v.physicalTop = 0 ;
133- v.physicalRight = isRotated ? height : width;
134- v.physicalBottom = isRotated ? width : height;
135- v.deviceWidth = isRotated ? height : width;
136- v.deviceHeight = isRotated ? width : height;
137- v.isActive = isActive;
138- v.uniqueId = uniqueId;
139- v.physicalPort = physicalPort;
140- v.type = type;
141-
142- addDisplayViewport (v);
143- }
144-
145142bool FakeInputReaderPolicy::updateViewport (const DisplayViewport& viewport) {
146143 size_t count = mViewports .size ();
147144 for (size_t i = 0 ; i < count; i++) {
0 commit comments