Initial unified commit for Android 13, with TrebleDroid GSI target, syncing up to 20221111

This commit is contained in:
Andy CrossGate Yan
2022-11-11 12:27:50 +00:00
commit cd68e3dcbc
197 changed files with 127907 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From 04c871f65cada40eb623f874998b227d3c945259 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 85ffefd..8869ac7 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -327,6 +327,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi
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.25.1

View File

@@ -0,0 +1,38 @@
From acde5315c66bc8c5eb6e3db4356e0ff66f96bba8 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 94d7f15..671ae6f 100644
--- a/vold_prepare_subdirs.cpp
+++ b/vold_prepare_subdirs.cpp
@@ -198,7 +198,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";
}
}
}
@@ -247,7 +247,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.25.1

View File

@@ -0,0 +1,25 @@
From fa66bb6c568e9a6f113d8e34b99091d6f392c96e 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 8190e7e..41ace8b 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -974,6 +974,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.25.1

View File

@@ -0,0 +1,47 @@
From caaaa7060a9adbfe83dc3e618823f75e38fc3347 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)
---
fs/Exfat.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index c8b19e0..9e34347 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,9 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
bool IsSupported() {
return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 &&
- IsFilesystemSupported("exfat");
+ (IsFilesystemSupported("exfat") ||
+ IsFilesystemSupported("texfat") ||
+ IsFilesystemSupported("sdfat"));
}
status_t Check(const std::string& source) {
@@ -61,13 +63,16 @@ 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";
+ 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.25.1

View File

@@ -0,0 +1,25 @@
From bf15352a6e778ecc1e371fe6079b7dedf6cf9568 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 5b1bdf7..e33570b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -273,7 +273,7 @@ static int process_config(VolumeManager* vm, VoldConfigs* configs) {
int partnum = entry.partnum;
int flags = 0;
- if (entry.is_encryptable()) {
+ if (entry.is_encryptable() || true) {
flags |= android::vold::Disk::Flags::kAdoptable;
configs->has_adoptable = true;
}
--
2.25.1