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/IncrementalService.h b/services/incremental/IncrementalService.h
index 3066121..5d53bac 100644
--- a/services/incremental/IncrementalService.h
+++ b/services/incremental/IncrementalService.h
@@ -113,6 +113,10 @@
         bool started() const { return totalBlocks > 0; }
         bool fullyLoaded() const { return !isError() && (totalBlocks == filledBlocks); }
 
+        int blocksRemainingOrError() const {
+            return totalBlocks <= 0 ? totalBlocks : totalBlocks - filledBlocks;
+        }
+
         float getProgress() const {
             return totalBlocks < 0
                     ? totalBlocks
@@ -130,15 +134,18 @@
     void onSystemReady();
 
     StorageId createStorage(std::string_view mountPoint,
-                            content::pm::DataLoaderParamsParcel&& dataLoaderParams,
-                            CreateOptions options, const DataLoaderStatusListener& statusListener,
-                            StorageHealthCheckParams&& healthCheckParams,
-                            const StorageHealthListener& healthListener,
-                            const std::vector<PerUidReadTimeouts>& perUidReadTimeouts);
+                            const content::pm::DataLoaderParamsParcel& dataLoaderParams,
+                            CreateOptions options);
     StorageId createLinkedStorage(std::string_view mountPoint, StorageId linkedStorage,
                                   CreateOptions options = CreateOptions::Default);
     StorageId openStorage(std::string_view path);
 
+    bool startLoading(StorageId storage, content::pm::DataLoaderParamsParcel&& dataLoaderParams,
+                      const DataLoaderStatusListener& statusListener,
+                      StorageHealthCheckParams&& healthCheckParams,
+                      const StorageHealthListener& healthListener,
+                      const std::vector<PerUidReadTimeouts>& perUidReadTimeouts);
+
     int bind(StorageId storage, std::string_view source, std::string_view target, BindKind kind);
     int unbind(StorageId storage, std::string_view target);
     void deleteStorage(StorageId storage);
@@ -156,7 +163,9 @@
     int unlink(StorageId storage, std::string_view path);
 
     int isFileFullyLoaded(StorageId storage, std::string_view filePath) const;
-    LoadingProgress getLoadingProgress(StorageId storage) const;
+
+    LoadingProgress getLoadingProgress(StorageId storage, bool stopOnFirstIncomplete) const;
+
     bool registerLoadingProgressListener(StorageId storage,
                                          const StorageLoadingProgressListener& progressListener);
     bool unregisterLoadingProgressListener(StorageId storage);
@@ -167,8 +176,6 @@
     RawMetadata getMetadata(StorageId storage, std::string_view path) const;
     RawMetadata getMetadata(StorageId storage, FileId node) const;
 
-    bool startLoading(StorageId storage) const;
-
     bool configureNativeBinaries(StorageId storage, std::string_view apkFullPath,
                                  std::string_view libDirRelativePath, std::string_view abi,
                                  bool extractNativeLibs);
@@ -388,7 +395,8 @@
     binder::Status applyStorageParams(IncFsMount& ifs, bool enableReadLogs);
 
     int isFileFullyLoadedFromPath(const IncFsMount& ifs, std::string_view filePath) const;
-    LoadingProgress getLoadingProgressFromPath(const IncFsMount& ifs, std::string_view path) const;
+    LoadingProgress getLoadingProgressFromPath(const IncFsMount& ifs, std::string_view path,
+                                               bool stopOnFirstIncomplete) const;
 
     int setFileContent(const IfsMountPtr& ifs, const incfs::FileId& fileId,
                        std::string_view debugFilePath, std::span<const uint8_t> data) const;