Loading cmds/dumpstate/Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ cc_defaults { ], } prebuilt_etc { name: "default_screenshot", src: "res/default_screenshot.png", filename_from_src: true, } cc_binary { name: "dumpstate", defaults: ["dumpstate_defaults"], Loading @@ -130,6 +136,7 @@ cc_binary { required: [ "atrace", "bugreport_procdump", "default_screenshot", "dmabuf_dump", "ip", "iptables", Loading cmds/dumpstate/dumpstate.cpp +19 −6 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ static const std::string ANR_TRACE_FILE_PREFIX = "trace_"; static const std::string SHUTDOWN_CHECKPOINTS_DIR = "/data/system/shutdown-checkpoints/"; static const std::string SHUTDOWN_CHECKPOINTS_FILE_PREFIX = "checkpoints-"; // File path to default screenshot image, that used when failed to capture the real screenshot. static const std::string DEFAULT_SCREENSHOT_PATH = "/system/etc/default_screenshot.png"; // TODO: temporary variables and functions used during C++ refactoring #define RETURN_IF_USER_DENIED_CONSENT() \ Loading Loading @@ -765,10 +768,14 @@ android::binder::Status Dumpstate::ConsentCallback::onReportApproved() { bool copy_succeeded = android::os::CopyFileToFd(ds.screenshot_path_, ds.options_->screenshot_fd.get()); ds.options_->is_screenshot_copied = copy_succeeded; if (copy_succeeded) { android::os::UnlinkAndLogOnError(ds.screenshot_path_); } else { MYLOGE("Failed to copy screenshot to a permanent file.\n"); copy_succeeded = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH, ds.options_->screenshot_fd.get()); } ds.options_->is_screenshot_copied = copy_succeeded; return android::binder::Status::ok(); } Loading Loading @@ -3442,7 +3449,9 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, // Do an early return if there were errors. We make an exception for consent // timing out because it's possible the user got distracted. In this case the // bugreport is not shared but made available for manual retrieval. MYLOGI("User denied consent. Returning\n"); MYLOGI("Bug report generation failed, this could have been due to" " several reasons such as BR copy failed, user consent was" " not grated etc. Returning\n"); return status; } if (status == Dumpstate::RunStatus::USER_CONSENT_TIMED_OUT) { Loading Loading @@ -3729,12 +3738,16 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid if (options_->do_screenshot && options_->screenshot_fd.get() != -1 && !options_->is_screenshot_copied) { copy_succeeded = android::os::CopyFileToFd(screenshot_path_, bool is_screenshot_copied = android::os::CopyFileToFd(screenshot_path_, options_->screenshot_fd.get()); options_->is_screenshot_copied = copy_succeeded; if (copy_succeeded) { if (is_screenshot_copied) { android::os::UnlinkAndLogOnError(screenshot_path_); } else { MYLOGE("Failed to copy screenshot to a permanent file.\n"); is_screenshot_copied = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH, options_->screenshot_fd.get()); } options_->is_screenshot_copied = is_screenshot_copied; } } return copy_succeeded ? Dumpstate::RunStatus::OK : Dumpstate::RunStatus::ERROR; Loading Loading @@ -3825,7 +3838,7 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only, b DurationReporter::~DurationReporter() { if (!title_.empty()) { float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC; if (elapsed >= .5f || verbose_) { if (elapsed >= 1.0f || verbose_) { MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed); } if (!logcat_only_) { Loading cmds/dumpstate/res/default_screenshot.png 0 → 100644 +185 B Loading image diff... cmds/evemu-record/README.md +4 −4 Original line number Diff line number Diff line Loading @@ -38,10 +38,10 @@ $ adb shell uinput - < my-recording.evemu ### Timestamp bases By default, event timestamps are recorded relative to the time of the first event received during the recording. Passing `--timestamp-base=boot` causes the timestamps to be recorded relative to the system boot time instead. While this does not affect the playback of the recording, it can be useful for matching recorded events with other logs that use such timestamps, such as `dmesg` or the touchpad gesture debug logs emitted by `TouchpadInputMapper`. the recording. Passing `--timestamp-base=epoch` causes the timestamps to be recorded as Unix timestamps, relative to the Unix epoch (00:00:00 UTC on 1st January 1970). While this does not affect the playback of the recording, it can make the events in the recording easier to match up with those from other log sources, like logcat. [FreeDesktop]: https://gitlab.freedesktop.org/libevdev/evemu [format]: https://gitlab.freedesktop.org/libevdev/evemu#device-description-format Loading include/input/KeyCharacterMap.h +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ public: /* Returns keycode after applying Android key code remapping defined in mKeyRemapping */ int32_t applyKeyRemapping(int32_t fromKeyCode) const; /** Returns list of keycodes that remap to provided keycode (@see setKeyRemapping()) */ std::vector<int32_t> findKeyCodesMappedToKeyCode(int32_t toKeyCode) const; /* Returns the <keyCode, metaState> pair after applying key behavior defined in the kcm file, * that tries to find a replacement key code based on current meta state */ std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode, Loading Loading
cmds/dumpstate/Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ cc_defaults { ], } prebuilt_etc { name: "default_screenshot", src: "res/default_screenshot.png", filename_from_src: true, } cc_binary { name: "dumpstate", defaults: ["dumpstate_defaults"], Loading @@ -130,6 +136,7 @@ cc_binary { required: [ "atrace", "bugreport_procdump", "default_screenshot", "dmabuf_dump", "ip", "iptables", Loading
cmds/dumpstate/dumpstate.cpp +19 −6 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ static const std::string ANR_TRACE_FILE_PREFIX = "trace_"; static const std::string SHUTDOWN_CHECKPOINTS_DIR = "/data/system/shutdown-checkpoints/"; static const std::string SHUTDOWN_CHECKPOINTS_FILE_PREFIX = "checkpoints-"; // File path to default screenshot image, that used when failed to capture the real screenshot. static const std::string DEFAULT_SCREENSHOT_PATH = "/system/etc/default_screenshot.png"; // TODO: temporary variables and functions used during C++ refactoring #define RETURN_IF_USER_DENIED_CONSENT() \ Loading Loading @@ -765,10 +768,14 @@ android::binder::Status Dumpstate::ConsentCallback::onReportApproved() { bool copy_succeeded = android::os::CopyFileToFd(ds.screenshot_path_, ds.options_->screenshot_fd.get()); ds.options_->is_screenshot_copied = copy_succeeded; if (copy_succeeded) { android::os::UnlinkAndLogOnError(ds.screenshot_path_); } else { MYLOGE("Failed to copy screenshot to a permanent file.\n"); copy_succeeded = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH, ds.options_->screenshot_fd.get()); } ds.options_->is_screenshot_copied = copy_succeeded; return android::binder::Status::ok(); } Loading Loading @@ -3442,7 +3449,9 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, // Do an early return if there were errors. We make an exception for consent // timing out because it's possible the user got distracted. In this case the // bugreport is not shared but made available for manual retrieval. MYLOGI("User denied consent. Returning\n"); MYLOGI("Bug report generation failed, this could have been due to" " several reasons such as BR copy failed, user consent was" " not grated etc. Returning\n"); return status; } if (status == Dumpstate::RunStatus::USER_CONSENT_TIMED_OUT) { Loading Loading @@ -3729,12 +3738,16 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid if (options_->do_screenshot && options_->screenshot_fd.get() != -1 && !options_->is_screenshot_copied) { copy_succeeded = android::os::CopyFileToFd(screenshot_path_, bool is_screenshot_copied = android::os::CopyFileToFd(screenshot_path_, options_->screenshot_fd.get()); options_->is_screenshot_copied = copy_succeeded; if (copy_succeeded) { if (is_screenshot_copied) { android::os::UnlinkAndLogOnError(screenshot_path_); } else { MYLOGE("Failed to copy screenshot to a permanent file.\n"); is_screenshot_copied = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH, options_->screenshot_fd.get()); } options_->is_screenshot_copied = is_screenshot_copied; } } return copy_succeeded ? Dumpstate::RunStatus::OK : Dumpstate::RunStatus::ERROR; Loading Loading @@ -3825,7 +3838,7 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only, b DurationReporter::~DurationReporter() { if (!title_.empty()) { float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC; if (elapsed >= .5f || verbose_) { if (elapsed >= 1.0f || verbose_) { MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed); } if (!logcat_only_) { Loading
cmds/evemu-record/README.md +4 −4 Original line number Diff line number Diff line Loading @@ -38,10 +38,10 @@ $ adb shell uinput - < my-recording.evemu ### Timestamp bases By default, event timestamps are recorded relative to the time of the first event received during the recording. Passing `--timestamp-base=boot` causes the timestamps to be recorded relative to the system boot time instead. While this does not affect the playback of the recording, it can be useful for matching recorded events with other logs that use such timestamps, such as `dmesg` or the touchpad gesture debug logs emitted by `TouchpadInputMapper`. the recording. Passing `--timestamp-base=epoch` causes the timestamps to be recorded as Unix timestamps, relative to the Unix epoch (00:00:00 UTC on 1st January 1970). While this does not affect the playback of the recording, it can make the events in the recording easier to match up with those from other log sources, like logcat. [FreeDesktop]: https://gitlab.freedesktop.org/libevdev/evemu [format]: https://gitlab.freedesktop.org/libevdev/evemu#device-description-format Loading
include/input/KeyCharacterMap.h +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ public: /* Returns keycode after applying Android key code remapping defined in mKeyRemapping */ int32_t applyKeyRemapping(int32_t fromKeyCode) const; /** Returns list of keycodes that remap to provided keycode (@see setKeyRemapping()) */ std::vector<int32_t> findKeyCodesMappedToKeyCode(int32_t toKeyCode) const; /* Returns the <keyCode, metaState> pair after applying key behavior defined in the kcm file, * that tries to find a replacement key code based on current meta state */ std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode, Loading