diff options
| author | 2025-02-26 11:55:07 -0800 | |
|---|---|---|
| committer | 2025-02-26 11:55:07 -0800 | |
| commit | 98bdc04b7658fde0a99403fc052d1d18e7d48ea6 (patch) | |
| tree | eddfcd420408117ba0399a190f75c13cf2db0036 /cmds | |
| parent | 7ba28a3a24fadce84a590a6f4a94907840fe814c (diff) | |
| parent | 8c6afcf151af438342729f2399c43560ae1f353c (diff) | |
Merge 25Q1 (ab/12770256) to aosp-main-future
Bug: 385190204
Merged-In: I0fb567cbcca67a2fc6c088f652c8af570b8d7e53
Change-Id: Iaae8cd491ff963cf422f4b19c54be33e1244a9a1
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/dumpstate/Android.bp | 7 | ||||
| -rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 32 | ||||
| -rw-r--r-- | cmds/dumpstate/res/default_screenshot.png | bin | 0 -> 185 bytes | |||
| -rw-r--r-- | cmds/evemu-record/README.md | 8 | ||||
| -rw-r--r-- | cmds/idlcli/Android.bp | 6 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandComposePwleV2.cpp | 146 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp | 78 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp | 72 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp | 73 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp | 73 | ||||
| -rw-r--r-- | cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp | 73 | ||||
| -rw-r--r-- | cmds/servicemanager/main.cpp | 1 |
12 files changed, 558 insertions, 11 deletions
diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp index 1397ae6df1..a5d176d8c4 100644 --- a/cmds/dumpstate/Android.bp +++ b/cmds/dumpstate/Android.bp @@ -120,6 +120,12 @@ cc_defaults { ], } +prebuilt_etc { + name: "default_screenshot", + src: "res/default_screenshot.png", + filename_from_src: true, +} + cc_binary { name: "dumpstate", defaults: ["dumpstate_defaults"], @@ -133,6 +139,7 @@ cc_binary { "alloctop", "atrace", "bugreport_procdump", + "default_screenshot", "dmabuf_dump", "ip", "iptables", diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index ab0274a15f..888fb67b31 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -208,6 +208,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() \ @@ -767,10 +770,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(); } @@ -1854,6 +1861,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"); @@ -3464,7 +3476,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) { @@ -3560,7 +3574,7 @@ std::future<std::string> 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. @@ -3751,12 +3765,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; @@ -3847,7 +3865,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 Binary files differnew file mode 100644 index 0000000000..10f36aa52b --- /dev/null +++ b/cmds/dumpstate/res/default_screenshot.png 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 diff --git a/cmds/idlcli/Android.bp b/cmds/idlcli/Android.bp index 50c2cd8be2..36dcbca0a3 100644 --- a/cmds/idlcli/Android.bp +++ b/cmds/idlcli/Android.bp @@ -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 <stdlib.h> + +#include <charconv> + +#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] <time> <frequency> <amplitude> ..."; + } + + UsageDetails getUsageDetails() const override { + UsageDetails details{ + {"-b", {"Block for duration of vibration."}}, + {"<time>", {"Segment duration in milliseconds"}}, + {"<frequency>", {"Target frequency in Hz"}}, + {"<amplitude>", {"Target amplitude in [0.0, 1.0]"}}, + {"...", {"May repeat multiple times."}}, + }; + return details; + } + + Status doArgs(Args& args) override { + while (args.get<std::string>().value_or("").find("-") == 0) { + auto opt = *args.pop<std::string>(); + if (opt == "--") { + break; + } else if (opt == "-b") { + mBlocking = true; + } else { + std::cerr << "Invalid Option '" << opt << "'!" << std::endl; + return USAGE; + } + } + + if (args.empty()) { + std::cerr << "Missing arguments! Please see usage" << std::endl; + return USAGE; + } + + while (!args.empty()) { + PwleV2Primitive segment; + + if (auto timeMs = args.pop<decltype(segment.timeMillis)>(); + timeMs && *timeMs >= 0 && *timeMs <= 0x7ffff) { + segment.timeMillis = *timeMs; + std::cout << "Time: " << segment.timeMillis << std::endl; + } else { + std::cerr << "Missing or Invalid Time!" << std::endl; + return USAGE; + } + + if (auto frequencyHz = args.pop<decltype(segment.frequencyHz)>(); + frequencyHz && *frequencyHz >= 30 && *frequencyHz <= 300) { + segment.frequencyHz = *frequencyHz; + std::cout << "Frequency: " << segment.frequencyHz << std::endl; + } else { + std::cerr << "Missing or Invalid Frequency!" << std::endl; + return USAGE; + } + + if (auto amplitude = args.pop<decltype(segment.amplitude)>(); + amplitude && *amplitude >= 0 && *amplitude <= 1.0) { + segment.amplitude = *amplitude; + std::cout << "Amplitude: " << segment.amplitude << std::endl; + } else { + std::cerr << "Missing or Invalid Amplitude!" << std::endl; + return USAGE; + } + + mCompositePwle.pwlePrimitives.emplace_back(std::move(segment)); + } + + if (!args.empty()) { + std::cerr << "Unexpected Arguments!" << std::endl; + return USAGE; + } + + return OK; + } + + Status doMain(Args&& /*args*/) override { + auto hal = getHal<aidl::IVibrator>(); + + if (!hal) { + return UNAVAILABLE; + } + + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + + std::shared_ptr<VibratorCallback> callback; + + if (mBlocking) { + callback = ndk::SharedRefBase::make<VibratorCallback>(); + } + + auto status = hal->call(&aidl::IVibrator::composePwleV2, mCompositePwle, callback); + + if (status.isOk() && callback) { + callback->waitForComplete(); + } + + std::cout << "Status: " << status.getDescription() << std::endl; + + return status.isOk() ? OK : ERROR; + } + + bool mBlocking; + CompositePwleV2 mCompositePwle; +}; + +static const auto Command = + CommandRegistry<CommandVibrator>::Register<CommandComposePwleV2>("composePwleV2"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp b/cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp new file mode 100644 index 0000000000..2edd0caf2e --- /dev/null +++ b/cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp @@ -0,0 +1,78 @@ +/* + * 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 "utils.h" +#include "vibrator.h" + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +using aidl::FrequencyAccelerationMapEntry; + +class CommandGetFrequencyToOutputAccelerationMap : public Command { + std::string getDescription() const override { + return "Retrieves vibrator frequency to output acceleration map."; + } + + std::string getUsageSummary() const override { return ""; } + + UsageDetails getUsageDetails() const override { + UsageDetails details{}; + return details; + } + + Status doArgs(Args& args) override { + if (!args.empty()) { + std::cerr << "Unexpected Arguments!" << std::endl; + return USAGE; + } + return OK; + } + + Status doMain(Args&& /*args*/) override { + std::string statusStr; + std::vector<FrequencyAccelerationMapEntry> frequencyToOutputAccelerationMap; + Status ret; + + if (auto hal = getHal<aidl::IVibrator>()) { + auto status = hal->call(&aidl::IVibrator::getFrequencyToOutputAccelerationMap, + &frequencyToOutputAccelerationMap); + statusStr = status.getDescription(); + ret = (status.isOk() ? OK : ERROR); + } else { + return UNAVAILABLE; + } + + std::cout << "Status: " << statusStr << std::endl; + std::cout << "Frequency to Output Amplitude Map: " << std::endl; + for (auto& entry : frequencyToOutputAccelerationMap) { + std::cout << entry.frequencyHz << " " << entry.maxOutputAccelerationGs << std::endl; + } + + return ret; + } +}; + +static const auto Command = + CommandRegistry<CommandVibrator>::Register<CommandGetFrequencyToOutputAccelerationMap>( + "getFrequencyToOutputAccelerationMap"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp b/cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp new file mode 100644 index 0000000000..cca072c46f --- /dev/null +++ b/cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp @@ -0,0 +1,72 @@ +/* + * 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 "utils.h" +#include "vibrator.h" + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +class CommandGetPwleV2CompositionSizeMax : public Command { + std::string getDescription() const override { + return "Retrieves vibrator PwleV2 max composition size."; + } + + std::string getUsageSummary() const override { return ""; } + + UsageDetails getUsageDetails() const override { + UsageDetails details{}; + return details; + } + + Status doArgs(Args& args) override { + if (!args.empty()) { + std::cerr << "Unexpected Arguments!" << std::endl; + return USAGE; + } + return OK; + } + + Status doMain(Args&& /*args*/) override { + std::string statusStr; + int32_t maxSize; + Status ret; + + if (auto hal = getHal<aidl::IVibrator>()) { + auto status = hal->call(&aidl::IVibrator::getPwleV2CompositionSizeMax, &maxSize); + statusStr = status.getDescription(); + ret = status.isOk() ? OK : ERROR; + } else { + return UNAVAILABLE; + } + + std::cout << "Status: " << statusStr << std::endl; + std::cout << "Max Size: " << maxSize << std::endl; + + return ret; + } +}; + +static const auto Command = + CommandRegistry<CommandVibrator>::Register<CommandGetPwleV2CompositionSizeMax>( + "getPwleV2CompositionSizeMax"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp b/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp new file mode 100644 index 0000000000..dbbfe1a6d4 --- /dev/null +++ b/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp @@ -0,0 +1,73 @@ +/* + * 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 "utils.h" +#include "vibrator.h" + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +class CommandGetPwleV2PrimitiveDurationMaxMillis : public Command { + std::string getDescription() const override { + return "Retrieves vibrator PwleV2 max primitive duration in milliseconds."; + } + + std::string getUsageSummary() const override { return ""; } + + UsageDetails getUsageDetails() const override { + UsageDetails details{}; + return details; + } + + Status doArgs(Args& args) override { + if (!args.empty()) { + std::cerr << "Unexpected Arguments!" << std::endl; + return USAGE; + } + return OK; + } + + Status doMain(Args&& /*args*/) override { + std::string statusStr; + int32_t maxDurationMs; + Status ret; + + if (auto hal = getHal<aidl::IVibrator>()) { + auto status = hal->call(&aidl::IVibrator::getPwleV2PrimitiveDurationMaxMillis, + &maxDurationMs); + statusStr = status.getDescription(); + ret = status.isOk() ? OK : ERROR; + } else { + return UNAVAILABLE; + } + + std::cout << "Status: " << statusStr << std::endl; + std::cout << "Primitive duration max: " << maxDurationMs << " ms" << std::endl; + + return ret; + } +}; + +static const auto Command = + CommandRegistry<CommandVibrator>::Register<CommandGetPwleV2PrimitiveDurationMaxMillis>( + "getPwleV2PrimitiveDurationMaxMillis"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp b/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp new file mode 100644 index 0000000000..09225c49c4 --- /dev/null +++ b/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp @@ -0,0 +1,73 @@ +/* + * 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 "utils.h" +#include "vibrator.h" + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +class CommandGetPwleV2PrimitiveDurationMinMillis : public Command { + std::string getDescription() const override { + return "Retrieves vibrator PwleV2 minimum primitive duration in milliseconds."; + } + + std::string getUsageSummary() const override { return ""; } + + UsageDetails getUsageDetails() const override { + UsageDetails details{}; + return details; + } + + Status doArgs(Args& args) override { + if (!args.empty()) { + std::cerr << "Unexpected Arguments!" << std::endl; + return USAGE; + } + return OK; + } + + Status doMain(Args&& /*args*/) override { + std::string statusStr; + int32_t minDurationMs; + Status ret; + + if (auto hal = getHal<aidl::IVibrator>()) { + auto status = hal->call(&aidl::IVibrator::getPwleV2PrimitiveDurationMinMillis, + &minDurationMs); + statusStr = status.getDescription(); + ret = status.isOk() ? OK : ERROR; + } else { + return UNAVAILABLE; + } + + std::cout << "Status: " << statusStr << std::endl; + std::cout << "Primitive duration min: " << minDurationMs << " ms" << std::endl; + + return ret; + } +}; + +static const auto Command = + CommandRegistry<CommandVibrator>::Register<CommandGetPwleV2PrimitiveDurationMinMillis>( + "getPwleV2PrimitiveDurationMinMillis"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp b/cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp new file mode 100644 index 0000000000..9c25bd2038 --- /dev/null +++ b/cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp @@ -0,0 +1,73 @@ +/* + * 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 <thread> + +#include "utils.h" +#include "vibrator.h" + +using std::chrono::milliseconds; +using std::this_thread::sleep_for; + +namespace android { +namespace idlcli { + +class CommandVibrator; + +namespace vibrator { + +using aidl::VendorEffect; + +class CommandPerformVendorEffect : public Command { + std::string getDescription() const override { return "Perform vendor vibration effect."; } + + std::string getUsageSummary() const override { return "[options] <none>"; } + + UsageDetails getUsageDetails() const override { + UsageDetails details{ + {"-b", {"Block for duration of vibration."}}, + {"<none>", {"No valid input."}}, + }; + return details; + } + + Status doArgs(Args& args) override { + while (args.get<std::string>().value_or("").find("-") == 0) { + auto opt = *args.pop<std::string>(); + if (opt == "--") { + break; + } else if (opt == "-b") { + mBlocking = true; + } else { + std::cerr << "Invalid Option '" << opt << "'!" << std::endl; + return USAGE; + } + } + + return OK; + } + + Status doMain(Args&& /*args*/) override { return UNAVAILABLE; } + + bool mBlocking; + VendorEffect mEffect; +}; + +static const auto Command = CommandRegistry<CommandVibrator>::Register<CommandPerformVendorEffect>( + "performVendorEffect"); + +} // namespace vibrator +} // namespace idlcli +} // namespace android diff --git a/cmds/servicemanager/main.cpp b/cmds/servicemanager/main.cpp index c126e91373..df5a8ed0d1 100644 --- a/cmds/servicemanager/main.cpp +++ b/cmds/servicemanager/main.cpp @@ -165,6 +165,7 @@ int main(int argc, char** argv) { IPCThreadState::self()->disableBackgroundScheduling(true); sp<ServiceManager> manager = sp<ServiceManager>::make(std::make_unique<Access>()); + manager->setRequestingSid(true); if (!manager->addService("manager", manager, false /*allowIsolated*/, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk()) { LOG(ERROR) << "Could not self register servicemanager"; } |