Initial commit for Android 10, syncing up to v201

This commit is contained in:
Andy CrossGate Yan
2019-10-23 09:02:48 +00:00
commit 017c525e4f
111 changed files with 8014 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From c3b771c76088e9308759d9d59a79c67fe52514b6 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 2a8e110..8b061cb 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -224,6 +224,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,22 @@
From 95622cc1d194d74b5d7c38747c2b0ce14470d030 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 20:53:12 +0200
Subject: [PATCH 2/6] Don't set reserved_disk group, it panics old inits
Change-Id: Ic4893136c188059d40d3e97099f7990dfa7432a8
---
vold.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/vold.rc b/vold.rc
index 93d8786..c27aeda 100644
--- a/vold.rc
+++ b/vold.rc
@@ -5,4 +5,3 @@ service vold /system/bin/vold \
ioprio be 2
writepid /dev/cpuset/foreground/tasks
shutdown critical
- group root reserved_disk
--
2.17.1

View File

@@ -0,0 +1,26 @@
From 54e73dca9f6ec77bbd2f88d3daaef3c9c87979a1 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 20:54:08 +0200
Subject: [PATCH 3/6] Create vendor_de. This is done by /init.rc on
system-as-root device
---
FsCrypt.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index 8b061cb..bb90ee0 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -669,6 +669,8 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_
auto vendor_de_path = android::vold::BuildDataVendorDePath(user_id);
auto user_de_path = android::vold::BuildDataUserDePath(volume_uuid, user_id);
+ prepare_dir(android::vold::BuildDataPath("") + "/vendor_de", 0771, 0, 0);
+
if (volume_uuid.empty()) {
if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false;
#if MANAGE_MISC_DIRS
--
2.17.1

View File

@@ -0,0 +1,44 @@
From 742595997f8f2380e0229e231848211c8126b92f 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 4/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 c624eb9..b9844a5 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) {
@@ -60,13 +60,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,25 @@
From 1cdb0168b3bc3981f71aba62f51064be57ccf8f5 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Aug 2018 22:38:08 +0200
Subject: [PATCH 5/6] Also create vendor_ce (same reason as vendor_de)
---
FsCrypt.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index bb90ee0..ec7ec7d 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -709,6 +709,8 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_
auto media_ce_path = android::vold::BuildDataMediaCePath(volume_uuid, user_id);
auto user_ce_path = android::vold::BuildDataUserCePath(volume_uuid, user_id);
+ prepare_dir(android::vold::BuildDataPath("") + "/vendor_ce", 0771, 0, 0);
+
if (volume_uuid.empty()) {
if (!prepare_dir(system_ce_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false;
if (!prepare_dir(misc_ce_path, 01771, AID_SYSTEM, AID_MISC)) return false;
--
2.17.1

View File

@@ -0,0 +1,32 @@
From b48715b53228daedd29507239ceb1704453f4163 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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cryptfs.cpp b/cryptfs.cpp
index ed9a53e..d2971ff 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -1888,7 +1888,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)) != 0) {
--
2.17.1

View File

@@ -0,0 +1,32 @@
From d184ff43ee1dd74f64fd9a0db99c29a225c22147 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 6/6] 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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cryptfs.cpp b/cryptfs.cpp
index 07617e9..dbdc5af 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -1643,7 +1643,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();
while ((mount_rc = fs_mgr_do_mount(&fstab_default, DATA_MNT_POINT, crypto_blkdev, 0,
needs_cp)) != 0) {
if (mount_rc == FS_MGR_DOMNT_BUSY) {
--
2.17.1