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/common/Android.bp b/compos/common/Android.bp
index 3c3397d..0773652 100644
--- a/compos/common/Android.bp
+++ b/compos/common/Android.bp
@@ -11,7 +11,6 @@
         "android.system.virtualizationservice-rust",
         "compos_aidl_interface-rust",
         "libanyhow",
-        "libbinder_common",
         "liblazy_static",
         "liblog_rust",
         "libnested_virt",
diff --git a/compos/common/binder.rs b/compos/common/binder.rs
index 45139f3..59726c0 100644
--- a/compos/common/binder.rs
+++ b/compos/common/binder.rs
@@ -16,8 +16,7 @@
 
 //! Helper for converting Error types to what Binder expects
 
-use android_system_virtualizationservice::binder::{ExceptionCode, Result as BinderResult};
-use binder_common::new_binder_exception;
+use android_system_virtualizationservice::binder::{Result as BinderResult, Status};
 use log::warn;
 use std::fmt::Debug;
 
@@ -28,6 +27,6 @@
     result.map_err(|e| {
         let message = format!("{:?}", e);
         warn!("Returning binder error: {}", &message);
-        new_binder_exception(ExceptionCode::SERVICE_SPECIFIC, message)
+        Status::new_service_specific_error_str(-1, Some(message))
     })
 }
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"),
             ));
         }