Initial unified commit for Android 14, with TrebleDroid GSI target, syncing up to 20240208

This commit is contained in:
Andy CrossGate Yan
2024-02-17 16:46:38 +08:00
commit e9902a4450
281 changed files with 169698 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From 7892af1ca6193fcc9ebba0d8bafe6e8a741856c5 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 17 Feb 2018 19:39:38 +0100
Subject: [PATCH 1/5] Allow deletion of symlink
Change-Id: I9731895f88729072297f753088583aabbe6990f4
---
FsCrypt.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index bbaf429..94e5201 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -359,6 +359,7 @@ static bool prepare_dir_with_policy(const std::string& dir, mode_t mode, uid_t u
static bool destroy_dir(const std::string& dir) {
LOG(DEBUG) << "Destroying: " << dir;
if (rmdir(dir.c_str()) != 0 && errno != ENOENT) {
+ if(unlink(dir.c_str()) == 0) return true;
PLOG(ERROR) << "Failed to destroy " << dir;
return false;
}
--
2.34.1

View File

@@ -0,0 +1,38 @@
From d61316b5f00c32b649d24d4defb196d9ddc99d03 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 7 Mar 2020 14:49:09 +0100
Subject: [PATCH 2/5] Failing to create facedata shouldn't be fatal
Some Pie vendors create it on their own, so SELinux would deny that
Also not all devices have face unlock anyway
See https://github.com/phhusson/treble_experimentations/issues/1119
---
vold_prepare_subdirs.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vold_prepare_subdirs.cpp b/vold_prepare_subdirs.cpp
index 60e82f5..c1ded02 100644
--- a/vold_prepare_subdirs.cpp
+++ b/vold_prepare_subdirs.cpp
@@ -205,7 +205,7 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla
}
auto facedata_path = vendor_de_path + "/facedata";
if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, facedata_path)) {
- return false;
+ LOG(ERROR) << "Failed preparing folder for de facedata";
}
}
}
@@ -254,7 +254,7 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla
auto vendor_ce_path = android::vold::BuildDataVendorCePath(user_id);
auto facedata_path = vendor_ce_path + "/facedata";
if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, facedata_path)) {
- return false;
+ LOG(ERROR) << "Failed preparing folder for de facedata";
}
}
}
--
2.34.1

View File

@@ -0,0 +1,25 @@
From 906fbe7e96851a950fb1401b0077fb15a348e6b2 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 29 Nov 2021 17:49:13 -0500
Subject: [PATCH 3/5] Don't unmount rw-system.sh binds
Change-Id: If9132c21defa8b09879b79a70794c5275d6852d0
---
VolumeManager.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index dc6fae9..47c8cd4 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -985,6 +985,7 @@ int VolumeManager::unmountAll() {
while ((mentry = getmntent(fp)) != NULL) {
auto test = std::string(mentry->mnt_dir);
if ((StartsWith(test, "/mnt/") &&
+ !StartsWith(test, "/mnt/phh") &&
#ifdef __ANDROID_DEBUGGABLE__
!StartsWith(test, "/mnt/scratch") &&
#endif
--
2.34.1

View File

@@ -0,0 +1,60 @@
From 912126dd1cbdd610440ca1b35c4479fa0c61dc12 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 18 Oct 2022 16:08:09 -0400
Subject: [PATCH 4/5] Exfat can be mounted with "exfat" kernel fs driver, or
"sdfat" or "texfat" (Samsung and Sony variants)
@AndyCGYan: Adapt to LineageOS vold
Change-Id: I331e66d8cb37664adbd493b9190123e29f01fd9d
---
Utils.cpp | 5 +++++
fs/Exfat.cpp | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Utils.cpp b/Utils.cpp
index 5e719b6..e20f170 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1059,6 +1059,11 @@ bool IsFilesystemSupported(const std::string& fsType) {
/* fuse filesystems */
supported.append("fuse\tntfs\n");
+ /* treat sdfat/texfat as exfat */
+ if (supported.find("sdfat\n") != std::string::npos || supported.find("texfat\n") != std::string::npos) {
+ supported.append("\texfat\n");
+ }
+
return supported.find(fsType + "\n") != std::string::npos;
}
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index c8b19e0..46a0e2d 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -61,13 +61,20 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi
auto mountData = android::base::StringPrintf("uid=%d,gid=%d,fmask=%o,dmask=%o", ownerUid,
ownerGid, permMask, permMask);
- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) {
+ const char *fs = "exfat";
+ if (IsFilesystemSupported("sdfat")) {
+ fs = "sdfat";
+ } else if (IsFilesystemSupported("texfat")) {
+ fs = "texfat";
+ }
+
+ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) {
return 0;
}
PLOG(ERROR) << "Mount failed; attempting read-only";
mountFlags |= MS_RDONLY;
- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) {
+ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) {
return 0;
}
--
2.34.1

View File

@@ -0,0 +1,25 @@
From bf0b19afc1bf8bad9a676d520f3fd5d81bb1f7cd Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 11 Mar 2020 14:02:35 +0100
Subject: [PATCH 5/5] Every voldmanaged storage is adoptable
---
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.cpp b/main.cpp
index e2025b7..8a02279 100644
--- a/main.cpp
+++ b/main.cpp
@@ -279,7 +279,7 @@ static int process_config(VolumeManager* vm, VoldConfigs* configs) {
std::string nickname(entry.label);
int flags = 0;
- if (entry.is_encryptable()) {
+ if (entry.is_encryptable() || true) {
flags |= android::vold::Disk::Flags::kAdoptable;
configs->has_adoptable = true;
}
--
2.34.1