Revert "IDLCLI: Update android.hardware.vibrator to V3 for idlcli"
Revert submission 29769949-PWLEV2_AIDLV3
Reason for revert: Build breakage
Reverted changes: /q/submissionid:29769949-PWLEV2_AIDLV3
Change-Id: If7e4c2c8b04ab06eab59cb50144c1e64b798a738
diff --git a/cmds/idlcli/Android.bp b/cmds/idlcli/Android.bp
index 9e64f45..50c2cd8 100644
--- a/cmds/idlcli/Android.bp
+++ b/cmds/idlcli/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2024 The Android Open Source Project
+// Copyright (C) 2019 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,7 +50,6 @@
"vibrator/CommandAlwaysOnEnable.cpp",
"vibrator/CommandCompose.cpp",
"vibrator/CommandComposePwle.cpp",
- "vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp",
"vibrator/CommandGetBandwidthAmplitudeMap.cpp",
"vibrator/CommandGetCapabilities.cpp",
"vibrator/CommandGetCompositionDelayMax.cpp",
@@ -73,11 +72,6 @@
"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
deleted file mode 100644
index 6d3cf84..0000000
--- a/cmds/idlcli/vibrator/CommandComposePwleV2.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 2edd0ca..0000000
--- a/cmds/idlcli/vibrator/CommandGetFrequencyToOutputAccelerationMap.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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
deleted file mode 100644
index cca072c..0000000
--- a/cmds/idlcli/vibrator/CommandGetPwleV2CompositionSizeMax.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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
deleted file mode 100644
index dbbfe1a..0000000
--- a/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMaxMillis.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 09225c4..0000000
--- a/cmds/idlcli/vibrator/CommandGetPwleV2PrimitiveDurationMinMillis.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 9c25bd2..0000000
--- a/cmds/idlcli/vibrator/CommandPerformVendorEffect.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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