Let vold mount IncFs onto directories under data and open control files.
Test: builds
Change-Id: Ibd96aae254b4fefaf56c9d549c4672a987c46221
"libf2fs_sparseblock",
"libhardware",
"libhardware_legacy",
+ "libincfs",
"libhidlbase",
"libkeymaster4support",
"libkeyutils",
],
aidl: {
local_include_dirs: ["binder"],
- include_dirs: ["frameworks/native/aidl/binder"],
+ include_dirs: [
+ "frameworks/native/aidl/binder",
+ "frameworks/base/core/java/android/os/incremental",
+ ],
export_aidl_headers: true,
},
+ whole_static_libs: [
+ "libincremental_aidl-cpp",
+ ],
}
cc_library_headers {
#include "FsCrypt.h"
#include "MetadataCrypt.h"
#include "cryptfs.h"
+#include "incfs_ndk.h"
#include <fstream>
#include <thread>
return ok();
}
+binder::Status VoldNativeService::incFsVersion(int32_t* _aidl_return) {
+ *_aidl_return = IncFs_Version();
+ return ok();
+}
+
+binder::Status VoldNativeService::mountIncFs(
+ const std::string& imagePath, const std::string& targetDir, int32_t flags,
+ ::android::os::incremental::IncrementalFileSystemControlParcel* _aidl_return) {
+ auto result = IncFs_Mount(imagePath.c_str(), targetDir.c_str(), flags,
+ INCFS_DEFAULT_READ_TIMEOUT_MS, 0777);
+ if (result.cmdFd < 0) {
+ return translate(result.cmdFd);
+ }
+ LOG(INFO) << "VoldNativeService::mountIncFs: everything is fine! " << result.cmdFd << "/"
+ << result.logFd;
+ using ParcelFileDescriptor = ::android::os::ParcelFileDescriptor;
+ using unique_fd = ::android::base::unique_fd;
+ _aidl_return->cmd = std::make_unique<ParcelFileDescriptor>(unique_fd(result.cmdFd));
+ if (result.logFd >= 0) {
+ _aidl_return->log = std::make_unique<ParcelFileDescriptor>(unique_fd(result.logFd));
+ }
+ return ok();
+}
+
+binder::Status VoldNativeService::unmountIncFs(const std::string& dir) {
+ return translate(IncFs_Unmount(dir.c_str()));
+}
+
+binder::Status VoldNativeService::bindMount(const std::string& sourceDir,
+ const std::string& targetDir) {
+ return translate(IncFs_BindMount(sourceDir.c_str(), targetDir.c_str()));
+}
+
} // namespace vold
} // namespace android
binder::Status supportsBlockCheckpoint(bool* _aidl_return);
binder::Status supportsFileCheckpoint(bool* _aidl_return);
binder::Status resetCheckpoint();
+
+ binder::Status incFsVersion(int32_t* _aidl_return) override;
+ binder::Status mountIncFs(
+ const std::string& imagePath, const std::string& targetDir, int32_t flags,
+ ::android::os::incremental::IncrementalFileSystemControlParcel* _aidl_return) override;
+ binder::Status unmountIncFs(const std::string& dir) override;
+ binder::Status bindMount(const std::string& sourceDir, const std::string& targetDir) override;
};
} // namespace vold
package android.os;
+import android.os.incremental.IncrementalFileSystemControlParcel;
import android.os.IVoldListener;
import android.os.IVoldTaskListener;
FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
+ int incFsVersion();
+ IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String imagePath, @utf8InCpp String targetDir, int flags);
+ void unmountIncFs(@utf8InCpp String dir);
+ void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
+
const int ENCRYPTION_FLAG_NO_UI = 4;
const int ENCRYPTION_STATE_NONE = 1;