[incremental] use same sysfs name for setOptions
Otherwise we have errors during applyStorageParams:
05-10 15:35:32.363 562 625 E IncrementalService: applyStorageParams failed: Status(-8, EX_SERVICE_SPECIFIC): '-95: '
05-10 15:35:32.363 562 625 E incfs-dataloaderconnector: setStorageParams failed with error: -95
05-10 15:35:32.363 562 625 E incfs-dataloaderconnector: DataLoader supports UID
05-10 15:35:32.367 0 0 E incfs : Can't change sysfs_name mount option on remount
BUG: 187308584
Test: atest CtsContentTestCases:android.content.pm.cts.PackageManagerShellCommandIncrementalTest#testInstallWithIdSigNoMissingPages
Change-Id: Ic2146aa7855e13de9f96794639de556f64e93701
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index 51b270c..24699d9 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -983,7 +983,8 @@
bool enableReadTimeouts = ifs.readTimeoutsRequested();
std::lock_guard l(mMountOperationLock);
- auto status = mVold->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts);
+ auto status = mVold->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts,
+ ifs.metricsKey);
if (status.isOk()) {
// Store states.
ifs.setReadLogsEnabled(enableReadLogs);
diff --git a/services/incremental/ServiceWrappers.cpp b/services/incremental/ServiceWrappers.cpp
index 68a28b2..ce3d514 100644
--- a/services/incremental/ServiceWrappers.cpp
+++ b/services/incremental/ServiceWrappers.cpp
@@ -56,8 +56,10 @@
}
binder::Status setIncFsMountOptions(
const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
- bool enableReadLogs, bool enableReadTimeouts) const final {
- return mInterface->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts);
+ bool enableReadLogs, bool enableReadTimeouts,
+ const std::string& sysfsName) const final {
+ return mInterface->setIncFsMountOptions(control, enableReadLogs, enableReadTimeouts,
+ sysfsName);
}
private:
diff --git a/services/incremental/ServiceWrappers.h b/services/incremental/ServiceWrappers.h
index c0ef7ba..39e2ee3 100644
--- a/services/incremental/ServiceWrappers.h
+++ b/services/incremental/ServiceWrappers.h
@@ -58,7 +58,7 @@
const std::string& targetDir) const = 0;
virtual binder::Status setIncFsMountOptions(
const os::incremental::IncrementalFileSystemControlParcel& control, bool enableReadLogs,
- bool enableReadTimeouts) const = 0;
+ bool enableReadTimeouts, const std::string& sysfsName) const = 0;
};
class DataLoaderManagerWrapper {
diff --git a/services/incremental/test/IncrementalServiceTest.cpp b/services/incremental/test/IncrementalServiceTest.cpp
index 6c9310b..fae654e 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_METHOD3(
+ MOCK_CONST_METHOD4(
setIncFsMountOptions,
binder::Status(const ::android::os::incremental::IncrementalFileSystemControlParcel&,
- bool, bool));
+ bool, bool, const std::string&));
void mountIncFsFails() {
ON_CALL(*this, mountIncFs(_, _, _, _, _))
@@ -83,12 +83,12 @@
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(_, _, _))
+ ON_CALL(*this, setIncFsMountOptions(_, _, _, _))
.WillByDefault(Invoke(this, &MockVoldService::setIncFsMountOptionsOk));
}
binder::Status getInvalidControlParcel(const std::string& imagePath,
@@ -108,7 +108,7 @@
}
binder::Status setIncFsMountOptionsOk(
const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
- bool enableReadLogs, bool enableReadTimeouts) {
+ bool enableReadLogs, bool enableReadTimeouts, const std::string& sysfsName) {
mReadLogsEnabled = enableReadLogs;
mReadTimeoutsEnabled = enableReadTimeouts;
return binder::Status::ok();
@@ -1451,9 +1451,9 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_));
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// on startLoading
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(1);
+ 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.
@@ -1475,8 +1475,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(2);
+ 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.
@@ -1503,8 +1503,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(2);
+ 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.
@@ -1544,8 +1544,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(1);
+ 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.
@@ -1585,8 +1585,8 @@
EXPECT_CALL(*mDataLoaderManager, unbindFromDataLoader(_)).Times(2);
EXPECT_CALL(*mVold, unmountIncFs(_)).Times(2);
// Enabling and then disabling readlogs.
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, true, _)).Times(5);
- EXPECT_CALL(*mVold, setIncFsMountOptions(_, false, _)).Times(3);
+ 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.
@@ -1660,9 +1660,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(2);
+ 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.
@@ -1685,8 +1685,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(_, false, _)).Times(1);
+ 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;
@@ -1705,8 +1705,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(_, false, _)).Times(1);
+ 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;
@@ -1726,8 +1726,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(_, false, _)).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);