[incfs] Call the new isFullyLoaded api where possible
Replace the remaining calls to getFilledRanges() with
isFullyLoaded() where we don't care about the progress
Bug: 183067554
Test: atest IncrementalService
Change-Id: Ic8dc2e3a0ef078353883feef7969b29e11dfa2d0
diff --git a/services/incremental/test/IncrementalServiceTest.cpp b/services/incremental/test/IncrementalServiceTest.cpp
index fb3a8a0..54bc95d 100644
--- a/services/incremental/test/IncrementalServiceTest.cpp
+++ b/services/incremental/test/IncrementalServiceTest.cpp
@@ -1606,9 +1606,7 @@
int storageId =
mIncrementalService->createStorage(tempDir.path, mDataLoaderParcel,
IncrementalService::CreateOptions::CreateNew);
- ASSERT_EQ(1,
- mIncrementalService->getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/false)
- .getProgress());
+ ASSERT_EQ(1, mIncrementalService->getLoadingProgress(storageId).getProgress());
}
TEST_F(IncrementalServiceTest, testGetLoadingProgressFailsWithFailedRanges) {
@@ -1620,9 +1618,7 @@
mIncrementalService->createStorage(tempDir.path, mDataLoaderParcel,
IncrementalService::CreateOptions::CreateNew);
EXPECT_CALL(*mIncFs, countFilledBlocks(_, _)).Times(1);
- ASSERT_EQ(-1,
- mIncrementalService->getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/false)
- .getProgress());
+ ASSERT_EQ(-1, mIncrementalService->getLoadingProgress(storageId).getProgress());
}
TEST_F(IncrementalServiceTest, testGetLoadingProgressSuccessWithEmptyRanges) {
@@ -1634,9 +1630,7 @@
mIncrementalService->createStorage(tempDir.path, mDataLoaderParcel,
IncrementalService::CreateOptions::CreateNew);
EXPECT_CALL(*mIncFs, countFilledBlocks(_, _)).Times(3);
- ASSERT_EQ(1,
- mIncrementalService->getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/false)
- .getProgress());
+ ASSERT_EQ(1, mIncrementalService->getLoadingProgress(storageId).getProgress());
}
TEST_F(IncrementalServiceTest, testGetLoadingProgressSuccess) {
@@ -1648,9 +1642,7 @@
mIncrementalService->createStorage(tempDir.path, mDataLoaderParcel,
IncrementalService::CreateOptions::CreateNew);
EXPECT_CALL(*mIncFs, countFilledBlocks(_, _)).Times(3);
- ASSERT_EQ(0.5,
- mIncrementalService->getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/false)
- .getProgress());
+ ASSERT_EQ(0.5, mIncrementalService->getLoadingProgress(storageId).getProgress());
}
TEST_F(IncrementalServiceTest, testRegisterLoadingProgressListenerSuccess) {
@@ -1833,8 +1825,12 @@
.WillOnce(Invoke(&checkPerUidTimeoutsEmpty));
EXPECT_CALL(*mTimedQueue, addJob(_, _, _)).Times(3);
- // Empty storage.
- mIncFs->countFilledBlocksEmpty();
+ // Loading storage.
+ EXPECT_CALL(*mIncFs, isEverythingFullyLoaded(_))
+ .WillOnce(Return(incfs::LoadingState::MissingBlocks))
+ .WillOnce(Return(incfs::LoadingState::MissingBlocks))
+ .WillOnce(Return(incfs::LoadingState::Full))
+ .WillOnce(Return(incfs::LoadingState::Full));
// Mark DataLoader as 'system' so that readlogs don't pollute the timed queue.
mDataLoaderParcel.packageName = "android";
@@ -1855,22 +1851,18 @@
const auto timedCallback = mTimedQueue->mWhat;
mTimedQueue->clearJob(storageId);
- // Still loading.
- mIncFs->countFilledBlocksSuccess();
-
// Call it again.
timedCallback();
}
{
- // Still present -> 0.5 progress.
+ // Still present -> some progress.
ASSERT_EQ(storageId, mTimedQueue->mId);
ASSERT_GE(mTimedQueue->mAfter, std::chrono::seconds(1));
const auto timedCallback = mTimedQueue->mWhat;
mTimedQueue->clearJob(storageId);
// Fully loaded but readlogs collection enabled.
- mIncFs->countFilledBlocksFullyLoaded();
ASSERT_GE(mDataLoader->setStorageParams(true), 0);
// Call it again.