[3/n] Android 14 port

More required fwb patches
This commit is contained in:
Peter Cai 2023-10-07 19:38:33 -04:00
parent edbcfc74f2
commit c06b6e26a2
8 changed files with 272 additions and 4 deletions

View file

@ -1,7 +1,7 @@
From c25e4bfafc3b0b9f44c9cd2b9fed590299480f71 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Tue, 12 Oct 2021 21:37:22 -0400
Subject: [PATCH 1/4] PackageParser: support glob matching for properties
Subject: [PATCH 1/8] PackageParser: support glob matching for properties
Needed to make phh's vendor overlays work
---

View file

@ -1,7 +1,7 @@
From 540857efdf49ba24121970d2b836eb38ab7e7b32 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Sat, 16 Oct 2021 05:27:57 -0700
Subject: [PATCH 2/4] Add support for app signature spoofing
Subject: [PATCH 2/8] 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

View file

@ -1,7 +1,7 @@
From 148fe28e381f444f7d06ea611dbd82c1e1ae8573 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Fri, 2 Sep 2022 21:36:06 -0400
Subject: [PATCH 3/4] FrameworkParsingPackageUtils: Add glob matching support
Subject: [PATCH 3/8] FrameworkParsingPackageUtils: Add glob matching support
for properties
This is now required in addition to the one in PackageParser in order

View file

@ -1,7 +1,7 @@
From 00b72ce36c74f294e9823a41c0f50f73d435b1dd Mon Sep 17 00:00:00 2001
From: Oliver Scott <olivercscott@gmail.com>
Date: Thu, 8 Jul 2021 10:41:43 -0400
Subject: [PATCH 4/4] Global VPN feature [1/2]
Subject: [PATCH 4/8] Global VPN feature [1/2]
* Modify existing VPN user range functions to conditionally have traffic
from all users pass through the global VPN.

View file

@ -0,0 +1,110 @@
From aa7e0467d0c5c98a9de336ef8e3e635491c8395a Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 15 Oct 2022 09:33:56 +0000
Subject: [PATCH 5/8] Revert "Remove more FDE methods from StorageManager"
This reverts commit bd13f84152449a3ead6fa8604fd31f48c0224676.
Change-Id: Ic394934ec27b1a486c60123130825d44dad73412
---
.../android/os/storage/StorageManager.java | 57 +++++++++++++++++++
.../internal/os/RoSystemProperties.java | 4 ++
2 files changed, 61 insertions(+)
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 80dd48825ba7..cb4769ff4ec3 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -1660,6 +1660,15 @@ public class StorageManager {
return false;
}
+ /** {@hide}
+ * 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 encrypted?
* <p>
@@ -1693,6 +1702,54 @@ public class StorageManager {
return isFileEncrypted();
}
+ /** {@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}
* @deprecated Use {@link #isFileEncrypted} instead, since emulated FBE is no longer supported.
*/
diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java
index 40d5c4761dff..66288706b0f1 100644
--- a/core/java/com/android/internal/os/RoSystemProperties.java
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
@@ -68,10 +68,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

View file

@ -0,0 +1,46 @@
From 5c0f50bd093ad8fa878b79d124942d1a5bceef00 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Dec 2021 15:01:41 -0500
Subject: [PATCH 6/8] Dynamically resize boot animation to match screen size
Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205
---
cmds/bootanimation/BootAnimation.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index a8b6c0b70804..9c50e954cee5 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -605,6 +605,28 @@ status_t BootAnimation::readyToRun() {
mFlingerSurface = s;
mTargetInset = -1;
+ if ( mAnimation != nullptr ) {
+ SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width);
+ int origWidth = mAnimation->width;
+ if ( mAnimation->width*2 < mWidth ) {
+ SLOGE("Making animation bigger");
+ mAnimation->width *= 2;
+ mAnimation->height *= 2;
+ } else if ( mWidth < mAnimation->width ) {
+ SLOGE("Making animation smaller");
+ mAnimation->width /= 2;
+ mAnimation->height /= 2;
+ }
+ for (Animation::Part& part : mAnimation->parts) {
+ for(auto& frame: part.frames) {
+ if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) {
+ frame.trimWidth = mAnimation->width;
+ frame.trimHeight = mAnimation->height;
+ }
+ }
+ }
+ }
+
// Rotate the boot animation according to the value specified in the sysprop
// ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
// ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
--
2.41.0

View file

@ -0,0 +1,40 @@
From d2b69b92fe4f37f8bcfdd4b8e3b756e5ad253663 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Wed, 2 Aug 2023 20:59:53 +0800
Subject: [PATCH 7/8] Restore getSimStateForSlotIndex in SubscriptionManager
MTK IMS still needs it here
Change-Id: I41bac57c68055f369232359a464642daab94403b
---
.../android/telephony/SubscriptionManager.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 64e43568e4d6..cfb4f12815a2 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2549,6 +2549,20 @@ public class SubscriptionManager {
return TelephonyManager.getDefault().isNetworkRoaming(subId);
}
+ /**
+ * Returns a constant indicating the state of sim for the slot index.
+ *
+ * @param slotIndex Logical SIM slot index.
+ *
+ * @see TelephonyManager.SimState
+ *
+ * @hide
+ */
+ @TelephonyManager.SimState
+ public static int getSimStateForSlotIndex(int slotIndex) {
+ return TelephonyManager.getSimStateForSlotIndex(slotIndex);
+ }
+
/**
* Set a field in the subscription database. Note not all fields are supported.
*
--
2.41.0

View file

@ -0,0 +1,72 @@
From 8a8a763c989ddbf886288a130a66c39a4613c515 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 12 Aug 2023 20:11:17 +0800
Subject: [PATCH 8/8] Add runWithCleanCallingIdentity variant with both
executor and return value
This complements the fixup to ImsPhoneCallTracker (in fw/o/t) for U
Change-Id: If444290787025e130dce4bdeaf92372ae32793fe
---
.../telephony/util/TelephonyUtils.java | 32 ++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
index 9a8c9655375d..454080144d35 100644
--- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
+++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
@@ -42,7 +42,9 @@ import com.android.internal.telephony.ITelephony;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
@@ -151,6 +153,34 @@ public final class TelephonyUtils {
}
}
+ /**
+ * Convenience method for running the provided action in the provided
+ * executor enclosed in
+ * {@link Binder#clearCallingIdentity}/{@link Binder#restoreCallingIdentity} and return
+ * the result.
+ *
+ * Any exception thrown by the given action will need to be handled by caller.
+ *
+ */
+ public static <T> T runWithCleanCallingIdentity(
+ @NonNull Supplier<T> action, @NonNull Executor executor) {
+ if (action != null) {
+ if (executor != null) {
+ try {
+ return CompletableFuture.supplyAsync(
+ () -> runWithCleanCallingIdentity(action), executor).get();
+ } catch (ExecutionException | InterruptedException e) {
+ Log.w(LOG_TAG, "TelephonyUtils : runWithCleanCallingIdentity exception: "
+ + e.getMessage());
+ return null;
+ }
+ } else {
+ return runWithCleanCallingIdentity(action);
+ }
+ }
+ return null;
+ }
+
/**
* Filter values in bundle to only basic types.
*/
@@ -319,4 +349,4 @@ public final class TelephonyUtils {
return false;
}
-}
\ No newline at end of file
+}
--
2.41.0