From 7d3847311e3d3955ea91facb0b83b824e16efdd4 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Wed, 25 Sep 2019 15:07:32 -0700 Subject: getDisplayViewportByType doesn't count more than one viewport Bug: none Test: none Change-Id: I795f14bb1d7bd7f62a0d2a6eb301f3cced4f5109 --- services/inputflinger/InputReaderBase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'services/inputflinger/InputReaderBase.cpp') diff --git a/services/inputflinger/InputReaderBase.cpp b/services/inputflinger/InputReaderBase.cpp index bc53cf52cc..0422d8342b 100644 --- a/services/inputflinger/InputReaderBase.cpp +++ b/services/inputflinger/InputReaderBase.cpp @@ -114,8 +114,10 @@ std::optional InputReaderConfiguration::getDisplayViewportByTyp std::optional result = std::nullopt; for (const DisplayViewport& currentViewport : mDisplays) { // Return the first match - if (currentViewport.type == type && !result) { - result = std::make_optional(currentViewport); + if (currentViewport.type == type) { + if (!result) { + result = std::make_optional(currentViewport); + } count++; } } -- cgit v1.2.3-59-g8ed1b