Moved set_requesting_sid to public BinderFeatures struct.
Bug: 178852354
Test: mm
Change-Id: I6d11eb57c01cd8379c529416145913a1abd9c611
diff --git a/authfs/fd_server/Android.bp b/authfs/fd_server/Android.bp
index f82b72f..7ac5eb4 100644
--- a/authfs/fd_server/Android.bp
+++ b/authfs/fd_server/Android.bp
@@ -9,7 +9,6 @@
"authfs_aidl_interface-rust",
"libandroid_logger",
"libanyhow",
- "libbinder_rs",
"libclap",
"liblibc",
"liblog_rust",
diff --git a/authfs/fd_server/src/main.rs b/authfs/fd_server/src/main.rs
index 99b6e9e..4e5c5d3 100644
--- a/authfs/fd_server/src/main.rs
+++ b/authfs/fd_server/src/main.rs
@@ -37,15 +37,14 @@
use std::os::unix::io::{AsRawFd, FromRawFd};
use anyhow::{bail, Context, Result};
-use binder::IBinderInternal; // TODO(178852354): remove once set_requesting_sid is exposed in the API.
use log::{debug, error};
use authfs_aidl_interface::aidl::com::android::virt::fs::IVirtFdService::{
BnVirtFdService, IVirtFdService, ERROR_IO, ERROR_UNKNOWN_FD, MAX_REQUESTING_DATA,
};
use authfs_aidl_interface::binder::{
- add_service, ExceptionCode, Interface, ProcessState, Result as BinderResult, Status,
- StatusCode, Strong,
+ add_service, BinderFeatures, ExceptionCode, Interface, ProcessState, Result as BinderResult,
+ Status, StatusCode, Strong,
};
const SERVICE_NAME: &str = "authfs_fd_server";
@@ -100,9 +99,7 @@
impl FdService {
pub fn new_binder(fd_pool: BTreeMap<i32, FdConfig>) -> Strong<dyn IVirtFdService> {
- let result = BnVirtFdService::new_binder(FdService { fd_pool });
- result.as_binder().set_requesting_sid(false);
- result
+ BnVirtFdService::new_binder(FdService { fd_pool }, BinderFeatures::default())
}
fn get_file_config(&self, id: i32) -> BinderResult<&FdConfig> {
diff --git a/virtmanager/src/aidl.rs b/virtmanager/src/aidl.rs
index 5a4eedc..cd3bb6d 100644
--- a/virtmanager/src/aidl.rs
+++ b/virtmanager/src/aidl.rs
@@ -24,7 +24,7 @@
use android_system_virtmanager::aidl::android::system::virtmanager::IVirtualMachineCallback::IVirtualMachineCallback;
use android_system_virtmanager::aidl::android::system::virtmanager::VirtualMachineDebugInfo::VirtualMachineDebugInfo;
use android_system_virtmanager::binder::{
- self, Interface, ParcelFileDescriptor, StatusCode, Strong, ThreadState,
+ self, BinderFeatures, Interface, ParcelFileDescriptor, StatusCode, Strong, ThreadState,
};
use log::{debug, error};
use std::ffi::CStr;
@@ -139,7 +139,7 @@
impl VirtualMachine {
fn create(instance: Arc<VmInstance>) -> Strong<dyn IVirtualMachine> {
let binder = VirtualMachine { instance };
- BnVirtualMachine::new_binder(binder)
+ BnVirtualMachine::new_binder(binder, BinderFeatures::default())
}
}
diff --git a/virtmanager/src/main.rs b/virtmanager/src/main.rs
index 486efeb..454fc7e 100644
--- a/virtmanager/src/main.rs
+++ b/virtmanager/src/main.rs
@@ -20,7 +20,7 @@
use crate::aidl::{VirtManager, BINDER_SERVICE_IDENTIFIER};
use android_system_virtmanager::aidl::android::system::virtmanager::IVirtManager::BnVirtManager;
-use android_system_virtmanager::binder::{add_service, ProcessState};
+use android_system_virtmanager::binder::{add_service, BinderFeatures, ProcessState};
use log::{info, Level};
/// The first CID to assign to a guest VM managed by the Virt Manager. CIDs lower than this are
@@ -38,7 +38,7 @@
);
let virt_manager = VirtManager::default();
- let virt_manager = BnVirtManager::new_binder(virt_manager);
+ let virt_manager = BnVirtManager::new_binder(virt_manager, BinderFeatures::default());
add_service(BINDER_SERVICE_IDENTIFIER, virt_manager.as_binder()).unwrap();
info!("Registered Binder service, joining threadpool.");
ProcessState::join_thread_pool();
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 061cfd7..8045817 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -22,7 +22,8 @@
BnVirtualMachineCallback, IVirtualMachineCallback,
};
use android_system_virtmanager::binder::{
- get_interface, DeathRecipient, IBinder, ParcelFileDescriptor, ProcessState, Strong,
+ get_interface, BinderFeatures, DeathRecipient, IBinder, ParcelFileDescriptor, ProcessState,
+ Strong,
};
use android_system_virtmanager::binder::{Interface, Result as BinderResult};
use anyhow::{Context, Error};
@@ -105,8 +106,10 @@
/// Wait until the given VM or the VirtManager itself dies.
fn wait_for_vm(vm: Strong<dyn IVirtualMachine>) -> Result<(), Error> {
let dead = AtomicFlag::default();
- let callback =
- BnVirtualMachineCallback::new_binder(VirtualMachineCallback { dead: dead.clone() });
+ let callback = BnVirtualMachineCallback::new_binder(
+ VirtualMachineCallback { dead: dead.clone() },
+ BinderFeatures::default(),
+ );
vm.registerCallback(&callback)?;
let death_recipient = wait_for_death(&mut vm.as_binder(), dead.clone())?;
dead.wait();