DO NOT MERGE Fix testVerifyStatsExternalConsistent case
Root cause: For devices mount /data partition without quota option will
get this testcase failure, because
the getExternalSize logic will use Android/obb path
to calculate totalsize.
But the testcase will check the totalsize excluding obb.
Solution: For device mounted userdata without quota option
will remove obbSize from totalSize, to
Make android.appsecurity.cts.StorageHostTest
testcase PASS.
Test: run cts-on-gsi -m CtsAppSecurityHostTestCases -t
android.appsecurity.cts.StorageHostTest
Bug: 145269983
Change-Id: I8df02d5427d7512046ca3793f03a133a4ad00cbd
(cherry picked from 5d64ddfe8907ecc016849414fce7ea364a3bdd26)
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 737c6c9..b5208f8 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2016,6 +2016,9 @@
auto obbPath = StringPrintf("%s/Android/obb",
create_data_media_path(uuid_, userId).c_str());
calculate_tree_size(obbPath, &obbSize);
+ if (!(flags & FLAG_USE_QUOTA)) {
+ totalSize -= obbSize;
+ }
ATRACE_END();
}