Merge changes from topic "CAP_AIDL_AUDIO_HAL" into main
* changes:
Add missing Cap Settings aidl support and helper
Migrate forced config and for force use to android.media.audio.common.types
diff --git a/Android.bp b/Android.bp
index 223a1a9..baf3291 100644
--- a/Android.bp
+++ b/Android.bp
@@ -51,7 +51,6 @@
// Lists all dependencies that can *not* be expected on the device.
static_libs: [
"VtsHalHidlTestUtils",
- "libhidlbase",
"libhidl-gen-utils",
],
@@ -64,6 +63,7 @@
"libbase",
// All the following are dependencies of any HAL definition library.
"libcutils",
+ "libhidlbase",
"liblog",
"libutils",
],
@@ -72,14 +72,6 @@
"-g",
],
- target: {
- android: {
- shared_libs: [
- "libvndksupport",
- ],
- },
- },
-
require_root: true,
}
diff --git a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
index 65ea9ef..cfe001e 100644
--- a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
+++ b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
@@ -386,14 +386,23 @@
* For input streams: the moment when data at the specified stream position
* was acquired (i.e. capture position).
*
- * The observable position must never be reset by the HAL module.
- * The data type of the frame counter is large enough to support
- * continuous counting for years of operation.
+ * The observable position must never be reset by the HAL module,
+ * providing an abstraction of continuous audio data flow. The data
+ * type of the frame counter is large enough to support continuous
+ * counting for years of operation.
*/
Position observable;
/**
* Used only for MMap streams to provide the hardware read / write
* position for audio data in the shared memory buffer 'audio.mmap'.
+ * Similar to the observable position, the 'Position::UNKNOWN' value
+ * can be returned when the HAL module is unable to retrieve the current
+ * position.
+ *
+ * The hardware position must never be reset by the HAL module,
+ * providing an abstraction of continuous audio data flow. The data
+ * type of the frame counter is large enough to support continuous
+ * counting for years of operation.
*/
Position hardware;
/**
diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp
index cc8f2b0..b6c0525 100644
--- a/automotive/remoteaccess/hal/default/Android.bp
+++ b/automotive/remoteaccess/hal/default/Android.bp
@@ -51,15 +51,22 @@
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-default-service",
defaults: ["remote-access-hal-defaults"],
- vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-default-service.rc"],
+ vintf_fragment_modules: ["remoteaccess-default-service.xml"],
+
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-tcu-test-service",
defaults: ["remote-access-hal-defaults"],
- vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-tcu-test-service.rc"],
+ vintf_fragment_modules: ["remoteaccess-default-service.xml"],
+}
+
+vintf_fragment {
+ name: "remoteaccess-default-service.xml",
+ src: "remoteaccess-default-service.xml",
+ vendor: true,
}
cc_library {
diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml
index 62c5650..73b4193 100644
--- a/compatibility_matrices/compatibility_matrix.202504.xml
+++ b/compatibility_matrices/compatibility_matrix.202504.xml
@@ -522,6 +522,7 @@
<name>ISharedSecret</name>
<instance>default</instance>
<instance>strongbox</instance>
+ <regex-instance>.*</regex-instance>
</interface>
</hal>
<hal format="aidl">
diff --git a/health/aidl/default/corpus/seed-2024-08-29-0 b/health/aidl/default/corpus/seed-2024-08-29-0
new file mode 100644
index 0000000..07fd0e9
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-0
Binary files differ
diff --git a/health/aidl/default/corpus/seed-2024-08-29-1 b/health/aidl/default/corpus/seed-2024-08-29-1
new file mode 100644
index 0000000..ef19735
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-1
Binary files differ
diff --git a/health/aidl/default/corpus/seed-2024-08-29-2 b/health/aidl/default/corpus/seed-2024-08-29-2
new file mode 100644
index 0000000..76addb7
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-2
Binary files differ
diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp
index d43c2d5..c5ad5a8 100644
--- a/health/utils/libhealthloop/HealthLoop.cpp
+++ b/health/utils/libhealthloop/HealthLoop.cpp
@@ -43,6 +43,8 @@
namespace hardware {
namespace health {
+static constexpr uint32_t kUeventMsgLen = 2048;
+
HealthLoop::HealthLoop() {
InitHealthdConfig(&healthd_config_);
awake_poll_interval_ = -1;
@@ -61,14 +63,13 @@
EventHandler{this, fd, std::move(func)}))
.get();
- struct epoll_event ev;
-
- ev.events = EPOLLIN;
+ struct epoll_event ev = {
+ .events = EPOLLIN | EPOLLERR,
+ .data.ptr = reinterpret_cast<void*>(event_handler),
+ };
if (wakeup == EVENT_WAKEUP_FD) ev.events |= EPOLLWAKEUP;
- ev.data.ptr = reinterpret_cast<void*>(event_handler);
-
if (epoll_ctl(epollfd_, EPOLL_CTL_ADD, fd, &ev) == -1) {
KLOG_ERROR(LOG_TAG, "epoll_ctl failed; errno=%d\n", errno);
return -1;
@@ -121,32 +122,42 @@
ScheduleBatteryUpdate();
}
-#define UEVENT_MSG_LEN 2048
-void HealthLoop::UeventEvent(uint32_t /*epevents*/) {
- // No need to lock because uevent_fd_ is guaranteed to be initialized.
-
- char msg[UEVENT_MSG_LEN + 2];
- char* cp;
- int n;
-
- n = uevent_kernel_multicast_recv(uevent_fd_, msg, UEVENT_MSG_LEN);
- if (n <= 0) return;
- if (n >= UEVENT_MSG_LEN) /* overflow -- discard */
- return;
-
- msg[n] = '\0';
- msg[n + 1] = '\0';
- cp = msg;
-
- while (*cp) {
- if (!strcmp(cp, "SUBSYSTEM=power_supply")) {
- ScheduleBatteryUpdate();
- break;
+// Returns true if and only if the battery statistics should be updated.
+bool HealthLoop::RecvUevents() {
+ bool update_stats = false;
+ for (;;) {
+ char msg[kUeventMsgLen + 2];
+ int n = uevent_kernel_multicast_recv(uevent_fd_, msg, kUeventMsgLen);
+ if (n < 0 && errno == ENOBUFS) {
+ update_stats = true;
+ }
+ if (n <= 0) return update_stats;
+ if (n >= kUeventMsgLen) {
+ // too long -- discard
+ continue;
+ }
+ if (update_stats) {
+ continue;
}
- /* advance to after the next \0 */
- while (*cp++)
- ;
+ msg[n] = '\0';
+ msg[n + 1] = '\0';
+ for (char* cp = msg; *cp;) {
+ if (strcmp(cp, "SUBSYSTEM=power_supply") == 0) {
+ update_stats = true;
+ break;
+ }
+
+ /* advance to after the next \0 */
+ while (*cp++) {
+ }
+ }
+ }
+}
+
+void HealthLoop::UeventEvent(uint32_t /*epevents*/) {
+ if (RecvUevents()) {
+ ScheduleBatteryUpdate();
}
}
@@ -169,7 +180,7 @@
}
void HealthLoop::UeventInit(void) {
- uevent_fd_.reset(uevent_create_socket(64 * 1024, true));
+ uevent_fd_.reset(uevent_create_socket(kUeventMsgLen, true));
if (uevent_fd_ < 0) {
KLOG_ERROR(LOG_TAG, "uevent_init: uevent_open_socket failed\n");
@@ -183,9 +194,9 @@
std::string error_msg = attach_result.error().message();
error_msg +=
". This is expected in recovery mode and also for kernel versions before 5.10.";
- KLOG_WARNING(LOG_TAG, "%s", error_msg.c_str());
+ KLOG_WARNING(LOG_TAG, "%s\n", error_msg.c_str());
} else {
- KLOG_INFO(LOG_TAG, "Successfully attached the BPF filter to the uevent socket");
+ KLOG_INFO(LOG_TAG, "Successfully attached the BPF filter to the uevent socket\n");
}
if (RegisterEvent(uevent_fd_, &HealthLoop::UeventEvent, EVENT_WAKEUP_FD))
diff --git a/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp b/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
index e885f0b..04b8bcd 100644
--- a/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
+++ b/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
@@ -192,16 +192,21 @@
bpf_object__close(obj);
}
+static constexpr char input0[] = "a";
+static constexpr char input1[] = "abc\0SUBSYSTEM=block\0";
+static constexpr char input2[] = "\0SUBSYSTEM=block";
+static constexpr char input3[] = "\0SUBSYSTEM=power_supply";
+static constexpr char input4[] = "\0SUBSYSTEM=power_supply\0";
+static constexpr char input5[] =
+ "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ "012345678901234567890123456789012345678901234567890123456789\0SUBSYSTEM=block\0";
+
INSTANTIATE_TEST_SUITE_P(
filterPse, filterPseTest,
- testing::Values(test_data{false, "a"},
- test_data{true, std::string_view("abc\0SUBSYSTEM=block\0", 20)},
- test_data{true, std::string_view("\0SUBSYSTEM=block", 16)},
- test_data{true, std::string_view("\0SUBSYSTEM=power_supply", 23)},
- test_data{false, std::string_view("\0SUBSYSTEM=power_supply\0", 24)},
- test_data{
- false,
- "012345678901234567890123456789012345678901234567890123456789012345"
- "678901234567890123456789012345678901234567890123456789012345678901"
- "234567890123456789012345678901234567890123456789012345678901234567"
- "890123456789012345678901234567890123456789\0SUBSYSTEM=block\0"}));
+ testing::Values(test_data{false, std::string_view(input0, sizeof(input0) - 1)},
+ test_data{true, std::string_view(input1, sizeof(input1) - 1)},
+ test_data{true, std::string_view(input2, sizeof(input2) - 1)},
+ test_data{true, std::string_view(input3, sizeof(input3) - 1)},
+ test_data{false, std::string_view(input4, sizeof(input4) - 1)},
+ test_data{false, std::string_view(input5, sizeof(input5) - 1)}));
diff --git a/health/utils/libhealthloop/include/health/HealthLoop.h b/health/utils/libhealthloop/include/health/HealthLoop.h
index 1af7274..43c38dc 100644
--- a/health/utils/libhealthloop/include/health/HealthLoop.h
+++ b/health/utils/libhealthloop/include/health/HealthLoop.h
@@ -93,6 +93,7 @@
void WakeAlarmInit();
void WakeAlarmEvent(uint32_t);
void UeventInit();
+ bool RecvUevents();
void UeventEvent(uint32_t);
void WakeAlarmSetInterval(int interval);
void PeriodicChores();
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index fbb6140..22a46ed 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -7,6 +7,24 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+vintf_fragment {
+ name: "android.hardware.security.keymint-service.xml",
+ src: "android.hardware.security.keymint-service.xml",
+ vendor: true,
+}
+
+vintf_fragment {
+ name: "android.hardware.security.sharedsecret-service.xml",
+ src: "android.hardware.security.sharedsecret-service.xml",
+ vendor: true,
+}
+
+vintf_fragment {
+ name: "android.hardware.security.secureclock-service.xml",
+ src: "android.hardware.security.secureclock-service.xml",
+ vendor: true,
+}
+
// The following target has an insecure implementation of KeyMint where the
// trusted application (TA) code runs in-process alongside the HAL service
// code.
@@ -18,11 +36,6 @@
name: "android.hardware.security.keymint-service",
relative_install_path: "hw",
init_rc: ["android.hardware.security.keymint-service.rc"],
- vintf_fragments: [
- "android.hardware.security.keymint-service.xml",
- "android.hardware.security.sharedsecret-service.xml",
- "android.hardware.security.secureclock-service.xml",
- ],
vendor: true,
cflags: [
"-Wall",
@@ -51,6 +64,11 @@
required: [
"android.hardware.hardware_keystore.xml",
],
+ vintf_fragment_modules: [
+ "android.hardware.security.keymint-service.xml",
+ "android.hardware.security.sharedsecret-service.xml",
+ "android.hardware.security.secureclock-service.xml",
+ ],
}
// The following target has an insecure implementation of KeyMint where the
@@ -65,11 +83,6 @@
relative_install_path: "hw",
vendor: true,
init_rc: ["android.hardware.security.keymint-service.nonsecure.rc"],
- vintf_fragments: [
- "android.hardware.security.keymint-service.xml",
- "android.hardware.security.sharedsecret-service.xml",
- "android.hardware.security.secureclock-service.xml",
- ],
defaults: [
"keymint_use_latest_hal_aidl_rust",
],
@@ -87,6 +100,11 @@
required: [
"android.hardware.hardware_keystore.xml",
],
+ vintf_fragment_modules: [
+ "android.hardware.security.keymint-service.xml",
+ "android.hardware.security.sharedsecret-service.xml",
+ "android.hardware.security.secureclock-service.xml",
+ ],
}
prebuilt_etc {
diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp
index ed97d9c..4f0d04b 100644
--- a/tv/tuner/aidl/default/Android.bp
+++ b/tv/tuner/aidl/default/Android.bp
@@ -10,7 +10,6 @@
cc_defaults {
name: "tuner_hal_example_defaults",
relative_install_path: "hw",
- vintf_fragments: ["tuner-default.xml"],
vendor: true,
compile_multilib: "first",
srcs: [
@@ -43,6 +42,15 @@
header_libs: [
"media_plugin_headers",
],
+ vintf_fragment_modules: [
+ "tuner-default.xml",
+ ],
+}
+
+vintf_fragment {
+ name: "tuner-default.xml",
+ src: "tuner-default.xml",
+ vendor: true,
}
cc_binary {
diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp
index 2047807..3fcb77f 100644
--- a/wifi/aidl/default/Android.bp
+++ b/wifi/aidl/default/Android.bp
@@ -112,9 +112,14 @@
export_include_dirs: ["."],
}
+vintf_fragment {
+ name: "android.hardware.wifi-service.xml",
+ src: "android.hardware.wifi-service.xml",
+ vendor: true,
+}
+
cc_binary {
name: "android.hardware.wifi-service",
- vintf_fragments: ["android.hardware.wifi-service.xml"],
relative_install_path: "hw",
proprietary: true,
cppflags: [
@@ -137,11 +142,11 @@
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service.rc"],
+ vintf_fragment_modules: ["android.hardware.wifi-service.xml"],
}
cc_binary {
name: "android.hardware.wifi-service-lazy",
- vintf_fragments: ["android.hardware.wifi-service.xml"],
overrides: ["android.hardware.wifi-service"],
cflags: ["-DLAZY_SERVICE"],
relative_install_path: "hw",
@@ -166,6 +171,7 @@
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service-lazy.rc"],
+ vintf_fragment_modules: ["android.hardware.wifi-service.xml"],
}
cc_test {