Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05215aff authored by Arpit Singh's avatar Arpit Singh
Browse files

Add CursorController to the input dump

Test: manually validate `adb shell dumpsys input`
Bug: 245989146
FLAG: EXEMPT log only update

Change-Id: Ibab15f613e3076df2ac2ac2e672ce9e699de7f67
parent a9567c6b
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,9 @@
#include <input/Input.h>
#include <input/Input.h>
#include <log/log.h>
#include <log/log.h>


#define INDENT "  "
#define INDENT2 "    "

namespace {
namespace {
// Time to spend fading out the pointer completely.
// Time to spend fading out the pointer completely.
const nsecs_t POINTER_FADE_DURATION = 500 * 1000000LL; // 500 ms
const nsecs_t POINTER_FADE_DURATION = 500 * 1000000LL; // 500 ms
@@ -449,6 +452,24 @@ bool MouseCursorController::resourcesLoaded() {
    return mLocked.resourcesLoaded;
    return mLocked.resourcesLoaded;
}
}


std::string MouseCursorController::dump() const {
    std::string dump = INDENT "MouseCursorController:\n";
    std::scoped_lock lock(mLock);
    dump += StringPrintf(INDENT2 "viewport: %s\n", mLocked.viewport.toString().c_str());
    dump += StringPrintf(INDENT2 "stylusHoverMode: %s\n",
                         mLocked.stylusHoverMode ? "true" : "false");
    dump += StringPrintf(INDENT2 "pointerFadeDirection: %d\n", mLocked.pointerFadeDirection);
    dump += StringPrintf(INDENT2 "updatePointerIcon: %s\n",
                         mLocked.updatePointerIcon ? "true" : "false");
    dump += StringPrintf(INDENT2 "resourcesLoaded: %s\n",
                         mLocked.resourcesLoaded ? "true" : "false");
    dump += StringPrintf(INDENT2 "requestedPointerType: %d\n", mLocked.requestedPointerType);
    dump += StringPrintf(INDENT2 "resolvedPointerType: %d\n", mLocked.resolvedPointerType);
    dump += StringPrintf(INDENT2 "skipScreenshot: %s\n", mLocked.skipScreenshot ? "true" : "false");
    dump += StringPrintf(INDENT2 "animating: %s\n", mLocked.animating ? "true" : "false");
    return dump;
}

bool MouseCursorController::doAnimations(nsecs_t timestamp) {
bool MouseCursorController::doAnimations(nsecs_t timestamp) {
    std::scoped_lock lock(mLock);
    std::scoped_lock lock(mLock);
    bool keepFading = doFadingAnimationLocked(timestamp);
    bool keepFading = doFadingAnimationLocked(timestamp);
+2 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,8 @@ public:


    bool resourcesLoaded();
    bool resourcesLoaded();


    std::string dump() const;

private:
private:
    mutable std::mutex mLock;
    mutable std::mutex mLock;


+3 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <android-base/stringprintf.h>
#include <android-base/stringprintf.h>
#include <android-base/thread_annotations.h>
#include <android-base/thread_annotations.h>
#include <ftl/enum.h>
#include <ftl/enum.h>
#include <input/PrintTools.h>


#include <mutex>
#include <mutex>


@@ -353,6 +354,8 @@ std::string PointerController::dump() {
    for (const auto& [_, spotController] : mLocked.spotControllers) {
    for (const auto& [_, spotController] : mLocked.spotControllers) {
        spotController.dump(dump, INDENT3);
        spotController.dump(dump, INDENT3);
    }
    }
    dump += INDENT2 "Cursor Controller:\n";
    dump += addLinePrefix(mCursorController.dump(), INDENT3);
    return dump;
    return dump;
}
}