gsid: Increase image allocation size limit

Reserve /data size as large as |super|,
so VAB can function properly.

Bug: 204963821
Test: on a coral-userdebug (|super| ~ 9GB, |userdata| ~ 50GB)
  $ adb shell gsi_tool create-partition --readwrite --partition \
    userdata --size $((45 << 30)) => fail
  $ adb shell gsi_tool create-partition --readwrite --partition \
    userdata --size $((35 << 30)) => success
Change-Id: I0bfbfe58471ba2d12231d8aa58510d61abd9b2a7
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 939f603..2e1de14 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -515,12 +515,12 @@
     if (statvfs(install_dir_.c_str(), &info)) {
         PLOG(ERROR) << "Could not statvfs(" << install_dir_ << ")";
     } else {
-        // Keep the storage device at least 40% free, plus 1% for jitter.
-        constexpr int jitter = 1;
-        const uint64_t reserved_blocks =
-                static_cast<uint64_t>(info.f_blocks) * (kMinimumFreeSpaceThreshold + jitter) / 100;
-        if (info.f_bavail > reserved_blocks) {
-            size = (info.f_bavail - reserved_blocks) * info.f_frsize;
+        uint64_t free_space = static_cast<uint64_t>(info.f_bavail) * info.f_frsize;
+        const auto free_space_threshold =
+                PartitionInstaller::GetMinimumFreeSpaceThreshold(install_dir_);
+        if (free_space_threshold.has_value() && free_space > *free_space_threshold) {
+            // Round down to multiples of filesystem block size.
+            size = (free_space - *free_space_threshold) / info.f_frsize * info.f_frsize;
         }
     }