diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-01 23:21:59 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-01 23:21:59 +0000 |
commit | 4c4bc185396b3041508a488e8166031d38d979f9 (patch) | |
tree | afb25388b9fc2b89f0812a1304877d42de66d4a7 | |
parent | dc4d87bd7bda0dd7e48de0ccaa262194f7064626 (diff) | |
parent | 209890c07d40651e5c44eb8677c6c4e555b35488 (diff) | |
download | core-android14-d1-s1-release.tar.gz |
Snap for 10594898 from 209890c07d40651e5c44eb8677c6c4e555b35488 to udc-d1-releaseandroid-14.0.0_r9android-14.0.0_r8android-14.0.0_r7android-14.0.0_r6android-14.0.0_r5android-14.0.0_r4android-14.0.0_r3android-14.0.0_r10android14-d1-s7-releaseandroid14-d1-s6-releaseandroid14-d1-s5-releaseandroid14-d1-s4-releaseandroid14-d1-s3-releaseandroid14-d1-s2-releaseandroid14-d1-s1-release
Change-Id: Icb466082d3df0b177b56cca9220eb22bf887675e
-rw-r--r-- | trusty/storage/proxy/Android.bp | 1 | ||||
-rw-r--r-- | trusty/storage/proxy/proxy.c | 13 | ||||
-rw-r--r-- | trusty/storage/proxy/rpmb.c | 8 |
3 files changed, 22 insertions, 0 deletions
diff --git a/trusty/storage/proxy/Android.bp b/trusty/storage/proxy/Android.bp index 2e97ee0fe..e362b8b97 100644 --- a/trusty/storage/proxy/Android.bp +++ b/trusty/storage/proxy/Android.bp @@ -33,6 +33,7 @@ cc_binary { shared_libs: [ "libbase", + "libbinder_ndk", "libcutils", "liblog", "libhardware_legacy", diff --git a/trusty/storage/proxy/proxy.c b/trusty/storage/proxy/proxy.c index c89c5b6fd..67e935e39 100644 --- a/trusty/storage/proxy/proxy.c +++ b/trusty/storage/proxy/proxy.c @@ -24,6 +24,7 @@ #include <sys/stat.h> #include <unistd.h> +#include <android/binder_process.h> #include <cutils/android_filesystem_config.h> #include "checkpoint_handling.h" @@ -238,6 +239,18 @@ int main(int argc, char* argv[]) { /* parse arguments */ parse_args(argc, argv); + /* + * Start binder threadpool. At least one extra binder thread is needed to + * connect to the wakelock service without relying on polling. If we poll on + * the main thread we end up pausing for at least 1s even if the service + * starts faster. We set the max thread count to 0 because startThreadPool + * "Starts one thread, PLUS those requested in setThreadPoolMaxThreadCount, + * PLUS those manually requested in joinThreadPool." We only need a single + * binder thread to receive notifications on. + */ + ABinderProcess_setThreadPoolMaxThreadCount(0); + ABinderProcess_startThreadPool(); + /* initialize secure storage directory */ rc = storage_init(ss_data_root); if (rc < 0) return EXIT_FAILURE; diff --git a/trusty/storage/proxy/rpmb.c b/trusty/storage/proxy/rpmb.c index 22a85a72b..1f5d10796 100644 --- a/trusty/storage/proxy/rpmb.c +++ b/trusty/storage/proxy/rpmb.c @@ -399,6 +399,14 @@ static int send_ufs_rpmb_req(int sg_fd, const struct storage_rpmb_send_req* req, bool is_request_write = req->reliable_write_size > 0; + /* + * Internally this call connects to the suspend service, which will cause + * this service to start if not already running. If the binder thread pool + * has not been started at this point, this call will block and poll for the + * service every 1s. We need to make sure the thread pool is started to + * receive an async notification that the service is started to avoid + * blocking (see main). + */ wl_rc = acquire_wake_lock(PARTIAL_WAKE_LOCK, UFS_WAKE_LOCK_NAME); if (wl_rc < 0) { ALOGE("%s: failed to acquire wakelock: %d, %s\n", __func__, wl_rc, strerror(errno)); |