Initial commit for Android 11, syncing up to v300.f

This commit is contained in:
Andy CrossGate Yan
2020-10-29 03:02:26 +00:00
commit 1bc6933877
78 changed files with 12938 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From 32affddf47a6a3aba580707f349565b3655a16b7 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/6] Allow deletion of symlink
Change-Id: I9731895f88729072297f753088583aabbe6990f4
---
FsCrypt.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index e21524a..ca8e6f9 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -313,6 +313,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.17.1

View File

@@ -0,0 +1,44 @@
From f19e29be30ae859c084bebd2d5c32f7ff94bc31f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Aug 2018 22:37:54 +0200
Subject: [PATCH 2/6] Support Samsung's implementation of exfat, called sdfat
---
fs/Exfat.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index 34f1024..3aa9494 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,7 @@ 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("sdfat"));
}
status_t Check(const std::string& source) {
@@ -61,13 +61,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 (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.17.1

View File

@@ -0,0 +1,41 @@
From d6f033bfbd7c03b30a23b287e84b1608c35d6038 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 16 Sep 2019 13:49:05 +0200
Subject: [PATCH] Check needsCheckpoint only if checkpoint is supported
This is needed because some devices (Xiaomi MiPad 4, uncertified)
declares a bootctrl HAL in manifest, but doesn't have it.
vold will then hang in needsCheckpoint waiting for bootctrl
Change-Id: I2dafcbca7e994d7a3ac36ef3698590db2ab482fa
---
cryptfs.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cryptfs.cpp b/cryptfs.cpp
index 063c5be..df48b15 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -1363,7 +1363,7 @@ static int create_crypto_blk_dev_hw(struct crypt_mnt_ftr* crypt_ftr, const unsig
load_count = load_crypto_mapping_table(crypt_ftr, master_key, real_blk_name, name, fd,
extra_params);
}
-
+
if (load_count < 0) {
SLOGE("Cannot load dm-crypt mapping table.\n");
goto errout;
@@ -1963,7 +1963,9 @@ static int cryptfs_restart_internal(int restart_main) {
SLOGE("Failed to setexeccon");
return -1;
}
- bool needs_cp = android::vold::cp_needsCheckpoint();
+ bool supportsCheckpoint = false;
+ android::vold::cp_supportsCheckpoint(supportsCheckpoint);
+ bool needs_cp = supportsCheckpoint && android::vold::cp_needsCheckpoint();
#ifdef CONFIG_HW_DISK_ENCRYPTION
while ((mount_rc = fs_mgr_do_mount(&fstab_default, DATA_MNT_POINT, blkdev.data(), 0,
needs_cp, false)) != 0) {
--
2.25.1

View File

@@ -0,0 +1,38 @@
From 8ffe3b736fa6736eb12951977eabdde6cd999359 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 28 Jan 2020 00:27:17 +0100
Subject: [PATCH 4/6] Sony has `texfat` exfat fs
---
fs/Exfat.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index 3aa9494..03ad649 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,11 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
bool IsSupported() {
return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 &&
- (IsFilesystemSupported("exfat") || IsFilesystemSupported("sdfat"));
+ (
+ IsFilesystemSupported("exfat") ||
+ IsFilesystemSupported("sdfat") ||
+ IsFilesystemSupported("texfat")
+ );
}
status_t Check(const std::string& source) {
@@ -64,6 +68,8 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi
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;
}
--
2.17.1

View File

@@ -0,0 +1,38 @@
From f558003318cd010d46dc3fca1508cf282d4ca56b 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 5/6] 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 d624d73..60056f3 100644
--- a/vold_prepare_subdirs.cpp
+++ b/vold_prepare_subdirs.cpp
@@ -164,7 +164,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";
}
}
if (flags & android::os::IVold::STORAGE_FLAG_CE) {
@@ -187,7 +187,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.17.1

View File

@@ -0,0 +1,25 @@
From c1ccb433badede868ab164e0b74d942fa6341559 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 6/6] Every voldmanaged storage is adoptable
---
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.cpp b/main.cpp
index ebe5510..113d9b9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -249,7 +249,7 @@ static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quot
std::string nickname(entry.label);
int flags = 0;
- if (entry.is_encryptable()) {
+ if (entry.is_encryptable() || true) {
flags |= android::vold::Disk::Flags::kAdoptable;
*has_adoptable = true;
}
--
2.17.1