Change storage migration to use quota APIs.
New quota APIs are much faster than trying to measure manually, and
removing this last user of calculateDirectorySize() means we can
remove it once and for all.
(cherry picked from commit a01369893823ee3d62ea79c422a76fe810f8a5cb)
Bug: 36056324
Test: builds, boots
Merged-In: I60bb197ffc161ed24fe4aa8093495c8874095cdb
Change-Id: I60bb197ffc161ed24fe4aa8093495c8874095cdb
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index aac4386..5115159 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -1644,6 +1644,7 @@
int64_t videoSize = 0;
int64_t imageSize = 0;
int64_t appSize = 0;
+ int64_t obbSize = 0;
auto device = findQuotaDeviceForUuid(uuid);
if (device.empty()) {
@@ -1691,6 +1692,13 @@
#endif
imageSize = dq.dqb_curspace;
}
+ if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), AID_MEDIA_OBB,
+ reinterpret_cast<char*>(&dq)) == 0) {
+#if MEASURE_DEBUG
+ LOG(DEBUG) << "quotactl() for GID " << AID_MEDIA_OBB << " " << dq.dqb_curspace;
+#endif
+ obbSize = dq.dqb_curspace;
+ }
ATRACE_END();
ATRACE_BEGIN("apps");
@@ -1747,6 +1755,11 @@
}
fts_close(fts);
ATRACE_END();
+
+ ATRACE_BEGIN("obb");
+ auto obbPath = create_data_media_obb_path(uuid_, "");
+ calculate_tree_size(obbPath, &obbSize);
+ ATRACE_END();
}
std::vector<int64_t> ret;
@@ -1755,6 +1768,7 @@
ret.push_back(videoSize);
ret.push_back(imageSize);
ret.push_back(appSize);
+ ret.push_back(obbSize);
#if MEASURE_DEBUG
LOG(DEBUG) << "Final result " << toString(ret);
#endif