Merge "keystore2 compat: stop crashing without hwservicemanager" into main
diff --git a/keystore2/src/error.rs b/keystore2/src/error.rs
index 3ca3942..d6ae0ce 100644
--- a/keystore2/src/error.rs
+++ b/keystore2/src/error.rs
@@ -55,10 +55,6 @@
     /// Wraps a Binder status code.
     #[error("Binder transaction error {0:?}")]
     BinderTransaction(StatusCode),
-    /// Wraps a Remote Provisioning ErrorCode as defined by the IRemotelyProvisionedComponent
-    /// AIDL interface spec.
-    #[error("Error::Rp({0:?})")]
-    Rp(ErrorCode),
 }
 
 impl Error {
@@ -103,16 +99,6 @@
     })
 }
 
-/// Helper function to map the binder status we get from calls into a RemotelyProvisionedComponent
-/// to a Keystore Error. We don't create an anyhow error here to make
-/// it easier to evaluate service specific errors.
-pub fn map_rem_prov_error<T>(r: BinderResult<T>) -> Result<T, Error> {
-    r.map_err(|s| match s.exception_code() {
-        ExceptionCode::SERVICE_SPECIFIC => Error::Rp(ErrorCode(s.service_specific_error())),
-        e_code => Error::Binder(e_code, 0),
-    })
-}
-
 /// This function is similar to map_km_error only that we don't expect
 /// any KeyMint error codes, we simply preserve the exception code and optional
 /// service specific exception.
@@ -230,7 +216,6 @@
     match root_cause.downcast_ref::<Error>() {
         Some(Error::Rc(rcode)) => rcode.0,
         Some(Error::Km(ec)) => ec.0,
-        Some(Error::Rp(_)) => ResponseCode::SYSTEM_ERROR.0,
         // If an Error::Binder reaches this stage we report a system error.
         // The exception code and possible service specific error will be
         // printed in the error log above.
diff --git a/keystore2/test_utils/Android.bp b/keystore2/test_utils/Android.bp
index eb04209..b2360db 100644
--- a/keystore2/test_utils/Android.bp
+++ b/keystore2/test_utils/Android.bp
@@ -40,28 +40,15 @@
         "libthiserror",
     ],
     static_libs: [
-        "libgtest",
-        "libkeymint_vts_test_utils",
         "libkeystore2_ffi_test_utils",
     ],
     shared_libs: [
-        // libkeymint_vts_test_utils needs to be static for atest,
-        // and that pulls in keymint shared lib dependency
-        "android.hardware.security.keymint-V3-ndk",
-        "libbase",
-        "libbinder",
-        "libbinder_ndk",
-        "libcppbor_external",
-        "libcppcose_rkp",
         "libcrypto",
-        "libcutils",
         "libkeymaster_messages",
         "libkeymaster_portable",
-        "libkeymint_remote_prov_support",
         "libkeymint_support",
+        "libkeymint_vts_test_utils",
         "libkeystore-engine",
-        "libutils",
-        "packagemanager_aidl-cpp",
     ],
 }
 
@@ -94,14 +81,12 @@
         "libkeystore2_ffi_test_utils_bridge_header",
     ],
     generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"],
-    static_libs: [
-        "libkeymint_vts_test_utils",
-    ],
     shared_libs: [
         "libcppbor_external",
         "libkeymaster_messages",
         "libkeymaster_portable",
         "libkeystore-engine",
+        "libkeymint_vts_test_utils",
     ],
 }
 
diff --git a/provisioner/Android.bp b/provisioner/Android.bp
index 605abb4..0bf687d 100644
--- a/provisioner/Android.bp
+++ b/provisioner/Android.bp
@@ -30,7 +30,6 @@
     ],
     shared_libs: [
         "libbinder_ndk",
-        "libcrypto",
         "liblog",
     ],
     static_libs: [
@@ -40,6 +39,7 @@
         "libbase",
         "libcppbor_external",
         "libcppcose_rkp",
+        "libcrypto_static",
         "libjsoncpp",
         "libkeymint_remote_prov_support",
         "libmediadrmrkp",