Skip to content

Commit 32ab773

Browse files
committed
Merge 25Q1 (ab/BP1A.250305.020) to AOSP main
Bug: 385190204 Merged-In: Ib562fdc672f09e92c646583840c324ad50e2fa39 Change-Id: Ie21212b27d78e41c9dacbfab510925d29653cfeb
2 parents 4b89f17 + cadcf50 commit 32ab773

448 files changed

Lines changed: 17741 additions & 5620 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmds/dumpstate/Android.bp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ cc_defaults {
120120
],
121121
}
122122

123+
prebuilt_etc {
124+
name: "default_screenshot",
125+
src: "res/default_screenshot.png",
126+
filename_from_src: true,
127+
}
128+
123129
cc_binary {
124130
name: "dumpstate",
125131
defaults: ["dumpstate_defaults"],
@@ -133,6 +139,7 @@ cc_binary {
133139
"alloctop",
134140
"atrace",
135141
"bugreport_procdump",
142+
"default_screenshot",
136143
"dmabuf_dump",
137144
"ip",
138145
"iptables",

cmds/dumpstate/dumpstate.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ static const std::string ANR_TRACE_FILE_PREFIX = "trace_";
208208
static const std::string SHUTDOWN_CHECKPOINTS_DIR = "/data/system/shutdown-checkpoints/";
209209
static const std::string SHUTDOWN_CHECKPOINTS_FILE_PREFIX = "checkpoints-";
210210

211+
// File path to default screenshot image, that used when failed to capture the real screenshot.
212+
static const std::string DEFAULT_SCREENSHOT_PATH = "/system/etc/default_screenshot.png";
213+
211214
// TODO: temporary variables and functions used during C++ refactoring
212215

213216
#define RETURN_IF_USER_DENIED_CONSENT() \
@@ -767,10 +770,14 @@ android::binder::Status Dumpstate::ConsentCallback::onReportApproved() {
767770

768771
bool copy_succeeded = android::os::CopyFileToFd(ds.screenshot_path_,
769772
ds.options_->screenshot_fd.get());
770-
ds.options_->is_screenshot_copied = copy_succeeded;
771773
if (copy_succeeded) {
772774
android::os::UnlinkAndLogOnError(ds.screenshot_path_);
775+
} else {
776+
MYLOGE("Failed to copy screenshot to a permanent file.\n");
777+
copy_succeeded = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH,
778+
ds.options_->screenshot_fd.get());
773779
}
780+
ds.options_->is_screenshot_copied = copy_succeeded;
774781
return android::binder::Status::ok();
775782
}
776783

@@ -1854,6 +1861,11 @@ Dumpstate::RunStatus Dumpstate::dumpstate() {
18541861
RunCommand("DUMP VENDOR RIL LOGS", {"vril-dump"}, options.Build());
18551862
}
18561863

1864+
/* Dump USB information */
1865+
RunCommand("typec_connector_class", {"typec_connector_class"},
1866+
CommandOptions::WithTimeout(10).AsRootIfAvailable().Build());
1867+
RunCommand("lsusb", {"lsusb"}, CommandOptions::WithTimeout(10).AsRootIfAvailable().Build());
1868+
18571869
printf("========================================================\n");
18581870
printf("== Android Framework Services\n");
18591871
printf("========================================================\n");
@@ -3464,7 +3476,9 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
34643476
// Do an early return if there were errors. We make an exception for consent
34653477
// timing out because it's possible the user got distracted. In this case the
34663478
// bugreport is not shared but made available for manual retrieval.
3467-
MYLOGI("User denied consent. Returning\n");
3479+
MYLOGI("Bug report generation failed, this could have been due to"
3480+
" several reasons such as BR copy failed, user consent was"
3481+
" not grated etc. Returning\n");
34683482
return status;
34693483
}
34703484
if (status == Dumpstate::RunStatus::USER_CONSENT_TIMED_OUT) {
@@ -3560,7 +3574,7 @@ std::future<std::string> Dumpstate::MaybeSnapshotSystemTraceAsync() {
35603574
// the dumpstate's own activity which is irrelevant.
35613575
RunCommand(
35623576
SERIALIZE_PERFETTO_TRACE_TASK, {"perfetto", "--save-for-bugreport"},
3563-
CommandOptions::WithTimeout(10).DropRoot().CloseAllFileDescriptorsOnExec().Build(),
3577+
CommandOptions::WithTimeout(30).DropRoot().CloseAllFileDescriptorsOnExec().Build(),
35643578
false, outFd);
35653579
// MaybeAddSystemTraceToZip() will take care of copying the trace in the zip
35663580
// file in the later stages.
@@ -3751,12 +3765,16 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid
37513765
if (options_->do_screenshot &&
37523766
options_->screenshot_fd.get() != -1 &&
37533767
!options_->is_screenshot_copied) {
3754-
copy_succeeded = android::os::CopyFileToFd(screenshot_path_,
3768+
bool is_screenshot_copied = android::os::CopyFileToFd(screenshot_path_,
37553769
options_->screenshot_fd.get());
3756-
options_->is_screenshot_copied = copy_succeeded;
3757-
if (copy_succeeded) {
3770+
if (is_screenshot_copied) {
37583771
android::os::UnlinkAndLogOnError(screenshot_path_);
3772+
} else {
3773+
MYLOGE("Failed to copy screenshot to a permanent file.\n");
3774+
is_screenshot_copied = android::os::CopyFileToFd(DEFAULT_SCREENSHOT_PATH,
3775+
options_->screenshot_fd.get());
37593776
}
3777+
options_->is_screenshot_copied = is_screenshot_copied;
37603778
}
37613779
}
37623780
return copy_succeeded ? Dumpstate::RunStatus::OK : Dumpstate::RunStatus::ERROR;
@@ -3847,7 +3865,7 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only, b
38473865
DurationReporter::~DurationReporter() {
38483866
if (!title_.empty()) {
38493867
float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC;
3850-
if (elapsed >= .5f || verbose_) {
3868+
if (elapsed >= 1.0f || verbose_) {
38513869
MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
38523870
}
38533871
if (!logcat_only_) {
185 Bytes
Loading

cmds/evemu-record/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ $ adb shell uinput - < my-recording.evemu
3838
### Timestamp bases
3939

4040
By default, event timestamps are recorded relative to the time of the first event received during
41-
the recording. Passing `--timestamp-base=boot` causes the timestamps to be recorded relative to the
42-
system boot time instead. While this does not affect the playback of the recording, it can be useful
43-
for matching recorded events with other logs that use such timestamps, such as `dmesg` or the
44-
touchpad gesture debug logs emitted by `TouchpadInputMapper`.
41+
the recording. Passing `--timestamp-base=epoch` causes the timestamps to be recorded as Unix
42+
timestamps, relative to the Unix epoch (00:00:00 UTC on 1st January 1970). While this does not
43+
affect the playback of the recording, it can make the events in the recording easier to match up
44+
with those from other log sources, like logcat.
4545

4646
[FreeDesktop]: https://gitlab.freedesktop.org/libevdev/evemu
4747
[format]: https://gitlab.freedesktop.org/libevdev/evemu#device-description-format

cmds/idlcli/Android.bp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ cc_library {
5050
"vibrator/CommandAlwaysOnEnable.cpp",
5151
"vibrator/CommandCompose.cpp",
5252
"vibrator/CommandComposePwle.cpp",
53+
"vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp",
5354
"vibrator/CommandGetBandwidthAmplitudeMap.cpp",
5455
"vibrator/CommandGetCapabilities.cpp",
5556
"vibrator/CommandGetCompositionDelayMax.cpp",
@@ -72,6 +73,11 @@ cc_library {
7273
"vibrator/CommandSetExternalControl.cpp",
7374
"vibrator/CommandSupportsAmplitudeControl.cpp",
7475
"vibrator/CommandSupportsExternalControl.cpp",
76+
"vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp",
77+
"vibrator/CommandGetPwleV2CompositionSizeMax.cpp",
78+
"vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp",
79+
"vibrator/CommandComposePwleV2.cpp",
80+
"vibrator/CommandPerformVendorEffect.cpp",
7581
],
7682
visibility: [":__subpackages__"],
7783
}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/*
2+
* Copyright (C) 2024 The Android Open Source Project *
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
#include <stdlib.h>
17+
18+
#include <charconv>
19+
20+
#include "utils.h"
21+
#include "vibrator.h"
22+
23+
namespace android {
24+
namespace idlcli {
25+
26+
class CommandVibrator;
27+
28+
namespace vibrator {
29+
30+
using aidl::CompositePwleV2;
31+
using aidl::PwleV2Primitive;
32+
33+
class CommandComposePwleV2 : public Command {
34+
std::string getDescription() const override { return "Compose normalized PWLE vibration."; }
35+
36+
std::string getUsageSummary() const override {
37+
return "[options] <time> <frequency> <amplitude> ...";
38+
}
39+
40+
UsageDetails getUsageDetails() const override {
41+
UsageDetails details{
42+
{"-b", {"Block for duration of vibration."}},
43+
{"<time>", {"Segment duration in milliseconds"}},
44+
{"<frequency>", {"Target frequency in Hz"}},
45+
{"<amplitude>", {"Target amplitude in [0.0, 1.0]"}},
46+
{"...", {"May repeat multiple times."}},
47+
};
48+
return details;
49+
}
50+
51+
Status doArgs(Args& args) override {
52+
while (args.get<std::string>().value_or("").find("-") == 0) {
53+
auto opt = *args.pop<std::string>();
54+
if (opt == "--") {
55+
break;
56+
} else if (opt == "-b") {
57+
mBlocking = true;
58+
} else {
59+
std::cerr << "Invalid Option '" << opt << "'!" << std::endl;
60+
return USAGE;
61+
}
62+
}
63+
64+
if (args.empty()) {
65+
std::cerr << "Missing arguments! Please see usage" << std::endl;
66+
return USAGE;
67+
}
68+
69+
while (!args.empty()) {
70+
PwleV2Primitive segment;
71+
72+
if (auto timeMs = args.pop<decltype(segment.timeMillis)>();
73+
timeMs && *timeMs >= 0 && *timeMs <= 0x7ffff) {
74+
segment.timeMillis = *timeMs;
75+
std::cout << "Time: " << segment.timeMillis << std::endl;
76+
} else {
77+
std::cerr << "Missing or Invalid Time!" << std::endl;
78+
return USAGE;
79+
}
80+
81+
if (auto frequencyHz = args.pop<decltype(segment.frequencyHz)>();
82+
frequencyHz && *frequencyHz >= 30 && *frequencyHz <= 300) {
83+
segment.frequencyHz = *frequencyHz;
84+
std::cout << "Frequency: " << segment.frequencyHz << std::endl;
85+
} else {
86+
std::cerr << "Missing or Invalid Frequency!" << std::endl;
87+
return USAGE;
88+
}
89+
90+
if (auto amplitude = args.pop<decltype(segment.amplitude)>();
91+
amplitude && *amplitude >= 0 && *amplitude <= 1.0) {
92+
segment.amplitude = *amplitude;
93+
std::cout << "Amplitude: " << segment.amplitude << std::endl;
94+
} else {
95+
std::cerr << "Missing or Invalid Amplitude!" << std::endl;
96+
return USAGE;
97+
}
98+
99+
mCompositePwle.pwlePrimitives.emplace_back(std::move(segment));
100+
}
101+
102+
if (!args.empty()) {
103+
std::cerr << "Unexpected Arguments!" << std::endl;
104+
return USAGE;
105+
}
106+
107+
return OK;
108+
}
109+
110+
Status doMain(Args&& /*args*/) override {
111+
auto hal = getHal<aidl::IVibrator>();
112+
113+
if (!hal) {
114+
return UNAVAILABLE;
115+
}
116+
117+
ABinderProcess_setThreadPoolMaxThreadCount(1);
118+
ABinderProcess_startThreadPool();
119+
120+
std::shared_ptr<VibratorCallback> callback;
121+
122+
if (mBlocking) {
123+
callback = ndk::SharedRefBase::make<VibratorCallback>();
124+
}
125+
126+
auto status = hal->call(&aidl::IVibrator::composePwleV2, mCompositePwle, callback);
127+
128+
if (status.isOk() && callback) {
129+
callback->waitForComplete();
130+
}
131+
132+
std::cout << "Status: " << status.getDescription() << std::endl;
133+
134+
return status.isOk() ? OK : ERROR;
135+
}
136+
137+
bool mBlocking;
138+
CompositePwleV2 mCompositePwle;
139+
};
140+
141+
static const auto Command =
142+
CommandRegistry<CommandVibrator>::Register<CommandComposePwleV2>("composePwleV2");
143+
144+
} // namespace vibrator
145+
} // namespace idlcli
146+
} // namespace android
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (C) 2024 The Android Open Source Project *
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
#include "utils.h"
17+
#include "vibrator.h"
18+
19+
namespace android {
20+
namespace idlcli {
21+
22+
class CommandVibrator;
23+
24+
namespace vibrator {
25+
26+
using aidl::FrequencyAccelerationMapEntry;
27+
28+
class CommandGetFrequencyToOutputAccelerationMap : public Command {
29+
std::string getDescription() const override {
30+
return "Retrieves vibrator frequency to output acceleration map.";
31+
}
32+
33+
std::string getUsageSummary() const override { return ""; }
34+
35+
UsageDetails getUsageDetails() const override {
36+
UsageDetails details{};
37+
return details;
38+
}
39+
40+
Status doArgs(Args& args) override {
41+
if (!args.empty()) {
42+
std::cerr << "Unexpected Arguments!" << std::endl;
43+
return USAGE;
44+
}
45+
return OK;
46+
}
47+
48+
Status doMain(Args&& /*args*/) override {
49+
std::string statusStr;
50+
std::vector<FrequencyAccelerationMapEntry> frequencyToOutputAccelerationMap;
51+
Status ret;
52+
53+
if (auto hal = getHal<aidl::IVibrator>()) {
54+
auto status = hal->call(&aidl::IVibrator::getFrequencyToOutputAccelerationMap,
55+
&frequencyToOutputAccelerationMap);
56+
statusStr = status.getDescription();
57+
ret = (status.isOk() ? OK : ERROR);
58+
} else {
59+
return UNAVAILABLE;
60+
}
61+
62+
std::cout << "Status: " << statusStr << std::endl;
63+
std::cout << "Frequency to Output Amplitude Map: " << std::endl;
64+
for (auto& entry : frequencyToOutputAccelerationMap) {
65+
std::cout << entry.frequencyHz << " " << entry.maxOutputAccelerationGs << std::endl;
66+
}
67+
68+
return ret;
69+
}
70+
};
71+
72+
static const auto Command =
73+
CommandRegistry<CommandVibrator>::Register<CommandGetFrequencyToOutputAccelerationMap>(
74+
"getFrequencyToOutputAccelerationMap");
75+
76+
} // namespace vibrator
77+
} // namespace idlcli
78+
} // namespace android

0 commit comments

Comments
 (0)