Merge "media.c2 aidl: change minSdk to 30" into main
diff --git a/drm/1.0/default/DrmPlugin.cpp b/drm/1.0/default/DrmPlugin.cpp
index dfa5d22..0a0a350 100644
--- a/drm/1.0/default/DrmPlugin.cpp
+++ b/drm/1.0/default/DrmPlugin.cpp
@@ -133,8 +133,8 @@
Vector<KeyValue> infoMapVec;
for (size_t i = 0; i < legacyInfoMap.size(); i++) {
KeyValue keyValuePair;
- keyValuePair.key = String8(legacyInfoMap.keyAt(i));
- keyValuePair.value = String8(legacyInfoMap.valueAt(i));
+ keyValuePair.key = legacyInfoMap.keyAt(i);
+ keyValuePair.value = legacyInfoMap.valueAt(i);
infoMapVec.push_back(keyValuePair);
}
_hidl_cb(toStatus(status), toHidlVec(infoMapVec));
diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h
index 5130b16..a25dd41 100644
--- a/drm/1.0/default/include/PluginLoader.h
+++ b/drm/1.0/default/include/PluginLoader.h
@@ -50,7 +50,7 @@
String8 file(pEntry->d_name);
if (base::EndsWith(file.c_str(), ".so")) {
String8 path = pluginDir + "/" + pEntry->d_name;
- T *plugin = loadOne(path, entry);
+ T* plugin = loadOne(path.c_str(), entry);
if (plugin) {
factories.push(plugin);
}
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index d6c37c5..e0c6fa5 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -111,13 +111,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts",":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts",":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/drm/1.1/vts/functional/Android.bp b/drm/1.1/vts/functional/Android.bp
index 760b67e..b539fa2 100644
--- a/drm/1.1/vts/functional/Android.bp
+++ b/drm/1.1/vts/functional/Android.bp
@@ -82,13 +82,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts",":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts",":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/drm/1.2/vts/functional/Android.bp b/drm/1.2/vts/functional/Android.bp
index 9a45051..9ceb1a3 100644
--- a/drm/1.2/vts/functional/Android.bp
+++ b/drm/1.2/vts/functional/Android.bp
@@ -100,13 +100,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts",":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts",":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/drm/1.3/vts/functional/Android.bp b/drm/1.3/vts/functional/Android.bp
index cd1cc0f..3db23e3 100644
--- a/drm/1.3/vts/functional/Android.bp
+++ b/drm/1.3/vts/functional/Android.bp
@@ -85,13 +85,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts",":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts",":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/drm/1.4/vts/functional/Android.bp b/drm/1.4/vts/functional/Android.bp
index e18d088..89edab7 100644
--- a/drm/1.4/vts/functional/Android.bp
+++ b/drm/1.4/vts/functional/Android.bp
@@ -88,13 +88,13 @@
data: [":libvtswidevine-arm-prebuilts"],
},
arm64: {
- data: [":libvtswidevine-arm64-prebuilts"],
+ data: [":libvtswidevine-arm64-prebuilts",":libvtswidevine-arm-prebuilts"],
},
x86: {
data: [":libvtswidevine-x86-prebuilts"],
},
x86_64: {
- data: [":libvtswidevine-x86_64-prebuilts"],
+ data: [":libvtswidevine-x86_64-prebuilts",":libvtswidevine-x86-prebuilts"],
},
},
test_suites: [
diff --git a/ir/aidl/default/Android.bp b/ir/aidl/default/Android.bp
index a8096c2..4006554 100644
--- a/ir/aidl/default/Android.bp
+++ b/ir/aidl/default/Android.bp
@@ -36,8 +36,58 @@
"liblog",
"libutils",
"android.hardware.ir-V1-ndk",
- "libhardware"
+ "libhardware",
],
srcs: ["main.cpp"],
}
+
+prebuilt_etc {
+ name: "android.hardware.ir-service.example.rc",
+ src: ":gen-android.hardware.ir-service.example.rc",
+ installable: false,
+}
+
+genrule {
+ name: "gen-android.hardware.ir-service.example.rc",
+ srcs: ["android.hardware.ir-service.example.rc"],
+ out: ["android.hardware.ir-service.example.apex.rc"],
+ cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.ir/bin/@' $(in) > $(out)",
+}
+
+prebuilt_etc {
+ name: "android.hardware.ir-service.example.xml",
+ src: "android.hardware.ir-service.example.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
+
+filegroup {
+ name: "com.android.hardware.ir_file_contexts",
+ srcs: ["apex_file_contexts"],
+}
+
+filegroup {
+ name: "com.android.hardware.ir_apex_manifest.json",
+ srcs: ["apex_manifest.json"],
+}
+
+apex_defaults {
+ name: "com.android.hardware.ir",
+ // Reference to the filegroup instead of direct path since
+ // paths in defaults don't work in a different directory.
+ file_contexts: ":com.android.hardware.ir_file_contexts",
+ manifest: ":com.android.hardware.ir_apex_manifest.json",
+
+ updatable: false,
+ vendor: true,
+
+ binaries: [
+ "android.hardware.ir-service.example",
+ ],
+ prebuilts: [
+ "android.hardware.ir-service.example.rc",
+ "android.hardware.ir-service.example.xml",
+ "android.hardware.consumerir.prebuilt.xml", // feature
+ ],
+}
diff --git a/ir/aidl/default/android.hardware.ir-service.example.rc b/ir/aidl/default/android.hardware.ir-service.example.rc
index d27f282..1a721da 100644
--- a/ir/aidl/default/android.hardware.ir-service.example.rc
+++ b/ir/aidl/default/android.hardware.ir-service.example.rc
@@ -1,4 +1,4 @@
-service vendor.ir-default /vendor/bin/hw/android.hardware.ir-service.example
+service vendor.ir-default /apex/com.android.hardware.ir/bin/hw/android.hardware.ir-service.example
class hal
user system
group system
diff --git a/ir/aidl/default/apex_file_contexts b/ir/aidl/default/apex_file_contexts
new file mode 100644
index 0000000..3bbf131
--- /dev/null
+++ b/ir/aidl/default/apex_file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.ir-service\.example u:object_r:hal_ir_default_exec:s0
diff --git a/ir/aidl/default/apex_manifest.json b/ir/aidl/default/apex_manifest.json
new file mode 100644
index 0000000..d384375
--- /dev/null
+++ b/ir/aidl/default/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.ir",
+ "version": 1
+}
\ No newline at end of file
diff --git a/uwb/aidl/default/Android.bp b/uwb/aidl/default/Android.bp
index 2b7ef57..916646c 100644
--- a/uwb/aidl/default/Android.bp
+++ b/uwb/aidl/default/Android.bp
@@ -15,6 +15,7 @@
prefer_rlib: true,
rustlibs: [
"android.hardware.uwb-V1-rust",
+ "liblibc",
"liblogger",
"liblog_rust",
"libbinder_rs",
diff --git a/uwb/aidl/default/src/uwb_chip.rs b/uwb/aidl/default/src/uwb_chip.rs
index b63aabe..2b8e481 100644
--- a/uwb/aidl/default/src/uwb_chip.rs
+++ b/uwb/aidl/default/src/uwb_chip.rs
@@ -6,7 +6,6 @@
use async_trait::async_trait;
use binder::{DeathRecipient, IBinder, Result, Strong};
-use log::info;
use std::sync::Arc;
use tokio::io::unix::AsyncFd;
use tokio::select;
@@ -16,12 +15,13 @@
use std::fs::{File, OpenOptions};
use std::io::{self, Read, Write};
use std::os::fd::AsRawFd;
+use std::os::unix::fs::OpenOptionsExt;
enum State {
Closed,
Opened {
callbacks: Strong<dyn IUwbClientCallback>,
- _handle: tokio::task::JoinHandle<()>,
+ handle: tokio::task::JoinHandle<()>,
serial: File,
death_recipient: DeathRecipient,
token: CancellationToken,
@@ -46,12 +46,12 @@
impl State {
/// Terminate the reader task.
- #[allow(dead_code)]
- fn close(&mut self) -> Result<()> {
- if let State::Opened { ref mut token, ref callbacks, ref mut death_recipient, .. } = *self {
+ async fn close(&mut self) -> Result<()> {
+ if let State::Opened { ref mut token, ref callbacks, ref mut death_recipient, ref mut handle, .. } = *self {
log::info!("waiting for task cancellation");
callbacks.as_binder().unlink_to_death(death_recipient)?;
token.cancel();
+ handle.await.unwrap();
log::info!("task successfully cancelled");
callbacks.onHalEvent(UwbEvent::CLOSE_CPLT, UwbStatus::OK)?;
*self = State::Closed;
@@ -69,11 +69,6 @@
cfmakeraw(&mut attrs);
tcsetattr(fd, SetArg::TCSANOW, &attrs)?;
- // Configure the file descriptor as non blocking.
- use nix::fcntl::*;
- let flags = OFlag::from_bits(fcntl(fd, FcntlArg::F_GETFL)?).unwrap();
- fcntl(fd, FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?;
-
Ok(file)
}
@@ -114,6 +109,7 @@
.read(true)
.write(true)
.create(false)
+ .custom_flags(libc::O_NONBLOCK)
.open(&self.path)
.and_then(makeraw)
.map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?;
@@ -122,7 +118,10 @@
let mut death_recipient = DeathRecipient::new(move || {
let mut state = state_death_recipient.blocking_lock();
log::info!("Uwb service has died");
- state.close().unwrap();
+ if let State::Opened { ref mut token, .. } = *state {
+ token.cancel();
+ *state = State::Closed;
+ }
});
callbacks.as_binder().link_to_death(&mut death_recipient)?;
@@ -137,7 +136,7 @@
.map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?;
let join_handle = tokio::task::spawn(async move {
- info!("UCI reader task started");
+ log::info!("UCI reader task started");
let mut reader = AsyncFd::new(reader).unwrap();
loop {
@@ -159,7 +158,7 @@
// the OS will only notify Tokio when the file descriptor
// transitions from not-ready to ready. For this to work
// you should first try to read or write and only poll for
- // readiness if that fails with an error of
+ // readiness if that fails with an error of
// std::io::ErrorKind::WouldBlock.
match reader.get_mut().read(&mut buffer) {
Ok(0) => {
@@ -173,7 +172,7 @@
let mut guard = select! {
_ = cloned_token.cancelled() => {
- info!("task is cancelled!");
+ log::info!("task is cancelled!");
return;
},
result = reader.readable() => result.unwrap()
@@ -199,7 +198,7 @@
*state = State::Opened {
callbacks: callbacks.clone(),
- _handle: join_handle,
+ handle: join_handle,
serial,
death_recipient,
token,
@@ -214,7 +213,7 @@
let mut state = self.state.lock().await;
if matches!(*state, State::Opened { .. }) {
- state.close()
+ state.close().await
} else {
Err(binder::ExceptionCode::ILLEGAL_STATE.into())
}