Use new binder exception constructors moved from binder_common.
Bug: 234019127
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp
Change-Id: I938c9d0ebae90c933c9a7ee8c27e9ecb0cc3e5fa
diff --git a/compos/src/compsvc.rs b/compos/src/compsvc.rs
index 5d58221..088d41a 100644
--- a/compos/src/compsvc.rs
+++ b/compos/src/compsvc.rs
@@ -19,7 +19,6 @@
//! actual compiler.
use anyhow::{bail, Context, Result};
-use binder_common::new_binder_exception;
use log::{error, info};
use rustutils::system_properties;
use std::default::Default;
@@ -35,7 +34,7 @@
BnCompOsService, CompilationMode::CompilationMode, ICompOsService,
};
use compos_aidl_interface::binder::{
- BinderFeatures, ExceptionCode, Interface, Result as BinderResult, Strong,
+ BinderFeatures, ExceptionCode, Interface, Result as BinderResult, Status, Strong,
};
use compos_common::binder::to_binder_result;
use compos_common::odrefresh::{is_system_property_interesting, ODREFRESH_PATH};
@@ -67,28 +66,28 @@
fn initializeSystemProperties(&self, names: &[String], values: &[String]) -> BinderResult<()> {
let mut initialized = self.initialized.write().unwrap();
if initialized.is_some() {
- return Err(new_binder_exception(
+ return Err(Status::new_exception_str(
ExceptionCode::ILLEGAL_STATE,
- format!("Already initialized: {:?}", initialized),
+ Some(format!("Already initialized: {:?}", initialized)),
));
}
*initialized = Some(false);
if names.len() != values.len() {
- return Err(new_binder_exception(
+ return Err(Status::new_exception_str(
ExceptionCode::ILLEGAL_ARGUMENT,
- format!(
+ Some(format!(
"Received inconsistent number of keys ({}) and values ({})",
names.len(),
values.len()
- ),
+ )),
));
}
for (name, value) in zip(names, values) {
if !is_system_property_interesting(name) {
- return Err(new_binder_exception(
+ return Err(Status::new_exception_str(
ExceptionCode::ILLEGAL_ARGUMENT,
- format!("Received invalid system property {}", &name),
+ Some(format!("Received invalid system property {}", &name)),
));
}
let result = system_properties::write(name, value);
@@ -113,9 +112,9 @@
) -> BinderResult<i8> {
let initialized = *self.initialized.read().unwrap();
if !initialized.unwrap_or(false) {
- return Err(new_binder_exception(
+ return Err(Status::new_exception_str(
ExceptionCode::ILLEGAL_STATE,
- "Service has not been initialized",
+ Some("Service has not been initialized"),
));
}