Merge "Initialize healthd_mode_ops in recovery default Health HAL impl."
diff --git a/atrace/1.0/Android.bp b/atrace/1.0/Android.bp
new file mode 100644
index 0000000..f7c9078
--- /dev/null
+++ b/atrace/1.0/Android.bp
@@ -0,0 +1,22 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.atrace@1.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IAtraceDevice.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "Status",
+ "TracingCategory",
+ ],
+ gen_java: true,
+}
+
diff --git a/atrace/1.0/IAtraceDevice.hal b/atrace/1.0/IAtraceDevice.hal
new file mode 100644
index 0000000..b6e78b4
--- /dev/null
+++ b/atrace/1.0/IAtraceDevice.hal
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+package android.hardware.atrace@1.0;
+
+interface IAtraceDevice {
+ /**
+ * Get vendor extended atrace points.
+ *
+ *
+ * @return categories of tracing points the device extended.
+ */
+ listCategories() generates (vec<TracingCategory> categories);
+
+ /**
+ * A hook when atrace set to enable specific categories, so HAL
+ * can enable kernel tracing points and/or notify other things
+ * for userspace tracing turning on.
+ *
+ * @param categories A vector of strings of categories (corresponding to
+ * TracingCategory.name) atrace needs to be enabled.
+ *
+ * @return status SUCCESS on success,
+ * ERROR_TRACING_POINT on error with enabling categories,
+ * ERROR_INVALID_ARGUMENT on invalid argument passed.
+ */
+ enableCategories(vec<string> categories) generates (Status status);
+
+ /**
+ * A hook when atrace set to clean up tracing categories, so HAL
+ * can disable all kernel tracing points and/or notify other things
+ * for userspace tracing turning off.
+ *
+ * @return status SUCCESS on success,
+ * ERROR_TRACING_POINT on error with disabling categories.
+ */
+ disableAllCategories() generates (Status status);
+};
diff --git a/atrace/1.0/default/Android.bp b/atrace/1.0/default/Android.bp
new file mode 100644
index 0000000..bcaf064
--- /dev/null
+++ b/atrace/1.0/default/Android.bp
@@ -0,0 +1,35 @@
+//
+// Copyright (C) 2018 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_binary {
+ name: "android.hardware.atrace@1.0-service",
+ defaults: ["hidl_defaults"],
+ relative_install_path: "hw",
+ vendor: true,
+ init_rc: ["android.hardware.atrace@1.0-service.rc"],
+ vintf_fragments: ["android.hardware.atrace@1.0-service.xml"],
+ srcs: [
+ "AtraceDevice.cpp",
+ "service.cpp",
+ ],
+ shared_libs: [
+ "liblog",
+ "libbase",
+ "libutils",
+ "libhidlbase",
+ "libhidltransport",
+ "android.hardware.atrace@1.0",
+ ],
+}
diff --git a/atrace/1.0/default/AtraceDevice.cpp b/atrace/1.0/default/AtraceDevice.cpp
new file mode 100644
index 0000000..43bcd9a
--- /dev/null
+++ b/atrace/1.0/default/AtraceDevice.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2018 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 <android-base/file.h>
+#include <android-base/logging.h>
+
+#include "AtraceDevice.h"
+
+namespace android {
+namespace hardware {
+namespace atrace {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::atrace::V1_0::Status;
+using ::android::hardware::atrace::V1_0::TracingCategory;
+
+struct TracingConfig {
+ std::string description;
+ std::vector<std::pair<std::string, bool>> paths;
+};
+
+// This is a map stores categories and their sysfs paths with required flags
+const std::map<std::string, TracingConfig> kTracingMap = {
+ // gfx
+ {
+ "gfx",
+ {"Graphics",
+ {{"/sys/kernel/debug/tracing/events/mdss/enable", false},
+ {"/sys/kernel/debug/tracing/events/sde/enable", false},
+ {"/sys/kernel/debug/tracing/events/mali_systrace/enable", false}}},
+ },
+ {
+ "ion",
+ {"ION allocation",
+ {{"/sys/kernel/debug/tracing/events/kmem/ion_alloc_buffer_start/enable", true}}},
+ },
+};
+
+// Methods from ::android::hardware::atrace::V1_0::IAtraceDevice follow.
+Return<void> AtraceDevice::listCategories(listCategories_cb _hidl_cb) {
+ hidl_vec<TracingCategory> categories;
+ categories.resize(kTracingMap.size());
+ std::size_t i = 0;
+ for (auto& c : kTracingMap) {
+ categories[i].name = c.first;
+ categories[i].description = c.second.description;
+ i++;
+ }
+ _hidl_cb(categories);
+ return Void();
+}
+
+Return<::android::hardware::atrace::V1_0::Status> AtraceDevice::enableCategories(
+ const hidl_vec<hidl_string>& categories) {
+ if (!categories.size()) {
+ return Status::ERROR_INVALID_ARGUMENT;
+ }
+ for (auto& c : categories) {
+ if (kTracingMap.count(c)) {
+ for (auto& p : kTracingMap.at(c).paths) {
+ if (!android::base::WriteStringToFile("1", p.first)) {
+ LOG(ERROR) << "Failed to enable tracing on: " << p.first;
+ if (p.second) {
+ // disable before return
+ disableAllCategories();
+ return Status::ERROR_TRACING_POINT;
+ }
+ }
+ }
+ } else {
+ return Status::ERROR_INVALID_ARGUMENT;
+ }
+ }
+ return Status::SUCCESS;
+}
+
+Return<::android::hardware::atrace::V1_0::Status> AtraceDevice::disableAllCategories() {
+ auto ret = Status::SUCCESS;
+ for (auto& c : kTracingMap) {
+ for (auto& p : c.second.paths) {
+ if (!android::base::WriteStringToFile("0", p.first)) {
+ LOG(ERROR) << "Failed to enable tracing on: " << p.first;
+ if (p.second) {
+ ret = Status::ERROR_TRACING_POINT;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace atrace
+} // namespace hardware
+} // namespace android
diff --git a/atrace/1.0/default/AtraceDevice.h b/atrace/1.0/default/AtraceDevice.h
new file mode 100644
index 0000000..e700f89
--- /dev/null
+++ b/atrace/1.0/default/AtraceDevice.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2018 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 ANDROID_HARDWARE_ATRACE_V1_0_ATRACEDEVICE_H
+#define ANDROID_HARDWARE_ATRACE_V1_0_ATRACEDEVICE_H
+
+#include <android/hardware/atrace/1.0/IAtraceDevice.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace atrace {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct AtraceDevice : public IAtraceDevice {
+ // Methods from ::android::hardware::atrace::V1_0::IAtraceDevice follow.
+ Return<void> listCategories(listCategories_cb _hidl_cb) override;
+ Return<::android::hardware::atrace::V1_0::Status> enableCategories(
+ const hidl_vec<hidl_string>& categories) override;
+ Return<::android::hardware::atrace::V1_0::Status> disableAllCategories() override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace atrace
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_ATRACE_V1_0_ATRACEDEVICE_H
diff --git a/atrace/1.0/default/android.hardware.atrace@1.0-service.rc b/atrace/1.0/default/android.hardware.atrace@1.0-service.rc
new file mode 100644
index 0000000..eb54c39
--- /dev/null
+++ b/atrace/1.0/default/android.hardware.atrace@1.0-service.rc
@@ -0,0 +1,13 @@
+on late-init
+ # vendor graphics trace points
+ chmod 0666 /sys/kernel/debug/tracing/events/sde/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/mdss/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/mali_systrace/enable
+ # ion allocation trace point
+ chmod 0666 /sys/kernel/debug/tracing/events/kmem/ion_alloc_buffer_start/enable
+
+service vendor.atrace-hal-1-0 /vendor/bin/hw/android.hardware.atrace@1.0-service
+ interface android.hardware.atrace@1.0::IAtraceDevice default
+ class early_hal
+ user system
+ group system
diff --git a/atrace/1.0/default/android.hardware.atrace@1.0-service.xml b/atrace/1.0/default/android.hardware.atrace@1.0-service.xml
new file mode 100644
index 0000000..fd3631c
--- /dev/null
+++ b/atrace/1.0/default/android.hardware.atrace@1.0-service.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.atrace</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IAtraceDevice</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/atrace/1.0/default/service.cpp b/atrace/1.0/default/service.cpp
new file mode 100644
index 0000000..662fd73
--- /dev/null
+++ b/atrace/1.0/default/service.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "android.hardware.atrace@1.0-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "AtraceDevice.h"
+
+using ::android::OK;
+using ::android::sp;
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::atrace::V1_0::IAtraceDevice;
+using ::android::hardware::atrace::V1_0::Status;
+using ::android::hardware::atrace::V1_0::TracingCategory;
+using ::android::hardware::atrace::V1_0::implementation::AtraceDevice;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IAtraceDevice> atrace = new AtraceDevice;
+ configureRpcThreadpool(1, true /* will join */);
+ if (atrace->registerAsService() != OK) {
+ ALOGE("Could not register service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}
diff --git a/atrace/1.0/types.hal b/atrace/1.0/types.hal
new file mode 100644
index 0000000..f137ef6
--- /dev/null
+++ b/atrace/1.0/types.hal
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+package android.hardware.atrace@1.0;
+
+enum Status : uint32_t {
+ /**
+ * Operation completed without errors.
+ */
+ SUCCESS = 0,
+ /**
+ * Operation failed with errors on enabling tracing point.
+ */
+ ERROR_TRACING_POINT = 1,
+ /**
+ * Operation failed because of invalid argument.
+ */
+ ERROR_INVALID_ARGUMENT = 2
+};
+
+struct TracingCategory {
+ /**
+ * Tracing category name, unique to frameworks's category.
+ */
+ string name;
+ /**
+ * Tracing category description.
+ */
+ string description;
+};
diff --git a/atrace/1.0/vts/functional/Android.bp b/atrace/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..6b50fb5
--- /dev/null
+++ b/atrace/1.0/vts/functional/Android.bp
@@ -0,0 +1,22 @@
+//
+// Copyright (C) 2018 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_test {
+ name: "VtsHalAtraceV1_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalAtraceV1_0TargetTest.cpp"],
+ static_libs: ["android.hardware.atrace@1.0"],
+}
diff --git a/atrace/1.0/vts/functional/VtsHalAtraceV1_0TargetTest.cpp b/atrace/1.0/vts/functional/VtsHalAtraceV1_0TargetTest.cpp
new file mode 100644
index 0000000..c62c2f0
--- /dev/null
+++ b/atrace/1.0/vts/functional/VtsHalAtraceV1_0TargetTest.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2018 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 <unordered_set>
+
+#include <android/hardware/atrace/1.0/IAtraceDevice.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::atrace::V1_0::IAtraceDevice;
+using ::android::hardware::atrace::V1_0::Status;
+
+// Test environment for Boot HIDL HAL.
+class AtraceHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static AtraceHidlEnvironment* Instance() {
+ static AtraceHidlEnvironment* instance = new AtraceHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IAtraceDevice>(); }
+
+ private:
+ AtraceHidlEnvironment() {}
+};
+
+/**
+ * There is no expected behaviour that can be tested so these tests check the
+ * HAL doesn't crash with different execution orders.
+ */
+struct AtraceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ virtual void SetUp() override {
+ atrace = ::testing::VtsHalHidlTargetTestBase::getService<IAtraceDevice>(
+ AtraceHidlEnvironment::Instance()->getServiceName<IAtraceDevice>());
+ ASSERT_NE(atrace, nullptr);
+ }
+
+ sp<IAtraceDevice> atrace;
+};
+
+hidl_vec<hidl_string> getVendorCategoryName(sp<IAtraceDevice> atrace) {
+ std::unordered_set<std::string> categories_set;
+ Return<void> ret = atrace->listCategories([&](const auto& list) {
+ for (const auto& category : list) {
+ std::string name = category.name;
+ if (categories_set.count(name)) {
+ ADD_FAILURE() << "Duplicate category: " << name;
+ } else {
+ categories_set.emplace(name);
+ }
+ }
+ });
+ if (!ret.isOk()) {
+ ADD_FAILURE();
+ }
+ hidl_vec<hidl_string> categories;
+ categories.resize(categories_set.size());
+ std::size_t i = 0;
+ for (auto& c : categories_set) {
+ categories[i++] = c;
+ }
+ return categories;
+}
+
+/* list categories from vendors. */
+TEST_F(AtraceHidlTest, listCategories) {
+ hidl_vec<hidl_string> vnd_categories = getVendorCategoryName(atrace);
+ EXPECT_NE(0, vnd_categories.size());
+}
+
+/* enable categories. */
+TEST_F(AtraceHidlTest, enableCategories) {
+ hidl_vec<hidl_string> vnd_categories = getVendorCategoryName(atrace);
+ // empty Category with ERROR_INVALID_ARGUMENT
+ hidl_vec<hidl_string> empty_categories;
+ auto ret = atrace->enableCategories(empty_categories);
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(Status::ERROR_INVALID_ARGUMENT, ret);
+ // non-empty categories SUCCESS
+ ret = atrace->enableCategories(vnd_categories);
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(Status::SUCCESS, ret);
+}
+
+/* enable categories. */
+TEST_F(AtraceHidlTest, disableAllCategories) {
+ auto ret = atrace->disableAllCategories();
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(Status::SUCCESS, ret);
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(AtraceHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ AtraceHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/audio/core/4.0/vts/functional/Android.bp b/audio/core/4.0/vts/functional/Android.bp
index 22c5493..e3b376c 100644
--- a/audio/core/4.0/vts/functional/Android.bp
+++ b/audio/core/4.0/vts/functional/Android.bp
@@ -29,6 +29,9 @@
"libicuuc_stubdata",
"libxml2",
],
+ shared_libs: [
+ "libfmq",
+ ],
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 836e150..f84e1e2 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -40,6 +40,8 @@
#include <android/hardware/audio/4.0/IPrimaryDevice.h>
#include <android/hardware/audio/4.0/types.h>
#include <android/hardware/audio/common/4.0/types.h>
+#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
#include <common/all-versions/VersionUtils.h>
@@ -57,12 +59,15 @@
using std::list;
using ::android::sp;
+using ::android::hardware::EventFlag;
using ::android::hardware::hidl_bitfield;
using ::android::hardware::hidl_enum_range;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+using ::android::hardware::kSynchronizedReadWrite;
using ::android::hardware::IPCThreadState;
+using ::android::hardware::MessageQueue;
using ::android::hardware::MQDescriptorSync;
using ::android::hardware::Return;
using ::android::hardware::audio::V4_0::AudioDrain;
@@ -74,6 +79,7 @@
using ::android::hardware::audio::V4_0::IDevicesFactory;
using ::android::hardware::audio::V4_0::IStream;
using ::android::hardware::audio::V4_0::IStreamIn;
+using ::android::hardware::audio::V4_0::MessageQueueFlagBits;
using ::android::hardware::audio::V4_0::TimeSpec;
using ReadParameters = ::android::hardware::audio::V4_0::IStreamIn::ReadParameters;
using ReadStatus = ::android::hardware::audio::V4_0::IStreamIn::ReadStatus;
@@ -502,7 +508,7 @@
}
//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// getMicrophones ///////////////////////////////
+/////////////////////////// get(Active)Microphones ///////////////////////////
//////////////////////////////////////////////////////////////////////////////
TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
@@ -510,6 +516,76 @@
hidl_vec<MicrophoneInfo> microphones;
ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
ASSERT_OK(res);
+ if (microphones.size() > 0) {
+ // When there is microphone on the phone, try to open an input stream
+ // and query for the active microphones.
+ doc::test(
+ "Make sure getMicrophones always succeeds"
+ "and getActiveMicrophones always succeeds when recording from these microphones.");
+ AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
+ AudioConfig config{};
+ config.channelMask = mkBitfield(AudioChannelMask::IN_MONO);
+ config.sampleRateHz = 8000;
+ config.format = AudioFormat::PCM_16_BIT;
+ auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
+ const SinkMetadata initialMetadata = {{{AudioSource::MIC, 1 /* gain */}}};
+ EventFlag* efGroup;
+ for (auto microphone : microphones) {
+ if (microphone.deviceAddress.device != AudioDevice::IN_BUILTIN_MIC) {
+ continue;
+ }
+ sp<IStreamIn> stream;
+ AudioConfig suggestedConfig{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress, config, flags,
+ initialMetadata,
+ returnIn(res, stream, suggestedConfig)));
+ if (res != Result::OK) {
+ ASSERT_TRUE(stream == nullptr);
+ AudioConfig suggestedConfigRetry{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress,
+ suggestedConfig, flags, initialMetadata,
+ returnIn(res, stream, suggestedConfigRetry)));
+ }
+ ASSERT_OK(res);
+ hidl_vec<MicrophoneInfo> activeMicrophones;
+ Result readRes;
+ typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
+ typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
+ std::unique_ptr<CommandMQ> commandMQ;
+ std::unique_ptr<DataMQ> dataMQ;
+ size_t frameSize = stream->getFrameSize();
+ size_t frameCount = stream->getBufferSize() / frameSize;
+ ASSERT_OK(stream->prepareForReading(
+ frameSize, frameCount, [&](auto r, auto& c, auto& d, auto&, auto&) {
+ readRes = r;
+ if (readRes == Result::OK) {
+ commandMQ.reset(new CommandMQ(c));
+ dataMQ.reset(new DataMQ(d));
+ if (dataMQ->isValid() && dataMQ->getEventFlagWord()) {
+ EventFlag::createEventFlag(dataMQ->getEventFlagWord(), &efGroup);
+ }
+ }
+ }));
+ ASSERT_OK(readRes);
+ ReadParameters params;
+ params.command = IStreamIn::ReadCommand::READ;
+ ASSERT_TRUE(commandMQ != nullptr);
+ ASSERT_TRUE(commandMQ->isValid());
+ ASSERT_TRUE(commandMQ->write(¶ms));
+ efGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
+ uint32_t efState = 0;
+ efGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
+ if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
+ ASSERT_OK(stream->getActiveMicrophones(returnIn(res, activeMicrophones)));
+ ASSERT_OK(res);
+ ASSERT_NE(0U, activeMicrophones.size());
+ }
+ stream->close();
+ if (efGroup) {
+ EventFlag::deleteEventFlag(&efGroup);
+ }
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -1117,14 +1193,6 @@
ASSERT_OK(stream->updateSinkMetadata(initialMetadata));
}
-TEST_P(InputStreamTest, getActiveMicrophones) {
- doc::test("Getting active microphones should always succeed");
- hidl_vec<MicrophoneInfo> microphones;
- ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
- ASSERT_OK(res);
- ASSERT_TRUE(microphones.size() > 0);
-}
-
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////// StreamOut //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
diff --git a/boot/1.0/default/Android.bp b/boot/1.0/default/Android.bp
index 67dee08..397c56d 100644
--- a/boot/1.0/default/Android.bp
+++ b/boot/1.0/default/Android.bp
@@ -2,7 +2,7 @@
name: "android.hardware.boot@1.0-impl",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
- vendor_available: true,
+ vendor: true,
recovery_available: true,
srcs: ["BootControl.cpp"],
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 78d1bf6..0d60be6 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -1,5 +1,13 @@
<compatibility-matrix version="1.0" type="framework" level="4">
<hal format="hidl" optional="false">
+ <name>android.hardware.atrace</name>
+ <version>1.0</version>
+ <interface>
+ <name>IAtraceDevice</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="false">
<name>android.hardware.audio</name>
<version>4.0</version>
<interface>
diff --git a/current.txt b/current.txt
index e26e239..327833f 100644
--- a/current.txt
+++ b/current.txt
@@ -386,6 +386,7 @@
# ABI preserving changes to HALs during Android Q
da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardware.configstore@1.0::ISurfaceFlingerConfigs
+b7ecf29927055ec422ec44bf776223f07d79ad9f92ccf9becf167e62c2607e7a android.hardware.keymaster@4.0::IKeymasterDevice
574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel
1fb32361286b938d48a55c2539c846732afce0b99fe08590f556643125bc13d3 android.hardware.neuralnetworks@1.0::types
e22e8135d061d0e9c4c1a70c25c19fdba10f4d3cda9795ef25b6392fc520317c android.hardware.neuralnetworks@1.1::types
diff --git a/fastboot/1.0/IFastboot.hal b/fastboot/1.0/IFastboot.hal
index 653fd79..a96755e 100644
--- a/fastboot/1.0/IFastboot.hal
+++ b/fastboot/1.0/IFastboot.hal
@@ -29,4 +29,34 @@
* reformatting.
*/
getPartitionType(string partitionName) generates (FileSystemType type, Result result);
+
+ /**
+ * Executes a fastboot OEM command.
+ *
+ * @param oemCmdArgs The oem command that is passed to the fastboot HAL.
+ * @response result Returns the status SUCCESS if the operation is successful,
+ * INVALID_ARGUMENT for bad arguments,
+ * FAILURE_UNKNOWN for an invalid/unsupported command.
+ */
+ doOemCommand(string oemCmd) generates (Result result);
+
+ /**
+ * Returns an OEM-defined string indicating the variant of the device, for
+ * example, US and ROW.
+ *
+ * @response variant Indicates the device variant.
+ * @response result Returns the status SUCCESS if the operation is successful,
+ * FAILURE_UNKNOWN otherwise.
+ */
+ getVariant() generates (string variant, Result result);
+
+ /**
+ * Returns whether off-mode-charging is enabled. If enabled, the device
+ * autoboots into a special mode when power is applied.
+ *
+ * @response state Returns whether off mode charging is enabled.
+ * @response result Returns the status SUCCESS if the operation is successful,
+ * FAILURE_UNKNOWN otherwise.
+ */
+ getOffModeChargeState() generates (bool state, Result result);
};
diff --git a/fastboot/1.0/types.hal b/fastboot/1.0/types.hal
index 8453deb..3fbe639 100644
--- a/fastboot/1.0/types.hal
+++ b/fastboot/1.0/types.hal
@@ -53,9 +53,9 @@
struct Result {
Status status;
/**
- * Error message pertaining to the status. It must be a failure message for
+ * Message pertaining to the status. It must be a failure message for
* Status FAILURE_UNKNOWN/NOT_SUPPORTED or an informative message for
* Status SUCCESS.
*/
- string error;
+ string message;
};
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
index c9f840e..2d901f3 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -119,6 +119,11 @@
struct ComparableBlacklistedSource {
IGnssConfiguration::BlacklistedSource id;
+ ComparableBlacklistedSource() {
+ id.constellation = GnssConstellationType::UNKNOWN;
+ id.svid = 0;
+ }
+
bool operator<(const ComparableBlacklistedSource& compare) const {
return ((id.svid < compare.id.svid) || ((id.svid == compare.id.svid) &&
(id.constellation < compare.id.constellation)));
@@ -191,18 +196,21 @@
* 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does not use those satellites.
* 4a & b) Turns off location, and send in empty blacklist.
- * 5) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * 5a) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does re-use at least the previously strongest satellite
+ * 5b) Retry a few times, in case GNSS search strategy takes a while to reacquire even the
+ * formerly strongest satellite
*/
TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
const int kLocationsToAwait = 3;
+ const int kRetriesToUnBlacklist = 10;
StartAndCheckLocations(kLocationsToAwait);
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
/*
* Identify strongest SV seen at least kLocationsToAwait -1 times
@@ -237,13 +245,18 @@
// retry and ensure satellite not used
list_gnss_sv_status_.clear();
- location_called_count_ = 0;
StartAndCheckLocations(kLocationsToAwait);
+ // early exit if test is being run with insufficient signal
+ if (location_called_count_ == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
+ }
+ ASSERT_TRUE(location_called_count_ > 0);
+
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
for (const auto& gnss_sv_status : list_gnss_sv_status_) {
for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
@@ -260,28 +273,40 @@
ASSERT_TRUE(result.isOk());
EXPECT_TRUE(result);
- StopAndClearLocations();
- list_gnss_sv_status_.clear();
-
- StartAndCheckLocations(kLocationsToAwait);
-
- // Tolerate 1 less sv status to handle edge cases in reporting.
- EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
-
bool strongest_sv_is_reobserved = false;
- for (const auto& gnss_sv_status : list_gnss_sv_status_) {
- for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
- const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
- if ((gnss_sv.svid == source_to_blacklist.svid) &&
- (gnss_sv.constellation == source_to_blacklist.constellation) &&
- (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
- strongest_sv_is_reobserved = true;
- break;
- }
+ // do several loops awaiting a few locations, allowing non-immediate reacquisition strategies
+ int unblacklist_loops_remaining = kRetriesToUnBlacklist;
+ while (!strongest_sv_is_reobserved && (unblacklist_loops_remaining-- > 0)) {
+ StopAndClearLocations();
+ list_gnss_sv_status_.clear();
+
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // early exit loop if test is being run with insufficient signal
+ if (location_called_count_ == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
}
- if (strongest_sv_is_reobserved) break;
+ ASSERT_TRUE(location_called_count_ > 0);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
+ ALOGD(
+ "Clear blacklist, observed %d GnssSvStatus, while awaiting %d Locations"
+ ", tries remaining %d",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, unblacklist_loops_remaining);
+
+ for (const auto& gnss_sv_status : list_gnss_sv_status_) {
+ for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
+ const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
+ if ((gnss_sv.svid == source_to_blacklist.svid) &&
+ (gnss_sv.constellation == source_to_blacklist.constellation) &&
+ (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
+ strongest_sv_is_reobserved = true;
+ break;
+ }
+ }
+ if (strongest_sv_is_reobserved) break;
+ }
}
EXPECT_TRUE(strongest_sv_is_reobserved);
StopAndClearLocations();
@@ -304,8 +329,8 @@
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
// Find first non-GPS constellation to blacklist
GnssConstellationType constellation_to_blacklist = GnssConstellationType::UNKNOWN;
diff --git a/keymaster/4.0/IKeymasterDevice.hal b/keymaster/4.0/IKeymasterDevice.hal
index 85a25c6..c867ab0 100644
--- a/keymaster/4.0/IKeymasterDevice.hal
+++ b/keymaster/4.0/IKeymasterDevice.hal
@@ -168,7 +168,7 @@
* startup, preferably by the bootloader. This bitstring must be cryptographically bound to every
* key managed by the IKeymasterDevice. As above, the recommended mechanism for this cryptographic
* binding is to include the Root of Trust data in the input to the key derivation function used to
- * derive a key that is used to encryp the private/secret key material.
+ * derive a key that is used to encrypt the private/secret key material.
*
* The root of trust consists of a bitstring that must be derived from the public key used by
* Verified Boot to verify the signature on the boot image and from the the lock state of the
@@ -386,7 +386,7 @@
* Generates a new cryptographic key, specifying associated parameters, which must be
* cryptographically bound to the key. IKeymasterDevice implementations must disallow any use
* of a key in any way inconsistent with the authorizations specified at generation time. With
- * respect to parameters that the secure environment cannot enforce, the secure envionment's
+ * respect to parameters that the secure environment cannot enforce, the secure environment's
* obligation is limited to ensuring that the unenforceable parameters associated with the key
* cannot be modified, so that every call to getKeyCharacteristics returns the original
* values. In addition, the characteristics returned by generateKey places parameters correctly
@@ -433,7 +433,7 @@
* supported for RSA keys.
*
* o Tag::DIGEST specifies digest algorithms that may be used with the new key. TEE
- * IKeymasterDevice implementatiosn must support all Digest values (see types.hal) for RSA
+ * IKeymasterDevice implementations must support all Digest values (see types.hal) for RSA
* keys. StrongBox IKeymasterDevice implementations must support SHA_2_256.
*
* o Tag::PADDING specifies the padding modes that may be used with the new
@@ -495,13 +495,13 @@
*
* @param keyFormat The format of the key material to import. See KeyFormat in types.hal.
*
- * @pram keyData The key material to import, in the format specifed in keyFormat.
+ * @pram keyData The key material to import, in the format specified in keyFormat.
*
* @return keyBlob Opaque descriptor of the imported key. The recommended implementation
* strategy is to include an encrypted copy of the key material, wrapped in a key
* unavailable outside secure hardware.
*
- * @return keyCharacteristics Decription of the generated key. See the getKeyCharacteristics
+ * @return keyCharacteristics Description of the generated key. See the getKeyCharacteristics
* method below.
*/
importKey(vec<KeyParameter> keyParams, KeyFormat keyFormat, vec<uint8_t> keyData)
@@ -615,7 +615,7 @@
* value, it must be computationally infeasible for the secure hardware to obtain the key
* material.
*
- * @return keyCharacteristics Decription of the generated key. See KeyCharacteristics in
+ * @return keyCharacteristics Description of the generated key. See KeyCharacteristics in
* types.hal.
*/
getKeyCharacteristics(vec<uint8_t> keyBlob, vec<uint8_t> clientId, vec<uint8_t> appData)
@@ -815,7 +815,7 @@
* any one of them is higher than the corresponding current device value upgradeKey() must
* return ErrorCode::INVALID_ARGUMENT. There is one exception: it is always permissible to
* "downgrade" from any OS_VERSION number to OS_VERSION 0. For example, if the key has
- * OS_VERSION 080001, it is permisible to upgrade the key if the current system version is
+ * OS_VERSION 080001, it is permissible to upgrade the key if the current system version is
* 080100, because the new version is larger, or if the current system version is 0, because
* upgrades to 0 are always allowed. If the system version were 080000, however, keymaster must
* return ErrorCode::INVALID_ARGUMENT because that value is smaller than 080001. Values other
@@ -1040,7 +1040,7 @@
* authorizations contain Tag::CALLER_NONCE, then the caller may provide an IV/nonce with
* Tag::NONCE in inParams. If a nonce is provided when Tag::CALLER_NONCE is not authorized,
* begin() must return ErrorCode::CALLER_NONCE_PROHIBITED. If a nonce is not provided when
- * Tag::CALLER_NONCE is authorized, IKeymasterDevice msut generate a random IV/nonce.
+ * Tag::CALLER_NONCE is authorized, IKeymasterDevice must generate a random IV/nonce.
*
* -- HMAC keys --
*
@@ -1082,7 +1082,7 @@
/**
* Provides data to, and possibly receives output from, an ongoing cryptographic operation begun
- * with begin(). The operation is specified by the operationHandle paramater.
+ * with begin(). The operation is specified by the operationHandle parameter.
*
* If operationHandle is invalid, update() must return ErrorCode::INVALID_OPERATION_HANDLE.
*
diff --git a/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h b/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
index 1869682..193e4ea 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
@@ -46,7 +46,7 @@
AuthorizationSet(const AuthorizationSet& other) : data_(other.data_) {}
// Move constructor.
- AuthorizationSet(AuthorizationSet&& other) : data_(std::move(other.data_)) {}
+ AuthorizationSet(AuthorizationSet&& other) noexcept : data_(std::move(other.data_)) {}
// Constructor from hidl_vec<KeyParameter>
AuthorizationSet(const hidl_vec<KeyParameter>& other) { *this = other; }
@@ -58,7 +58,7 @@
}
// Move assignment.
- AuthorizationSet& operator=(AuthorizationSet&& other) {
+ AuthorizationSet& operator=(AuthorizationSet&& other) noexcept {
data_ = std::move(other.data_);
return *this;
}