Installation hardening: reducing read timeout during installation.
And then restoring post-install.
Bug: 160635296
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I0821458bf92db162518a2cbcb7499cd7544e64f2
diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp
index 63488f9..f843ea4 100644
--- a/services/incremental/BinderIncrementalService.cpp
+++ b/services/incremental/BinderIncrementalService.cpp
@@ -150,6 +150,11 @@
return ok();
}
+binder::Status BinderIncrementalService::onInstallationComplete(int32_t storageId) {
+ mImpl.onInstallationComplete(storageId);
+ return ok();
+}
+
binder::Status BinderIncrementalService::makeBindMount(int32_t storageId,
const std::string& sourcePath,
const std::string& targetFullPath,
diff --git a/services/incremental/BinderIncrementalService.h b/services/incremental/BinderIncrementalService.h
index ebb23dc..5c8741b 100644
--- a/services/incremental/BinderIncrementalService.h
+++ b/services/incremental/BinderIncrementalService.h
@@ -52,6 +52,8 @@
const ::android::sp<IStorageHealthListener>& healthListener,
const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts,
bool* _aidl_return) final;
+ binder::Status onInstallationComplete(int32_t storageId) final;
+
binder::Status makeBindMount(int32_t storageId, const std::string& sourcePath,
const std::string& targetFullPath, int32_t bindType,
int32_t* _aidl_return) final;
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index 6695ba8..388f932 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -100,6 +100,12 @@
return (s & (Constants::blockSize - 1)) == 0;
}
+static bool getAlwaysEnableReadTimeoutsForSystemDataLoaders() {
+ return android::base::
+ GetBoolProperty("debug.incremental.always_enable_read_timeouts_for_system_dataloaders",
+ true);
+}
+
static bool getEnforceReadLogsMaxIntervalForSystemDataLoaders() {
return android::base::GetBoolProperty("debug.incremental.enforce_readlogs_max_interval_for_"
"system_dataloaders",
@@ -315,19 +321,11 @@
::rmdir(path::c_str(root));
}
-void IncrementalService::IncFsMount::setReadLogsEnabled(bool value) {
+void IncrementalService::IncFsMount::setFlag(StorageFlags flag, bool value) {
if (value) {
- flags |= StorageFlags::ReadLogsEnabled;
+ flags |= flag;
} else {
- flags &= ~StorageFlags::ReadLogsEnabled;
- }
-}
-
-void IncrementalService::IncFsMount::setReadLogsRequested(bool value) {
- if (value) {
- flags |= StorageFlags::ReadLogsRequested;
- } else {
- flags &= ~StorageFlags::ReadLogsRequested;
+ flags &= ~flag;
}
}
@@ -728,10 +726,17 @@
LOG(INFO) << "Skipped data loader stub creation because it already exists";
return false;
}
+
prepareDataLoaderLocked(*ifs, std::move(dataLoaderParams), std::move(statusListener),
healthCheckParams, std::move(healthListener));
CHECK(ifs->dataLoaderStub);
dataLoaderStub = ifs->dataLoaderStub;
+
+ // Disable long read timeouts for non-system dataloaders.
+ // To be re-enabled after installation is complete.
+ ifs->setReadTimeoutsRequested(dataLoaderStub->isSystemDataLoader() &&
+ getAlwaysEnableReadTimeoutsForSystemDataLoaders());
+ applyStorageParamsLocked(*ifs);
}
if (dataLoaderStub->isSystemDataLoader() &&
@@ -765,6 +770,18 @@
return dataLoaderStub->requestStart();
}
+void IncrementalService::onInstallationComplete(StorageId storage) {
+ IfsMountPtr ifs = getIfs(storage);
+ if (!ifs) {
+ return;
+ }
+
+ // Always enable long read timeouts after installation is complete.
+ std::unique_lock l(ifs->lock);
+ ifs->setReadTimeoutsRequested(true);
+ applyStorageParamsLocked(*ifs);
+}
+
IncrementalService::BindPathMap::const_iterator IncrementalService::findStorageLocked(
std::string_view path) const {
return findParentPath(mBindsByPath, path);
@@ -868,7 +885,7 @@
if (!ifs->readLogsRequested()) {
return 0;
}
- if (auto status = applyStorageParamsLocked(*ifs, /*enableReadLogs=*/true); status != 0) {
+ if (auto status = applyStorageParamsLocked(*ifs); status != 0) {
return status;
}
}
@@ -880,10 +897,10 @@
int IncrementalService::disableReadLogsLocked(IncFsMount& ifs) {
ifs.setReadLogsRequested(false);
- return applyStorageParamsLocked(ifs, /*enableReadLogs=*/false);
+ return applyStorageParamsLocked(ifs);
}
-int IncrementalService::applyStorageParamsLocked(IncFsMount& ifs, bool enableReadLogs) {
+int IncrementalService::applyStorageParamsLocked(IncFsMount& ifs) {
os::incremental::IncrementalFileSystemControlParcel control;
control.cmd.reset(dup(ifs.control.cmd()));
control.pendingReads.reset(dup(ifs.control.pendingReads()));
@@ -892,11 +909,15 @@
control.log.reset(dup(logsFd));
}
+ bool enableReadLogs = ifs.readLogsRequested();
+ bool enableReadTimeouts = ifs.readTimeoutsRequested();
+
std::lock_guard l(mMountOperationLock);
- auto status = mVold->setIncFsMountOptions(control, enableReadLogs);
+ auto status = mVold->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts);
if (status.isOk()) {
- // Store enabled state.
+ // Store states.
ifs.setReadLogsEnabled(enableReadLogs);
+ ifs.setReadTimeoutsEnabled(enableReadTimeouts);
} else {
LOG(ERROR) << "applyStorageParams failed: " << status.toString8();
}
@@ -1271,7 +1292,7 @@
maxPendingTimeUs = std::max(maxPendingTimeUs, microseconds(timeouts.maxPendingTimeUs));
}
if (maxPendingTimeUs < Constants::minPerUidTimeout) {
- LOG(ERROR) << "Skip setting read timeouts (maxPendingTime < Constants::minPerUidTimeout): "
+ LOG(ERROR) << "Skip setting read timeouts (maxPendingTime < Constants::minPerUidTimeout): "
<< duration_cast<milliseconds>(maxPendingTimeUs).count() << "ms < "
<< Constants::minPerUidTimeout.count() << "ms";
return;
@@ -2946,8 +2967,10 @@
return result;
}
- LOG(DEBUG) << id() << ": pendingReads: " << control.pendingReads() << ", "
- << mLastPendingReads.size() << ": " << mLastPendingReads.front().bootClockTsUs;
+ LOG(DEBUG) << id() << ": pendingReads: fd(" << control.pendingReads() << "), count("
+ << mLastPendingReads.size() << "), block: " << mLastPendingReads.front().block
+ << ", time: " << mLastPendingReads.front().bootClockTsUs
+ << ", uid: " << mLastPendingReads.front().uid;
return getOldestTsFromLastPendingReads();
}
diff --git a/services/incremental/IncrementalService.h b/services/incremental/IncrementalService.h
index fb6f56c..e3b1e6f 100644
--- a/services/incremental/IncrementalService.h
+++ b/services/incremental/IncrementalService.h
@@ -118,6 +118,9 @@
ReadLogsAllowed = 1 << 0,
ReadLogsEnabled = 1 << 1,
ReadLogsRequested = 1 << 2,
+
+ ReadTimeoutsEnabled = 1 << 3,
+ ReadTimeoutsRequested = 1 << 4,
};
struct LoadingProgress {
@@ -160,6 +163,7 @@
const StorageHealthCheckParams& healthCheckParams,
StorageHealthListener healthListener,
std::vector<PerUidReadTimeouts> perUidReadTimeouts);
+ void onInstallationComplete(StorageId storage);
int bind(StorageId storage, std::string_view source, std::string_view target, BindKind kind);
int unbind(StorageId storage, std::string_view target);
@@ -316,7 +320,7 @@
} mHealthBase = {TimePoint::max(), kMaxBootClockTsUs};
StorageHealthCheckParams mHealthCheckParams;
int mStreamStatus = content::pm::IDataLoaderStatusListener::STREAM_HEALTHY;
- std::vector<incfs::ReadInfo> mLastPendingReads;
+ std::vector<incfs::ReadInfoWithUid> mLastPendingReads;
};
using DataLoaderStubPtr = sp<DataLoaderStub>;
@@ -364,13 +368,32 @@
void disallowReadLogs() { flags &= ~StorageFlags::ReadLogsAllowed; }
int32_t readLogsAllowed() const { return (flags & StorageFlags::ReadLogsAllowed); }
- void setReadLogsEnabled(bool value);
+ void setReadLogsEnabled(bool value) {
+ return setFlag(StorageFlags::ReadLogsEnabled, value);
+ }
int32_t readLogsEnabled() const { return (flags & StorageFlags::ReadLogsEnabled); }
- void setReadLogsRequested(bool value);
+ void setReadLogsRequested(bool value) {
+ return setFlag(StorageFlags::ReadLogsRequested, value);
+ }
int32_t readLogsRequested() const { return (flags & StorageFlags::ReadLogsRequested); }
+ void setReadTimeoutsEnabled(bool value) {
+ return setFlag(StorageFlags::ReadTimeoutsEnabled, value);
+ }
+ int32_t readTimeoutsEnabled() const { return (flags & StorageFlags::ReadTimeoutsEnabled); }
+
+ void setReadTimeoutsRequested(bool value) {
+ return setFlag(StorageFlags::ReadTimeoutsRequested, value);
+ }
+ int32_t readTimeoutsRequested() const {
+ return (flags & StorageFlags::ReadTimeoutsRequested);
+ }
+
static void cleanupFilesystem(std::string_view root);
+
+ private:
+ void setFlag(StorageFlags flag, bool value);
};
using IfsMountPtr = std::shared_ptr<IncFsMount>;
@@ -422,7 +445,7 @@
int makeDirs(const IncFsMount& ifs, StorageId storageId, std::string_view path, int mode);
int disableReadLogsLocked(IncFsMount& ifs);
- int applyStorageParamsLocked(IncFsMount& ifs, bool enableReadLogs);
+ int applyStorageParamsLocked(IncFsMount& ifs);
LoadingProgress getLoadingProgressFromPath(const IncFsMount& ifs, std::string_view path) const;
diff --git a/services/incremental/ServiceWrappers.cpp b/services/incremental/ServiceWrappers.cpp
index 8e416f3..0755a22 100644
--- a/services/incremental/ServiceWrappers.cpp
+++ b/services/incremental/ServiceWrappers.cpp
@@ -55,8 +55,8 @@
}
binder::Status setIncFsMountOptions(
const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
- bool enableReadLogs) const final {
- return mInterface->setIncFsMountOptions(control, enableReadLogs);
+ bool enableReadLogs, bool enableReadTimeouts) const final {
+ return mInterface->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts);
}
private:
@@ -233,8 +233,9 @@
ErrorCode reserveSpace(const Control& control, FileId id, IncFsSize size) const final {
return incfs::reserveSpace(control, id, size);
}
- WaitResult waitForPendingReads(const Control& control, std::chrono::milliseconds timeout,
- std::vector<incfs::ReadInfo>* pendingReadsBuffer) const final {
+ WaitResult waitForPendingReads(
+ const Control& control, std::chrono::milliseconds timeout,
+ std::vector<incfs::ReadInfoWithUid>* pendingReadsBuffer) const final {
return incfs::waitForPendingReads(control, timeout, pendingReadsBuffer);
}
ErrorCode setUidReadTimeouts(const Control& control,
diff --git a/services/incremental/ServiceWrappers.h b/services/incremental/ServiceWrappers.h
index d4cdcbe..78e9589 100644
--- a/services/incremental/ServiceWrappers.h
+++ b/services/incremental/ServiceWrappers.h
@@ -56,8 +56,8 @@
virtual binder::Status bindMount(const std::string& sourceDir,
const std::string& targetDir) const = 0;
virtual binder::Status setIncFsMountOptions(
- const os::incremental::IncrementalFileSystemControlParcel& control,
- bool enableReadLogs) const = 0;
+ const os::incremental::IncrementalFileSystemControlParcel& control, bool enableReadLogs,
+ bool enableReadTimeouts) const = 0;
};
class DataLoaderManagerWrapper {
@@ -117,7 +117,7 @@
virtual ErrorCode reserveSpace(const Control& control, FileId id, IncFsSize size) const = 0;
virtual WaitResult waitForPendingReads(
const Control& control, std::chrono::milliseconds timeout,
- std::vector<incfs::ReadInfo>* pendingReadsBuffer) const = 0;
+ std::vector<incfs::ReadInfoWithUid>* pendingReadsBuffer) const = 0;
virtual ErrorCode setUidReadTimeouts(
const Control& control,
const std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts)
diff --git a/services/incremental/test/IncrementalServiceTest.cpp b/services/incremental/test/IncrementalServiceTest.cpp
index 1ec446d..14bcd4e 100644
--- a/services/incremental/test/IncrementalServiceTest.cpp
+++ b/services/incremental/test/IncrementalServiceTest.cpp
@@ -56,10 +56,10 @@
MOCK_CONST_METHOD1(unmountIncFs, binder::Status(const std::string& dir));
MOCK_CONST_METHOD2(bindMount,
binder::Status(const std::string& sourceDir, const std::string& argetDir));
- MOCK_CONST_METHOD2(
+ MOCK_CONST_METHOD3(
setIncFsMountOptions,
binder::Status(const ::android::os::incremental::IncrementalFileSystemControlParcel&,
- bool));
+ bool, bool));
void mountIncFsFails() {
ON_CALL(*this, mountIncFs(_, _, _, _))
@@ -83,12 +83,13 @@
ON_CALL(*this, bindMount(_, _)).WillByDefault(Return(binder::Status::ok()));
}
void setIncFsMountOptionsFails() const {
- ON_CALL(*this, setIncFsMountOptions(_, _))
+ ON_CALL(*this, setIncFsMountOptions(_, _, _))
.WillByDefault(Return(
binder::Status::fromExceptionCode(1, String8("failed to set options"))));
}
void setIncFsMountOptionsSuccess() {
- ON_CALL(*this, setIncFsMountOptions(_, _)).WillByDefault(Return(binder::Status::ok()));
+ ON_CALL(*this, setIncFsMountOptions(_, _, _))
+ .WillByDefault(Invoke(this, &MockVoldService::setIncFsMountOptionsOk));
}
binder::Status getInvalidControlParcel(const std::string& imagePath,
const std::string& targetDir, int32_t flags,
@@ -103,10 +104,23 @@
_aidl_return->log.reset(base::unique_fd(dup(STDIN_FILENO)));
return binder::Status::ok();
}
+ binder::Status setIncFsMountOptionsOk(
+ const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
+ bool enableReadLogs, bool enableReadTimeouts) {
+ mReadLogsEnabled = enableReadLogs;
+ mReadTimeoutsEnabled = enableReadTimeouts;
+ return binder::Status::ok();
+ }
+
+ bool readLogsEnabled() const { return mReadLogsEnabled; }
+ bool readTimeoutsEnabled() const { return mReadTimeoutsEnabled; }
private:
TemporaryFile cmdFile;
TemporaryFile logFile;
+
+ bool mReadLogsEnabled = false;
+ bool mReadTimeoutsEnabled = true;
};
class MockDataLoader : public IDataLoader {
@@ -395,7 +409,7 @@
MOCK_CONST_METHOD3(reserveSpace, ErrorCode(const Control& control, FileId id, IncFsSize size));
MOCK_CONST_METHOD3(waitForPendingReads,
WaitResult(const Control& control, std::chrono::milliseconds timeout,
- std::vector<incfs::ReadInfo>* pendingReadsBuffer));
+ std::vector<incfs::ReadInfoWithUid>* pendingReadsBuffer));
MOCK_CONST_METHOD2(setUidReadTimeouts,
ErrorCode(const Control& control,
const std::vector<PerUidReadTimeouts>& perUidReadTimeouts));
@@ -435,7 +449,7 @@
ON_CALL(*this, waitForPendingReads(_, _, _))
.WillByDefault(
Invoke([ts](const Control& control, std::chrono::milliseconds timeout,
- std::vector<incfs::ReadInfo>* pendingReadsBuffer) {
+ std::vector<incfs::ReadInfoWithUid>* pendingReadsBuffer) {
pendingReadsBuffer->push_back({.bootClockTsUs = ts});
return android::incfs::WaitResult::HaveData;
}));
@@ -1302,8 +1316,10 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
+ // on startLoading
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
// We are calling setIncFsMountOptions(true).
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(1);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// Not expecting callback removal.
@@ -1325,8 +1341,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// Enabling and then disabling readlogs.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(1);
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(2);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// Not expecting callback removal.
@@ -1353,8 +1369,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// Enabling and then disabling readlogs.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(2);
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(2);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(2);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// Not expecting callback removal.
@@ -1394,8 +1410,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// Enabling and then disabling readlogs.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(3);
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false)).Times(0);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(3);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// Not expecting callback removal.
@@ -1435,8 +1451,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_)).Times(2);
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// Enabling and then disabling readlogs.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(3);
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(5);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(3);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// Not expecting callback removal.
@@ -1448,9 +1464,14 @@
IncrementalService::CreateOptions::CreateNew);
ASSERT_GE(storageId, 0);
+ // Before install - long timeouts.
+ ASSERT_TRUE(mVold->readTimeoutsEnabled());
+
auto dataLoaderParcel = mDataLoaderParcel;
ASSERT_TRUE(mIncrementalService->startLoading(storageId, std::move(dataLoaderParcel), {}, {},
{}, {}));
+ // During install - short timeouts.
+ ASSERT_FALSE(mVold->readTimeoutsEnabled());
// Disable readlogs callback present.
ASSERT_EQ(storageId, mTimedQueue->mId);
@@ -1463,9 +1484,15 @@
mClock->advance(90min);
ASSERT_GE(mDataLoader->setStorageParams(true), 0);
+ mIncrementalService->onInstallationComplete(storageId);
+ // After install - long timeouts.
+ ASSERT_TRUE(mVold->readTimeoutsEnabled());
+
// New installation.
ASSERT_TRUE(mIncrementalService->startLoading(storageId, std::move(mDataLoaderParcel), {}, {},
{}, {}));
+ // New installation - short timeouts.
+ ASSERT_FALSE(mVold->readTimeoutsEnabled());
// New callback present.
ASSERT_EQ(storageId, mTimedQueue->mId);
@@ -1485,6 +1512,10 @@
// And timeout.
mClock->advance(90min);
ASSERT_EQ(mDataLoader->setStorageParams(true), -EPERM);
+
+ mIncrementalService->onInstallationComplete(storageId);
+ // After install - long timeouts.
+ ASSERT_TRUE(mVold->readTimeoutsEnabled());
}
TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsSuccessAndPermissionChanged) {
@@ -1495,9 +1526,9 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// We are calling setIncFsMountOptions(true).
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(1);
// setIncFsMountOptions(false) is called on the callback.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(2);
// After setIncFsMountOptions succeeded expecting to start watching.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(1);
// After callback is called, disable read logs and remove callback.
@@ -1520,7 +1551,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// checkPermission fails, no calls to set opitions, start or stop WatchingMode.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(0);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(0);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(0);
EXPECT_CALL(*mAppOpsManager, stopWatchingMode(_)).Times(0);
TemporaryDir tempDir;
@@ -1539,7 +1571,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// checkPermission fails, no calls to set opitions, start or stop WatchingMode.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(0);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(0);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(0);
EXPECT_CALL(*mAppOpsManager, stopWatchingMode(_)).Times(0);
TemporaryDir tempDir;
@@ -1559,7 +1592,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// We are calling setIncFsMountOptions.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(1);
+ EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
// setIncFsMountOptions fails, no calls to start or stop WatchingMode.
EXPECT_CALL(*mAppOpsManager, startWatchingMode(_, _, _)).Times(0);
EXPECT_CALL(*mAppOpsManager, stopWatchingMode(_)).Times(0);