[incfs] Make native library extraction async
IncrementalService can create the library files beforehand, but
delay filling in their data. As it takes quite a while in
general (over a second in cases when the phone is busy), it's
better to run the unzipping and filling in a separate thread
and only make sure it finishes before the whole installation
process is complete.
This speeds up the megacity.apk installation by ~250-300ms,
1000-1100ms -> 750-800ms
Bug: 153513507
Test: adb install megacity.apk
Change-Id: Ia44f7e45b9e0abaebdfb6fe5352f9dcf29ab4ece
diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp
index aabc58c..ebebf60 100644
--- a/services/incremental/BinderIncrementalService.cpp
+++ b/services/incremental/BinderIncrementalService.cpp
@@ -116,11 +116,14 @@
return ok();
}
-binder::Status BinderIncrementalService::createStorage(const std::string& path,
- const DataLoaderParamsParcel& params,
- const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& listener,
- int32_t createMode, int32_t* _aidl_return) {
- *_aidl_return = mImpl.createStorage(path, const_cast<DataLoaderParamsParcel&&>(params), listener, android::incremental::IncrementalService::CreateOptions(createMode));
+binder::Status BinderIncrementalService::createStorage(
+ const std::string& path, const DataLoaderParamsParcel& params,
+ const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& listener,
+ int32_t createMode, int32_t* _aidl_return) {
+ *_aidl_return =
+ mImpl.createStorage(path, const_cast<DataLoaderParamsParcel&&>(params), listener,
+ android::incremental::IncrementalService::CreateOptions(
+ createMode));
return ok();
}
@@ -181,7 +184,8 @@
if (!params.signature) {
nfp.signature = {};
} else {
- nfp.signature = {(const char*)params.signature->data(), (IncFsSize)params.signature->size()};
+ nfp.signature = {(const char*)params.signature->data(),
+ (IncFsSize)params.signature->size()};
}
return {0, id, nfp};
}
@@ -278,6 +282,12 @@
return ok();
}
+binder::Status BinderIncrementalService::waitForNativeBinariesExtraction(int storageId,
+ bool* _aidl_return) {
+ *_aidl_return = mImpl.waitForNativeBinariesExtraction(storageId);
+ return ok();
+}
+
} // namespace android::os::incremental
jlong Incremental_IncrementalService_Start() {