From 34ba75d71f5d9bde1034cf2b245bb4c5a0453eac Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Wed, 9 Aug 2023 19:25:11 -0400 Subject: [PATCH] fwb: Add compatibility patch for MTK S IMS --- ...support-glob-matching-for-properties.patch | 6 +- ...d-support-for-app-signature-spoofing.patch | 6 +- ...PackageUtils-Add-glob-matching-suppo.patch | 6 +- .../base/0004-Global-VPN-feature-1-2.patch | 6 +- ...d.version.incremental-to-signal-OTA-.patch | 6 +- ...more-FDE-methods-from-StorageManager.patch | 127 ++++++++++++++++++ 6 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 frameworks/base/0006-Revert-Remove-more-FDE-methods-from-StorageManager.patch diff --git a/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch b/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch index db2a7ad..5521e96 100644 --- a/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch +++ b/frameworks/base/0001-PackageParser-support-glob-matching-for-properties.patch @@ -1,7 +1,7 @@ -From 2128e26099e203ebaf43796c23a5c423d4eb9272 Mon Sep 17 00:00:00 2001 +From 5e94fc70ba1963ed33eb6633702cce706b6814d1 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Tue, 12 Oct 2021 21:37:22 -0400 -Subject: [PATCH 1/5] PackageParser: support glob matching for properties +Subject: [PATCH 1/6] PackageParser: support glob matching for properties Needed to make phh's vendor overlays work --- @@ -32,5 +32,5 @@ index c15b3e0b80c3..05bb843c0c4d 100644 } return true; -- -2.40.1 +2.41.0 diff --git a/frameworks/base/0002-Add-support-for-app-signature-spoofing.patch b/frameworks/base/0002-Add-support-for-app-signature-spoofing.patch index 1af6132..966f492 100644 --- a/frameworks/base/0002-Add-support-for-app-signature-spoofing.patch +++ b/frameworks/base/0002-Add-support-for-app-signature-spoofing.patch @@ -1,7 +1,7 @@ -From d617a2ae55f3a345a3b0ea754208f4050ed0ae92 Mon Sep 17 00:00:00 2001 +From 3199a7f449d08acf306aafb180ccbcbacd993616 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 16 Oct 2021 05:27:57 -0700 -Subject: [PATCH 2/5] Add support for app signature spoofing +Subject: [PATCH 2/6] Add support for app signature spoofing This is needed by microG GmsCore to pretend to be the official Google Play Services package, because client apps check the package signature @@ -159,5 +159,5 @@ index 46b7460dff1b..40549962436f 100644 if (packageInfo == null) { return null; -- -2.40.1 +2.41.0 diff --git a/frameworks/base/0003-FrameworkParsingPackageUtils-Add-glob-matching-suppo.patch b/frameworks/base/0003-FrameworkParsingPackageUtils-Add-glob-matching-suppo.patch index 4443a8f..f449efc 100644 --- a/frameworks/base/0003-FrameworkParsingPackageUtils-Add-glob-matching-suppo.patch +++ b/frameworks/base/0003-FrameworkParsingPackageUtils-Add-glob-matching-suppo.patch @@ -1,7 +1,7 @@ -From 53b7e684e38bbcf5ed91c7c3ff35ce669fc7e3d6 Mon Sep 17 00:00:00 2001 +From 734839b7918f93cb746ebbe82179a9cbcf165424 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Fri, 2 Sep 2022 21:36:06 -0400 -Subject: [PATCH 3/5] FrameworkParsingPackageUtils: Add glob matching support +Subject: [PATCH 3/6] FrameworkParsingPackageUtils: Add glob matching support for properties This is now required in addition to the one in PackageParser in order @@ -36,5 +36,5 @@ index 3e1c5bb3d7ec..f15978c57574 100644 } return true; -- -2.40.1 +2.41.0 diff --git a/frameworks/base/0004-Global-VPN-feature-1-2.patch b/frameworks/base/0004-Global-VPN-feature-1-2.patch index e2bffeb..39f3205 100644 --- a/frameworks/base/0004-Global-VPN-feature-1-2.patch +++ b/frameworks/base/0004-Global-VPN-feature-1-2.patch @@ -1,7 +1,7 @@ -From 270918c3bef42e290e2f984a806ca9db213485bc Mon Sep 17 00:00:00 2001 +From af0cbe50e889694dc72ab84c4e1af816bdd199b9 Mon Sep 17 00:00:00 2001 From: Oliver Scott Date: Thu, 8 Jul 2021 10:41:43 -0400 -Subject: [PATCH 4/5] Global VPN feature [1/2] +Subject: [PATCH 4/6] Global VPN feature [1/2] * Modify existing VPN user range functions to conditionally have traffic from all users pass through the global VPN. @@ -197,5 +197,5 @@ index 8510de4ef201..7c02924a711d 100644 // To stop the VPN profile, the caller must be the current prepared package and must be // running an Ikev2VpnProfile. -- -2.40.1 +2.41.0 diff --git a/frameworks/base/0005-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch b/frameworks/base/0005-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch index 30cde47..77c15f4 100644 --- a/frameworks/base/0005-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch +++ b/frameworks/base/0005-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch @@ -1,7 +1,7 @@ -From d7f925f3680e21dc501ac67607737b9bc6ee8f24 Mon Sep 17 00:00:00 2001 +From 628ab41923ce082cd68ab8d4a184823b62a75ab3 Mon Sep 17 00:00:00 2001 From: dhacker29 Date: Tue, 24 Nov 2015 01:53:47 -0500 -Subject: [PATCH 5/5] fw/b: Use ro.build.version.incremental to signal OTA +Subject: [PATCH 5/6] fw/b: Use ro.build.version.incremental to signal OTA upgrades Squash of: @@ -232,5 +232,5 @@ index 88aeb17dc2b4..af7b481dd311 100644 } -- -2.40.1 +2.41.0 diff --git a/frameworks/base/0006-Revert-Remove-more-FDE-methods-from-StorageManager.patch b/frameworks/base/0006-Revert-Remove-more-FDE-methods-from-StorageManager.patch new file mode 100644 index 0000000..54e5bff --- /dev/null +++ b/frameworks/base/0006-Revert-Remove-more-FDE-methods-from-StorageManager.patch @@ -0,0 +1,127 @@ +From 54e70eb7ce231f6a1bef4ffdedb6008b3a949820 Mon Sep 17 00:00:00 2001 +From: Andy CrossGate Yan +Date: Sat, 15 Oct 2022 09:33:56 +0000 +Subject: [PATCH 6/6] Revert "Remove more FDE methods from StorageManager" + +This reverts commit bd13f84152449a3ead6fa8604fd31f48c0224676. +--- + .../android/os/storage/StorageManager.java | 69 ++++++++++++++++--- + .../internal/os/RoSystemProperties.java | 4 ++ + 2 files changed, 65 insertions(+), 8 deletions(-) + +diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java +index d9604b3f0145..603612e82007 100644 +--- a/core/java/android/os/storage/StorageManager.java ++++ b/core/java/android/os/storage/StorageManager.java +@@ -1681,13 +1681,18 @@ public class StorageManager { + } + + /** {@hide} +- * Is this device encrypted? +- *

+- * Note: all devices launching with Android 10 (API level 29) or later are +- * required to be encrypted. This should only ever return false for +- * in-development devices on which encryption has not yet been configured. +- * +- * @return true if encrypted, false if not encrypted ++ * Is this device encryptable or already encrypted? ++ * @return true for encryptable or encrypted ++ * false not encrypted and not encryptable ++ */ ++ public static boolean isEncryptable() { ++ return RoSystemProperties.CRYPTO_ENCRYPTABLE; ++ } ++ ++ /** {@hide} ++ * Is this device already encrypted? ++ * @return true for encrypted. (Implies isEncryptable() == true) ++ * false not encrypted + */ + public static boolean isEncrypted() { + return RoSystemProperties.CRYPTO_ENCRYPTED; +@@ -1696,7 +1701,7 @@ public class StorageManager { + /** {@hide} + * Is this device file encrypted? + * @return true for file encrypted. (Implies isEncrypted() == true) +- * false not encrypted or using "managed" encryption ++ * false not encrypted or block encrypted + */ + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + public static boolean isFileEncryptedNativeOnly() { +@@ -1706,6 +1711,54 @@ public class StorageManager { + return RoSystemProperties.CRYPTO_FILE_ENCRYPTED; + } + ++ /** {@hide} ++ * Is this device block encrypted? ++ * @return true for block encrypted. (Implies isEncrypted() == true) ++ * false not encrypted or file encrypted ++ */ ++ public static boolean isBlockEncrypted() { ++ return false; ++ } ++ ++ /** {@hide} ++ * Is this device block encrypted with credentials? ++ * @return true for crediential block encrypted. ++ * (Implies isBlockEncrypted() == true) ++ * false not encrypted, file encrypted or default block encrypted ++ */ ++ public static boolean isNonDefaultBlockEncrypted() { ++ return false; ++ } ++ ++ /** {@hide} ++ * Is this device in the process of being block encrypted? ++ * @return true for encrypting. ++ * false otherwise ++ * Whether device isEncrypted at this point is undefined ++ * Note that only system services and CryptKeeper will ever see this return ++ * true - no app will ever be launched in this state. ++ * Also note that this state will not change without a teardown of the ++ * framework, so no service needs to check for changes during their lifespan ++ */ ++ public static boolean isBlockEncrypting() { ++ return false; ++ } ++ ++ /** {@hide} ++ * Is this device non default block encrypted and in the process of ++ * prompting for credentials? ++ * @return true for prompting for credentials. ++ * (Implies isNonDefaultBlockEncrypted() == true) ++ * false otherwise ++ * Note that only system services and CryptKeeper will ever see this return ++ * true - no app will ever be launched in this state. ++ * Also note that this state will not change without a teardown of the ++ * framework, so no service needs to check for changes during their lifespan ++ */ ++ public static boolean inCryptKeeperBounce() { ++ return false; ++ } ++ + /** {@hide} */ + public static boolean isFileEncryptedEmulatedOnly() { + return SystemProperties.getBoolean(StorageManager.PROP_EMULATE_FBE, false); +diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java +index cccd80e82420..adb5c107bc62 100644 +--- a/core/java/com/android/internal/os/RoSystemProperties.java ++++ b/core/java/com/android/internal/os/RoSystemProperties.java +@@ -62,10 +62,14 @@ public class RoSystemProperties { + public static final CryptoProperties.type_values CRYPTO_TYPE = + CryptoProperties.type().orElse(CryptoProperties.type_values.NONE); + // These are pseudo-properties ++ public static final boolean CRYPTO_ENCRYPTABLE = ++ CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED; + public static final boolean CRYPTO_ENCRYPTED = + CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED; + public static final boolean CRYPTO_FILE_ENCRYPTED = + CRYPTO_TYPE == CryptoProperties.type_values.FILE; ++ public static final boolean CRYPTO_BLOCK_ENCRYPTED = ++ CRYPTO_TYPE == CryptoProperties.type_values.BLOCK; + + public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG = + "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); +-- +2.41.0 +