Inherited installation support for Incremental.

Bug: 162345970
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I360f44bc52e05553eacc448faa26f603d9eaae59
Merged-In: I360f44bc52e05553eacc448faa26f603d9eaae59
diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp
index d224428..b2efc71 100644
--- a/services/incremental/BinderIncrementalService.cpp
+++ b/services/incremental/BinderIncrementalService.cpp
@@ -118,18 +118,10 @@
 
 binder::Status BinderIncrementalService::createStorage(
         const ::std::string& path, const ::android::content::pm::DataLoaderParamsParcel& params,
-        int32_t createMode,
-        const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& statusListener,
-        const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams,
-        const ::android::sp<::android::os::incremental::IStorageHealthListener>& healthListener,
-        const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts,
-        int32_t* _aidl_return) {
-    *_aidl_return =
-            mImpl.createStorage(path, const_cast<content::pm::DataLoaderParamsParcel&&>(params),
-                                android::incremental::IncrementalService::CreateOptions(createMode),
-                                statusListener,
-                                const_cast<StorageHealthCheckParams&&>(healthCheckParams),
-                                healthListener, perUidReadTimeouts);
+        int32_t createMode, int32_t* _aidl_return) {
+    *_aidl_return = mImpl.createStorage(path, params,
+                                        android::incremental::IncrementalService::CreateOptions(
+                                                createMode));
     return ok();
 }
 
@@ -144,6 +136,21 @@
     return ok();
 }
 
+binder::Status BinderIncrementalService::startLoading(
+        int32_t storageId, const ::android::content::pm::DataLoaderParamsParcel& params,
+        const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& statusListener,
+        const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams,
+        const ::android::sp<IStorageHealthListener>& healthListener,
+        const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts,
+        bool* _aidl_return) {
+    *_aidl_return =
+            mImpl.startLoading(storageId, const_cast<content::pm::DataLoaderParamsParcel&&>(params),
+                               statusListener,
+                               const_cast<StorageHealthCheckParams&&>(healthCheckParams),
+                               healthListener, perUidReadTimeouts);
+    return ok();
+}
+
 binder::Status BinderIncrementalService::makeBindMount(int32_t storageId,
                                                        const std::string& sourcePath,
                                                        const std::string& targetFullPath,
@@ -253,9 +260,16 @@
     return ok();
 }
 
+binder::Status BinderIncrementalService::isFullyLoaded(int32_t storageId, int32_t* _aidl_return) {
+    *_aidl_return = mImpl.getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/true)
+                            .blocksRemainingOrError();
+    return ok();
+}
+
 binder::Status BinderIncrementalService::getLoadingProgress(int32_t storageId,
                                                             float* _aidl_return) {
-    *_aidl_return = mImpl.getLoadingProgress(storageId).getProgress();
+    *_aidl_return =
+            mImpl.getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/false).getProgress();
     return ok();
 }
 
@@ -291,11 +305,6 @@
     return ok();
 }
 
-binder::Status BinderIncrementalService::startLoading(int32_t storageId, bool* _aidl_return) {
-    *_aidl_return = mImpl.startLoading(storageId);
-    return ok();
-}
-
 binder::Status BinderIncrementalService::configureNativeBinaries(
         int32_t storageId, const std::string& apkFullPath, const std::string& libDirRelativePath,
         const std::string& abi, bool extractNativeLibs, bool* _aidl_return) {