diff options
author | 2022-10-22 03:18:32 +0100 | |
---|---|---|
committer | 2022-11-11 14:05:13 +0000 | |
commit | c9e53047c614d96785e497e4be0361b0b42c9a68 (patch) | |
tree | f983ada41ad6891f94bb1506112929105522a2c7 | |
parent | 08f7a6adfbf8e9dcabe89417b1305280093d7cce (diff) |
Add dump to DisplayInfo.
This way it can be dumped as part of PointerController's dump.
Bug: 254277939
Test: manually inspect `dumpsys input`
Change-Id: I9ad71d14c81af390f5b9ccb4fa75439bd4496c26
-rw-r--r-- | libs/gui/DisplayInfo.cpp | 18 | ||||
-rw-r--r-- | libs/gui/include/gui/DisplayInfo.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libs/gui/DisplayInfo.cpp b/libs/gui/DisplayInfo.cpp index 52d9540eeb..bd640df81e 100644 --- a/libs/gui/DisplayInfo.cpp +++ b/libs/gui/DisplayInfo.cpp @@ -20,8 +20,13 @@ #include <gui/DisplayInfo.h> #include <private/gui/ParcelUtils.h> +#include <android-base/stringprintf.h> #include <log/log.h> +#include <inttypes.h> + +#define INDENT " " + namespace android::gui { // --- DisplayInfo --- @@ -67,4 +72,17 @@ status_t DisplayInfo::writeToParcel(android::Parcel* parcel) const { return OK; } +void DisplayInfo::dump(std::string& out, const char* prefix) const { + using android::base::StringAppendF; + + out += prefix; + StringAppendF(&out, "DisplayViewport[id=%" PRId32 "]\n", displayId); + out += prefix; + StringAppendF(&out, INDENT "Width=%" PRId32 ", Height=%" PRId32 "\n", logicalWidth, + logicalHeight); + std::string transformPrefix(prefix); + transformPrefix.append(INDENT); + transform.dump(out, "Transform", transformPrefix.c_str()); +} + } // namespace android::gui diff --git a/libs/gui/include/gui/DisplayInfo.h b/libs/gui/include/gui/DisplayInfo.h index 74f33a2a87..42b62c755c 100644 --- a/libs/gui/include/gui/DisplayInfo.h +++ b/libs/gui/include/gui/DisplayInfo.h @@ -41,6 +41,8 @@ struct DisplayInfo : public Parcelable { status_t writeToParcel(android::Parcel*) const override; status_t readFromParcel(const android::Parcel*) override; + + void dump(std::string& result, const char* prefix = "") const; }; } // namespace android::gui
\ No newline at end of file |