Merge "Fix closure of record thread"
diff --git a/Android.bp b/Android.bp
index 815e766..fc6babe 100644
--- a/Android.bp
+++ b/Android.bp
@@ -58,8 +58,6 @@
"libhidl_gtest_helper",
],
- group_static_libs: true,
-
// Lists all system dependencies that can be expected on the device.
shared_libs: [
"libbase",
diff --git a/broadcastradio/common/vts/utils/Android.bp b/broadcastradio/common/vts/utils/Android.bp
index e08813b..dd48db3 100644
--- a/broadcastradio/common/vts/utils/Android.bp
+++ b/broadcastradio/common/vts/utils/Android.bp
@@ -34,5 +34,4 @@
"-Wextra",
"-Werror",
],
- group_static_libs: true,
}
diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp
index 3c414e7..376ac97 100644
--- a/common/fmq/aidl/Android.bp
+++ b/common/fmq/aidl/Android.bp
@@ -19,7 +19,7 @@
"android/hardware/common/fmq/*.aidl",
],
imports: [
- "android.hardware.common",
+ "android.hardware.common-V2",
],
stability: "vintf",
backend: {
diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp
index 97d7a98..b23d4a7 100644
--- a/graphics/common/aidl/Android.bp
+++ b/graphics/common/aidl/Android.bp
@@ -21,7 +21,7 @@
],
stability: "vintf",
imports: [
- "android.hardware.common",
+ "android.hardware.common-V2",
],
backend: {
java: {
diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp
index 951cdd5..3a69936 100644
--- a/neuralnetworks/aidl/Android.bp
+++ b/neuralnetworks/aidl/Android.bp
@@ -16,8 +16,8 @@
],
stability: "vintf",
imports: [
- "android.hardware.common",
- "android.hardware.graphics.common",
+ "android.hardware.common-V2",
+ "android.hardware.graphics.common-V2",
],
backend: {
java: {
diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp
index cd45a62..028d297 100644
--- a/security/keymint/aidl/Android.bp
+++ b/security/keymint/aidl/Android.bp
@@ -14,7 +14,7 @@
"android/hardware/security/keymint/*.aidl",
],
imports: [
- "android.hardware.security.secureclock",
+ "android.hardware.security.secureclock-V1",
],
stability: "vintf",
backend: {
diff --git a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
index 2922e83..0fd1dda 100644
--- a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
+++ b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
@@ -21,6 +21,7 @@
import android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback;
import android.media.audio.common.AudioChannelLayout;
import android.media.audio.common.AudioConfig;
+import android.media.audio.common.AudioConfigBase;
import android.media.audio.common.AudioFormatDescription;
import android.media.audio.common.AudioFormatType;
import android.media.audio.common.PcmType;
@@ -348,11 +349,12 @@
private static AudioConfig createConfig() {
AudioConfig config = new AudioConfig();
- config.channelMask = AudioChannelLayout.layoutMask(AudioChannelLayout.LAYOUT_MONO);
- config.format = new AudioFormatDescription();
- config.format.type = AudioFormatType.PCM;
- config.format.pcm = PcmType.INT_16_BIT;
- config.sampleRateHz = 16000;
+ config.base = new AudioConfigBase();
+ config.base.channelMask = AudioChannelLayout.layoutMask(AudioChannelLayout.LAYOUT_MONO);
+ config.base.format = new AudioFormatDescription();
+ config.base.format.type = AudioFormatType.PCM;
+ config.base.format.pcm = PcmType.INT_16_BIT;
+ config.base.sampleRate = 16000;
return config;
}
}
diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp
index 989815e..5d21753 100755
--- a/uwb/aidl/Android.bp
+++ b/uwb/aidl/Android.bp
@@ -23,6 +23,7 @@
enabled: true,
},
apex_available: [
+ "//apex_available:platform",
"com.android.uwb",
],
min_sdk_version: "current",
diff --git a/uwb/aidl/default/Android.bp b/uwb/aidl/default/Android.bp
new file mode 100644
index 0000000..8c2b60e
--- /dev/null
+++ b/uwb/aidl/default/Android.bp
@@ -0,0 +1,35 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_binary {
+ name: "android.hardware.uwb-service",
+ relative_install_path: "hw",
+ init_rc: ["uwb-service.rc"],
+ vintf_fragments: ["uwb-service.xml"],
+ vendor: true,
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-g",
+ ],
+ shared_libs: [
+ "liblog",
+ "libbinder_ndk",
+ ],
+ static_libs: [
+ "libbase",
+ "libutils",
+ "android.hardware.uwb-V1-ndk",
+ ],
+ srcs: [
+ "service.cpp",
+ "uwb.cpp",
+ "uwb_chip.cpp",
+ ],
+}
diff --git a/uwb/aidl/default/OWNERS b/uwb/aidl/default/OWNERS
new file mode 100644
index 0000000..c4ad416
--- /dev/null
+++ b/uwb/aidl/default/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 1042770
+include platform/packages/modules/Uwb:/OWNERS
diff --git a/uwb/aidl/default/service.cpp b/uwb/aidl/default/service.cpp
new file mode 100644
index 0000000..007637f
--- /dev/null
+++ b/uwb/aidl/default/service.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2021, 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/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/StrongPointer.h>
+
+#include "uwb.h"
+
+using ::aidl::android::hardware::uwb::IUwb;
+using ::android::sp;
+using ::android::base::InitLogging;
+using ::android::base::StderrLogger;
+using ::android::hardware::uwb::impl::Uwb;
+
+int main(int /*argc*/, char* argv[]) {
+ InitLogging(argv, StderrLogger);
+ LOG(INFO) << "UWB HAL starting up";
+
+ ABinderProcess_setThreadPoolMaxThreadCount(0);
+ std::shared_ptr<IUwb> uwb = ndk::SharedRefBase::make<Uwb>();
+ const std::string instance = std::string() + IUwb::descriptor + "/default";
+ binder_status_t status = AServiceManager_addService(uwb->asBinder().get(), instance.c_str());
+ CHECK(status == STATUS_OK);
+
+ ABinderProcess_joinThreadPool();
+ return EXIT_FAILURE; // should not reach
+}
diff --git a/uwb/aidl/default/uwb-service.rc b/uwb/aidl/default/uwb-service.rc
new file mode 100644
index 0000000..e2c3825
--- /dev/null
+++ b/uwb/aidl/default/uwb-service.rc
@@ -0,0 +1,3 @@
+service vendor.uwb_hal /vendor/bin/hw/android.hardware.uwb-service
+ class hal
+ user uwb
diff --git a/uwb/aidl/default/uwb-service.xml b/uwb/aidl/default/uwb-service.xml
new file mode 100644
index 0000000..013d9de
--- /dev/null
+++ b/uwb/aidl/default/uwb-service.xml
@@ -0,0 +1,10 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.uwb</name>
+ <version>1</version>
+ <interface>
+ <name>IUwb</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/uwb/aidl/default/uwb.cpp b/uwb/aidl/default/uwb.cpp
new file mode 100644
index 0000000..1e2ef4e
--- /dev/null
+++ b/uwb/aidl/default/uwb.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021, 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/logging.h>
+
+#include "uwb.h"
+
+namespace {
+static constexpr char kDefaultChipName[] = "default";
+
+} // namespace
+
+namespace android {
+namespace hardware {
+namespace uwb {
+namespace impl {
+using namespace ::aidl::android::hardware::uwb;
+
+// The default implementation of the HAL assumes 1 chip on the device.
+Uwb::Uwb() : chips_({{kDefaultChipName, ndk::SharedRefBase::make<UwbChip>(kDefaultChipName)}}) {}
+
+Uwb::~Uwb() {}
+
+::ndk::ScopedAStatus Uwb::getChips(std::vector<std::string>* names) {
+ for (const auto& chip : chips_) {
+ names->push_back(chip.first);
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus Uwb::getChip(const std::string& name, std::shared_ptr<IUwbChip>* chip) {
+ const auto chip_found = chips_.find(name);
+ if (chip_found == chips_.end()) {
+ LOG(ERROR) << "Unknown chip name" << name;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ *chip = chip_found->second;
+ return ndk::ScopedAStatus::ok();
+}
+} // namespace impl
+} // namespace uwb
+} // namespace hardware
+} // namespace android
diff --git a/uwb/aidl/default/uwb.h b/uwb/aidl/default/uwb.h
new file mode 100644
index 0000000..ec51fd8
--- /dev/null
+++ b/uwb/aidl/default/uwb.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2021, 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_UWB_UWB
+#define ANDROID_HARDWARE_UWB_UWB
+
+#include <map>
+#include <vector>
+
+#include <aidl/android/hardware/uwb/BnUwb.h>
+#include <aidl/android/hardware/uwb/IUwbChip.h>
+
+#include "uwb_chip.h"
+
+namespace android {
+namespace hardware {
+namespace uwb {
+namespace impl {
+using namespace ::aidl::android::hardware::uwb;
+// Default implementation mean't to be used on simulator targets.
+class Uwb : public BnUwb {
+ public:
+ Uwb();
+ virtual ~Uwb();
+
+ ::ndk::ScopedAStatus getChips(std::vector<std::string>* names) override;
+ ::ndk::ScopedAStatus getChip(const std::string& name, std::shared_ptr<IUwbChip>* chip) override;
+
+ private:
+ std::map<std::string, std::shared_ptr<UwbChip>> chips_;
+};
+} // namespace impl
+} // namespace uwb
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_UWB_UWB
\ No newline at end of file
diff --git a/uwb/aidl/default/uwb_chip.cpp b/uwb/aidl/default/uwb_chip.cpp
new file mode 100644
index 0000000..727bcf1
--- /dev/null
+++ b/uwb/aidl/default/uwb_chip.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2021, 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 "uwb.h"
+
+namespace android {
+namespace hardware {
+namespace uwb {
+namespace impl {
+using namespace ::aidl::android::hardware::uwb;
+
+UwbChip::UwbChip(const std::string& name) : name_(name) {}
+UwbChip::~UwbChip() {}
+
+::ndk::ScopedAStatus UwbChip::getName(std::string* name) {
+ *name = name_;
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus UwbChip::open(
+ const std::shared_ptr<IUwbClientCallback>& /* clientCallback */) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
+::ndk::ScopedAStatus UwbChip::close() {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
+::ndk::ScopedAStatus UwbChip::coreInit() {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
+::ndk::ScopedAStatus UwbChip::getSupportedVendorUciVersion(int32_t* /* version */) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
+::ndk::ScopedAStatus UwbChip::sendUciMessage(const std::vector<uint8_t>& /* data */,
+ int32_t* /* bytes_written */) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+} // namespace impl
+} // namespace uwb
+} // namespace hardware
+} // namespace android
diff --git a/uwb/aidl/default/uwb_chip.h b/uwb/aidl/default/uwb_chip.h
new file mode 100644
index 0000000..5d3f55c
--- /dev/null
+++ b/uwb/aidl/default/uwb_chip.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2021, 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_UWB_UWBCHIP
+#define ANDROID_HARDWARE_UWB_UWBCHIP
+
+#include <vector>
+
+#include <aidl/android/hardware/uwb/BnUwbChip.h>
+#include <aidl/android/hardware/uwb/IUwbClientCallback.h>
+
+namespace android {
+namespace hardware {
+namespace uwb {
+namespace impl {
+using namespace ::aidl::android::hardware::uwb;
+// Default implementation mean't to be used on simulator targets.
+class UwbChip : public BnUwbChip {
+ public:
+ UwbChip(const std::string& name);
+ virtual ~UwbChip();
+
+ ::ndk::ScopedAStatus getName(std::string* name) override;
+ ::ndk::ScopedAStatus open(const std::shared_ptr<IUwbClientCallback>& clientCallback) override;
+ ::ndk::ScopedAStatus close() override;
+ ::ndk::ScopedAStatus coreInit() override;
+ ::ndk::ScopedAStatus getSupportedVendorUciVersion(int32_t* version) override;
+ ::ndk::ScopedAStatus sendUciMessage(const std::vector<uint8_t>& data,
+ int32_t* bytes_written) override;
+
+ private:
+ std::string name_;
+};
+} // namespace impl
+} // namespace uwb
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_UWB_UWBCHIP