Fix casting bug, add control for hard quotas.

(cherry picked from commit bdd4de8a98d57110befb0c29f662e8a3e4cfc275)

Bug: 64160395, 63255278
Test: /data/nativetest/installd_service_test/installd_cache_test
Merged-In: I8e2e24afd88da4dc13afdf05927e59c268e69825
Change-Id: I8e2e24afd88da4dc13afdf05927e59c268e69825
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index c087713..4a93b1f 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -311,6 +311,7 @@
         return -1;
     }
 
+#if APPLY_HARD_QUOTAS
     if ((dq.dqb_bhardlimit == 0) || (dq.dqb_ihardlimit == 0)) {
         auto path = create_data_path(uuid ? uuid->c_str() : nullptr);
         struct statvfs stat;
@@ -335,6 +336,10 @@
         // Hard quota already set; assume it's reasonable
         return 0;
     }
+#else
+    // Hard quotas disabled
+    return 0;
+#endif
 }
 
 binder::Status InstalldNativeService::createAppData(const std::unique_ptr<std::string>& uuid,