From 5aa8d157afa3e15419a41bf0da0500d6ba01596b Mon Sep 17 00:00:00 2001 From: Kean Mariotti Date: Mon, 23 Sep 2024 12:10:09 +0000 Subject: dumpstate.cpp: increase perfetto serialization timeout This commit increases the timeout of "perfetto --save-for-bugreport" from 10s to 30s, thus giving more time to data sources to process OnFlush. 30s seems a bit extreme but in production we ran into cases (e.g. b/369053554), where the serialization took >18s. Fix: 369053554 Flag: EXEMPT bugfix Test: atest com.android.os.bugreports.tests.BugreportManagerTest Ignore-AOSP-First: depends on changes not available in AOSP (I343813929a537c601132dd15db5e2c4d3fbbdcb1) Change-Id: Ie976c7d86fef854f24b115b347890a3d40be9885 --- cmds/dumpstate/dumpstate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmds') diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 220fef6f8d..2383732234 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -3533,7 +3533,7 @@ std::future Dumpstate::MaybeSnapshotSystemTraceAsync() { // the dumpstate's own activity which is irrelevant. RunCommand( SERIALIZE_PERFETTO_TRACE_TASK, {"perfetto", "--save-for-bugreport"}, - CommandOptions::WithTimeout(10).DropRoot().CloseAllFileDescriptorsOnExec().Build(), + CommandOptions::WithTimeout(30).DropRoot().CloseAllFileDescriptorsOnExec().Build(), false, outFd); // MaybeAddSystemTraceToZip() will take care of copying the trace in the zip // file in the later stages. -- cgit v1.2.3-59-g8ed1b From 3a5b65ae3b6debaef109072c37c4e6a1f749a5f2 Mon Sep 17 00:00:00 2001 From: Kunduz Baryktabasova Date: Mon, 7 Oct 2024 11:53:48 +0000 Subject: Copy BR when failed to copy the screenshot. Flag: EXEMPT minor bugfix Test: manual test Bug: 367591117 Bug: 367349763 Change-Id: Ia9a4be2ebf2c8ffb0265baef14ac5616f8b06446 --- cmds/dumpstate/Android.bp | 7 +++++++ cmds/dumpstate/dumpstate.cpp | 25 +++++++++++++++++++------ cmds/dumpstate/res/default_screenshot.png | Bin 0 -> 185 bytes 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 cmds/dumpstate/res/default_screenshot.png (limited to 'cmds') diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp index b22cc2a508..372008e63b 100644 --- a/cmds/dumpstate/Android.bp +++ b/cmds/dumpstate/Android.bp @@ -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"], @@ -130,6 +136,7 @@ cc_binary { required: [ "atrace", "bugreport_procdump", + "default_screenshot", "dmabuf_dump", "ip", "iptables", diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index d427ecf280..d24edc4d82 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -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() \ @@ -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(); } @@ -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) { @@ -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; @@ -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_) { diff --git a/cmds/dumpstate/res/default_screenshot.png b/cmds/dumpstate/res/default_screenshot.png new file mode 100644 index 0000000000..10f36aa52b Binary files /dev/null and b/cmds/dumpstate/res/default_screenshot.png differ -- cgit v1.2.3-59-g8ed1b From d5850998561e2fedaea5811fc4bf11689ef6bab2 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Thu, 10 Oct 2024 18:11:10 +0000 Subject: evemu-record: Document the --timestamp-base=epoch option The timestamp base "boot" was changed to "epoch" in: commit I80e3b4db1bcc2e6f656bfaaf7904f1678cfb29cf Bug: 245989146 Change-Id: Id867cece5732306454d67efc58f08e0534df26f9 Flag: DOCS_ONLY Test: None --- cmds/evemu-record/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmds') diff --git a/cmds/evemu-record/README.md b/cmds/evemu-record/README.md index 5d16d51da0..cd28520413 100644 --- a/cmds/evemu-record/README.md +++ b/cmds/evemu-record/README.md @@ -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 -- cgit v1.2.3-59-g8ed1b From d0776158d0eceb0cc5bdd4371bfaf912190af0ce Mon Sep 17 00:00:00 2001 From: Radu Date: Tue, 29 Oct 2024 12:08:54 +0000 Subject: Add USB information to bugreport Include the output of two commands useful especially for usb-related debugging - lsusb (toybox) - list usb devices connected to the host - typec_connector_class - list information about the type-c ports of the system Bug: 375337894 Flag: EXEMPT additional logs to bugreport Ignore-AOSP-First: typec_connector_class currently developed internally but designed to be public. Test: manual - check if bugreport contains entries for lsusb and typec_connector_class and if the output of typec_connector_class_is_similar to: port0 uevent: DEVTYPE=typec_port TYPEC_PORT=port0 vconn_source: no supported_accessory_modes: none power_role: source [sink] data_role: host [device] preferred_role: source power_operation_mode: default usb_power_delivery_revision: 0.0 usb_typec_revision: 0.0 waiting_for_supplier: 0 port1 [...port1 info] Change-Id: If0ff2bfb45023698d18bfbaee522bd29843224af --- cmds/dumpstate/dumpstate.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmds') diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index d24edc4d82..b012243c8b 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -1841,6 +1841,11 @@ Dumpstate::RunStatus Dumpstate::dumpstate() { RunCommand("DUMP VENDOR RIL LOGS", {"vril-dump"}, options.Build()); } + /* Dump USB information */ + RunCommand("typec_connector_class", {"typec_connector_class"}, + CommandOptions::WithTimeout(10).AsRootIfAvailable().Build()); + RunCommand("lsusb", {"lsusb"}, CommandOptions::WithTimeout(10).AsRootIfAvailable().Build()); + printf("========================================================\n"); printf("== Android Framework Services\n"); printf("========================================================\n"); -- cgit v1.2.3-59-g8ed1b From 3a5f4bef5b0080fb4fb54af63b1f9292d11c193a Mon Sep 17 00:00:00 2001 From: Nathan Kulczak Date: Wed, 9 Oct 2024 07:58:14 +0000 Subject: IDLCLI: Update android.hardware.vibrator to V3 for idlcli Implement the following functions to enable testing of new interfaces: - performVendorEffect (stub) - getPwleFrequencyToOutputAccelerationMap - getPwleV2PrimitiveDurationMinMillis - getPwleV2PrimitiveDurationMaxMillis - getPwleV2CompositionSizeMax - composePwleV2 Flag: EXEMPT internal dev tools Bug: 346570576 Test: Flash to device and execute PWLEV2 methods Change-Id: Id51781194f7fe8ef11fb783700b2b14a763018b4 Signed-off-by: Nathan Kulczak --- cmds/idlcli/Android.bp | 8 +- cmds/idlcli/vibrator/CommandComposePwleV2.cpp | 146 +++++++++++++++++++++ .../CommandGetFrequencyToOutputAccelerationMap.cpp | 78 +++++++++++ .../CommandGetPwleV2CompositionSizeMax.cpp | 72 ++++++++++ .../CommandGetPwleV2PrimitiveDurationMaxMillis.cpp | 73 +++++++++++ .../CommandGetPwleV2PrimitiveDurationMinMillis.cpp | 73 +++++++++++ .../idlcli/vibrator/CommandPerformVendorEffect.cpp | 73 +++++++++++ 7 files changed, 522 insertions(+), 1 deletion(-) create mode 100644 cmds/idlcli/vibrator/CommandComposePwleV2.cpp create mode 100644 cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp create mode 100644 cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp create mode 100644 cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp create mode 100644 cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp create mode 100644 cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp (limited to 'cmds') diff --git a/cmds/idlcli/Android.bp b/cmds/idlcli/Android.bp index 50c2cd8be2..9e64f45ae0 100644 --- a/cmds/idlcli/Android.bp +++ b/cmds/idlcli/Android.bp @@ -1,4 +1,4 @@ -// Copyright (C) 2019 The Android Open Source Project +// Copyright (C) 2024 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -50,6 +50,7 @@ cc_library { "vibrator/CommandAlwaysOnEnable.cpp", "vibrator/CommandCompose.cpp", "vibrator/CommandComposePwle.cpp", + "vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp", "vibrator/CommandGetBandwidthAmplitudeMap.cpp", "vibrator/CommandGetCapabilities.cpp", "vibrator/CommandGetCompositionDelayMax.cpp", @@ -72,6 +73,11 @@ cc_library { "vibrator/CommandSetExternalControl.cpp", "vibrator/CommandSupportsAmplitudeControl.cpp", "vibrator/CommandSupportsExternalControl.cpp", + "vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp", + "vibrator/CommandGetPwleV2CompositionSizeMax.cpp", + "vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp", + "vibrator/CommandComposePwleV2.cpp", + "vibrator/CommandPerformVendorEffect.cpp", ], visibility: [":__subpackages__"], } diff --git a/cmds/idlcli/vibrator/CommandComposePwleV2.cpp b/cmds/idlcli/vibrator/CommandComposePwleV2.cpp new file mode 100644 index 0000000000..6d3cf84a2e --- /dev/null +++ b/cmds/idlcli/vibrator/CommandComposePwleV2.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2024 The Android Open Source Project * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include + +#include "utils.h" +#include "vibrator.h" + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +using aidl::CompositePwleV2; +using aidl::PwleV2Primitive; + +class CommandComposePwleV2 : public Command { + std::string getDescription() const override { return "Compose normalized PWLE vibration."; } + + std::string getUsageSummary() const override { + return "[options]