Add type to DisplayViewport
Add type to DisplayViewport. Store a single array of viewports, but
only allow 1 internal and 1 external viewport for now.
DisplayManagerService now totally in charge of the viewports.
Bug: 111108021
Test: atest -a libinput_tests inputflinger_tests
Change-Id: Iac3dbc2e4a61b9609344db475d29bcdc7c167b1c
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 9b985dc..b70ee09 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -132,6 +132,7 @@
InputReaderConfiguration mConfig;
KeyedVector<int32_t, sp<FakePointerController> > mPointerControllers;
Vector<InputDeviceInfo> mInputDevices;
+ std::vector<DisplayViewport> mViewports;
TouchAffineTransformation transform;
protected:
@@ -143,17 +144,20 @@
void setDisplayViewport(int32_t displayId, int32_t width, int32_t height, int32_t orientation,
const std::string& uniqueId) {
- DisplayViewport v = createDisplayViewport(displayId, width, height, orientation, uniqueId);
+ mViewports.clear();
// Set the size of both the internal and external display at the same time.
- mConfig.setPhysicalDisplayViewport(ViewportType::VIEWPORT_INTERNAL, v);
- mConfig.setPhysicalDisplayViewport(ViewportType::VIEWPORT_EXTERNAL, v);
+ mViewports.push_back(createDisplayViewport(displayId, width, height, orientation, uniqueId,
+ ViewportType::VIEWPORT_INTERNAL));
+ mViewports.push_back(createDisplayViewport(displayId, width, height, orientation, uniqueId,
+ ViewportType::VIEWPORT_EXTERNAL));
+ mConfig.setDisplayViewports(mViewports);
}
void setVirtualDisplayViewport(int32_t displayId, int32_t width, int32_t height, int32_t orientation,
const std::string& uniqueId) {
- Vector<DisplayViewport> viewports;
- viewports.push_back(createDisplayViewport(displayId, width, height, orientation, uniqueId));
- mConfig.setVirtualDisplayViewports(viewports);
+ mViewports.push_back(createDisplayViewport(displayId, width, height, orientation, uniqueId,
+ ViewportType::VIEWPORT_VIRTUAL));
+ mConfig.setDisplayViewports(mViewports);
}
void addExcludedDeviceName(const std::string& deviceName) {
@@ -203,7 +207,7 @@
private:
DisplayViewport createDisplayViewport(int32_t displayId, int32_t width, int32_t height,
- int32_t orientation, const std::string& uniqueId) {
+ int32_t orientation, const std::string& uniqueId, ViewportType type) {
bool isRotated = (orientation == DISPLAY_ORIENTATION_90
|| orientation == DISPLAY_ORIENTATION_270);
DisplayViewport v;
@@ -220,6 +224,7 @@
v.deviceWidth = isRotated ? height : width;
v.deviceHeight = isRotated ? width : height;
v.uniqueId = uniqueId;
+ v.type = type;
return v;
}