Merge "libbinder: on host"
diff --git a/cmds/atrace/Android.bp b/cmds/atrace/Android.bp
index cc2a6f7..e7d0ad0 100644
--- a/cmds/atrace/Android.bp
+++ b/cmds/atrace/Android.bp
@@ -10,9 +10,7 @@
shared_libs: [
"libbinder",
- "libhwbinder",
"libhidlbase",
- "libhidltransport",
"liblog",
"libutils",
"libcutils",
diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp
index 93bbe90..09aee89 100644
--- a/cmds/dumpstate/Android.bp
+++ b/cmds/dumpstate/Android.bp
@@ -88,7 +88,6 @@
"libdumputils",
"libhardware_legacy",
"libhidlbase",
- "libhidltransport",
"liblog",
"libutils",
],
@@ -119,6 +118,8 @@
"kill",
"librank",
"logcat",
+ "lpdump",
+ "lpdumpd",
"lsmod",
"lsof",
"netstat",
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index c98784e..254e142 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -929,6 +929,14 @@
RunCommand("IP6TABLES RAW", {"ip6tables", "-t", "raw", "-L", "-nvx"});
}
+static void DumpDynamicPartitionInfo() {
+ if (!::android::base::GetBoolProperty("ro.boot.dynamic_partitions", false)) {
+ return;
+ }
+
+ RunCommand("LPDUMP", {"lpdump", "--all"});
+}
+
static void AddAnrTraceDir(const bool add_to_zip, const std::string& anr_traces_dir) {
MYLOGD("AddAnrTraceDir(): dump_traces_file=%s, anr_traces_dir=%s\n", dump_traces_path,
anr_traces_dir.c_str());
@@ -1515,6 +1523,7 @@
}
add_mountinfo();
DumpIpTablesAsRoot();
+ DumpDynamicPartitionInfo();
// Capture any IPSec policies in play. No keys are exposed here.
RunCommand("IP XFRM POLICY", {"ip", "xfrm", "policy"}, CommandOptions::WithTimeout(10).Build());
@@ -1982,7 +1991,7 @@
static void Vibrate(int duration_ms) {
// clang-format off
- RunCommand("", {"cmd", "vibrator", "vibrate", std::to_string(duration_ms), "dumpstate"},
+ RunCommand("", {"cmd", "vibrator", "vibrate", "-f", std::to_string(duration_ms), "dumpstate"},
CommandOptions::WithTimeout(10)
.Log("Vibrate: '%s'\n")
.Always()
@@ -3495,7 +3504,7 @@
struct sockaddr addr;
socklen_t alen = sizeof(addr);
- int fd = accept(s, &addr, &alen);
+ int fd = accept4(s, &addr, &alen, SOCK_CLOEXEC);
// Close socket just after accept(), to make sure that connect() by client will get error
// when the socket is used by the other services.
diff --git a/cmds/idlcli/Android.bp b/cmds/idlcli/Android.bp
new file mode 100644
index 0000000..40b8dc7
--- /dev/null
+++ b/cmds/idlcli/Android.bp
@@ -0,0 +1,53 @@
+// 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.
+// 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.
+
+cc_defaults {
+ name: "idlcli-defaults",
+ shared_libs: [
+ "android.hardware.vibrator@1.0",
+ "android.hardware.vibrator@1.1",
+ "android.hardware.vibrator@1.2",
+ "android.hardware.vibrator@1.3",
+ "libbase",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"idlcli\"",
+ ],
+}
+
+cc_library {
+ name: "libidlcli",
+ defaults: ["idlcli-defaults"],
+ srcs: [
+ "CommandVibrator.cpp",
+ "vibrator/CommandOff.cpp",
+ "vibrator/CommandOn.cpp",
+ "vibrator/CommandPerform.cpp",
+ "vibrator/CommandSetAmplitude.cpp",
+ "vibrator/CommandSetExternalControl.cpp",
+ "vibrator/CommandSupportsAmplitudeControl.cpp",
+ "vibrator/CommandSupportsExternalControl.cpp",
+ ],
+ visibility: [":__subpackages__"],
+}
+
+cc_binary {
+ name: "idlcli",
+ defaults: ["idlcli-defaults"],
+ srcs: ["main.cpp"],
+ whole_static_libs: ["libidlcli"],
+}
diff --git a/cmds/idlcli/CommandVibrator.cpp b/cmds/idlcli/CommandVibrator.cpp
new file mode 100644
index 0000000..a7a70c3
--- /dev/null
+++ b/cmds/idlcli/CommandVibrator.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ * 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"
+
+namespace android {
+namespace idlcli {
+
+class IdlCli;
+
+class CommandVibrator : public CommandWithSubcommands<CommandVibrator> {
+ std::string getDescription() const override { return "Invoke Vibrator HIDL APIs."; }
+
+ std::string getUsageSummary() const override { return "<api> [arguments]"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<api>", CommandRegistry<CommandVibrator>::List()},
+ };
+ return details;
+ }
+};
+
+static const auto Command = CommandRegistry<IdlCli>::Register<CommandVibrator>("vibrator");
+
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/IdlCli.h b/cmds/idlcli/IdlCli.h
new file mode 100644
index 0000000..dd84304
--- /dev/null
+++ b/cmds/idlcli/IdlCli.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ * 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.
+ */
+
+#ifndef FRAMEWORK_NATIVE_CMDS_IDLCLI_IDLCLI_H_
+#define FRAMEWORK_NATIVE_CMDS_IDLCLI_IDLCLI_H_
+
+#include "utils.h"
+
+namespace android {
+namespace idlcli {
+
+class IdlCli : public CommandWithSubcommands<IdlCli> {
+ std::string getDescription() const override { return "Invoke IDL APIs."; }
+
+ std::string getUsageSummary() const override { return "<idl> [arguments]"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<idl>", CommandRegistry<IdlCli>::List()},
+ };
+ return details;
+ }
+};
+
+} // namespace idlcli
+} // namespace android
+
+#endif // FRAMEWORK_NATIVE_CMDS_IDLCLI_IDLCLI_H_
diff --git a/cmds/idlcli/main.cpp b/cmds/idlcli/main.cpp
new file mode 100644
index 0000000..9ed9d82
--- /dev/null
+++ b/cmds/idlcli/main.cpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ * 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 "IdlCli.h"
+#include "utils.h"
+
+int main(const int argc, const char* const argv[]) {
+ using namespace ::android::idlcli;
+ return IdlCli{}.main(Args{argc, argv});
+}
diff --git a/cmds/idlcli/utils.h b/cmds/idlcli/utils.h
new file mode 100644
index 0000000..a8e5954
--- /dev/null
+++ b/cmds/idlcli/utils.h
@@ -0,0 +1,270 @@
+/*
+ * 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.
+ * 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.
+ */
+
+#ifndef FRAMEWORK_NATIVE_CMDS_IDLCLI_UTILS_H_
+#define FRAMEWORK_NATIVE_CMDS_IDLCLI_UTILS_H_
+
+#include <hidl/HidlSupport.h>
+
+#include <iomanip>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <string>
+#include <vector>
+
+namespace android {
+namespace idlcli {
+
+namespace overrides {
+
+namespace details {
+
+template <typename T>
+inline std::istream &operator>>(std::istream &stream, T &out) {
+ auto pos = stream.tellg();
+ auto tmp = +out;
+ auto min = +std::numeric_limits<T>::min();
+ auto max = +std::numeric_limits<T>::max();
+ stream >> tmp;
+ if (!stream) {
+ return stream;
+ }
+ if (tmp < min || tmp > max) {
+ stream.seekg(pos);
+ stream.setstate(std::ios_base::failbit);
+ return stream;
+ }
+ out = tmp;
+ return stream;
+}
+
+} // namespace details
+
+// override for default behavior of treating as a character
+inline std::istream &operator>>(std::istream &stream, int8_t &out) {
+ return details::operator>>(stream, out);
+}
+
+// override for default behavior of treating as a character
+inline std::istream &operator>>(std::istream &stream, uint8_t &out) {
+ return details::operator>>(stream, out);
+}
+
+} // namespace overrides
+
+template <typename T, typename R = hardware::hidl_enum_range<T>>
+inline std::istream &operator>>(std::istream &stream, T &out) {
+ using overrides::operator>>;
+ auto validRange = R();
+ auto pos = stream.tellg();
+ std::underlying_type_t<T> in;
+ T tmp;
+ stream >> in;
+ if (!stream) {
+ return stream;
+ }
+ tmp = static_cast<T>(in);
+ if (tmp < *validRange.begin() || tmp > *std::prev(validRange.end())) {
+ stream.seekg(pos);
+ stream.setstate(std::ios_base::failbit);
+ return stream;
+ }
+ out = tmp;
+ return stream;
+}
+
+enum Status : unsigned int {
+ OK,
+ USAGE,
+ UNAVAILABLE,
+ ERROR,
+};
+
+class Args {
+public:
+ Args(const int argc, const char *const argv[]) {
+ for (int argi = 0; argi < argc; argi++) {
+ mArgs.emplace_back(std::string_view(argv[argi]));
+ }
+ }
+
+ template <typename T = std::string>
+ std::optional<T> get() {
+ return get<T>(false);
+ }
+
+ template <typename T = std::string>
+ std::optional<T> pop() {
+ return get<T>(true);
+ }
+
+ bool empty() { return mArgs.empty(); }
+
+private:
+ template <typename T>
+ std::optional<T> get(bool erase) {
+ using idlcli::operator>>;
+ using overrides::operator>>;
+ T retValue;
+
+ if (mArgs.empty()) {
+ return {};
+ }
+
+ std::stringstream stream{std::string{mArgs.front()}};
+ stream >> std::setbase(0) >> retValue;
+ if (!stream || !stream.eof()) {
+ return {};
+ }
+
+ if (erase) {
+ mArgs.erase(mArgs.begin());
+ }
+
+ return retValue;
+ }
+
+ std::vector<std::string_view> mArgs;
+};
+
+class Command {
+protected:
+ struct Usage {
+ std::string name;
+ std::vector<std::string> details;
+ };
+ using UsageDetails = std::vector<Usage>;
+
+public:
+ virtual ~Command() = default;
+
+ Status main(Args &&args) {
+ Status status = doArgsAndMain(std::move(args));
+ if (status == USAGE) {
+ printUsage();
+ return ERROR;
+ }
+ if (status == UNAVAILABLE) {
+ std::cerr << "The requested operation is unavailable." << std::endl;
+ return ERROR;
+ }
+ return status;
+ }
+
+private:
+ virtual std::string getDescription() const = 0;
+ virtual std::string getUsageSummary() const = 0;
+ virtual UsageDetails getUsageDetails() const = 0;
+ virtual Status doArgs(Args &args) = 0;
+ virtual Status doMain(Args &&args) = 0;
+
+ void printUsage() const {
+ std::cerr << "Description:\n " << getDescription() << std::endl;
+ std::cerr << "Usage:\n " << mName << " " << getUsageSummary() << std::endl;
+
+ std::cerr << "Details:" << std::endl;
+ size_t entryNameWidth = 0;
+ for (auto &entry : getUsageDetails()) {
+ entryNameWidth = std::max(entryNameWidth, entry.name.length());
+ }
+ for (auto &entry : getUsageDetails()) {
+ auto prefix = entry.name;
+ for (auto &line : entry.details) {
+ std::cerr << " " << std::left << std::setw(entryNameWidth + 8) << prefix << line
+ << std::endl;
+ prefix = "";
+ }
+ }
+ }
+
+ Status doArgsAndMain(Args &&args) {
+ Status status;
+ mName = *args.pop();
+ if ((status = doArgs(args)) != OK) {
+ return status;
+ }
+ if ((status = doMain(std::move(args))) != OK) {
+ return status;
+ }
+ return OK;
+ }
+
+protected:
+ std::string mName;
+};
+
+template <typename T>
+class CommandRegistry {
+private:
+ using CommandCreator = std::function<std::unique_ptr<Command>()>;
+
+public:
+ template <typename U>
+ static CommandCreator Register(const std::string name) {
+ Instance()->mCommands[name] = [] { return std::make_unique<U>(); };
+ return Instance()->mCommands[name];
+ }
+
+ static std::unique_ptr<Command> Create(const std::string name) {
+ auto it = Instance()->mCommands.find(name);
+ if (it == Instance()->mCommands.end()) {
+ return nullptr;
+ }
+ return it->second();
+ }
+
+ static auto List() {
+ std::vector<std::string> list;
+ for (auto &it : Instance()->mCommands) {
+ list.push_back(it.first);
+ }
+ std::sort(list.begin(), list.end());
+ return list;
+ }
+
+private:
+ static CommandRegistry *Instance() {
+ static CommandRegistry sRegistry;
+ return &sRegistry;
+ }
+
+private:
+ std::map<const std::string, CommandCreator> mCommands;
+};
+
+template <typename T>
+class CommandWithSubcommands : public Command {
+private:
+ Status doArgs(Args &args) override {
+ mCommand = CommandRegistry<T>::Create(*args.get());
+ if (!mCommand) {
+ std::cerr << "Invalid Command!" << std::endl;
+ return USAGE;
+ }
+ return OK;
+ }
+
+ Status doMain(Args &&args) override { return mCommand->main(std::move(args)); }
+
+protected:
+ std::unique_ptr<Command> mCommand;
+};
+
+} // namespace idlcli
+} // namespace android
+
+#endif // FRAMEWORK_NATIVE_CMDS_IDLCLI_UTILS_H_
diff --git a/cmds/idlcli/vibrator.h b/cmds/idlcli/vibrator.h
new file mode 100644
index 0000000..bcb207b
--- /dev/null
+++ b/cmds/idlcli/vibrator.h
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ * 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.
+ */
+
+#ifndef FRAMEWORK_NATIVE_CMDS_IDLCLI_VIBRATOR_H_
+#define FRAMEWORK_NATIVE_CMDS_IDLCLI_VIBRATOR_H_
+
+#include <android/hardware/vibrator/1.3/IVibrator.h>
+
+#include "utils.h"
+
+#include "log/log.h"
+
+namespace android {
+
+using hardware::Return;
+
+static constexpr int NUM_TRIES = 2;
+
+// Creates a Return<R> with STATUS::EX_NULL_POINTER.
+template <class R>
+inline Return<R> NullptrStatus() {
+ using ::android::hardware::Status;
+ return Return<R>{Status::fromExceptionCode(Status::EX_NULL_POINTER)};
+}
+
+template <typename I>
+class HalWrapper {
+public:
+ static std::unique_ptr<HalWrapper> Create() {
+ // Assume that if getService returns a nullptr, HAL is not available on the
+ // device.
+ auto hal = I::getService();
+ return hal ? std::unique_ptr<HalWrapper>(new HalWrapper(std::move(hal))) : nullptr;
+ }
+
+ template <class R, class... Args0, class... Args1>
+ Return<R> call(Return<R> (I::*fn)(Args0...), Args1&&... args1) {
+ return (*mHal.*fn)(std::forward<Args1>(args1)...);
+ }
+
+private:
+ HalWrapper(sp<I>&& hal) : mHal(std::move(hal)) {}
+
+private:
+ sp<I> mHal;
+};
+
+template <typename I>
+static auto getHal() {
+ static auto sHalWrapper = HalWrapper<I>::Create();
+ return sHalWrapper.get();
+}
+
+template <class R, class I, class... Args0, class... Args1>
+Return<R> halCall(Return<R> (I::*fn)(Args0...), Args1&&... args1) {
+ auto hal = getHal<I>();
+ return hal ? hal->call(fn, std::forward<Args1>(args1)...) : NullptrStatus<R>();
+}
+
+namespace idlcli {
+namespace vibrator {
+
+namespace V1_0 = ::android::hardware::vibrator::V1_0;
+namespace V1_1 = ::android::hardware::vibrator::V1_1;
+namespace V1_2 = ::android::hardware::vibrator::V1_2;
+namespace V1_3 = ::android::hardware::vibrator::V1_3;
+
+} // namespace vibrator
+} // namespace idlcli
+
+} // namespace android
+
+#endif // FRAMEWORK_NATIVE_CMDS_IDLCLI_VIBRATOR_H_
diff --git a/cmds/idlcli/vibrator/CommandOff.cpp b/cmds/idlcli/vibrator/CommandOff.cpp
new file mode 100644
index 0000000..a674f01
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandOff.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ * 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 CommandOff : public Command {
+ std::string getDescription() const override { return "Turn off vibrator."; }
+
+ 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 {
+ auto ret = halCall(&V1_0::IVibrator::off);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Status: " << toString(ret) << std::endl;
+
+ return ret == V1_0::Status::OK ? OK : ERROR;
+ }
+};
+
+static const auto Command = CommandRegistry<CommandVibrator>::Register<CommandOff>("off");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandOn.cpp b/cmds/idlcli/vibrator/CommandOn.cpp
new file mode 100644
index 0000000..2164b7d
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandOn.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ * 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 CommandOn : public Command {
+ std::string getDescription() const override { return "Turn on vibrator."; }
+
+ std::string getUsageSummary() const override { return "<duration>"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<duration>", {"In milliseconds."}},
+ };
+ return details;
+ }
+
+ Status doArgs(Args &args) override {
+ if (auto duration = args.pop<decltype(mDuration)>()) {
+ mDuration = *duration;
+ } else {
+ std::cerr << "Missing or Invalid Duration!" << std::endl;
+ return USAGE;
+ }
+ if (!args.empty()) {
+ std::cerr << "Unexpected Arguments!" << std::endl;
+ return USAGE;
+ }
+ return OK;
+ }
+
+ Status doMain(Args && /*args*/) override {
+ auto ret = halCall(&V1_0::IVibrator::on, mDuration);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Status: " << toString(ret) << std::endl;
+
+ return ret == V1_0::Status::OK ? OK : ERROR;
+ }
+
+ uint32_t mDuration;
+};
+
+static const auto Command = CommandRegistry<CommandVibrator>::Register<CommandOn>("on");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandPerform.cpp b/cmds/idlcli/vibrator/CommandPerform.cpp
new file mode 100644
index 0000000..688cbd8
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandPerform.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ * 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 V1_0::EffectStrength;
+using V1_3::Effect;
+
+class CommandPerform : public Command {
+ std::string getDescription() const override { return "Perform vibration effect."; }
+
+ std::string getUsageSummary() const override { return "<effect> <strength>"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<effect>", {"Effect ID."}},
+ {"<strength>", {"0-2."}},
+ };
+ return details;
+ }
+
+ Status doArgs(Args &args) override {
+ if (auto effect = args.pop<decltype(mEffect)>()) {
+ mEffect = *effect;
+ std::cout << "Effect: " << toString(mEffect) << std::endl;
+ } else {
+ std::cerr << "Missing or Invalid Effect!" << std::endl;
+ return USAGE;
+ }
+ if (auto strength = args.pop<decltype(mStrength)>()) {
+ mStrength = *strength;
+ std::cout << "Strength: " << toString(mStrength) << std::endl;
+ } else {
+ std::cerr << "Missing or Invalid Strength!" << std::endl;
+ return USAGE;
+ }
+ if (!args.empty()) {
+ std::cerr << "Unexpected Arguments!" << std::endl;
+ return USAGE;
+ }
+ return OK;
+ }
+
+ Status doMain(Args && /*args*/) override {
+ Return<void> ret;
+ V1_0::Status status;
+ uint32_t lengthMs;
+ auto callback = [&status, &lengthMs](V1_0::Status retStatus, uint32_t retLengthMs) {
+ status = retStatus;
+ lengthMs = retLengthMs;
+ };
+
+ if (auto hal = getHal<V1_3::IVibrator>()) {
+ ret = hal->call(&V1_3::IVibrator::perform_1_3, static_cast<V1_3::Effect>(mEffect),
+ mStrength, callback);
+ } else if (auto hal = getHal<V1_2::IVibrator>()) {
+ ret = hal->call(&V1_2::IVibrator::perform_1_2, static_cast<V1_2::Effect>(mEffect),
+ mStrength, callback);
+ } else if (auto hal = getHal<V1_1::IVibrator>()) {
+ ret = hal->call(&V1_1::IVibrator::perform_1_1, static_cast<V1_1::Effect_1_1>(mEffect),
+ mStrength, callback);
+ } else if (auto hal = getHal<V1_0::IVibrator>()) {
+ ret = hal->call(&V1_0::IVibrator::perform, static_cast<V1_0::Effect>(mEffect),
+ mStrength, callback);
+ } else {
+ ret = NullptrStatus<void>();
+ }
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Status: " << toString(status) << std::endl;
+ std::cout << "Length: " << lengthMs << std::endl;
+
+ return status == V1_0::Status::OK ? OK : ERROR;
+ }
+
+ Effect mEffect;
+ EffectStrength mStrength;
+};
+
+static const auto Command = CommandRegistry<CommandVibrator>::Register<CommandPerform>("perform");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandSetAmplitude.cpp b/cmds/idlcli/vibrator/CommandSetAmplitude.cpp
new file mode 100644
index 0000000..38a1dc2
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandSetAmplitude.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ * 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 CommandSetAmplitude : public Command {
+ std::string getDescription() const override { return "Set vibration amplitude."; }
+
+ std::string getUsageSummary() const override { return "<amplitude>"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<amplitude>", {"1-255."}},
+ };
+ return details;
+ }
+
+ Status doArgs(Args &args) override {
+ if (auto amplitude = args.pop<decltype(mAmplitude)>()) {
+ mAmplitude = *amplitude;
+ } else {
+ std::cerr << "Missing or Invalid Amplitude!" << std::endl;
+ return USAGE;
+ }
+ if (!args.empty()) {
+ std::cerr << "Unexpected Arguments!" << std::endl;
+ return USAGE;
+ }
+ return OK;
+ }
+
+ Status doMain(Args && /*args*/) override {
+ auto ret = halCall(&V1_0::IVibrator::setAmplitude, mAmplitude);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Status: " << toString(ret) << std::endl;
+
+ return ret == V1_0::Status::OK ? OK : ERROR;
+ }
+
+ uint8_t mAmplitude;
+};
+
+static const auto Command =
+ CommandRegistry<CommandVibrator>::Register<CommandSetAmplitude>("setAmplitude");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandSetExternalControl.cpp b/cmds/idlcli/vibrator/CommandSetExternalControl.cpp
new file mode 100644
index 0000000..5fb1fac
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandSetExternalControl.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ * 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 CommandSetExternalControl : public Command {
+ std::string getDescription() const override {
+ return "Enable/disable vibration external control.";
+ }
+
+ std::string getUsageSummary() const override { return "<enable>"; }
+
+ UsageDetails getUsageDetails() const override {
+ UsageDetails details{
+ {"<enable>", {"0/1."}},
+ };
+ return details;
+ }
+
+ Status doArgs(Args &args) override {
+ if (auto enable = args.pop<decltype(mEnable)>()) {
+ mEnable = *enable;
+ } else {
+ std::cerr << "Missing Enable!" << std::endl;
+ return USAGE;
+ }
+ return OK;
+ }
+
+ Status doMain(Args && /*args*/) override {
+ auto ret = halCall(&V1_3::IVibrator::setExternalControl, mEnable);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Status: " << toString(ret) << std::endl;
+
+ return ret == V1_0::Status::OK ? OK : ERROR;
+ }
+
+ bool mEnable;
+};
+
+static const auto Command =
+ CommandRegistry<CommandVibrator>::Register<CommandSetExternalControl>("setExternalControl");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandSupportsAmplitudeControl.cpp b/cmds/idlcli/vibrator/CommandSupportsAmplitudeControl.cpp
new file mode 100644
index 0000000..cdc529a
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandSupportsAmplitudeControl.cpp
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ * 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 CommandSupportsAmplitudeControl : public Command {
+ std::string getDescription() const override { return "Check support for amplitude control."; }
+
+ 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 {
+ auto ret = halCall(&V1_0::IVibrator::supportsAmplitudeControl);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Result: " << std::boolalpha << ret << std::endl;
+
+ return OK;
+ }
+};
+
+static const auto Command =
+ CommandRegistry<CommandVibrator>::Register<CommandSupportsAmplitudeControl>(
+ "supportsAmplitudeControl");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/idlcli/vibrator/CommandSupportsExternalControl.cpp b/cmds/idlcli/vibrator/CommandSupportsExternalControl.cpp
new file mode 100644
index 0000000..ed15d76
--- /dev/null
+++ b/cmds/idlcli/vibrator/CommandSupportsExternalControl.cpp
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ * 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 CommandSupportsExternalControl : public Command {
+ std::string getDescription() const override { return "Check support for external control."; }
+
+ 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 {
+ auto ret = halCall(&V1_3::IVibrator::supportsExternalControl);
+
+ if (!ret.isOk()) {
+ return UNAVAILABLE;
+ }
+
+ std::cout << "Result: " << std::boolalpha << ret << std::endl;
+
+ return OK;
+ }
+};
+
+static const auto Command =
+ CommandRegistry<CommandVibrator>::Register<CommandSupportsExternalControl>(
+ "supportsExternalControl");
+
+} // namespace vibrator
+} // namespace idlcli
+} // namespace android
diff --git a/cmds/lshal/Android.bp b/cmds/lshal/Android.bp
index f8b8c68..5afae4b 100644
--- a/cmds/lshal/Android.bp
+++ b/cmds/lshal/Android.bp
@@ -19,7 +19,6 @@
"libcutils",
"libutils",
"libhidlbase",
- "libhidltransport",
"libhidl-gen-hash",
"libhidl-gen-utils",
"libvintf",
@@ -51,7 +50,6 @@
"libcutils",
"libutils",
"libhidlbase",
- "libhidltransport",
"libhidl-gen-hash",
"libhidl-gen-utils",
"libvintf",
@@ -81,9 +79,7 @@
"libgmock",
],
shared_libs: [
- "libhwbinder",
"libhidlbase",
- "libhidltransport",
"libvintf",
],
srcs: [
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index ad7e4c4..a7ccf64 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -163,11 +163,11 @@
VintfInfo getVintfInfo(const std::shared_ptr<const ObjectType>& object,
const FqInstance& fqInstance, vintf::TransportArch ta, VintfInfo value) {
bool found = false;
- (void)object->forEachInstanceOfVersion(fqInstance.getPackage(), fqInstance.getVersion(),
- [&](const auto& instance) {
- found = match(instance, fqInstance, ta);
- return !found; // continue if not found
- });
+ (void)object->forEachHidlInstanceOfVersion(fqInstance.getPackage(), fqInstance.getVersion(),
+ [&](const auto& instance) {
+ found = match(instance, fqInstance, ta);
+ return !found; // continue if not found
+ });
return found ? value : VINTF_INFO_EMPTY;
}
@@ -453,7 +453,7 @@
}
bool found = false;
- (void)manifest->forEachInstanceOfVersion(package, version, [&found](const auto&) {
+ (void)manifest->forEachHidlInstanceOfVersion(package, version, [&found](const auto&) {
found = true;
return false; // break
});
@@ -797,9 +797,9 @@
std::map<std::string, TableEntry> entries;
- manifest->forEachInstance([&] (const vintf::ManifestInstance& manifestInstance) {
+ manifest->forEachHidlInstance([&] (const vintf::ManifestInstance& manifestInstance) {
TableEntry entry{
- .interfaceName = manifestInstance.getFqInstance().string(),
+ .interfaceName = manifestInstance.description(),
.transport = manifestInstance.transport(),
.arch = manifestInstance.arch(),
// TODO(b/71555570): Device manifest does not distinguish HALs from vendor or ODM.
diff --git a/cmds/lshal/test.cpp b/cmds/lshal/test.cpp
index 76f7c7f..3d550ba 100644
--- a/cmds/lshal/test.cpp
+++ b/cmds/lshal/test.cpp
@@ -452,7 +452,7 @@
}
TEST_F(ListTest, DumpVintf) {
- const std::string expected = "<manifest version=\"1.0\" type=\"device\">\n"
+ const std::string expected = "<manifest version=\"2.0\" type=\"device\">\n"
" <hal format=\"hidl\">\n"
" <name>a.h.foo1</name>\n"
" <transport>hwbinder</transport>\n"
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index b3aa342..463d67f 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -17,8 +17,10 @@
#include "ServiceManager.h"
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <cutils/android_filesystem_config.h>
#include <cutils/multiuser.h>
+#include <thread>
using ::android::binder::Status;
@@ -41,39 +43,44 @@
}
Status ServiceManager::getService(const std::string& name, sp<IBinder>* outBinder) {
- // Servicemanager is single-threaded and cannot block. This method exists for legacy reasons.
- return checkService(name, outBinder);
+ *outBinder = tryGetService(name, true);
+ // returns ok regardless of result for legacy reasons
+ return Status::ok();
}
Status ServiceManager::checkService(const std::string& name, sp<IBinder>* outBinder) {
+ *outBinder = tryGetService(name, false);
+ // returns ok regardless of result for legacy reasons
+ return Status::ok();
+}
+
+sp<IBinder> ServiceManager::tryGetService(const std::string& name, bool startIfNotFound) {
auto ctx = mAccess->getCallingContext();
- auto it = mNameToService.find(name);
- if (it == mNameToService.end()) {
- *outBinder = nullptr;
- return Status::ok();
- }
+ sp<IBinder> out;
+ if (auto it = mNameToService.find(name); it != mNameToService.end()) {
+ const Service& service = it->second;
- const Service& service = it->second;
+ if (!service.allowIsolated) {
+ uid_t appid = multiuser_get_app_id(ctx.uid);
+ bool isIsolated = appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END;
- if (!service.allowIsolated) {
- uid_t appid = multiuser_get_app_id(ctx.uid);
- bool isIsolated = appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END;
-
- if (isIsolated) {
- *outBinder = nullptr;
- return Status::ok();
+ if (isIsolated) {
+ return nullptr;
+ }
}
+ out = service.binder;
}
if (!mAccess->canFind(ctx, name)) {
- // returns ok and null for legacy reasons
- *outBinder = nullptr;
- return Status::ok();
+ return nullptr;
}
- *outBinder = service.binder;
- return Status::ok();
+ if (!out && startIfNotFound) {
+ tryStartService(name);
+ }
+
+ return out;
}
bool isValidServiceName(const std::string& name) {
@@ -253,4 +260,13 @@
}
}
+void ServiceManager::tryStartService(const std::string& name) {
+ ALOGI("Since '%s' could not be found, trying to start it as a lazy AIDL service",
+ name.c_str());
+
+ std::thread([=] {
+ (void)base::SetProperty("ctl.interface_start", "aidl/" + name);
+ }).detach();
+}
+
} // namespace android
diff --git a/cmds/servicemanager/ServiceManager.h b/cmds/servicemanager/ServiceManager.h
index fcc5124..006e519 100644
--- a/cmds/servicemanager/ServiceManager.h
+++ b/cmds/servicemanager/ServiceManager.h
@@ -30,6 +30,7 @@
ServiceManager(std::unique_ptr<Access>&& access);
~ServiceManager();
+ // getService will try to start any services it cannot find
binder::Status getService(const std::string& name, sp<IBinder>* outBinder) override;
binder::Status checkService(const std::string& name, sp<IBinder>* outBinder) override;
binder::Status addService(const std::string& name, const sp<IBinder>& binder,
@@ -42,6 +43,9 @@
void binderDied(const wp<IBinder>& who) override;
+protected:
+ virtual void tryStartService(const std::string& name);
+
private:
struct Service {
sp<IBinder> binder; // not null
@@ -57,6 +61,7 @@
void removeCallback(const wp<IBinder>& who,
CallbackMap::iterator* it,
bool* found);
+ sp<IBinder> tryGetService(const std::string& name, bool startIfNotFound);
CallbackMap mNameToCallback;
ServiceMap mNameToService;
diff --git a/cmds/servicemanager/main.cpp b/cmds/servicemanager/main.cpp
index 9f6193b..11d43a6 100644
--- a/cmds/servicemanager/main.cpp
+++ b/cmds/servicemanager/main.cpp
@@ -36,8 +36,6 @@
const char* driver = argc == 2 ? argv[1] : "/dev/binder";
- android::base::InitLogging(nullptr, &android::base::KernelLogger);
-
sp<ProcessState> ps = ProcessState::initWithDriver(driver);
ps->setThreadPoolMaxThreadCount(0);
ps->setCallRestriction(ProcessState::CallRestriction::FATAL_IF_NOT_ONEWAY);
diff --git a/cmds/servicemanager/test_sm.cpp b/cmds/servicemanager/test_sm.cpp
index 3c211d2..25245be 100644
--- a/cmds/servicemanager/test_sm.cpp
+++ b/cmds/servicemanager/test_sm.cpp
@@ -57,6 +57,12 @@
MOCK_METHOD1(canList, bool(const CallingContext&));
};
+class MockServiceManager : public ServiceManager {
+ public:
+ MockServiceManager(std::unique_ptr<Access>&& access) : ServiceManager(std::move(access)) {}
+ MOCK_METHOD1(tryStartService, void(const std::string& name));
+};
+
static sp<ServiceManager> getPermissiveServiceManager() {
std::unique_ptr<MockAccess> access = std::make_unique<NiceMock<MockAccess>>();
@@ -65,7 +71,7 @@
ON_CALL(*access, canFind(_, _)).WillByDefault(Return(true));
ON_CALL(*access, canList(_)).WillByDefault(Return(true));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
return sm;
}
@@ -113,7 +119,7 @@
.uid = uid,
}));
EXPECT_CALL(*access, canAdd(_, _)).Times(0);
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
EXPECT_FALSE(sm->addService("foo", getBinder(), false /*allowIsolated*/,
IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk());
@@ -135,7 +141,7 @@
EXPECT_CALL(*access, getCallingContext()).WillOnce(Return(Access::CallingContext{}));
EXPECT_CALL(*access, canAdd(_, _)).WillOnce(Return(false));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
EXPECT_FALSE(sm->addService("foo", getBinder(), false /*allowIsolated*/,
IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk());
@@ -168,7 +174,7 @@
EXPECT_CALL(*access, canAdd(_, _)).WillOnce(Return(true));
EXPECT_CALL(*access, canFind(_, _)).WillOnce(Return(false));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
EXPECT_TRUE(sm->addService("foo", getBinder(), false /*allowIsolated*/,
IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk());
@@ -192,7 +198,7 @@
EXPECT_CALL(*access, canAdd(_, _)).WillOnce(Return(true));
EXPECT_CALL(*access, canFind(_, _)).WillOnce(Return(true));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
sp<IBinder> service = getBinder();
EXPECT_TRUE(sm->addService("foo", service, true /*allowIsolated*/,
@@ -218,7 +224,7 @@
// TODO(b/136023468): when security check is first, this should be called first
// EXPECT_CALL(*access, canFind(_, _)).WillOnce(Return(true));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
EXPECT_TRUE(sm->addService("foo", getBinder(), false /*allowIsolated*/,
IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk());
@@ -235,7 +241,7 @@
EXPECT_CALL(*access, getCallingContext()).WillOnce(Return(Access::CallingContext{}));
EXPECT_CALL(*access, canList(_)).WillOnce(Return(false));
- sp<ServiceManager> sm = new ServiceManager(std::move(access));
+ sp<ServiceManager> sm = new NiceMock<MockServiceManager>(std::move(access));
std::vector<std::string> out;
EXPECT_FALSE(sm->listServices(IServiceManager::DUMP_FLAG_PRIORITY_ALL, &out).isOk());
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index a603c83..b6f3d7b 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -240,7 +240,7 @@
const std::string name = String8(name16).c_str();
sp<IBinder> out;
- if(!mTheRealServiceManager->checkService(name, &out).isOk()) {
+ if (!mTheRealServiceManager->getService(name, &out).isOk()) {
return nullptr;
}
if(out != nullptr) return out;
@@ -264,13 +264,13 @@
// Handle race condition for lazy services. Here is what can happen:
// - the service dies (not processed by init yet).
// - sm processes death notification.
- // - sm gets checkService and calls init to start service.
+ // - sm gets getService and calls init to start service.
// - init gets the start signal, but the service already appears
// started, so it does nothing.
// - init gets death signal, but doesn't know it needs to restart
// the service
// - we need to request service again to get it to start
- if(!mTheRealServiceManager->checkService(name, &out).isOk()) {
+ if (!mTheRealServiceManager->getService(name, &out).isOk()) {
return nullptr;
}
if(out != nullptr) return out;
diff --git a/libs/binder/tests/Android.bp b/libs/binder/tests/Android.bp
index bc457ce..f25e954 100644
--- a/libs/binder/tests/Android.bp
+++ b/libs/binder/tests/Android.bp
@@ -70,6 +70,7 @@
"libutils",
],
test_suites: ["device-tests"],
+ require_root: true,
}
cc_test {
@@ -136,6 +137,7 @@
"libutils",
],
test_suites: ["device-tests"],
+ require_root: true,
}
aidl_interface {
diff --git a/libs/dumputils/Android.bp b/libs/dumputils/Android.bp
index e23de8e..e403d36 100644
--- a/libs/dumputils/Android.bp
+++ b/libs/dumputils/Android.bp
@@ -18,7 +18,6 @@
shared_libs: [
"libbase",
"libhidlbase",
- "libhidltransport",
"liblog",
"libutils",
],
diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp
index 34575f5..59cb8e0 100644
--- a/libs/gui/Android.bp
+++ b/libs/gui/Android.bp
@@ -165,8 +165,6 @@
"libEGL",
"libGLESv2",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"liblog",
"libnativewindow",
"libsync",
diff --git a/libs/gui/tests/Android.bp b/libs/gui/tests/Android.bp
index ab6dcaa..cbda6b2 100644
--- a/libs/gui/tests/Android.bp
+++ b/libs/gui/tests/Android.bp
@@ -47,7 +47,6 @@
"libcutils",
"libgui",
"libhidlbase",
- "libhidltransport",
"libinput",
"libui",
"libutils",
diff --git a/libs/sensor/OWNERS b/libs/sensor/OWNERS
index 81099e8..90c2330 100644
--- a/libs/sensor/OWNERS
+++ b/libs/sensor/OWNERS
@@ -1,3 +1,3 @@
arthuri@google.com
bduddie@google.com
-bstack@google.com
+stange@google.com
diff --git a/libs/ui/Android.bp b/libs/ui/Android.bp
index 2cc6857..1a0d8c0 100644
--- a/libs/ui/Android.bp
+++ b/libs/ui/Android.bp
@@ -96,8 +96,6 @@
"libbase",
"libcutils",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"libsync",
"libutils",
"liblog",
diff --git a/libs/ui/tests/Android.bp b/libs/ui/tests/Android.bp
index 373fa4f..99434b7 100644
--- a/libs/ui/tests/Android.bp
+++ b/libs/ui/tests/Android.bp
@@ -38,7 +38,6 @@
"android.frameworks.bufferhub@1.0",
"libcutils",
"libhidlbase",
- "libhwbinder",
"libui",
"libutils",
],
@@ -59,7 +58,6 @@
"android.frameworks.bufferhub@1.0",
"libcutils",
"libhidlbase",
- "libhwbinder",
"liblog",
"libui",
"libutils"
diff --git a/libs/vr/libvrflinger/Android.bp b/libs/vr/libvrflinger/Android.bp
index 2829353..12ce74b 100644
--- a/libs/vr/libvrflinger/Android.bp
+++ b/libs/vr/libvrflinger/Android.bp
@@ -57,7 +57,6 @@
"libgui",
"libsync",
"libhidlbase",
- "libhidltransport",
"libfmq",
"libpdx_default_transport",
]
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp
index abc7a72..342fb59 100644
--- a/opengl/libs/Android.bp
+++ b/opengl/libs/Android.bp
@@ -153,7 +153,6 @@
"android.hardware.configstore-utils",
"libbase",
"libhidlbase",
- "libhidltransport",
"libnativebridge_lazy",
"libnativeloader_lazy",
"libutils",
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 29a966d..c51a129 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -40,7 +40,6 @@
EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
ATRACE_CALL();
- clearError();
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
@@ -48,6 +47,7 @@
// Call down the chain, which usually points directly to the impl
// but may also be routed through layers
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetDisplay(display);
}
@@ -55,7 +55,6 @@
EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display,
const EGLAttrib* attrib_list) {
ATRACE_CALL();
- clearError();
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
@@ -63,6 +62,7 @@
// Call down the chain, which usually points directly to the impl
// but may also be routed through layers
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list);
}
@@ -239,13 +239,12 @@
// in which case we must make sure we've initialized ourselves, this
// happens the first time egl_get_display() is called.
- clearError();
-
if (egl_init_drivers() == EGL_FALSE) {
setError(EGL_BAD_PARAMETER, NULL);
return nullptr;
}
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetProcAddress(procname);
}
@@ -324,23 +323,21 @@
}
EGLBoolean eglBindAPI(EGLenum api) {
- clearError();
-
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglBindAPI(api);
}
EGLenum eglQueryAPI(void) {
- clearError();
-
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglQueryAPI();
}
@@ -595,23 +592,21 @@
}
EGLuint64NV eglGetSystemTimeFrequencyNV() {
- clearError();
-
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
}
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetSystemTimeFrequencyNV();
}
EGLuint64NV eglGetSystemTimeNV() {
- clearError();
-
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
}
+ clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetSystemTimeNV();
}
diff --git a/opengl/tests/EGLTest/Android.bp b/opengl/tests/EGLTest/Android.bp
index a9e873a..19c8b37 100644
--- a/opengl/tests/EGLTest/Android.bp
+++ b/opengl/tests/EGLTest/Android.bp
@@ -22,7 +22,6 @@
"libbinder",
"libgui",
"libhidlbase",
- "libhidltransport",
"liblog",
"libutils",
"libnativewindow",
diff --git a/services/bufferhub/Android.bp b/services/bufferhub/Android.bp
index cd03bc2..2bb6aef 100644
--- a/services/bufferhub/Android.bp
+++ b/services/bufferhub/Android.bp
@@ -37,8 +37,6 @@
"libcrypto",
"libcutils",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"liblog",
"libui",
"libutils",
@@ -64,8 +62,6 @@
"libcrypto",
"libcutils",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"liblog",
"libui",
"libutils",
diff --git a/services/displayservice/Android.bp b/services/displayservice/Android.bp
index 3442cb2..4d2d873 100644
--- a/services/displayservice/Android.bp
+++ b/services/displayservice/Android.bp
@@ -27,7 +27,6 @@
"liblog",
"libgui",
"libhidlbase",
- "libhidltransport",
"libutils",
"android.frameworks.displayservice@1.0",
],
diff --git a/services/schedulerservice/Android.bp b/services/schedulerservice/Android.bp
index 0227164..73802db 100644
--- a/services/schedulerservice/Android.bp
+++ b/services/schedulerservice/Android.bp
@@ -6,8 +6,6 @@
cflags: ["-Wall", "-Werror"],
shared_libs: [
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"libmediautils",
"liblog",
"libutils",
diff --git a/services/sensorservice/Android.bp b/services/sensorservice/Android.bp
index 33a2747..1c9a4af 100644
--- a/services/sensorservice/Android.bp
+++ b/services/sensorservice/Android.bp
@@ -45,8 +45,6 @@
"libcrypto",
"libbase",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"libfmq",
"android.hardware.sensors@1.0",
"android.hardware.sensors@2.0",
diff --git a/services/sensorservice/OWNERS b/services/sensorservice/OWNERS
index 81099e8..90c2330 100644
--- a/services/sensorservice/OWNERS
+++ b/services/sensorservice/OWNERS
@@ -1,3 +1,3 @@
arthuri@google.com
bduddie@google.com
-bstack@google.com
+stange@google.com
diff --git a/services/sensorservice/hidl/Android.bp b/services/sensorservice/hidl/Android.bp
index 02c13fa..d0c83d6 100644
--- a/services/sensorservice/hidl/Android.bp
+++ b/services/sensorservice/hidl/Android.bp
@@ -13,8 +13,6 @@
shared_libs: [
"libbase",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"libutils",
"libsensor",
"android.frameworks.sensorservice@1.0",
diff --git a/services/surfaceflinger/Android.bp b/services/surfaceflinger/Android.bp
index 9aa4e85..4f0695a 100644
--- a/services/surfaceflinger/Android.bp
+++ b/services/surfaceflinger/Android.bp
@@ -43,8 +43,6 @@
"libgui",
"libhardware",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"liblayers_proto",
"liblog",
"libnativewindow",
@@ -85,8 +83,6 @@
"android.hardware.graphics.composer@2.3",
"android.hardware.power@1.3",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
],
}
@@ -199,7 +195,6 @@
"libcutils",
"libdisplayservicehidl",
"libhidlbase",
- "libhidltransport",
"libinput",
"liblayers_proto",
"liblog",
@@ -248,8 +243,6 @@
"android.hardware.configstore@1.1",
"android.hardware.graphics.common@1.2",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"libui",
"libutils",
"liblog",
@@ -260,8 +253,6 @@
export_shared_lib_headers: [
"android.hardware.graphics.common@1.2",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
],
export_static_lib_headers: [
"SurfaceFlingerProperties",
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index bd0b55f..c57b955 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -243,8 +243,9 @@
bool sidebandStreamChanged = true;
if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false)) {
// mSidebandStreamChanged was changed to false
+ mSidebandStream = mConsumer->getSidebandStream();
auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
- layerCompositionState.sidebandStream = mConsumer->getSidebandStream();
+ layerCompositionState.sidebandStream = mSidebandStream;
if (layerCompositionState.sidebandStream != nullptr) {
setTransactionFlags(eTransactionNeeded);
mFlinger->setTransactionFlags(eTraversalNeeded);
diff --git a/services/surfaceflinger/tests/fakehwc/Android.bp b/services/surfaceflinger/tests/fakehwc/Android.bp
index a2c0611..2feff45 100644
--- a/services/surfaceflinger/tests/fakehwc/Android.bp
+++ b/services/surfaceflinger/tests/fakehwc/Android.bp
@@ -20,8 +20,6 @@
"libgui",
"libhardware",
"libhidlbase",
- "libhidltransport",
- "libhwbinder",
"liblayers_proto",
"liblog",
"libnativewindow",
diff --git a/services/vr/hardware_composer/Android.bp b/services/vr/hardware_composer/Android.bp
index 1604775..c202b5c 100644
--- a/services/vr/hardware_composer/Android.bp
+++ b/services/vr/hardware_composer/Android.bp
@@ -23,7 +23,6 @@
"libfmq",
"libhardware",
"libhidlbase",
- "libhidltransport",
"liblog",
"libsync",
"libui",
@@ -109,7 +108,6 @@
"libbinder",
"liblog",
"libhardware",
- "libhwbinder",
"libhidlbase",
"libui",
"libutils",
diff --git a/vulkan/libvulkan/Android.bp b/vulkan/libvulkan/Android.bp
index 993b751..df5f1eb 100644
--- a/vulkan/libvulkan/Android.bp
+++ b/vulkan/libvulkan/Android.bp
@@ -87,7 +87,6 @@
"libbase",
"libdl_android",
"libhidlbase",
- "libhidltransport",
"liblog",
"libui",
"libgraphicsenv",