diff options
author | 2020-10-27 16:51:29 +0000 | |
---|---|---|
committer | 2020-11-04 03:21:14 +0000 | |
commit | 0ac8f0c75aff8946cda28bb04a65511d194b7051 (patch) | |
tree | 32d98446b7bb0823ab3f15987b8cda5762354783 | |
parent | a6bccfc44f7c46798757cff709d107ad5eda492f (diff) |
Allow for multiple internal and external viewports.
Also, don't restrict to non-default displays for internal viewports;
leave that up to the input system to decide the policy on selecting
which display to use if there's more than one.
Bug: 116824030
Bug: 171549575
Test: atest InputReader_test
Change-Id: I0f29b4c6043edf4f3e8fa5ac10380d67b11203d3
-rw-r--r-- | services/core/java/com/android/server/display/DisplayManagerService.java | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java index b10cd12cdba5..3ac2185c374d 100644 --- a/services/core/java/com/android/server/display/DisplayManagerService.java +++ b/services/core/java/com/android/server/display/DisplayManagerService.java @@ -1423,17 +1423,18 @@ public final class DisplayManagerService extends SystemService { private Optional<Integer> getViewportType(DisplayDeviceInfo info) { // Get the corresponding viewport type. - if ((info.flags & DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY) != 0) { - return Optional.of(VIEWPORT_INTERNAL); - } else if (info.touch == DisplayDeviceInfo.TOUCH_EXTERNAL) { - return Optional.of(VIEWPORT_EXTERNAL); - } else if (info.touch == DisplayDeviceInfo.TOUCH_VIRTUAL - && !TextUtils.isEmpty(info.uniqueId)) { - return Optional.of(VIEWPORT_VIRTUAL); - } else { - if (DEBUG) { - Slog.i(TAG, "Display " + info + " does not support input device matching."); - } + switch (info.touch) { + case DisplayDeviceInfo.TOUCH_INTERNAL: + return Optional.of(VIEWPORT_INTERNAL); + case DisplayDeviceInfo.TOUCH_EXTERNAL: + return Optional.of(VIEWPORT_EXTERNAL); + case DisplayDeviceInfo.TOUCH_VIRTUAL: + if (!TextUtils.isEmpty(info.uniqueId)) { + return Optional.of(VIEWPORT_VIRTUAL); + } + // fallthrough + default: + Slog.w(TAG, "Display " + info + " does not support input device matching."); } return Optional.empty(); } @@ -1483,13 +1484,6 @@ public final class DisplayManagerService extends SystemService { return null; } - // Only allow a single INTERNAL or EXTERNAL viewport by forcing their uniqueIds - // to be identical (in particular, empty). - // TODO (b/116824030) allow multiple EXTERNAL viewports and remove this function. - if (viewportType != VIEWPORT_VIRTUAL) { - uniqueId = ""; - } - DisplayViewport viewport; final int count = mViewports.size(); for (int i = 0; i < count; i++) { |