Initial unified commit for Android 14, with "light" GSI target

This commit is contained in:
Andy CrossGate Yan
2024-02-17 16:48:27 +08:00
commit ea765d3ff5
117 changed files with 15033 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
From 36920a508f5c97585652116c356451ae759bf946 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 25 Oct 2020 23:57:26 +0100
Subject: [PATCH 1/5] Re-implement fnmatch-like behaviour for RRO java-side
T: Also apply to FrameworkParsingPackageUtils (@PeterCxy)
Change-Id: Id38292a9a1453aa87b8401c1fdb390fa4e63c7d1
---
.../pm/parsing/FrameworkParsingPackageUtils.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
index b75ba82ad091..b344f7232190 100644
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
@@ -223,8 +223,17 @@ public class FrameworkParsingPackageUtils {
continue;
}
// 3. Check if prop is equal to expected value.
- if (!currValue.equals(propValues[i])) {
- return false;
+ final String value = propValues[i];
+ if(value.startsWith("+")) {
+ final java.util.regex.Pattern regex = java.util.regex.Pattern.compile(value.substring(1, value.length()).replace("*", ".*"));
+ java.util.regex.Matcher matcher = regex.matcher(currValue);
+ if (!matcher.find()) {
+ return false;
+ }
+ } else {
+ if(!value.equals(currValue)) {
+ return false;
+ }
}
}
return true;
--
2.34.1

View File

@@ -0,0 +1,46 @@
From 69fbb22f3d265d9baf7ba87c2e0d42671a898037 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 24 Mar 2018 08:01:48 +0100
Subject: [PATCH 2/5] LightsService: Alternative backlight scale
Reserved a manual override just in case
Change-Id: I46ae69c758d1a4609d89cf1c293488ea5fc76787
---
.../com/android/server/lights/LightsService.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index fea6b29d9260..2a9a3b63ea2e 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -32,6 +32,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.os.Trace;
import android.provider.Settings;
import android.util.Slog;
@@ -295,6 +296,18 @@ public class LightsService extends SystemService {
return;
}
int brightnessInt = BrightnessSynchronizer.brightnessFloatToInt(brightness);
+ if (mHwLight.id == 0) {
+ int scaleOverrideValue = SystemProperties.getInt("persist.sys.treble.backlight_scale.override_value", -1);
+ if (scaleOverrideValue != -1) {
+ setLightLocked(brightnessInt * scaleOverrideValue / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
+ return;
+ }
+ int scaleValue = SystemProperties.getInt("persist.sys.treble.backlight_scale.value", -1);
+ if (scaleValue != -1) {
+ setLightLocked(brightnessInt * scaleValue / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
+ return;
+ }
+ }
int color = brightnessInt & 0x000000ff;
color = 0xff000000 | (color << 16) | (color << 8) | color;
setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
--
2.34.1

View File

@@ -0,0 +1,110 @@
From f5e64bb671b92afc7e9d897c950f3c51aebfe882 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 3/5] 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.34.1

View File

@@ -0,0 +1,40 @@
From aaf44460fbf5dcdbb844e4c5bba99b48576e59ef 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 4/5] 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.34.1

View File

@@ -0,0 +1,88 @@
From d9dd8793634f892d905e46d45e190f72f8761def Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 19 Nov 2023 23:07:03 +0800
Subject: [PATCH 5/5] Restore getPhysicalDisplayIds in SurfaceControl
For convenience of accessing DynamicDisplayInfo from Settings
Copy over the updated implementation from DisplayControl while we're at it
This partially reverts commit e2f333728788ad88a65208a6119aed90e13e7040.
Change-Id: Ie056ecaf76acbc70d73e1c26cc4542088fcda18d
---
core/java/android/view/SurfaceControl.java | 8 ++++++++
core/jni/android_view_SurfaceControl.cpp | 18 ++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index c11f4975149d..cf9262aafb03 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -179,6 +179,7 @@ public final class SurfaceControl implements Parcelable {
private static native boolean nativeClearAnimationFrameStats();
private static native boolean nativeGetAnimationFrameStats(WindowAnimationFrameStats outStats);
+ private static native long[] nativeGetPhysicalDisplayIds();
private static native void nativeSetDisplaySurface(long transactionObj,
IBinder displayToken, long nativeSurfaceObject);
private static native void nativeSetDisplayLayerStack(long transactionObj,
@@ -2402,6 +2403,13 @@ public final class SurfaceControl implements Parcelable {
IVirtualDisplayCallback.Stub.asInterface(displayToken));
}
+ /**
+ * @hide
+ */
+ public static long[] getPhysicalDisplayIds() {
+ return nativeGetPhysicalDisplayIds();
+ }
+
/**
* Returns whether protected content is supported in GPU composition.
* @hide
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 424925328dfd..2ebd6bec0b18 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -36,6 +36,7 @@
#include <gui/SurfaceComposerClient.h>
#include <jni.h>
#include <nativehelper/JNIHelp.h>
+#include <nativehelper/ScopedPrimitiveArray.h>
#include <nativehelper/ScopedUtfChars.h>
#include <private/gui/ComposerService.h>
#include <stdio.h>
@@ -985,6 +986,21 @@ static void nativeSetDestinationFrame(JNIEnv* env, jclass clazz, jlong transacti
transaction->setDestinationFrame(ctrl, crop);
}
+static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) {
+ const auto displayIds = SurfaceComposerClient::getPhysicalDisplayIds();
+ ScopedLongArrayRW values(env, env->NewLongArray(displayIds.size()));
+ if (values.get() == nullptr) {
+ jniThrowException(env, "java/lang/OutOfMemoryError", nullptr);
+ return nullptr;
+ }
+
+ for (size_t i = 0; i < displayIds.size(); ++i) {
+ values[i] = static_cast<jlong>(displayIds[i].value);
+ }
+
+ return values.getJavaArray();
+}
+
static jobject nativeGetDisplayedContentSamplingAttributes(JNIEnv* env, jclass clazz,
jobject tokenObj) {
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
@@ -2133,6 +2149,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetFrameRate },
{"nativeSetDefaultFrameRateCompatibility", "(JJI)V",
(void*)nativeSetDefaultFrameRateCompatibility},
+ {"nativeGetPhysicalDisplayIds", "()[J",
+ (void*)nativeGetPhysicalDisplayIds },
{"nativeSetDisplaySurface", "(JLandroid/os/IBinder;J)V",
(void*)nativeSetDisplaySurface },
{"nativeSetDisplayLayerStack", "(JLandroid/os/IBinder;I)V",
--
2.34.1