diff options
-rw-r--r-- | include/input/DisplayTopologyGraph.h | 3 | ||||
-rw-r--r-- | libs/input/DisplayTopologyGraph.cpp | 39 | ||||
-rw-r--r-- | services/inputflinger/PointerChoreographer.cpp | 3 | ||||
-rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 3 |
4 files changed, 48 insertions, 0 deletions
diff --git a/include/input/DisplayTopologyGraph.h b/include/input/DisplayTopologyGraph.h index ce7259e09a..9fc080d6f8 100644 --- a/include/input/DisplayTopologyGraph.h +++ b/include/input/DisplayTopologyGraph.h @@ -46,6 +46,8 @@ struct DisplayTopologyAdjacentDisplay { DisplayTopologyPosition position; // The offset in DP of the adjacent display, relative to the source display. float offsetDp; + + std::string dump() const; }; /** @@ -57,6 +59,7 @@ struct DisplayTopologyGraph { std::unordered_map<ui::LogicalDisplayId, int> displaysDensity; bool isValid() const; + std::string dump() const; }; } // namespace android diff --git a/libs/input/DisplayTopologyGraph.cpp b/libs/input/DisplayTopologyGraph.cpp index 7ad9f163b8..934f2e8135 100644 --- a/libs/input/DisplayTopologyGraph.cpp +++ b/libs/input/DisplayTopologyGraph.cpp @@ -17,15 +17,20 @@ #define LOG_TAG "DisplayTopologyValidator" #include <android-base/logging.h> +#include <android-base/stringprintf.h> #include <ftl/enum.h> #include <input/DisplayTopologyGraph.h> +#include <input/PrintTools.h> #include <ui/LogicalDisplayId.h> #include <algorithm> +#define INDENT " " + namespace android { namespace { + DisplayTopologyPosition getOppositePosition(DisplayTopologyPosition position) { switch (position) { case DisplayTopologyPosition::LEFT: @@ -95,11 +100,45 @@ bool validateDensities(const android::DisplayTopologyGraph& displayTopologyGraph return true; } +std::string logicalDisplayIdToString(const ui::LogicalDisplayId& displayId) { + return base::StringPrintf("displayId(%d)", displayId.val()); +} + +std::string adjacentDisplayToString(const DisplayTopologyAdjacentDisplay& adjacentDisplay) { + return adjacentDisplay.dump(); +} + +std::string adjacentDisplayVectorToString( + const std::vector<DisplayTopologyAdjacentDisplay>& adjacentDisplays) { + return dumpVector(adjacentDisplays, adjacentDisplayToString); +} + } // namespace +std::string DisplayTopologyAdjacentDisplay::dump() const { + std::string dump; + dump += base::StringPrintf("DisplayTopologyAdjacentDisplay: {displayId: %d, position: %s, " + "offsetDp: %f}", + displayId.val(), ftl::enum_string(position).c_str(), offsetDp); + return dump; +} + bool DisplayTopologyGraph::isValid() const { return validatePrimaryDisplay(*this) && validateTopologyGraph(*this) && validateDensities(*this); } +std::string DisplayTopologyGraph::dump() const { + std::string dump; + dump += base::StringPrintf("PrimaryDisplayId: %d\n", primaryDisplayId.val()); + dump += base::StringPrintf("TopologyGraph:\n"); + dump += addLinePrefix(dumpMap(graph, logicalDisplayIdToString, adjacentDisplayVectorToString), + INDENT); + dump += "\n"; + dump += base::StringPrintf("DisplaysDensity:\n"); + dump += addLinePrefix(dumpMap(displaysDensity, logicalDisplayIdToString), INDENT); + dump += "\n"; + return dump; +} + } // namespace android diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp index f8ab830d2d..98f0f346df 100644 --- a/services/inputflinger/PointerChoreographer.cpp +++ b/services/inputflinger/PointerChoreographer.cpp @@ -31,6 +31,7 @@ #include "PointerChoreographer.h" #define INDENT " " +#define INDENT2 " " namespace android { @@ -647,6 +648,8 @@ void PointerChoreographer::dump(std::string& dump) { std::string pointerControllerDump = addLinePrefix(drawingTabletController->dump(), INDENT); dump += INDENT + std::to_string(deviceId) + " : " + pointerControllerDump; } + dump += INDENT "DisplayTopologyGraph:\n"; + dump += addLinePrefix(mTopology.dump(), INDENT2); dump += "\n"; } diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index ef50fc0036..1fa04261eb 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -5222,6 +5222,9 @@ std::string InputDispatcher::DispatcherWindowInfo::dumpDisplayAndWindowInfo() co } else { dump += "Displays: <none>\n"; } + dump += "DisplayTopologyGraph:\n"; + dump += addLinePrefix(mTopology.dump(), INDENT); + dump += "\n"; return dump; } |