Compare commits

..

No commits in common. "aosp15" and "aosp15" have entirely different histories.

47 changed files with 772 additions and 1948 deletions

View file

@ -1,4 +1,4 @@
From 9f770e862954f07e8a7cce36aedd4879b10641c6 Mon Sep 17 00:00:00 2001 From e0e96a633b717830325cd6189fff23e57d7ee6f1 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me> From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 19 Feb 2022 08:20:25 -0500 Date: Sat, 19 Feb 2022 08:20:25 -0500
Subject: [PATCH] Add new mechanism to fake vendor props on a per-process basis Subject: [PATCH] Add new mechanism to fake vendor props on a per-process basis
@ -132,5 +132,5 @@ index e0d38a8..4f54885 100644
static bool is_appcompat_override(const char* name) { static bool is_appcompat_override(const char* name) {
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From 875011b65d3839871b488b18d483fd56f2306a7b Mon Sep 17 00:00:00 2001 From 30492f22b249f2bd73085341f231da81ed290cf5 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 15:42:39 -0400 Date: Wed, 24 Aug 2022 15:42:39 -0400
Subject: [PATCH 1/6] APM: Optionally force-load audio policy for system-side Subject: [PATCH 1/6] APM: Optionally force-load audio policy for system-side
@ -57,5 +57,5 @@ index 6f19a7a145..08836377b7 100644
// Global Configuration // Global Configuration
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From d24b962cb20fb0a3e807d05c534f43f8bd0ce350 Mon Sep 17 00:00:00 2001 From 710bea3b445304ca1201b8923cdc3bf824d6a10e Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Thu, 25 Aug 2022 13:30:29 -0400 Date: Thu, 25 Aug 2022 13:30:29 -0400
Subject: [PATCH 2/6] APM: Remove A2DP audio ports from the primary HAL Subject: [PATCH 2/6] APM: Remove A2DP audio ports from the primary HAL
@ -75,5 +75,5 @@ index 08836377b7..0f7c903909 100644
RouteTraits::Collection routes; RouteTraits::Collection routes;
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From b3bc05d8e2bb94c4992a12a943d16c27554fa54d Mon Sep 17 00:00:00 2001 From d2fda04e8ad3ff0d3fda168fd41e493e9db54e7a Mon Sep 17 00:00:00 2001
From: ponces <ponces26@gmail.com> From: ponces <ponces26@gmail.com>
Date: Mon, 24 Oct 2022 09:38:34 +0100 Date: Mon, 24 Oct 2022 09:38:34 +0100
Subject: [PATCH 3/6] voip: Fix high pitched voice on Qualcomm devices Subject: [PATCH 3/6] voip: Fix high pitched voice on Qualcomm devices
@ -52,5 +52,5 @@ index 0f7c903909..c4474cf1c2 100644
ALOGE("%s: No %s found", __func__, Attributes::name); ALOGE("%s: No %s found", __func__, Attributes::name);
return BAD_VALUE; return BAD_VALUE;
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From 88eee2c55fa4e85aeef0df59c9b788b2b7868c6b Mon Sep 17 00:00:00 2001 From 68b78f8122c2ba128a8314a8ea3e8a50afc4158b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me> From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 5 Aug 2019 18:09:50 +0200 Date: Mon, 5 Aug 2019 18:09:50 +0200
Subject: [PATCH 4/6] Fix BT in-call on CAF devices Subject: [PATCH 4/6] Fix BT in-call on CAF devices
@ -127,5 +127,5 @@ index c4474cf1c2..c1df8f278b 100644
for (const xmlNode *children = cur->xmlChildrenNode; children != NULL; for (const xmlNode *children = cur->xmlChildrenNode; children != NULL;
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From 79a670c8e20a8eb68849be7e3f9b4c0421d92073 Mon Sep 17 00:00:00 2001 From a20df6bb1d38d2bb402c16fc64fcafd20464a757 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me> From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 21 Dec 2020 20:19:11 +0100 Date: Mon, 21 Dec 2020 20:19:11 +0100
Subject: [PATCH 5/6] Make camera IDs filter-out optional Subject: [PATCH 5/6] Make camera IDs filter-out optional
@ -11,10 +11,10 @@ Add a property for that.
1 file changed, 9 insertions(+), 5 deletions(-) 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index a8d748028b..203a166a36 100644 index 51f06cb013..4892d80cfa 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp --- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp +++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -324,7 +324,9 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds @@ -318,7 +318,9 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
// API1 app doesn't handle logical and physical camera devices well. So // API1 app doesn't handle logical and physical camera devices well. So
// for each camera facing, only take the first id advertised by HAL in // for each camera facing, only take the first id advertised by HAL in
// all [logical, physical1, physical2, ...] id combos, and filter out the rest. // all [logical, physical1, physical2, ...] id combos, and filter out the rest.
@ -25,7 +25,7 @@ index a8d748028b..203a166a36 100644
collectDeviceIdsLocked(providerDeviceIds, publicDeviceIds, systemDeviceIds); collectDeviceIdsLocked(providerDeviceIds, publicDeviceIds, systemDeviceIds);
} }
auto sortFunc = auto sortFunc =
@@ -1108,10 +1110,12 @@ SystemCameraKind CameraProviderManager::ProviderInfo::DeviceInfo3::getSystemCame @@ -1102,10 +1104,12 @@ SystemCameraKind CameraProviderManager::ProviderInfo::DeviceInfo3::getSystemCame
// Go through the capabilities and check if it has // Go through the capabilities and check if it has
// ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA // ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA
@ -43,5 +43,5 @@ index a8d748028b..203a166a36 100644
} }
return SystemCameraKind::PUBLIC; return SystemCameraKind::PUBLIC;
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From d483a03149f587b3078d81256ac356382aafdd6b Mon Sep 17 00:00:00 2001 From 5ce88c0c583ad228cb456d68543cebb5c23390a7 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Thu, 18 Aug 2022 15:44:46 -0400 Date: Thu, 18 Aug 2022 15:44:46 -0400
Subject: [PATCH 6/6] APM: Restore S, R and Q behavior respectively for Subject: [PATCH 6/6] APM: Restore S, R and Q behavior respectively for
@ -36,10 +36,10 @@ Change-Id: I56d36d2aef4319935cb88a3e4771b23c6d5b2145
2 files changed, 148 insertions(+), 61 deletions(-) 2 files changed, 148 insertions(+), 61 deletions(-)
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 73b574ccfa..4c44acb966 100644 index 1f8cedd290..cfac4a2090 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -746,6 +746,17 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -726,6 +726,17 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
ALOGV("%s device rxDevice %s txDevice %s", __func__, ALOGV("%s device rxDevice %s txDevice %s", __func__,
rxDevices.itemAt(0)->toString().c_str(), txSourceDevice->toString().c_str()); rxDevices.itemAt(0)->toString().c_str(), txSourceDevice->toString().c_str());
@ -57,7 +57,7 @@ index 73b574ccfa..4c44acb966 100644
auto telephonyRxModule = auto telephonyRxModule =
mHwModules.getModuleForDeviceType(AUDIO_DEVICE_IN_TELEPHONY_RX, AUDIO_FORMAT_DEFAULT); mHwModules.getModuleForDeviceType(AUDIO_DEVICE_IN_TELEPHONY_RX, AUDIO_FORMAT_DEFAULT);
auto telephonyTxModule = auto telephonyTxModule =
@@ -768,9 +779,20 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -748,9 +759,20 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
ALOGE("%s() no telephony Tx and/or RX device", __func__); ALOGE("%s() no telephony Tx and/or RX device", __func__);
return INVALID_OPERATION; return INVALID_OPERATION;
} }
@ -81,7 +81,7 @@ index 73b574ccfa..4c44acb966 100644
} else { } else {
// If the RX device is on the primary HW module, then use legacy routing method for // If the RX device is on the primary HW module, then use legacy routing method for
// voice calls via setOutputDevice() on primary output. // voice calls via setOutputDevice() on primary output.
@@ -794,7 +816,14 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -774,7 +796,14 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
} }
muteWaitMs = setOutputDevices(__func__, mPrimaryOutput, rxDevices, true, delayMs); muteWaitMs = setOutputDevices(__func__, mPrimaryOutput, rxDevices, true, delayMs);
} else { // create RX path audio patch } else { // create RX path audio patch
@ -97,7 +97,7 @@ index 73b574ccfa..4c44acb966 100644
// If the TX device is on the primary HW module but RX device is // If the TX device is on the primary HW module but RX device is
// on other HW module, SinkMetaData of telephony input should handle it // on other HW module, SinkMetaData of telephony input should handle it
// assuming the device uses audio HAL V5.0 and above // assuming the device uses audio HAL V5.0 and above
@@ -810,6 +839,13 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -790,6 +819,13 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
} }
} }
connectTelephonyTxAudioSource(txSourceDevice, txSinkDevice, delayMs); connectTelephonyTxAudioSource(txSourceDevice, txSinkDevice, delayMs);
@ -111,7 +111,7 @@ index 73b574ccfa..4c44acb966 100644
} else if (fix_call_audio_patch()) { } else if (fix_call_audio_patch()) {
disconnectTelephonyAudioSource(mCallTxSourceClient); disconnectTelephonyAudioSource(mCallTxSourceClient);
} }
@@ -819,6 +855,36 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -799,6 +835,36 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
return NO_ERROR; return NO_ERROR;
} }
@ -148,7 +148,7 @@ index 73b574ccfa..4c44acb966 100644
bool AudioPolicyManager::isDeviceOfModule( bool AudioPolicyManager::isDeviceOfModule(
const sp<DeviceDescriptor>& devDesc, const char *moduleId) const { const sp<DeviceDescriptor>& devDesc, const char *moduleId) const {
sp<HwModule> module = mHwModules.getModuleFromName(moduleId); sp<HwModule> module = mHwModules.getModuleFromName(moduleId);
@@ -5636,83 +5702,101 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch * @@ -5513,83 +5579,101 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
// in config XML to reach the sink so that is can be declared as available. // in config XML to reach the sink so that is can be declared as available.
audio_io_handle_t output = AUDIO_IO_HANDLE_NONE; audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
sp<SwAudioOutputDescriptor> outputDesc; sp<SwAudioOutputDescriptor> outputDesc;
@ -166,14 +166,14 @@ index 73b574ccfa..4c44acb966 100644
- : audio_channel_mask_in_to_out(sourceMask); - : audio_channel_mask_in_to_out(sourceMask);
- config.format = sourceDesc->config().format; - config.format = sourceDesc->config().format;
- audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE; - audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
- DeviceIdVector selectedDeviceIds; - audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
- bool isRequestedDeviceForExclusiveUse = false; - bool isRequestedDeviceForExclusiveUse = false;
- output_type_t outputType; - output_type_t outputType;
- bool isSpatialized; - bool isSpatialized;
- bool isBitPerfect; - bool isBitPerfect;
- getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes, - getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
- &stream, sourceDesc->uid(), &config, &flags, - &stream, sourceDesc->uid(), &config, &flags,
- &selectedDeviceIds, &isRequestedDeviceForExclusiveUse, - &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
- nullptr, &outputType, &isSpatialized, &isBitPerfect); - nullptr, &outputType, &isSpatialized, &isBitPerfect);
- if (output == AUDIO_IO_HANDLE_NONE) { - if (output == AUDIO_IO_HANDLE_NONE) {
- ALOGV("%s no output for device %s", - ALOGV("%s no output for device %s",
@ -219,14 +219,14 @@ index 73b574ccfa..4c44acb966 100644
+ : audio_channel_mask_in_to_out(sourceMask); + : audio_channel_mask_in_to_out(sourceMask);
+ config.format = sourceDesc->config().format; + config.format = sourceDesc->config().format;
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE; + audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
+ DeviceIdVector selectedDeviceIds; + audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
+ bool isRequestedDeviceForExclusiveUse = false; + bool isRequestedDeviceForExclusiveUse = false;
+ output_type_t outputType; + output_type_t outputType;
+ bool isSpatialized; + bool isSpatialized;
+ bool isBitPerfect; + bool isBitPerfect;
+ getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes, + getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
+ &stream, sourceDesc->uid(), &config, &flags, + &stream, sourceDesc->uid(), &config, &flags,
+ &selectedDeviceIds, &isRequestedDeviceForExclusiveUse, + &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
+ nullptr, &outputType, &isSpatialized, &isBitPerfect); + nullptr, &outputType, &isSpatialized, &isBitPerfect);
+ if (output == AUDIO_IO_HANDLE_NONE) { + if (output == AUDIO_IO_HANDLE_NONE) {
+ ALOGV("%s no output for device %s", + ALOGV("%s no output for device %s",
@ -308,10 +308,10 @@ index 73b574ccfa..4c44acb966 100644
AUDIO_STREAM_PATCH; AUDIO_STREAM_PATCH;
patchBuilder.addSource(srcMixPortConfig); patchBuilder.addSource(srcMixPortConfig);
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 44863eedc2..e8024942fd 100644 index 84edf34da4..4b1093cb23 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h --- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -1017,6 +1017,9 @@ protected: @@ -1013,6 +1013,9 @@ protected:
SoundTriggerSessionCollection mSoundTriggerSessions; SoundTriggerSessionCollection mSoundTriggerSessions;
@ -322,5 +322,5 @@ index 44863eedc2..e8024942fd 100644
SourceClientCollection mAudioSources; SourceClientCollection mAudioSources;
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 3c6a1bbffa88d93be209b41b911f192618a3b8e6 Mon Sep 17 00:00:00 2001 From 2b9fc3684d24ff3276f18c4de93402cf7d92e5c3 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Tue, 12 Oct 2021 21:37:22 -0400 Date: Tue, 12 Oct 2021 21:37:22 -0400
Subject: [PATCH 01/11] PackageParser: support glob matching for properties Subject: [PATCH 01/12] PackageParser: support glob matching for properties
Needed to make phh's vendor overlays work Needed to make phh's vendor overlays work
--- ---
@ -32,5 +32,5 @@ index 4b579e7db..8176cf8e8 100644
} }
return true; return true;
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 6d3e460a5e0df0f6ac2f653d0577560a2c8f32d3 Mon Sep 17 00:00:00 2001 From 6de413c8d88d2d6f02e81a4247af47b506ea4451 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Fri, 2 Sep 2022 21:36:06 -0400 Date: Fri, 2 Sep 2022 21:36:06 -0400
Subject: [PATCH 02/11] FrameworkParsingPackageUtils: Add glob matching support Subject: [PATCH 02/12] FrameworkParsingPackageUtils: Add glob matching support
for properties for properties
This is now required in addition to the one in PackageParser in order This is now required in addition to the one in PackageParser in order
@ -13,7 +13,7 @@ Change-Id: Ie8679c0ffe03cead4a68bd2d0eb429f05af2d417
1 file changed, 10 insertions(+), 2 deletions(-) 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
index e30f871b6..a2979f695 100644 index 153dd9a93..900151440 100644
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java --- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java +++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
@@ -215,8 +215,16 @@ public class FrameworkParsingPackageUtils { @@ -215,8 +215,16 @@ public class FrameworkParsingPackageUtils {
@ -36,5 +36,5 @@ index e30f871b6..a2979f695 100644
} }
return true; return true;
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 176fce488f4206d10e3d4873bce3a43a97540890 Mon Sep 17 00:00:00 2001 From a5c2cffdac5181c437437fee002526d43a080c51 Mon Sep 17 00:00:00 2001
From: Oliver Scott <olivercscott@gmail.com> From: Oliver Scott <olivercscott@gmail.com>
Date: Thu, 8 Jul 2021 10:41:43 -0400 Date: Thu, 8 Jul 2021 10:41:43 -0400
Subject: [PATCH 03/11] Global VPN feature [1/2] Subject: [PATCH 03/12] Global VPN feature [1/2]
* Modify existing VPN user range functions to conditionally have traffic * Modify existing VPN user range functions to conditionally have traffic
from all users pass through the global VPN. from all users pass through the global VPN.
@ -28,10 +28,10 @@ Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
3 files changed, 46 insertions(+), 5 deletions(-) 3 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4acb6312f..dbc9845a8 100644 index ef8b3d738..b5014f24e 100644
--- a/core/java/android/provider/Settings.java --- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java
@@ -18232,6 +18232,12 @@ public final class Settings { @@ -18029,6 +18029,12 @@ public final class Settings {
CLOCKWORK_HOME_READY, CLOCKWORK_HOME_READY,
}; };
@ -72,7 +72,7 @@ index f39762766..c7dc809c9 100644
mVpnUserId = newUserInfo.restrictedProfileParentId; mVpnUserId = newUserInfo.restrictedProfileParentId;
} else { } else {
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 4c5f65285..1c546be6f 100644 index e1bb8a1a0..cf89eb842 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java --- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -778,6 +778,15 @@ public class Vpn { @@ -778,6 +778,15 @@ public class Vpn {
@ -197,5 +197,5 @@ index 4c5f65285..1c546be6f 100644
// To stop the VPN profile, the caller must be the current prepared package and must be // To stop the VPN profile, the caller must be the current prepared package and must be
// running an Ikev2VpnProfile. // running an Ikev2VpnProfile.
-- --
2.48.1 2.44.0

View file

@ -0,0 +1,46 @@
From 1357225dd52f3f2a6a1766c33eca32506b8f7ac2 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 04/12] 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 c2f6e3072..7213f3058 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -619,6 +619,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.44.0

View file

@ -1,7 +1,7 @@
From cca38c720efc73912913a59be2a3d261017c2863 Mon Sep 17 00:00:00 2001 From f89ddfd215de9269559afdd6b23e4eca56da8eef Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com> From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Wed, 2 Aug 2023 20:59:53 +0800 Date: Wed, 2 Aug 2023 20:59:53 +0800
Subject: [PATCH 04/11] Restore getSimStateForSlotIndex in SubscriptionManager Subject: [PATCH 05/12] Restore getSimStateForSlotIndex in SubscriptionManager
MTK IMS still needs it here MTK IMS still needs it here
@ -11,10 +11,10 @@ Change-Id: I41bac57c68055f369232359a464642daab94403b
1 file changed, 14 insertions(+) 1 file changed, 14 insertions(+)
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e0af22369..2175b3d96 100644 index 6faef7ecf..33e3b6a0d 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java --- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2913,6 +2913,20 @@ public class SubscriptionManager { @@ -2916,6 +2916,20 @@ public class SubscriptionManager {
return TelephonyManager.getDefault().isNetworkRoaming(subId); return TelephonyManager.getDefault().isNetworkRoaming(subId);
} }
@ -36,5 +36,5 @@ index e0af22369..2175b3d96 100644
* Set a field in the subscription database. Note not all fields are supported. * Set a field in the subscription database. Note not all fields are supported.
* *
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From f9a12ae1920588f2d75849462abf7d2ba9d0373b Mon Sep 17 00:00:00 2001 From 6ed2fcbdc5aaadd1bb29f8bfd80cf9200515acb0 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com> From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 12 Aug 2023 20:11:17 +0800 Date: Sat, 12 Aug 2023 20:11:17 +0800
Subject: [PATCH 05/11] Add runWithCleanCallingIdentity variant with both Subject: [PATCH 06/12] Add runWithCleanCallingIdentity variant with both
executor and return value executor and return value
This complements the fixup to ImsPhoneCallTracker (in fw/o/t) for U This complements the fixup to ImsPhoneCallTracker (in fw/o/t) for U
@ -61,5 +61,5 @@ index 422433891..3bbecf0f2 100644
* Filter values in bundle to only basic types. * Filter values in bundle to only basic types.
*/ */
-- --
2.48.1 2.44.0

View file

@ -0,0 +1,138 @@
From 33667f43e841a799a6e34c28fecfce5fb7f470ef Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com>
Date: Mon, 19 Feb 2024 16:20:04 +0100
Subject: [PATCH 07/11] Allow signature spoofing for microG Companion/Services
This patch enables signature spoofing when the following conditions are
met:
* Build is debuggable (userdebug/eng)
* Package name is com.android.vending or com.google.android.gms
* Package is signed with microG release keys
* Fake signature is correct
Additionally, we let these apps be forceQueryable if they so desire.
phh change: No need to be debuggable
Change-Id: I8fc82ed266a2cc59636b662c7ea7e29c94f509b5
---
.../com/android/server/pm/AppsFilterImpl.java | 2 +
.../com/android/server/pm/ComputerEngine.java | 47 +++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/services/core/java/com/android/server/pm/AppsFilterImpl.java b/services/core/java/com/android/server/pm/AppsFilterImpl.java
index cc4c2b5bf..57263da93 100644
--- a/services/core/java/com/android/server/pm/AppsFilterImpl.java
+++ b/services/core/java/com/android/server/pm/AppsFilterImpl.java
@@ -36,6 +36,7 @@ import static com.android.server.pm.AppsFilterUtils.canQueryAsUpdateOwner;
import static com.android.server.pm.AppsFilterUtils.canQueryViaComponents;
import static com.android.server.pm.AppsFilterUtils.canQueryViaPackage;
import static com.android.server.pm.AppsFilterUtils.canQueryViaUsesLibrary;
+import static com.android.server.pm.ComputerEngine.isMicrogSigned;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -599,6 +600,7 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable,
newIsForceQueryable = mForceQueryable.contains(newPkgSetting.getAppId())
/* shared user that is already force queryable */
|| newPkgSetting.isForceQueryableOverride() /* adb override */
+ || (newPkg.isForceQueryable() && isMicrogSigned(newPkg))
|| (newPkgSetting.isSystem() && (mSystemAppsQueryable
|| newPkg.isForceQueryable()
|| ArrayUtils.contains(mForceQueryableByDevicePackageNames,
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index 4665a72b0..ff736f3d0 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -102,6 +102,7 @@ import android.content.pm.UserPackage;
import android.content.pm.VersionedPackage;
import android.os.Binder;
import android.os.Build;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.ParcelableException;
import android.os.PatternMatcher;
@@ -174,6 +175,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.UUID;
@@ -422,6 +424,10 @@ public class ComputerEngine implements Computer {
private final PackageManagerInternal.ExternalSourcesPolicy mExternalSourcesPolicy;
private final CrossProfileIntentResolverEngine mCrossProfileIntentResolverEngine;
+ // Signatures used by microG
+ private static final Signature MICROG_FAKE_SIGNATURE = new Signature("308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a");
+ private static final Signature MICROG_REAL_SIGNATURE = new Signature("308202ed308201d5a003020102020426ffa009300d06092a864886f70d01010b05003027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a656374301e170d3132313030363132303533325a170d3337303933303132303533325a3027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a02820101009a8d2a5336b0eaaad89ce447828c7753b157459b79e3215dc962ca48f58c2cd7650df67d2dd7bda0880c682791f32b35c504e43e77b43c3e4e541f86e35a8293a54fb46e6b16af54d3a4eda458f1a7c8bc1b7479861ca7043337180e40079d9cdccb7e051ada9b6c88c9ec635541e2ebf0842521c3024c826f6fd6db6fd117c74e859d5af4db04448965ab5469b71ce719939a06ef30580f50febf96c474a7d265bb63f86a822ff7b643de6b76e966a18553c2858416cf3309dd24278374bdd82b4404ef6f7f122cec93859351fc6e5ea947e3ceb9d67374fe970e593e5cd05c905e1d24f5a5484f4aadef766e498adf64f7cf04bddd602ae8137b6eea40722d0203010001a321301f301d0603551d0e04160414110b7aa9ebc840b20399f69a431f4dba6ac42a64300d06092a864886f70d01010b0500038201010007c32ad893349cf86952fb5a49cfdc9b13f5e3c800aece77b2e7e0e9c83e34052f140f357ec7e6f4b432dc1ed542218a14835acd2df2deea7efd3fd5e8f1c34e1fb39ec6a427c6e6f4178b609b369040ac1f8844b789f3694dc640de06e44b247afed11637173f36f5886170fafd74954049858c6096308fc93c1bc4dd5685fa7a1f982a422f2a3b36baa8c9500474cf2af91c39cbec1bc898d10194d368aa5e91f1137ec115087c31962d8f76cd120d28c249cf76f4c70f5baa08c70a7234ce4123be080cee789477401965cfe537b924ef36747e8caca62dfefdd1a6288dcb1c4fd2aaa6131a7ad254e9742022cfd597d2ca5c660ce9e41ff537e5a4041e37");
+
// PackageManagerService attributes that are primitives are referenced through the
// pms object directly. Primitives are the only attributes so referenced.
protected final PackageManagerService mService;
@@ -1481,6 +1487,42 @@ public class ComputerEngine implements Computer {
return result;
}
+ public static boolean isMicrogSigned(AndroidPackage p) {
+ // Allowlist the following apps:
+ // * com.android.vending - microG Companion
+ // * com.google.android.gms - microG Services
+ if (!p.getPackageName().equals("com.android.vending") &&
+ !p.getPackageName().equals("com.google.android.gms")) {
+ return false;
+ }
+ return Signature.areExactMatch(
+ p.getSigningDetails(), new Signature[]{MICROG_REAL_SIGNATURE});
+ }
+
+ private static Optional<Signature> generateFakeSignature(AndroidPackage p) {
+ if (!isMicrogSigned(p)) {
+ return Optional.empty();
+ }
+
+ Bundle metadata = p.getMetaData();
+ if (metadata == null) {
+ return Optional.empty();
+ }
+
+ String fakeSignatureStr = metadata.getString("fake-signature");
+ if (TextUtils.isEmpty(fakeSignatureStr)) {
+ return Optional.empty();
+ }
+
+ // Only MICROG_FAKE_SIGNATURE can be faked
+ Signature fakeSignature = new Signature(fakeSignatureStr);
+ if (!fakeSignature.equals(MICROG_FAKE_SIGNATURE)) {
+ return Optional.empty();
+ }
+
+ return Optional.of(fakeSignature);
+ }
+
public final PackageInfo generatePackageInfo(PackageStateInternal ps,
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
if (!mUserManager.exists(userId)) return null;
@@ -1529,6 +1571,10 @@ public class ComputerEngine implements Computer {
packageInfo.packageName = packageInfo.applicationInfo.packageName =
resolveExternalPackageName(p);
+ generateFakeSignature(p).ifPresent(fakeSignature -> {
+ packageInfo.signatures = new Signature[]{fakeSignature};
+ });
+
if (Flags.provideInfoOfApkInApex()) {
final String apexModuleName = ps.getApexModuleName();
if (apexModuleName != null) {
@@ -1536,6 +1582,7 @@ public class ComputerEngine implements Computer {
mApexManager.getActivePackageNameForApexModuleName(apexModuleName));
}
}
+
return packageInfo;
} else if ((flags & (MATCH_UNINSTALLED_PACKAGES | MATCH_ARCHIVED_PACKAGES)) != 0
&& PackageUserStateUtils.isAvailable(state, flags)) {
--
2.44.0

View file

@ -1,7 +1,7 @@
From 45736b5d760fdac0ec405f1620942ff9a7c023d9 Mon Sep 17 00:00:00 2001 From 8eec006d00e012f02a33cea8f631af15bdd14498 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Sun, 22 Sep 2024 22:53:01 -0400 Date: Sun, 22 Sep 2024 22:53:01 -0400
Subject: [PATCH 06/11] AuthService: HIDL and AIDL fingerprint services are Subject: [PATCH 07/12] AuthService: HIDL and AIDL fingerprint services are
mutually exclusive mutually exclusive
...and make sure that we prioritize AIDL over HIDL. This is essential ...and make sure that we prioritize AIDL over HIDL. This is essential
@ -38,5 +38,5 @@ index 2d802b21c..0730d634f 100644
if (fingerprintService != null) { if (fingerprintService != null) {
-- --
2.48.1 2.44.0

View file

@ -0,0 +1,42 @@
From ad608b13f93f9532e4f7abcaabc6a3f735ad87ba Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 22 Sep 2024 22:53:01 -0400
Subject: [PATCH 08/11] AuthService: HIDL and AIDL fingerprint services are
mutually exclusive
...and make sure that we prioritize AIDL over HIDL. This is essential
for GSIs to boot on newer devices while having the HIDL property set for
compatibility with older ones.
Change-Id: I834297a44674820d813d8f6d376dfd294f084f3b
---
.../com/android/server/biometrics/AuthService.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java
index 2d802b21c..0730d634f 100644
--- a/services/core/java/com/android/server/biometrics/AuthService.java
+++ b/services/core/java/com/android/server/biometrics/AuthService.java
@@ -908,15 +908,13 @@ public class AuthService extends SystemService {
handlerProvider.getFingerprintHandler().post(() -> {
final FingerprintSensorConfigurations mFingerprintSensorConfigurations =
- new FingerprintSensorConfigurations(!(hidlConfigStrings != null
- && hidlConfigStrings.length > 0));
-
- if (hidlConfigStrings != null && hidlConfigStrings.length > 0) {
- mFingerprintSensorConfigurations.addHidlSensors(hidlConfigStrings, context);
- }
+ new FingerprintSensorConfigurations(fingerprintAidlInstances != null
+ && fingerprintAidlInstances.length > 0);
if (fingerprintAidlInstances != null && fingerprintAidlInstances.length > 0) {
mFingerprintSensorConfigurations.addAidlSensors(fingerprintAidlInstances);
+ } else if (hidlConfigStrings != null && hidlConfigStrings.length > 0) {
+ mFingerprintSensorConfigurations.addHidlSensors(hidlConfigStrings, context);
}
if (fingerprintService != null) {
--
2.44.0

View file

@ -1,7 +1,7 @@
From 6cd16322e3d44ea9d96c74af96a967e48fa88d44 Mon Sep 17 00:00:00 2001 From 0439e89b1442adc5d6bb2b876ca7bc87a0b0ebd1 Mon Sep 17 00:00:00 2001
From: dhacker29 <dhackerdvm@gmail.com> From: dhacker29 <dhackerdvm@gmail.com>
Date: Tue, 24 Nov 2015 01:53:47 -0500 Date: Tue, 24 Nov 2015 01:53:47 -0500
Subject: [PATCH 07/11] fw/b: Use ro.build.version.incremental to signal OTA Subject: [PATCH 08/12] fw/b: Use ro.build.version.incremental to signal OTA
upgrades upgrades
Co-authored-by: maxwen <max.weninger@gmail.com> Co-authored-by: maxwen <max.weninger@gmail.com>
@ -76,7 +76,7 @@ index ce9130ad5..737ecae1c 100644
} }
final AppWidgetProviderInfo info = new AppWidgetProviderInfo(); final AppWidgetProviderInfo info = new AppWidgetProviderInfo();
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index aadf11227..8b0c4f42b 100644 index 611e0d862..0e343e18a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java --- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2239,7 +2239,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService @@ -2239,7 +2239,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
@ -99,7 +99,7 @@ index aadf11227..8b0c4f42b 100644
} }
diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
index 7af39f74d..4bd83e739 100644 index 975758241..54527a6b0 100644
--- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
+++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
@@ -1400,8 +1400,6 @@ public class PackageManagerServiceUtils { @@ -1400,8 +1400,6 @@ public class PackageManagerServiceUtils {
@ -120,7 +120,7 @@ index 7af39f74d..4bd83e739 100644
cacheDir = FileUtils.createDir(cacheBaseDir, cacheName); cacheDir = FileUtils.createDir(cacheBaseDir, cacheName);
} }
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 485a28070..78086791a 100644 index 1f672a093..bef67a838 100644
--- a/services/core/java/com/android/server/pm/Settings.java --- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java
@@ -485,7 +485,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile @@ -485,7 +485,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
@ -133,7 +133,7 @@ index 485a28070..78086791a 100644
} }
} }
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 1052c94d7..21481d216 100644 index 5518bfae8..e26eec659 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java --- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java +++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -5259,7 +5259,7 @@ public class ShortcutService extends IShortcutService.Stub { @@ -5259,7 +5259,7 @@ public class ShortcutService extends IShortcutService.Stub {
@ -146,5 +146,5 @@ index 1052c94d7..21481d216 100644
final void wtf(String message) { final void wtf(String message) {
-- --
2.48.1 2.44.0

View file

@ -1,16 +1,63 @@
From 2f4c395069d1dfd7cce9a896f17868aa4aaf91c4 Mon Sep 17 00:00:00 2001 From e9f37a43249f7816b78c4a8ce3a82f48db779567 Mon Sep 17 00:00:00 2001
From: Pranav Vashi <neobuddy89@gmail.com> From: Pranav Vashi <neobuddy89@gmail.com>
Date: Sat, 21 Sep 2024 13:44:09 +0530 Date: Sat, 21 Sep 2024 13:44:09 +0530
Subject: [PATCH 09/11] WebView: Add check before setting default or fallback Subject: [PATCH 09/12] WebView: Add check before setting default or fallback
provider provider
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
--- ---
.../webkit/WebViewUpdateServiceImpl.java | 14 ++++++--
.../webkit/WebViewUpdateServiceImpl2.java | 34 ++++++++++++++----- .../webkit/WebViewUpdateServiceImpl2.java | 34 ++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-) 2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
index b9be4a2de..e98196f9f 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
@@ -15,6 +15,7 @@
*/
package com.android.server.webkit;
+import android.app.AppGlobals;
import android.annotation.Nullable;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -396,7 +397,7 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
@Override
public WebViewProviderInfo getDefaultWebViewPackage() {
for (WebViewProviderInfo provider : getWebViewPackages()) {
- if (provider.availableByDefault) {
+ if (provider.availableByDefault && isPackageAvailable(provider.packageName)) {
return provider;
}
}
@@ -406,6 +407,15 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
throw new AndroidRuntimeException("No available by default WebView Provider.");
}
+ private static boolean isPackageAvailable(String packageName) {
+ try {
+ AppGlobals.getInitialApplication().getPackageManager().getPackageInfo(packageName, 0);
+ return true;
+ } catch (NameNotFoundException e) {
+ return false;
+ }
+ }
+
private static class ProviderAndPackageInfo {
public final WebViewProviderInfo provider;
public final PackageInfo packageInfo;
@@ -644,7 +654,7 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
*/
private static WebViewProviderInfo getFallbackProvider(WebViewProviderInfo[] webviewPackages) {
for (WebViewProviderInfo provider : webviewPackages) {
- if (provider.isFallback) {
+ if (provider.isFallback && isPackageAvailable(provider.packageName)) {
return provider;
}
}
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
index 9e8dc2690..9e415bf63 100644 index 307c15b72..26d1195dc 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java --- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java +++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
@ -21,7 +68,7 @@ index 9e8dc2690..9e415bf63 100644
import android.annotation.Nullable; import android.annotation.Nullable;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
@@ -113,7 +114,7 @@ class WebViewUpdateServiceImpl2 { @@ -112,7 +113,7 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
WebViewProviderInfo defaultProvider = null; WebViewProviderInfo defaultProvider = null;
for (WebViewProviderInfo provider : webviewProviders) { for (WebViewProviderInfo provider : webviewProviders) {
@ -30,7 +77,7 @@ index 9e8dc2690..9e415bf63 100644
defaultProvider = provider; defaultProvider = provider;
break; break;
} }
@@ -182,6 +183,15 @@ class WebViewUpdateServiceImpl2 { @@ -182,6 +183,15 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
} }
} }
@ -46,7 +93,7 @@ index 9e8dc2690..9e415bf63 100644
private boolean shouldTriggerRepairLocked() { private boolean shouldTriggerRepairLocked() {
if (mAttemptedToRepairBefore) { if (mAttemptedToRepairBefore) {
return false; return false;
@@ -208,12 +218,20 @@ class WebViewUpdateServiceImpl2 { @@ -208,12 +218,20 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
} }
mAttemptedToRepairBefore = true; mAttemptedToRepairBefore = true;
} }
@ -72,8 +119,8 @@ index 9e8dc2690..9e415bf63 100644
+ } + }
} }
public void prepareWebViewInSystemServer() { @Override
@@ -691,7 +709,7 @@ class WebViewUpdateServiceImpl2 { @@ -701,7 +719,7 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
*/ */
private static WebViewProviderInfo getFallbackProvider(WebViewProviderInfo[] webviewPackages) { private static WebViewProviderInfo getFallbackProvider(WebViewProviderInfo[] webviewPackages) {
for (WebViewProviderInfo provider : webviewPackages) { for (WebViewProviderInfo provider : webviewPackages) {
@ -83,5 +130,5 @@ index 9e8dc2690..9e415bf63 100644
} }
} }
-- --
2.48.1 2.44.0

View file

@ -0,0 +1,150 @@
From 35527df5e9e87a4af86d51e3290e7679f5a5f4cc Mon Sep 17 00:00:00 2001
From: dhacker29 <dhackerdvm@gmail.com>
Date: Tue, 24 Nov 2015 01:53:47 -0500
Subject: [PATCH 09/11] fw/b: Use ro.build.version.incremental to signal OTA
upgrades
Co-authored-by: maxwen <max.weninger@gmail.com>
Co-authored-by: Sam Mortimer <sam@mortimer.me.uk>
Co-authored-by: Wang Han <416810799@qq.com>
Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
---
core/java/android/app/admin/SystemUpdateInfo.java | 4 ++--
core/java/android/content/pm/PackagePartitions.java | 2 +-
.../java/com/android/server/appwidget/AppWidgetXmlUtil.java | 4 ++--
.../java/com/android/server/pm/PackageManagerService.java | 5 +++--
.../com/android/server/pm/PackageManagerServiceUtils.java | 3 +--
services/core/java/com/android/server/pm/Settings.java | 2 +-
.../core/java/com/android/server/pm/ShortcutService.java | 2 +-
7 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java
index 9e6c91f4e..7459b0e05 100644
--- a/core/java/android/app/admin/SystemUpdateInfo.java
+++ b/core/java/android/app/admin/SystemUpdateInfo.java
@@ -133,7 +133,7 @@ public final class SystemUpdateInfo implements Parcelable {
out.startTag(null, tag);
out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime);
out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState);
- out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
+ out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL);
out.endTag(null, tag);
}
@@ -142,7 +142,7 @@ public final class SystemUpdateInfo implements Parcelable {
public static SystemUpdateInfo readFromXml(TypedXmlPullParser parser) {
// If an OTA has been applied (build fingerprint has changed), discard stale info.
final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD );
- if (!Build.FINGERPRINT.equals(buildFingerprint)) {
+ if (!Build.VERSION.INCREMENTAL.equals(buildFingerprint)) {
return null;
}
try {
diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java
index ff80e614b..da3b68ecf 100644
--- a/core/java/android/content/pm/PackagePartitions.java
+++ b/core/java/android/content/pm/PackagePartitions.java
@@ -131,7 +131,7 @@ public class PackagePartitions {
final String partitionName = SYSTEM_PARTITIONS.get(i).getName();
digestProperties[i] = "ro." + partitionName + ".build.fingerprint";
}
- digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.fingerprint"; // build fingerprint
+ digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.version.incremental";
return SystemProperties.digestOf(digestProperties);
}
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetXmlUtil.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetXmlUtil.java
index ce9130ad5..737ecae1c 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetXmlUtil.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetXmlUtil.java
@@ -117,7 +117,7 @@ public class AppWidgetXmlUtil {
out.attributeInt(null, ATTR_WIDGET_FEATURES, info.widgetFeatures);
out.attributeInt(null, ATTR_DESCRIPTION_RES, info.descriptionRes);
out.attributeBoolean(null, ATTR_PROVIDER_INHERITANCE, info.isExtendedFromAppWidgetProvider);
- out.attribute(null, ATTR_OS_FINGERPRINT, Build.FINGERPRINT);
+ out.attribute(null, ATTR_OS_FINGERPRINT, Build.VERSION.INCREMENTAL);
}
/**
@@ -128,7 +128,7 @@ public class AppWidgetXmlUtil {
@NonNull final TypedXmlPullParser parser) {
Objects.requireNonNull(parser);
final String fingerprint = parser.getAttributeValue(null, ATTR_OS_FINGERPRINT);
- if (!Build.FINGERPRINT.equals(fingerprint)) {
+ if (!Build.VERSION.INCREMENTAL.equals(fingerprint)) {
return null;
}
final AppWidgetProviderInfo info = new AppWidgetProviderInfo();
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 611e0d862..0e343e18a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2239,7 +2239,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
if (mIsUpgrade) {
PackageManagerServiceUtils.logCriticalInfo(Log.INFO,
"Upgrading from " + ver.fingerprint + " (" + ver.buildFingerprint + ") to "
- + PackagePartitions.FINGERPRINT + " (" + Build.FINGERPRINT + ")");
+ + PackagePartitions.FINGERPRINT
+ + " (" + Build.VERSION.INCREMENTAL + ")");
}
mPriorSdkVersion = mIsUpgrade ? ver.sdkVersion : -1;
mInitAppsHelper = new InitAppsHelper(this, mApexManager, mInstallPackageHelper,
@@ -2397,7 +2398,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
| Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
}
}
- ver.buildFingerprint = Build.FINGERPRINT;
+ ver.buildFingerprint = Build.VERSION.INCREMENTAL;
ver.fingerprint = PackagePartitions.FINGERPRINT;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
index 975758241..54527a6b0 100644
--- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
+++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
@@ -1400,8 +1400,6 @@ public class PackageManagerServiceUtils {
// that starts with "eng." to signify that this is an engineering build and not
// destined for release.
if (isUserDebugBuild && incrementalVersion.startsWith("eng.")) {
- Slog.w(TAG, "Wiping cache directory because the system partition changed.");
-
// Heuristic: If the /system directory has been modified recently due to an "adb sync"
// or a regular make, then blow away the cache. Note that mtimes are *NOT* reliable
// in general and should not be used for production changes. In this specific case,
@@ -1409,6 +1407,7 @@ public class PackageManagerServiceUtils {
File frameworkDir =
new File(Environment.getRootDirectory(), "framework");
if (cacheDir.lastModified() < frameworkDir.lastModified()) {
+ Slog.w(TAG, "Wiping cache directory because the system partition changed.");
FileUtils.deleteContents(cacheBaseDir);
cacheDir = FileUtils.createDir(cacheBaseDir, cacheName);
}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 1f672a093..bef67a838 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -485,7 +485,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
public void forceCurrent() {
sdkVersion = Build.VERSION.SDK_INT;
databaseVersion = CURRENT_DATABASE_VERSION;
- buildFingerprint = Build.FINGERPRINT;
+ buildFingerprint = Build.VERSION.INCREMENTAL;
fingerprint = PackagePartitions.FINGERPRINT;
}
}
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 5518bfae8..e26eec659 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -5259,7 +5259,7 @@ public class ShortcutService extends IShortcutService.Stub {
// Injection point.
String injectBuildFingerprint() {
- return Build.FINGERPRINT;
+ return Build.VERSION.INCREMENTAL;
}
final void wtf(String message) {
--
2.44.0

View file

@ -1,7 +1,7 @@
From 8b3f59482cf7f27406d9a8c9ef717e6bc70cfb88 Mon Sep 17 00:00:00 2001 From 63814a8d4c25c343a7f3d3374ed4f085517fa8d0 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Sat, 21 Dec 2024 11:04:35 -0500 Date: Sat, 21 Dec 2024 11:04:35 -0500
Subject: [PATCH 08/11] Add support for treating virtual biometric sensors as Subject: [PATCH 10/12] Add support for treating virtual biometric sensors as
real ones real ones
This happens on Unihertz Jelly Max. They forgot to change their sensor This happens on Unihertz Jelly Max. They forgot to change their sensor
@ -45,5 +45,5 @@ index 48c5887d8..bec56d9a6 100644
Slog.i(TAG, "getIFingerprint fqName is mapped: " + fqName + "->" + fqNameMapped); Slog.i(TAG, "getIFingerprint fqName is mapped: " + fqName + "->" + fqNameMapped);
try { try {
-- --
2.48.1 2.44.0

View file

@ -0,0 +1,134 @@
From fb0c9ab82954cf41bb985957d3eddfd190ca2ca5 Mon Sep 17 00:00:00 2001
From: Pranav Vashi <neobuddy89@gmail.com>
Date: Sat, 21 Sep 2024 13:44:09 +0530
Subject: [PATCH 10/11] WebView: Add check before setting default or fallback
provider
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
---
.../webkit/WebViewUpdateServiceImpl.java | 14 ++++++--
.../webkit/WebViewUpdateServiceImpl2.java | 34 ++++++++++++++-----
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
index b9be4a2de..e98196f9f 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
@@ -15,6 +15,7 @@
*/
package com.android.server.webkit;
+import android.app.AppGlobals;
import android.annotation.Nullable;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -396,7 +397,7 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
@Override
public WebViewProviderInfo getDefaultWebViewPackage() {
for (WebViewProviderInfo provider : getWebViewPackages()) {
- if (provider.availableByDefault) {
+ if (provider.availableByDefault && isPackageAvailable(provider.packageName)) {
return provider;
}
}
@@ -406,6 +407,15 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
throw new AndroidRuntimeException("No available by default WebView Provider.");
}
+ private static boolean isPackageAvailable(String packageName) {
+ try {
+ AppGlobals.getInitialApplication().getPackageManager().getPackageInfo(packageName, 0);
+ return true;
+ } catch (NameNotFoundException e) {
+ return false;
+ }
+ }
+
private static class ProviderAndPackageInfo {
public final WebViewProviderInfo provider;
public final PackageInfo packageInfo;
@@ -644,7 +654,7 @@ class WebViewUpdateServiceImpl implements WebViewUpdateServiceInterface {
*/
private static WebViewProviderInfo getFallbackProvider(WebViewProviderInfo[] webviewPackages) {
for (WebViewProviderInfo provider : webviewPackages) {
- if (provider.isFallback) {
+ if (provider.isFallback && isPackageAvailable(provider.packageName)) {
return provider;
}
}
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
index 307c15b72..26d1195dc 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl2.java
@@ -15,6 +15,7 @@
*/
package com.android.server.webkit;
+import android.app.AppGlobals;
import android.annotation.Nullable;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -112,7 +113,7 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
WebViewProviderInfo defaultProvider = null;
for (WebViewProviderInfo provider : webviewProviders) {
- if (provider.availableByDefault) {
+ if (provider.availableByDefault && isPackageAvailable(provider.packageName)) {
defaultProvider = provider;
break;
}
@@ -182,6 +183,15 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
}
}
+ private static boolean isPackageAvailable(String packageName) {
+ try {
+ AppGlobals.getInitialApplication().getPackageManager().getPackageInfo(packageName, 0);
+ return true;
+ } catch (NameNotFoundException e) {
+ return false;
+ }
+ }
+
private boolean shouldTriggerRepairLocked() {
if (mAttemptedToRepairBefore) {
return false;
@@ -208,12 +218,20 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
}
mAttemptedToRepairBefore = true;
}
- Slog.w(
- TAG,
- "No provider available for all users, trying to install and enable "
- + mDefaultProvider.packageName);
- mSystemInterface.installExistingPackageForAllUsers(mDefaultProvider.packageName);
- mSystemInterface.enablePackageForAllUsers(mDefaultProvider.packageName, true);
+
+ WebViewProviderInfo[] webviewProviders = mSystemInterface.getWebViewPackages();
+ WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
+ if (fallbackProvider != null) {
+ Slog.w(TAG, "No valid provider, trying to install and enable "
+ + fallbackProvider.packageName);
+ mSystemInterface.installExistingPackageForAllUsers(fallbackProvider.packageName);
+ mSystemInterface.enablePackageForAllUsers(fallbackProvider.packageName, true);
+ } else {
+ Slog.w(TAG, "No provider available for all users, trying to install and enable "
+ + mDefaultProvider.packageName);
+ mSystemInterface.installExistingPackageForAllUsers(mDefaultProvider.packageName);
+ mSystemInterface.enablePackageForAllUsers(mDefaultProvider.packageName, true);
+ }
}
@Override
@@ -701,7 +719,7 @@ class WebViewUpdateServiceImpl2 implements WebViewUpdateServiceInterface {
*/
private static WebViewProviderInfo getFallbackProvider(WebViewProviderInfo[] webviewPackages) {
for (WebViewProviderInfo provider : webviewPackages) {
- if (provider.isFallback) {
+ if (provider.isFallback && isPackageAvailable(provider.packageName)) {
return provider;
}
}
--
2.44.0

View file

@ -0,0 +1,49 @@
From a6a02e1099bee7d8749525e5fc092527fd2b1818 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sat, 21 Dec 2024 11:04:35 -0500
Subject: [PATCH 11/11] Add support for treating virtual biometric sensors as
real ones
This happens on Unihertz Jelly Max. They forgot to change their sensor
instance name from "virtual" to something else.
Change-Id: I106d41cd078e6b1e354c72ec35fa240a44397c5e
---
.../fingerprint/FingerprintSensorConfigurations.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java
index 48c5887d8..bec56d9a6 100644
--- a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java
+++ b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java
@@ -29,6 +29,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.util.Log;
import android.util.Slog;
@@ -172,6 +173,10 @@ public class FingerprintSensorConfigurations implements Parcelable {
* @return real fqName
*/
public static String remapFqName(String fqName) {
+ if (SystemProperties.getBoolean("persist.sys.phh.virtual_sensors_are_real", false)) {
+ return fqName;
+ }
+
if (!fqName.contains(IFingerprint.DESCRIPTOR + "/virtual")) {
return fqName; //no remap needed for real hardware HAL
} else {
@@ -185,7 +190,7 @@ public class FingerprintSensorConfigurations implements Parcelable {
* @return aidl interface
*/
public static IFingerprint getIFingerprint(String fqName) {
- if (fqName.contains("virtual")) {
+ if (fqName.contains("virtual") && !SystemProperties.getBoolean("persist.sys.phh.virtual_sensors_are_real", false)) {
String fqNameMapped = remapFqName(fqName);
Slog.i(TAG, "getIFingerprint fqName is mapped: " + fqName + "->" + fqNameMapped);
try {
--
2.44.0

View file

@ -1,7 +1,7 @@
From 30058cdf576d1496ca63560f878eacf940e36ea2 Mon Sep 17 00:00:00 2001 From 73a7c9dcfd0752557d08d0e5972aa1ec9cad766a Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com> From: LuK1337 <priv.luk@gmail.com>
Date: Mon, 19 Feb 2024 16:20:04 +0100 Date: Mon, 19 Feb 2024 16:20:04 +0100
Subject: [PATCH 10/11] Allow signature spoofing for microG Companion/Services Subject: [PATCH 11/12] Allow signature spoofing for microG Companion/Services
This patch enables signature spoofing when the following conditions are This patch enables signature spoofing when the following conditions are
met: met:
@ -43,10 +43,10 @@ index cc4c2b5bf..57263da93 100644
|| newPkg.isForceQueryable() || newPkg.isForceQueryable()
|| ArrayUtils.contains(mForceQueryableByDevicePackageNames, || ArrayUtils.contains(mForceQueryableByDevicePackageNames,
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index be2f58dc2..3eb3df412 100644 index 4665a72b0..2f73bb836 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java --- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java +++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -103,6 +103,7 @@ import android.content.pm.UserPackage; @@ -102,6 +102,7 @@ import android.content.pm.UserPackage;
import android.content.pm.VersionedPackage; import android.content.pm.VersionedPackage;
import android.os.Binder; import android.os.Binder;
import android.os.Build; import android.os.Build;
@ -54,7 +54,7 @@ index be2f58dc2..3eb3df412 100644
import android.os.IBinder; import android.os.IBinder;
import android.os.ParcelableException; import android.os.ParcelableException;
import android.os.PatternMatcher; import android.os.PatternMatcher;
@@ -176,6 +177,7 @@ import java.util.Collections; @@ -174,6 +175,7 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -62,7 +62,7 @@ index be2f58dc2..3eb3df412 100644
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@@ -424,6 +426,10 @@ public class ComputerEngine implements Computer { @@ -422,6 +424,10 @@ public class ComputerEngine implements Computer {
private final PackageManagerInternal.ExternalSourcesPolicy mExternalSourcesPolicy; private final PackageManagerInternal.ExternalSourcesPolicy mExternalSourcesPolicy;
private final CrossProfileIntentResolverEngine mCrossProfileIntentResolverEngine; private final CrossProfileIntentResolverEngine mCrossProfileIntentResolverEngine;
@ -73,7 +73,7 @@ index be2f58dc2..3eb3df412 100644
// PackageManagerService attributes that are primitives are referenced through the // PackageManagerService attributes that are primitives are referenced through the
// pms object directly. Primitives are the only attributes so referenced. // pms object directly. Primitives are the only attributes so referenced.
protected final PackageManagerService mService; protected final PackageManagerService mService;
@@ -1483,6 +1489,49 @@ public class ComputerEngine implements Computer { @@ -1481,6 +1487,49 @@ public class ComputerEngine implements Computer {
return result; return result;
} }
@ -123,7 +123,7 @@ index be2f58dc2..3eb3df412 100644
public final PackageInfo generatePackageInfo(PackageStateInternal ps, public final PackageInfo generatePackageInfo(PackageStateInternal ps,
@PackageManager.PackageInfoFlagsBits long flags, int userId) { @PackageManager.PackageInfoFlagsBits long flags, int userId) {
if (!mUserManager.exists(userId)) return null; if (!mUserManager.exists(userId)) return null;
@@ -1538,6 +1587,11 @@ public class ComputerEngine implements Computer { @@ -1536,6 +1585,11 @@ public class ComputerEngine implements Computer {
mApexManager.getActivePackageNameForApexModuleName(apexModuleName)); mApexManager.getActivePackageNameForApexModuleName(apexModuleName));
} }
} }
@ -136,10 +136,10 @@ index be2f58dc2..3eb3df412 100644
} else if ((flags & (MATCH_UNINSTALLED_PACKAGES | MATCH_ARCHIVED_PACKAGES)) != 0 } else if ((flags & (MATCH_UNINSTALLED_PACKAGES | MATCH_ARCHIVED_PACKAGES)) != 0
&& PackageUserStateUtils.isAvailable(state, flags)) { && PackageUserStateUtils.isAvailable(state, flags)) {
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 4c0cee404..a4d192c8e 100644 index a5085fc31..9a1d2bc2b 100644
--- a/services/core/jni/Android.bp --- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp +++ b/services/core/jni/Android.bp
@@ -71,6 +71,7 @@ cc_library_static { @@ -74,6 +74,7 @@ cc_library_static {
"com_android_server_vibrator_VibratorManagerService.cpp", "com_android_server_vibrator_VibratorManagerService.cpp",
"com_android_server_pdb_PersistentDataBlockService.cpp", "com_android_server_pdb_PersistentDataBlockService.cpp",
"com_android_server_am_LowMemDetector.cpp", "com_android_server_am_LowMemDetector.cpp",
@ -147,7 +147,7 @@ index 4c0cee404..a4d192c8e 100644
"com_android_server_pm_PackageManagerShellCommandDataLoader.cpp", "com_android_server_pm_PackageManagerShellCommandDataLoader.cpp",
"com_android_server_sensor_SensorService.cpp", "com_android_server_sensor_SensorService.cpp",
"com_android_server_wm_TaskFpsCallbackController.cpp", "com_android_server_wm_TaskFpsCallbackController.cpp",
@@ -94,6 +95,12 @@ cc_library_static { @@ -97,6 +98,12 @@ cc_library_static {
header_libs: [ header_libs: [
"bionic_libc_platform_headers", "bionic_libc_platform_headers",
], ],
@ -205,11 +205,11 @@ index 000000000..bbe298097
+ +
+} // namespace android +} // namespace android
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index 09fd8d4ac..0d61a13d2 100644 index 3c55d1824..5fac851d9 100644
--- a/services/core/jni/onload.cpp --- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp +++ b/services/core/jni/onload.cpp
@@ -58,6 +58,7 @@ int register_android_server_utils_AnrTimer(JNIEnv *env); @@ -59,6 +59,7 @@ int register_android_server_am_LowMemDetector(JNIEnv* env);
int register_android_server_utils_LazyJniRegistrar(JNIEnv* env); int register_android_server_utils_AnrTimer(JNIEnv *env);
int register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(JNIEnv* env); int register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(JNIEnv* env);
int register_com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker(JNIEnv* env); int register_com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker(JNIEnv* env);
+int register_android_server_com_android_server_pm_ComputerEngine(JNIEnv* env); +int register_android_server_com_android_server_pm_ComputerEngine(JNIEnv* env);
@ -217,7 +217,7 @@ index 09fd8d4ac..0d61a13d2 100644
int register_android_server_AdbDebuggingManager(JNIEnv* env); int register_android_server_AdbDebuggingManager(JNIEnv* env);
int register_android_server_FaceService(JNIEnv* env); int register_android_server_FaceService(JNIEnv* env);
@@ -124,6 +125,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) @@ -124,6 +125,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
register_android_server_utils_LazyJniRegistrar(env); register_android_server_utils_AnrTimer(env);
register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(env); register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(env);
register_com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker(env); register_com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker(env);
+ register_android_server_com_android_server_pm_ComputerEngine(env); + register_android_server_com_android_server_pm_ComputerEngine(env);
@ -225,5 +225,5 @@ index 09fd8d4ac..0d61a13d2 100644
register_android_server_AdbDebuggingManager(env); register_android_server_AdbDebuggingManager(env);
register_android_server_FaceService(env); register_android_server_FaceService(env);
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 31cfef8a4245e49b99fc36cc8eaf7b0452ae9985 Mon Sep 17 00:00:00 2001 From 125054a90b153342a08cebf025e8752fe0113b36 Mon Sep 17 00:00:00 2001
From: Jonathan Klee <jonathan.klee@e.email> From: Jonathan Klee <jonathan.klee@e.email>
Date: Thu, 12 Dec 2024 15:27:57 +0100 Date: Thu, 12 Dec 2024 15:27:57 +0100
Subject: [PATCH 11/11] Allow spoofing signingInfo for microG Subject: [PATCH 12/12] Allow spoofing signingInfo for microG
Companion/Services Companion/Services
- Spoof PackageInfo signingInfo + signatures so that - Spoof PackageInfo signingInfo + signatures so that
@ -14,10 +14,10 @@ Signed-off-by: althafvly <althafvly@gmail.com>
1 file changed, 13 insertions(+) 1 file changed, 13 insertions(+)
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index 3eb3df412..6f5813065 100644 index 2f73bb836..4cf099aed 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java --- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java +++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -170,6 +170,7 @@ import java.io.FileOutputStream; @@ -168,6 +168,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -25,7 +25,7 @@ index 3eb3df412..6f5813065 100644
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@@ -1590,6 +1591,18 @@ public class ComputerEngine implements Computer { @@ -1588,6 +1589,18 @@ public class ComputerEngine implements Computer {
generateFakeSignature(p).ifPresent(fakeSignature -> { generateFakeSignature(p).ifPresent(fakeSignature -> {
packageInfo.signatures = new Signature[]{fakeSignature}; packageInfo.signatures = new Signature[]{fakeSignature};
@ -45,5 +45,5 @@ index 3eb3df412..6f5813065 100644
return packageInfo; return packageInfo;
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From b02d33fe80bed126c8caeebb51ced31e9b0c710e Mon Sep 17 00:00:00 2001 From ccd46a8a09baedf0fcad9648d75ac29468055a8f Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Sun, 6 Oct 2024 09:06:48 -0400 Date: Sun, 6 Oct 2024 09:06:48 -0400
Subject: [PATCH 1/7] sensorservice: Add support for ignoring broken sensors Subject: [PATCH 1/3] sensorservice: Add support for ignoring broken sensors
This allows those sensors to be replaced by SensorFusion when possible. This allows those sensors to be replaced by SensorFusion when possible.
@ -11,7 +11,7 @@ Change-Id: I5509ee1f54fdf4838f6e3b109819a689f483cfc4
1 file changed, 17 insertions(+) 1 file changed, 17 insertions(+)
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 9c4d1ace15..5a95096fdb 100644 index 9c4d1ac..5a95096 100644
--- a/services/sensorservice/SensorDevice.cpp --- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
@ -57,5 +57,5 @@ index 9c4d1ace15..5a95096fdb 100644
if (sensor.type < DEVICE_PRIVATE_BASE) { if (sensor.type < DEVICE_PRIVATE_BASE) {
sensor.resolution = SensorDeviceUtils::resolutionForSensor(sensor); sensor.resolution = SensorDeviceUtils::resolutionForSensor(sensor);
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 050301ed102cd6b41756adf114243a3cfa8b70a6 Mon Sep 17 00:00:00 2001 From 8dd1136bfd5a9dc403dc24839de2cbd1fe5cd273 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me> From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 25 Nov 2023 08:15:28 -0500 Date: Sat, 25 Nov 2023 08:15:28 -0500
Subject: [PATCH 2/7] Add MTK GED KPI support to fix broken Mediatek gpufreq Subject: [PATCH 2/3] Add MTK GED KPI support to fix broken Mediatek gpufreq
Mediatek GPU scheduler likes to have the timestamps of the frames to be Mediatek GPU scheduler likes to have the timestamps of the frames to be
able to adjust DVFS. able to adjust DVFS.
@ -24,7 +24,7 @@ Change-Id: Ic29a231ea8651efd598083611197aaa9e3c1fbbe
2 files changed, 205 insertions(+) 2 files changed, 205 insertions(+)
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index e41f9bbf43..d6863467a3 100644 index 66e7ddd..32070fa 100644
--- a/libs/gui/Surface.cpp --- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp
@@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
@ -279,7 +279,7 @@ index e41f9bbf43..d6863467a3 100644
mConnectedToCpu = true; mConnectedToCpu = true;
// Clear the dirty region in case we're switching from a non-CPU API // Clear the dirty region in case we're switching from a non-CPU API
diff --git a/libs/gui/include/gui/Surface.h b/libs/gui/include/gui/Surface.h diff --git a/libs/gui/include/gui/Surface.h b/libs/gui/include/gui/Surface.h
index 14a351316d..e0843a8016 100644 index 14a3513..e0843a8 100644
--- a/libs/gui/include/gui/Surface.h --- a/libs/gui/include/gui/Surface.h
+++ b/libs/gui/include/gui/Surface.h +++ b/libs/gui/include/gui/Surface.h
@@ -742,6 +742,9 @@ protected: @@ -742,6 +742,9 @@ protected:
@ -293,5 +293,5 @@ index 14a351316d..e0843a8016 100644
} // namespace android } // namespace android
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 37580f1924099111b2995e910ed64bb4182b9c39 Mon Sep 17 00:00:00 2001 From 399022e4c7686d24d6738ad6a1c939998c6ac801 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Mon, 7 Oct 2024 22:07:58 -0400 Date: Mon, 7 Oct 2024 22:07:58 -0400
Subject: [PATCH 3/7] vibratorservice: Support optionally ignoring vibrator Subject: [PATCH 3/3] vibratorservice: Support optionally ignoring vibrator
effects effects
On Unihertz Jelly Max the preloaded vibrator HAL is utterly broken. On Unihertz Jelly Max the preloaded vibrator HAL is utterly broken.
@ -13,7 +13,7 @@ Change-Id: I308190a225932fba2a4aa1c830c03ab874d8032e
2 files changed, 32 insertions(+) 2 files changed, 32 insertions(+)
diff --git a/services/vibratorservice/Android.bp b/services/vibratorservice/Android.bp diff --git a/services/vibratorservice/Android.bp b/services/vibratorservice/Android.bp
index 4735ae5897..6263b0506f 100644 index 4735ae5..6263b05 100644
--- a/services/vibratorservice/Android.bp --- a/services/vibratorservice/Android.bp
+++ b/services/vibratorservice/Android.bp +++ b/services/vibratorservice/Android.bp
@@ -41,6 +41,7 @@ cc_library_shared { @@ -41,6 +41,7 @@ cc_library_shared {
@ -25,7 +25,7 @@ index 4735ae5897..6263b0506f 100644
"libhidlbase", "libhidlbase",
"liblog", "liblog",
diff --git a/services/vibratorservice/VibratorHalWrapper.cpp b/services/vibratorservice/VibratorHalWrapper.cpp diff --git a/services/vibratorservice/VibratorHalWrapper.cpp b/services/vibratorservice/VibratorHalWrapper.cpp
index 3ddc4f2aca..11178659ff 100644 index 4ac1618..ab027bd 100644
--- a/services/vibratorservice/VibratorHalWrapper.cpp --- a/services/vibratorservice/VibratorHalWrapper.cpp
+++ b/services/vibratorservice/VibratorHalWrapper.cpp +++ b/services/vibratorservice/VibratorHalWrapper.cpp
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
@ -78,7 +78,7 @@ index 3ddc4f2aca..11178659ff 100644
} }
if (mInfoCache.mSupportedBraking.isFailed()) { if (mInfoCache.mSupportedBraking.isFailed()) {
mInfoCache.mSupportedBraking = getSupportedBrakingInternal(); mInfoCache.mSupportedBraking = getSupportedBrakingInternal();
@@ -305,6 +332,8 @@ HalResult<void> AidlHalWrapper::alwaysOnDisable(int32_t id) { @@ -295,6 +322,8 @@ HalResult<void> AidlHalWrapper::alwaysOnDisable(int32_t id) {
HalResult<milliseconds> AidlHalWrapper::performEffect( HalResult<milliseconds> AidlHalWrapper::performEffect(
Effect effect, EffectStrength strength, const std::function<void()>& completionCallback) { Effect effect, EffectStrength strength, const std::function<void()>& completionCallback) {
@ -87,7 +87,7 @@ index 3ddc4f2aca..11178659ff 100644
HalResult<Capabilities> capabilities = getCapabilities(); HalResult<Capabilities> capabilities = getCapabilities();
bool supportsCallback = capabilities.isOk() && bool supportsCallback = capabilities.isOk() &&
static_cast<int32_t>(capabilities.value() & Capabilities::PERFORM_CALLBACK); static_cast<int32_t>(capabilities.value() & Capabilities::PERFORM_CALLBACK);
@@ -582,6 +611,8 @@ template <typename T> @@ -563,6 +592,8 @@ template <typename T>
HalResult<milliseconds> HidlHalWrapper<I>::performInternal( HalResult<milliseconds> HidlHalWrapper<I>::performInternal(
perform_fn<T> performFn, sp<I> handle, T effect, EffectStrength strength, perform_fn<T> performFn, sp<I> handle, T effect, EffectStrength strength,
const std::function<void()>& completionCallback) { const std::function<void()>& completionCallback) {
@ -97,5 +97,5 @@ index 3ddc4f2aca..11178659ff 100644
int32_t lengthMs; int32_t lengthMs;
auto effectCallback = [&status, &lengthMs](V1_0::Status retStatus, uint32_t retLengthMs) { auto effectCallback = [&status, &lengthMs](V1_0::Status retStatus, uint32_t retLengthMs) {
-- --
2.48.1 2.44.0

View file

@ -1,348 +0,0 @@
From b12faaf3064de58caf0f6bfaf7fcac5a47f5024d Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 12:54:56 -0400
Subject: [PATCH 4/7] Revert "Remove flag single_hop_screenshots"
This reverts commit 16c4c32c55231dc241c386a0423710baa452b7de.
Change-Id: Ib1618cd4e1f83ba1f211a04429538b32e8de79da
---
.../surfaceflinger/RegionSamplingThread.cpp | 22 ++-
services/surfaceflinger/SurfaceFlinger.cpp | 184 ++++++++++++++----
services/surfaceflinger/SurfaceFlinger.h | 10 +-
.../surfaceflinger/common/FlagManager.cpp | 2 +
.../common/include/common/FlagManager.h | 1 +
.../tests/unittests/TestableSurfaceFlinger.h | 3 +-
6 files changed, 171 insertions(+), 51 deletions(-)
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 21d3396ebe..08f831c8e5 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -353,13 +353,21 @@ void RegionSamplingThread::captureSample() {
sampledBounds.getSize(), ui::Dataspace::V0_SRGB, displayWeak,
RenderArea::Options::CAPTURE_SECURE_LAYERS);
- std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
- auto displayState =
- mFlinger.getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
- FenceResult fenceResult =
- mFlinger.captureScreenshot(renderAreaBuilder, buffer, kRegionSampling, kGrayscale,
- kIsProtected, kAttachGainmap, nullptr, displayState, layers)
- .get();
+ FenceResult fenceResult;
+ if (FlagManager::getInstance().single_hop_screenshot()) {
+ std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
+ auto displayState =
+ mFlinger.getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
+ fenceResult = mFlinger.captureScreenshot(renderAreaBuilder, buffer, kRegionSampling,
+ kGrayscale, kIsProtected, kAttachGainmap, nullptr,
+ displayState, layers)
+ .get();
+ } else {
+ fenceResult = mFlinger.captureScreenshotLegacy(renderAreaBuilder, getLayerSnapshotsFn,
+ buffer, kRegionSampling, kGrayscale,
+ kIsProtected, kAttachGainmap, nullptr)
+ .get();
+ }
if (fenceResult.ok()) {
fenceResult.value()->waitForever(LOG_TAG);
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 896d13d31d..852a8b81e1 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -7389,41 +7389,79 @@ void SurfaceFlinger::captureScreenCommon(RenderAreaBuilderVariant renderAreaBuil
return;
}
- std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
- auto displayState = getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
-
- const bool supportsProtected = getRenderEngine().supportsProtectedContent();
- bool hasProtectedLayer = false;
- if (allowProtected && supportsProtected) {
- hasProtectedLayer = layersHasProtectedLayer(layers);
- }
- const bool isProtected = hasProtectedLayer && allowProtected && supportsProtected;
- const uint32_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_RENDER |
- GRALLOC_USAGE_HW_TEXTURE |
- (isProtected ? GRALLOC_USAGE_PROTECTED
- : GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
- sp<GraphicBuffer> buffer =
- getFactory().createGraphicBuffer(bufferSize.getWidth(), bufferSize.getHeight(),
- static_cast<android_pixel_format>(reqPixelFormat),
- 1 /* layerCount */, usage, "screenshot");
-
- const status_t bufferStatus = buffer->initCheck();
- if (bufferStatus != OK) {
- // Animations may end up being really janky, but don't crash here.
- // Otherwise an irreponsible process may cause an SF crash by allocating
- // too much.
- ALOGE("%s: Buffer failed to allocate: %d", __func__, bufferStatus);
- invokeScreenCaptureError(bufferStatus, captureListener);
- return;
+ if (FlagManager::getInstance().single_hop_screenshot()) {
+ std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
+ auto displayState =
+ getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
+
+ const bool supportsProtected = getRenderEngine().supportsProtectedContent();
+ bool hasProtectedLayer = false;
+ if (allowProtected && supportsProtected) {
+ hasProtectedLayer = layersHasProtectedLayer(layers);
+ }
+ const bool isProtected = hasProtectedLayer && allowProtected && supportsProtected;
+ const uint32_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_RENDER |
+ GRALLOC_USAGE_HW_TEXTURE |
+ (isProtected ? GRALLOC_USAGE_PROTECTED
+ : GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
+ sp<GraphicBuffer> buffer =
+ getFactory().createGraphicBuffer(bufferSize.getWidth(), bufferSize.getHeight(),
+ static_cast<android_pixel_format>(reqPixelFormat),
+ 1 /* layerCount */, usage, "screenshot");
+
+ const status_t bufferStatus = buffer->initCheck();
+ if (bufferStatus != OK) {
+ // Animations may end up being really janky, but don't crash here.
+ // Otherwise an irreponsible process may cause an SF crash by allocating
+ // too much.
+ ALOGE("%s: Buffer failed to allocate: %d", __func__, bufferStatus);
+ invokeScreenCaptureError(bufferStatus, captureListener);
+ return;
+ }
+ const std::shared_ptr<renderengine::ExternalTexture> texture = std::make_shared<
+ renderengine::impl::ExternalTexture>(buffer, getRenderEngine(),
+ renderengine::impl::ExternalTexture::Usage::
+ WRITEABLE);
+ auto futureFence = captureScreenshot(renderAreaBuilder, texture, false /* regionSampling */,
+ grayscale, isProtected, attachGainmap, captureListener,
+ displayState, layers);
+ futureFence.get();
+
+ } else {
+ const bool supportsProtected = getRenderEngine().supportsProtectedContent();
+ bool hasProtectedLayer = false;
+ if (allowProtected && supportsProtected) {
+ auto layers = mScheduler->schedule([=]() { return getLayerSnapshotsFn(); }).get();
+ hasProtectedLayer = layersHasProtectedLayer(layers);
+ }
+ const bool isProtected = hasProtectedLayer && allowProtected && supportsProtected;
+ const uint32_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_RENDER |
+ GRALLOC_USAGE_HW_TEXTURE |
+ (isProtected ? GRALLOC_USAGE_PROTECTED
+ : GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
+ sp<GraphicBuffer> buffer =
+ getFactory().createGraphicBuffer(bufferSize.getWidth(), bufferSize.getHeight(),
+ static_cast<android_pixel_format>(reqPixelFormat),
+ 1 /* layerCount */, usage, "screenshot");
+
+ const status_t bufferStatus = buffer->initCheck();
+ if (bufferStatus != OK) {
+ // Animations may end up being really janky, but don't crash here.
+ // Otherwise an irreponsible process may cause an SF crash by allocating
+ // too much.
+ ALOGE("%s: Buffer failed to allocate: %d", __func__, bufferStatus);
+ invokeScreenCaptureError(bufferStatus, captureListener);
+ return;
+ }
+ const std::shared_ptr<renderengine::ExternalTexture> texture = std::make_shared<
+ renderengine::impl::ExternalTexture>(buffer, getRenderEngine(),
+ renderengine::impl::ExternalTexture::Usage::
+ WRITEABLE);
+ auto futureFence = captureScreenshotLegacy(renderAreaBuilder, getLayerSnapshotsFn, texture,
+ false /* regionSampling */, grayscale,
+ isProtected, attachGainmap, captureListener);
+ futureFence.get();
}
- const std::shared_ptr<renderengine::ExternalTexture> texture = std::make_shared<
- renderengine::impl::ExternalTexture>(buffer, getRenderEngine(),
- renderengine::impl::ExternalTexture::Usage::
- WRITEABLE);
- auto futureFence =
- captureScreenshot(renderAreaBuilder, texture, false /* regionSampling */, grayscale,
- isProtected, attachGainmap, captureListener, displayState, layers);
- futureFence.get();
}
std::optional<SurfaceFlinger::OutputCompositionState>
@@ -7489,7 +7527,7 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
ftl::SharedFuture<FenceResult> renderFuture =
renderScreenImpl(renderArea.get(), buffer, regionSampling, grayscale, isProtected,
- captureResults, displayState, layers);
+ attachGainmap, captureResults, displayState, layers);
if (captureResults.capturedHdrLayers && attachGainmap &&
FlagManager::getInstance().true_hdr_screenshots()) {
@@ -7524,7 +7562,8 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
ScreenCaptureResults unusedResults;
ftl::SharedFuture<FenceResult> hdrRenderFuture =
renderScreenImpl(renderArea.get(), hdrTexture, regionSampling, grayscale,
- isProtected, unusedResults, displayState, layers);
+ isProtected, attachGainmap, unusedResults, displayState,
+ layers);
renderFuture =
ftl::Future(std::move(renderFuture))
@@ -7570,10 +7609,67 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
return renderFuture;
}
+ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshotLegacy(
+ RenderAreaBuilderVariant renderAreaBuilder, GetLayerSnapshotsFunction getLayerSnapshotsFn,
+ const std::shared_ptr<renderengine::ExternalTexture>& buffer, bool regionSampling,
+ bool grayscale, bool isProtected, bool attachGainmap,
+ const sp<IScreenCaptureListener>& captureListener) {
+ SFTRACE_CALL();
+
+ auto takeScreenshotFn = [=, this, renderAreaBuilder = std::move(renderAreaBuilder)]() REQUIRES(
+ kMainThreadContext) mutable -> ftl::SharedFuture<FenceResult> {
+ auto layers = getLayerSnapshotsFn();
+ auto displayState = getDisplayStateFromRenderAreaBuilder(renderAreaBuilder);
+
+ ScreenCaptureResults captureResults;
+ std::unique_ptr<const RenderArea> renderArea =
+ std::visit([](auto&& arg) -> std::unique_ptr<RenderArea> { return arg.build(); },
+ renderAreaBuilder);
+
+ if (!renderArea) {
+ ALOGW("Skipping screen capture because of invalid render area.");
+ if (captureListener) {
+ captureResults.fenceResult = base::unexpected(NO_MEMORY);
+ captureListener->onScreenCaptureCompleted(captureResults);
+ }
+ return ftl::yield<FenceResult>(base::unexpected(NO_ERROR)).share();
+ }
+
+ ftl::SharedFuture<FenceResult> renderFuture =
+ renderScreenImpl(renderArea.get(), buffer, regionSampling, grayscale, isProtected,
+ attachGainmap, captureResults, displayState, layers);
+
+ if (captureListener) {
+ // Defer blocking on renderFuture back to the Binder thread.
+ return ftl::Future(std::move(renderFuture))
+ .then([captureListener, captureResults = std::move(captureResults)](
+ FenceResult fenceResult) mutable -> FenceResult {
+ captureResults.fenceResult = std::move(fenceResult);
+ captureListener->onScreenCaptureCompleted(captureResults);
+ return base::unexpected(NO_ERROR);
+ })
+ .share();
+ }
+ return renderFuture;
+ };
+
+ // TODO(b/294936197): Run takeScreenshotsFn() in a binder thread to reduce the number
+ // of calls on the main thread.
+ auto future =
+ mScheduler->schedule(FTL_FAKE_GUARD(kMainThreadContext, std::move(takeScreenshotFn)));
+
+ // Flatten nested futures.
+ auto chain = ftl::Future(std::move(future)).then([](ftl::SharedFuture<FenceResult> future) {
+ return future;
+ });
+
+ return chain.share();
+}
+
ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
const RenderArea* renderArea, const std::shared_ptr<renderengine::ExternalTexture>& buffer,
- bool regionSampling, bool grayscale, bool isProtected, ScreenCaptureResults& captureResults,
- std::optional<OutputCompositionState>& displayState,
+ bool regionSampling, bool grayscale, bool isProtected, bool attachGainmap,
+ ScreenCaptureResults& captureResults, std::optional<OutputCompositionState>& displayState,
std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) {
SFTRACE_CALL();
@@ -7719,9 +7815,15 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
//
// TODO(b/196334700) Once we use RenderEngineThreaded everywhere we can always defer the call
// to CompositionEngine::present.
- ftl::SharedFuture<FenceResult> presentFuture = mRenderEngine->isThreaded()
- ? ftl::yield(present()).share()
- : mScheduler->schedule(std::move(present)).share();
+ ftl::SharedFuture<FenceResult> presentFuture;
+ if (FlagManager::getInstance().single_hop_screenshot()) {
+ presentFuture = mRenderEngine->isThreaded()
+ ? ftl::yield(present()).share()
+ : mScheduler->schedule(std::move(present)).share();
+ } else {
+ presentFuture = mRenderEngine->isThreaded() ? ftl::defer(std::move(present)).share()
+ : ftl::yield(present()).share();
+ }
return presentFuture;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1e2c08747b..835cb572b4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -885,10 +885,16 @@ private:
std::optional<OutputCompositionState>& displayState,
std::vector<std::pair<Layer*, sp<LayerFE>>>& layers);
+ ftl::SharedFuture<FenceResult> captureScreenshotLegacy(
+ RenderAreaBuilderVariant, GetLayerSnapshotsFunction,
+ const std::shared_ptr<renderengine::ExternalTexture>&, bool regionSampling,
+ bool grayscale, bool isProtected, bool attachGainmap,
+ const sp<IScreenCaptureListener>&);
+
ftl::SharedFuture<FenceResult> renderScreenImpl(
const RenderArea*, const std::shared_ptr<renderengine::ExternalTexture>&,
- bool regionSampling, bool grayscale, bool isProtected, ScreenCaptureResults&,
- std::optional<OutputCompositionState>& displayState,
+ bool regionSampling, bool grayscale, bool isProtected, bool attachGainmap,
+ ScreenCaptureResults&, std::optional<OutputCompositionState>& displayState,
std::vector<std::pair<Layer*, sp<LayerFE>>>& layers);
void readPersistentProperties();
diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp
index 5e78426c77..5c417ba748 100644
--- a/services/surfaceflinger/common/FlagManager.cpp
+++ b/services/surfaceflinger/common/FlagManager.cpp
@@ -166,6 +166,7 @@ void FlagManager::dump(std::string& result) const {
DUMP_ACONFIG_FLAG(skip_invisible_windows_in_input);
DUMP_ACONFIG_FLAG(begone_bright_hlg);
DUMP_ACONFIG_FLAG(window_blur_kawase2);
+ DUMP_ACONFIG_FLAG(single_hop_screenshot);
#undef DUMP_ACONFIG_FLAG
#undef DUMP_LEGACY_SERVER_FLAG
@@ -259,6 +260,7 @@ FLAG_MANAGER_ACONFIG_FLAG(local_tonemap_screenshots, "debug.sf.local_tonemap_scr
FLAG_MANAGER_ACONFIG_FLAG(override_trusted_overlay, "");
FLAG_MANAGER_ACONFIG_FLAG(flush_buffer_slots_to_uncache, "");
FLAG_MANAGER_ACONFIG_FLAG(force_compile_graphite_renderengine, "");
+FLAG_MANAGER_ACONFIG_FLAG(single_hop_screenshot, "");
FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots");
FLAG_MANAGER_ACONFIG_FLAG(display_config_error_hal, "");
FLAG_MANAGER_ACONFIG_FLAG(connected_display_hdr, "debug.sf.connected_display_hdr");
diff --git a/services/surfaceflinger/common/include/common/FlagManager.h b/services/surfaceflinger/common/include/common/FlagManager.h
index d8887f538f..15284ba0ee 100644
--- a/services/surfaceflinger/common/include/common/FlagManager.h
+++ b/services/surfaceflinger/common/include/common/FlagManager.h
@@ -95,6 +95,7 @@ public:
bool override_trusted_overlay() const;
bool flush_buffer_slots_to_uncache() const;
bool force_compile_graphite_renderengine() const;
+ bool single_hop_screenshot() const;
bool trace_frame_rate_override() const;
bool true_hdr_screenshots() const;
bool display_config_error_hal() const;
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 7f0b7a6585..fd8bc0d22d 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -475,7 +475,8 @@ public:
return mFlinger->renderScreenImpl(renderArea.get(), buffer, regionSampling,
false /* grayscale */, false /* isProtected */,
- captureResults, displayState, layers);
+ false /* attachGainmap */, captureResults, displayState,
+ layers);
}
auto getLayerSnapshotsForScreenshotsFn(ui::LayerStack layerStack, uint32_t uid) {
--
2.48.1

View file

@ -1,334 +0,0 @@
From aa5e6f794b3e2c9f5bdbc40da702b14dd9a1764e Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:19:17 -0400
Subject: [PATCH 5/7] Revert "Reorder release fence attachment for non-threaded
RE"
This reverts commit 0b80c74300b73e937ee9a9cb58487bd126daa4d8.
---
.../surfaceflinger/RegionSamplingThread.cpp | 11 ++-
services/surfaceflinger/SurfaceFlinger.cpp | 97 ++++++++++---------
services/surfaceflinger/SurfaceFlinger.h | 16 ++-
.../tests/unittests/TestableSurfaceFlinger.h | 3 +-
4 files changed, 69 insertions(+), 58 deletions(-)
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 08f831c8e5..011fd9e20a 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -354,13 +354,14 @@ void RegionSamplingThread::captureSample() {
RenderArea::Options::CAPTURE_SECURE_LAYERS);
FenceResult fenceResult;
- if (FlagManager::getInstance().single_hop_screenshot()) {
- std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
- auto displayState =
- mFlinger.getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
+ if (FlagManager::getInstance().single_hop_screenshot() &&
+ mFlinger.mRenderEngine->isThreaded()) {
+ std::vector<sp<LayerFE>> layerFEs;
+ auto displayState = mFlinger.getSnapshotsFromMainThread(renderAreaBuilder,
+ getLayerSnapshotsFn, layerFEs);
fenceResult = mFlinger.captureScreenshot(renderAreaBuilder, buffer, kRegionSampling,
kGrayscale, kIsProtected, kAttachGainmap, nullptr,
- displayState, layers)
+ displayState, layerFEs)
.get();
} else {
fenceResult = mFlinger.captureScreenshotLegacy(renderAreaBuilder, getLayerSnapshotsFn,
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 852a8b81e1..067a8bafe0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -7335,10 +7335,9 @@ void SurfaceFlinger::attachReleaseFenceFutureToLayer(Layer* layer, LayerFE* laye
// typically a layer with DRM contents, or have the GRALLOC_USAGE_PROTECTED set on the buffer.
// A protected layer has no implication on whether it's secure, which is explicitly set by
// application to avoid being screenshot or drawn via unsecure display.
-bool SurfaceFlinger::layersHasProtectedLayer(
- const std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) const {
+bool SurfaceFlinger::layersHasProtectedLayer(const std::vector<sp<LayerFE>>& layers) const {
bool protectedLayerFound = false;
- for (auto& [_, layerFE] : layers) {
+ for (auto& layerFE : layers) {
protectedLayerFound |=
(layerFE->mSnapshot->isVisible && layerFE->mSnapshot->hasProtectedContent);
if (protectedLayerFound) {
@@ -7354,21 +7353,15 @@ bool SurfaceFlinger::layersHasProtectedLayer(
// risk of deadlocks.
std::optional<SurfaceFlinger::OutputCompositionState> SurfaceFlinger::getSnapshotsFromMainThread(
RenderAreaBuilderVariant& renderAreaBuilder, GetLayerSnapshotsFunction getLayerSnapshotsFn,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) {
+ std::vector<sp<LayerFE>>& layerFEs) {
return mScheduler
- ->schedule([=, this, &renderAreaBuilder, &layers]() REQUIRES(kMainThreadContext) {
+ ->schedule([=, this, &renderAreaBuilder, &layerFEs]() REQUIRES(kMainThreadContext) {
SFTRACE_NAME("getSnapshotsFromMainThread");
- layers = getLayerSnapshotsFn();
- // Non-threaded RenderEngine eventually returns to the main thread a 2nd time
- // to complete the screenshot. Release fences should only be added during the 2nd
- // hop to main thread in order to avoid potential deadlocks from waiting for the
- // the future fence to fire.
- if (mRenderEngine->isThreaded()) {
- for (auto& [layer, layerFE] : layers) {
- attachReleaseFenceFutureToLayer(layer, layerFE.get(),
- ui::INVALID_LAYER_STACK);
- }
+ auto layers = getLayerSnapshotsFn();
+ for (auto& [layer, layerFE] : layers) {
+ attachReleaseFenceFutureToLayer(layer, layerFE.get(), ui::INVALID_LAYER_STACK);
}
+ layerFEs = extractLayerFEs(layers);
return getDisplayStateFromRenderAreaBuilder(renderAreaBuilder);
})
.get();
@@ -7389,15 +7382,15 @@ void SurfaceFlinger::captureScreenCommon(RenderAreaBuilderVariant renderAreaBuil
return;
}
- if (FlagManager::getInstance().single_hop_screenshot()) {
- std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
+ if (FlagManager::getInstance().single_hop_screenshot() && mRenderEngine->isThreaded()) {
+ std::vector<sp<LayerFE>> layerFEs;
auto displayState =
- getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
+ getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layerFEs);
const bool supportsProtected = getRenderEngine().supportsProtectedContent();
bool hasProtectedLayer = false;
if (allowProtected && supportsProtected) {
- hasProtectedLayer = layersHasProtectedLayer(layers);
+ hasProtectedLayer = layersHasProtectedLayer(layerFEs);
}
const bool isProtected = hasProtectedLayer && allowProtected && supportsProtected;
const uint32_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_RENDER |
@@ -7424,7 +7417,7 @@ void SurfaceFlinger::captureScreenCommon(RenderAreaBuilderVariant renderAreaBuil
WRITEABLE);
auto futureFence = captureScreenshot(renderAreaBuilder, texture, false /* regionSampling */,
grayscale, isProtected, attachGainmap, captureListener,
- displayState, layers);
+ displayState, layerFEs);
futureFence.get();
} else {
@@ -7432,7 +7425,7 @@ void SurfaceFlinger::captureScreenCommon(RenderAreaBuilderVariant renderAreaBuil
bool hasProtectedLayer = false;
if (allowProtected && supportsProtected) {
auto layers = mScheduler->schedule([=]() { return getLayerSnapshotsFn(); }).get();
- hasProtectedLayer = layersHasProtectedLayer(layers);
+ hasProtectedLayer = layersHasProtectedLayer(extractLayerFEs(layers));
}
const bool isProtected = hasProtectedLayer && allowProtected && supportsProtected;
const uint32_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_RENDER |
@@ -7500,13 +7493,22 @@ SurfaceFlinger::getDisplayStateFromRenderAreaBuilder(RenderAreaBuilderVariant& r
return std::nullopt;
}
+std::vector<sp<LayerFE>> SurfaceFlinger::extractLayerFEs(
+ const std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) const {
+ std::vector<sp<LayerFE>> layerFEs;
+ layerFEs.reserve(layers.size());
+ for (const auto& [_, layerFE] : layers) {
+ layerFEs.push_back(layerFE);
+ }
+ return layerFEs;
+}
+
ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
const RenderAreaBuilderVariant& renderAreaBuilder,
const std::shared_ptr<renderengine::ExternalTexture>& buffer, bool regionSampling,
bool grayscale, bool isProtected, bool attachGainmap,
const sp<IScreenCaptureListener>& captureListener,
- std::optional<OutputCompositionState>& displayState,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) {
+ std::optional<OutputCompositionState>& displayState, std::vector<sp<LayerFE>>& layerFEs) {
SFTRACE_CALL();
ScreenCaptureResults captureResults;
@@ -7525,9 +7527,11 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
float displayBrightnessNits = displayState.value().displayBrightnessNits;
float sdrWhitePointNits = displayState.value().sdrWhitePointNits;
+ // Empty vector needed to pass into renderScreenImpl for legacy path
+ std::vector<std::pair<Layer*, sp<android::LayerFE>>> layers;
ftl::SharedFuture<FenceResult> renderFuture =
renderScreenImpl(renderArea.get(), buffer, regionSampling, grayscale, isProtected,
- attachGainmap, captureResults, displayState, layers);
+ attachGainmap, captureResults, displayState, layers, layerFEs);
if (captureResults.capturedHdrLayers && attachGainmap &&
FlagManager::getInstance().true_hdr_screenshots()) {
@@ -7563,7 +7567,7 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
ftl::SharedFuture<FenceResult> hdrRenderFuture =
renderScreenImpl(renderArea.get(), hdrTexture, regionSampling, grayscale,
isProtected, attachGainmap, unusedResults, displayState,
- layers);
+ layers, layerFEs);
renderFuture =
ftl::Future(std::move(renderFuture))
@@ -7619,6 +7623,9 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshotLegacy(
auto takeScreenshotFn = [=, this, renderAreaBuilder = std::move(renderAreaBuilder)]() REQUIRES(
kMainThreadContext) mutable -> ftl::SharedFuture<FenceResult> {
auto layers = getLayerSnapshotsFn();
+ for (auto& [layer, layerFE] : layers) {
+ attachReleaseFenceFutureToLayer(layer, layerFE.get(), ui::INVALID_LAYER_STACK);
+ }
auto displayState = getDisplayStateFromRenderAreaBuilder(renderAreaBuilder);
ScreenCaptureResults captureResults;
@@ -7635,9 +7642,10 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshotLegacy(
return ftl::yield<FenceResult>(base::unexpected(NO_ERROR)).share();
}
+ auto layerFEs = extractLayerFEs(layers);
ftl::SharedFuture<FenceResult> renderFuture =
renderScreenImpl(renderArea.get(), buffer, regionSampling, grayscale, isProtected,
- attachGainmap, captureResults, displayState, layers);
+ attachGainmap, captureResults, displayState, layers, layerFEs);
if (captureListener) {
// Defer blocking on renderFuture back to the Binder thread.
@@ -7670,10 +7678,10 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
const RenderArea* renderArea, const std::shared_ptr<renderengine::ExternalTexture>& buffer,
bool regionSampling, bool grayscale, bool isProtected, bool attachGainmap,
ScreenCaptureResults& captureResults, std::optional<OutputCompositionState>& displayState,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) {
+ std::vector<std::pair<Layer*, sp<LayerFE>>>& layers, std::vector<sp<LayerFE>>& layerFEs) {
SFTRACE_CALL();
- for (auto& [_, layerFE] : layers) {
+ for (auto& layerFE : layerFEs) {
frontend::LayerSnapshot* snapshot = layerFE->mSnapshot.get();
captureResults.capturedSecureLayers |= (snapshot->isVisible && snapshot->isSecure);
captureResults.capturedHdrLayers |= isHdrLayer(*snapshot);
@@ -7732,32 +7740,29 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
captureResults.buffer = capturedBuffer->getBuffer();
ui::LayerStack layerStack{ui::DEFAULT_LAYER_STACK};
- if (!layers.empty()) {
- const sp<LayerFE>& layerFE = layers.back().second;
+ if (!layerFEs.empty()) {
+ const sp<LayerFE>& layerFE = layerFEs.back();
layerStack = layerFE->getCompositionState()->outputFilter.layerStack;
}
+ auto copyLayerFEs = [&layerFEs]() {
+ std::vector<sp<compositionengine::LayerFE>> ceLayerFEs;
+ ceLayerFEs.reserve(layerFEs.size());
+ for (const auto& layerFE : layerFEs) {
+ ceLayerFEs.push_back(layerFE);
+ }
+ return ceLayerFEs;
+ };
+
auto present = [this, buffer = capturedBuffer, dataspace = captureResults.capturedDataspace,
sdrWhitePointNits, displayBrightnessNits, grayscale, isProtected,
- layers = std::move(layers), layerStack, regionSampling,
+ layerFEs = copyLayerFEs(), layerStack, regionSampling,
renderArea = std::move(renderArea), renderIntent,
enableLocalTonemapping]() -> FenceResult {
std::unique_ptr<compositionengine::CompositionEngine> compositionEngine =
mFactory.createCompositionEngine();
compositionEngine->setRenderEngine(mRenderEngine.get());
- std::vector<sp<compositionengine::LayerFE>> layerFEs;
- layerFEs.reserve(layers.size());
- for (auto& [layer, layerFE] : layers) {
- // Release fences were not yet added for non-threaded render engine. To avoid
- // deadlocks between main thread and binder threads waiting for the future fence
- // result, fences should be added to layers in the same hop onto the main thread.
- if (!mRenderEngine->isThreaded()) {
- attachReleaseFenceFutureToLayer(layer, layerFE.get(), ui::INVALID_LAYER_STACK);
- }
- layerFEs.push_back(layerFE);
- }
-
compositionengine::Output::ColorProfile colorProfile{.dataspace = dataspace,
.renderIntent = renderIntent};
@@ -7816,10 +7821,8 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
// TODO(b/196334700) Once we use RenderEngineThreaded everywhere we can always defer the call
// to CompositionEngine::present.
ftl::SharedFuture<FenceResult> presentFuture;
- if (FlagManager::getInstance().single_hop_screenshot()) {
- presentFuture = mRenderEngine->isThreaded()
- ? ftl::yield(present()).share()
- : mScheduler->schedule(std::move(present)).share();
+ if (FlagManager::getInstance().single_hop_screenshot() && mRenderEngine->isThreaded()) {
+ presentFuture = ftl::yield(present()).share();
} else {
presentFuture = mRenderEngine->isThreaded() ? ftl::defer(std::move(present)).share()
: ftl::yield(present()).share();
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 835cb572b4..1df78acbf9 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -861,14 +861,13 @@ private:
void attachReleaseFenceFutureToLayer(Layer* layer, LayerFE* layerFE, ui::LayerStack layerStack);
// Checks if a protected layer exists in a list of layers.
- bool layersHasProtectedLayer(const std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) const;
+ bool layersHasProtectedLayer(const std::vector<sp<LayerFE>>& layers) const;
using OutputCompositionState = compositionengine::impl::OutputCompositionState;
std::optional<OutputCompositionState> getSnapshotsFromMainThread(
RenderAreaBuilderVariant& renderAreaBuilder,
- GetLayerSnapshotsFunction getLayerSnapshotsFn,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers);
+ GetLayerSnapshotsFunction getLayerSnapshotsFn, std::vector<sp<LayerFE>>& layerFEs);
void captureScreenCommon(RenderAreaBuilderVariant, GetLayerSnapshotsFunction,
ui::Size bufferSize, ui::PixelFormat, bool allowProtected,
@@ -877,13 +876,19 @@ private:
std::optional<OutputCompositionState> getDisplayStateFromRenderAreaBuilder(
RenderAreaBuilderVariant& renderAreaBuilder) REQUIRES(kMainThreadContext);
+ // Legacy layer raw pointer is not safe to access outside the main thread.
+ // Creates a new vector consisting only of LayerFEs, which can be safely
+ // accessed outside the main thread.
+ std::vector<sp<LayerFE>> extractLayerFEs(
+ const std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) const;
+
ftl::SharedFuture<FenceResult> captureScreenshot(
const RenderAreaBuilderVariant& renderAreaBuilder,
const std::shared_ptr<renderengine::ExternalTexture>& buffer, bool regionSampling,
bool grayscale, bool isProtected, bool attachGainmap,
const sp<IScreenCaptureListener>& captureListener,
std::optional<OutputCompositionState>& displayState,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers);
+ std::vector<sp<LayerFE>>& layerFEs);
ftl::SharedFuture<FenceResult> captureScreenshotLegacy(
RenderAreaBuilderVariant, GetLayerSnapshotsFunction,
@@ -895,7 +900,8 @@ private:
const RenderArea*, const std::shared_ptr<renderengine::ExternalTexture>&,
bool regionSampling, bool grayscale, bool isProtected, bool attachGainmap,
ScreenCaptureResults&, std::optional<OutputCompositionState>& displayState,
- std::vector<std::pair<Layer*, sp<LayerFE>>>& layers);
+ std::vector<std::pair<Layer*, sp<LayerFE>>>& layers,
+ std::vector<sp<LayerFE>>& layerFEs);
void readPersistentProperties();
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index fd8bc0d22d..2ba739b462 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -472,11 +472,12 @@ public:
ScreenCaptureResults captureResults;
auto displayState = std::optional{display->getCompositionDisplay()->getState()};
auto layers = getLayerSnapshotsFn();
+ auto layerFEs = mFlinger->extractLayerFEs(layers);
return mFlinger->renderScreenImpl(renderArea.get(), buffer, regionSampling,
false /* grayscale */, false /* isProtected */,
false /* attachGainmap */, captureResults, displayState,
- layers);
+ layers, layerFEs);
}
auto getLayerSnapshotsForScreenshotsFn(ui::LayerStack layerStack, uint32_t uid) {
--
2.48.1

View file

@ -1,755 +0,0 @@
From c2edb476e76d96dc48ed0f5b46367d1b0137e8b7 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:24:30 -0400
Subject: [PATCH 6/7] Revert "Remove release fence flags"
This reverts commit 0077fde3aba6f2bde4e878f88c0dd466350fc1b1.
Change-Id: I04eb5f0a45cc63e55b6b74f2327d182cd9f15098
---
.../src/CompositionEngine.cpp | 32 +++--
.../CompositionEngine/src/Output.cpp | 15 +-
.../tests/CompositionEngineTest.cpp | 5 +
.../CompositionEngine/tests/OutputTest.cpp | 134 ++++++++++++++++++
services/surfaceflinger/Layer.cpp | 59 +++++++-
services/surfaceflinger/Layer.h | 16 +++
services/surfaceflinger/LayerFE.cpp | 4 +-
.../surfaceflinger/RegionSamplingThread.cpp | 2 +-
services/surfaceflinger/SurfaceFlinger.cpp | 123 +++++++++++-----
.../TransactionCallbackInvoker.cpp | 11 +-
.../TransactionCallbackInvoker.h | 1 +
.../surfaceflinger/common/FlagManager.cpp | 4 +
.../common/include/common/FlagManager.h | 2 +
.../tests/TransactionTestHarnesses.h | 15 +-
14 files changed, 364 insertions(+), 59 deletions(-)
diff --git a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
index cfcce473a2..5c5d0cd74d 100644
--- a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
@@ -198,23 +198,25 @@ void CompositionEngine::preComposition(CompositionRefreshArgs& args) {
// these buffers and fire a NO_FENCE to release it. This ensures that all
// promises for buffer releases are fulfilled at the end of composition.
void CompositionEngine::postComposition(CompositionRefreshArgs& args) {
- SFTRACE_CALL();
- ALOGV(__FUNCTION__);
-
- for (auto& layerFE : args.layers) {
- if (layerFE->getReleaseFencePromiseStatus() ==
- LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
- layerFE->setReleaseFence(Fence::NO_FENCE);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ SFTRACE_CALL();
+ ALOGV(__FUNCTION__);
+
+ for (auto& layerFE : args.layers) {
+ if (layerFE->getReleaseFencePromiseStatus() ==
+ LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
+ layerFE->setReleaseFence(Fence::NO_FENCE);
+ }
}
- }
- // List of layersWithQueuedFrames does not necessarily overlap with
- // list of layers, so those layersWithQueuedFrames also need any
- // unfulfilled promises to be resolved for completeness.
- for (auto& layerFE : args.layersWithQueuedFrames) {
- if (layerFE->getReleaseFencePromiseStatus() ==
- LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
- layerFE->setReleaseFence(Fence::NO_FENCE);
+ // List of layersWithQueuedFrames does not necessarily overlap with
+ // list of layers, so those layersWithQueuedFrames also need any
+ // unfulfilled promises to be resolved for completeness.
+ for (auto& layerFE : args.layersWithQueuedFrames) {
+ if (layerFE->getReleaseFencePromiseStatus() ==
+ LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
+ layerFE->setReleaseFence(Fence::NO_FENCE);
+ }
}
}
}
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index f9ed92d1ee..34773de107 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -1664,7 +1664,13 @@ void Output::presentFrameAndReleaseLayers(bool flushEvenWhenDisabled) {
releaseFence =
Fence::merge("LayerRelease", releaseFence, frame.clientTargetAcquireFence);
}
- layer->getLayerFE().setReleaseFence(releaseFence);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ layer->getLayerFE().setReleaseFence(releaseFence);
+ } else {
+ layer->getLayerFE()
+ .onLayerDisplayed(ftl::yield<FenceResult>(std::move(releaseFence)).share(),
+ outputState.layerFilter.layerStack);
+ }
}
// We've got a list of layers needing fences, that are disjoint with
@@ -1672,7 +1678,12 @@ void Output::presentFrameAndReleaseLayers(bool flushEvenWhenDisabled) {
// supply them with the present fence.
for (auto& weakLayer : mReleasedLayers) {
if (const auto layer = weakLayer.promote()) {
- layer->setReleaseFence(frame.presentFence);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ layer->setReleaseFence(frame.presentFence);
+ } else {
+ layer->onLayerDisplayed(ftl::yield<FenceResult>(frame.presentFence).share(),
+ outputState.layerFilter.layerStack);
+ }
}
}
diff --git a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
index 3e0c390a5d..deb90deaf7 100644
--- a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
@@ -29,6 +29,8 @@
#include "TimeStats/TimeStats.h"
#include "mock/DisplayHardware/MockHWComposer.h"
+#include <variant>
+
using namespace com::android::graphics::surfaceflinger;
namespace android::compositionengine {
@@ -491,6 +493,9 @@ struct CompositionEnginePostCompositionTest : public CompositionEngineTest {
};
TEST_F(CompositionEnginePostCompositionTest, postCompositionReleasesAllFences) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, true);
+ ASSERT_TRUE(FlagManager::getInstance().ce_fence_promise());
+
EXPECT_CALL(*mLayer1FE, getReleaseFencePromiseStatus)
.WillOnce(Return(LayerFE::ReleaseFencePromiseStatus::FULFILLED));
EXPECT_CALL(*mLayer2FE, getReleaseFencePromiseStatus)
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
index 442b603ca0..eb7f0ddc37 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
@@ -35,6 +35,7 @@
#include <ui/Rect.h>
#include <ui/Region.h>
+#include <cmath>
#include <cstdint>
#include <variant>
@@ -3289,9 +3290,57 @@ TEST_F(OutputPostFramebufferTest, ifEnabledMustFlipThenPresentThenSendPresentCom
mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
}
+TEST_F(OutputPostFramebufferTest, releaseFencesAreSentToLayerFE) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, false);
+ ASSERT_FALSE(FlagManager::getInstance().ce_fence_promise());
+ // Simulate getting release fences from each layer, and ensure they are passed to the
+ // front-end layer interface for each layer correctly.
+
+ mOutput.mState.isEnabled = true;
+
+ // Create three unique fence instances
+ sp<Fence> layer1Fence = sp<Fence>::make();
+ sp<Fence> layer2Fence = sp<Fence>::make();
+ sp<Fence> layer3Fence = sp<Fence>::make();
+
+ Output::FrameFences frameFences;
+ frameFences.layerFences.emplace(&mLayer1.hwc2Layer, layer1Fence);
+ frameFences.layerFences.emplace(&mLayer2.hwc2Layer, layer2Fence);
+ frameFences.layerFences.emplace(&mLayer3.hwc2Layer, layer3Fence);
+
+ EXPECT_CALL(mOutput, presentFrame()).WillOnce(Return(frameFences));
+ EXPECT_CALL(*mRenderSurface, onPresentDisplayCompleted());
+
+ // Compare the pointers values of each fence to make sure the correct ones
+ // are passed. This happens to work with the current implementation, but
+ // would not survive certain calls like Fence::merge() which would return a
+ // new instance.
+ EXPECT_CALL(*mLayer1.layerFE, onLayerDisplayed(_, _))
+ .WillOnce([&layer1Fence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(layer1Fence), futureFenceResult.get());
+ });
+ EXPECT_CALL(*mLayer2.layerFE, onLayerDisplayed(_, _))
+ .WillOnce([&layer2Fence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(layer2Fence), futureFenceResult.get());
+ });
+ EXPECT_CALL(*mLayer3.layerFE, onLayerDisplayed(_, _))
+ .WillOnce([&layer3Fence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(layer3Fence), futureFenceResult.get());
+ });
+
+ constexpr bool kFlushEvenWhenDisabled = false;
+ mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
+}
+
TEST_F(OutputPostFramebufferTest, releaseFencesAreSetInLayerFE) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, true);
+ ASSERT_TRUE(FlagManager::getInstance().ce_fence_promise());
// Simulate getting release fences from each layer, and ensure they are passed to the
// front-end layer interface for each layer correctly.
+
mOutput.mState.isEnabled = true;
// Create three unique fence instances
@@ -3328,7 +3377,37 @@ TEST_F(OutputPostFramebufferTest, releaseFencesAreSetInLayerFE) {
mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
}
+TEST_F(OutputPostFramebufferTest, releaseFencesIncludeClientTargetAcquireFence) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, false);
+ ASSERT_FALSE(FlagManager::getInstance().ce_fence_promise());
+
+ mOutput.mState.isEnabled = true;
+ mOutput.mState.usesClientComposition = true;
+
+ Output::FrameFences frameFences;
+ frameFences.clientTargetAcquireFence = sp<Fence>::make();
+ frameFences.layerFences.emplace(&mLayer1.hwc2Layer, sp<Fence>::make());
+ frameFences.layerFences.emplace(&mLayer2.hwc2Layer, sp<Fence>::make());
+ frameFences.layerFences.emplace(&mLayer3.hwc2Layer, sp<Fence>::make());
+
+ EXPECT_CALL(mOutput, presentFrame()).WillOnce(Return(frameFences));
+ EXPECT_CALL(*mRenderSurface, onPresentDisplayCompleted());
+
+ // Fence::merge is called, and since none of the fences are actually valid,
+ // Fence::NO_FENCE is returned and passed to each onLayerDisplayed() call.
+ // This is the best we can do without creating a real kernel fence object.
+ EXPECT_CALL(*mLayer1.layerFE, onLayerDisplayed).WillOnce(Return());
+ EXPECT_CALL(*mLayer2.layerFE, onLayerDisplayed).WillOnce(Return());
+ EXPECT_CALL(*mLayer3.layerFE, onLayerDisplayed).WillOnce(Return());
+
+ constexpr bool kFlushEvenWhenDisabled = false;
+ mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
+}
+
TEST_F(OutputPostFramebufferTest, setReleaseFencesIncludeClientTargetAcquireFence) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, true);
+ ASSERT_TRUE(FlagManager::getInstance().ce_fence_promise());
+
mOutput.mState.isEnabled = true;
mOutput.mState.usesClientComposition = true;
@@ -3351,7 +3430,62 @@ TEST_F(OutputPostFramebufferTest, setReleaseFencesIncludeClientTargetAcquireFenc
mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
}
+TEST_F(OutputPostFramebufferTest, releasedLayersSentPresentFence) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, false);
+ ASSERT_FALSE(FlagManager::getInstance().ce_fence_promise());
+
+ mOutput.mState.isEnabled = true;
+ mOutput.mState.usesClientComposition = true;
+
+ // This should happen even if there are no (current) output layers.
+ EXPECT_CALL(mOutput, getOutputLayerCount()).WillOnce(Return(0u));
+
+ // Load up the released layers with some mock instances
+ sp<StrictMock<mock::LayerFE>> releasedLayer1 = sp<StrictMock<mock::LayerFE>>::make();
+ sp<StrictMock<mock::LayerFE>> releasedLayer2 = sp<StrictMock<mock::LayerFE>>::make();
+ sp<StrictMock<mock::LayerFE>> releasedLayer3 = sp<StrictMock<mock::LayerFE>>::make();
+ Output::ReleasedLayers layers;
+ layers.push_back(releasedLayer1);
+ layers.push_back(releasedLayer2);
+ layers.push_back(releasedLayer3);
+ mOutput.setReleasedLayers(std::move(layers));
+
+ // Set up a fake present fence
+ sp<Fence> presentFence = sp<Fence>::make();
+ Output::FrameFences frameFences;
+ frameFences.presentFence = presentFence;
+
+ EXPECT_CALL(mOutput, presentFrame()).WillOnce(Return(frameFences));
+ EXPECT_CALL(*mRenderSurface, onPresentDisplayCompleted());
+
+ // Each released layer should be given the presentFence.
+ EXPECT_CALL(*releasedLayer1, onLayerDisplayed(_, _))
+ .WillOnce([&presentFence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(presentFence), futureFenceResult.get());
+ });
+ EXPECT_CALL(*releasedLayer2, onLayerDisplayed(_, _))
+ .WillOnce([&presentFence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(presentFence), futureFenceResult.get());
+ });
+ EXPECT_CALL(*releasedLayer3, onLayerDisplayed(_, _))
+ .WillOnce([&presentFence](ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack) {
+ EXPECT_EQ(FenceResult(presentFence), futureFenceResult.get());
+ });
+
+ constexpr bool kFlushEvenWhenDisabled = false;
+ mOutput.presentFrameAndReleaseLayers(kFlushEvenWhenDisabled);
+
+ // After the call the list of released layers should have been cleared.
+ EXPECT_TRUE(mOutput.getReleasedLayersForTest().empty());
+}
+
TEST_F(OutputPostFramebufferTest, setReleasedLayersSentPresentFence) {
+ SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags::ce_fence_promise, true);
+ ASSERT_TRUE(FlagManager::getInstance().ce_fence_promise());
+
mOutput.mState.isEnabled = true;
mOutput.mState.usesClientComposition = true;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 195461f47e..a8e60f1632 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -805,6 +805,54 @@ void Layer::prepareReleaseCallbacks(ftl::Future<FenceResult> futureFenceResult,
}
}
+void Layer::onLayerDisplayed(ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack layerStack,
+ std::function<FenceResult(FenceResult)>&& continuation) {
+ sp<CallbackHandle> ch = findCallbackHandle();
+
+ if (!FlagManager::getInstance().screenshot_fence_preservation() && continuation) {
+ futureFenceResult = ftl::Future(futureFenceResult).then(std::move(continuation)).share();
+ }
+
+ if (ch != nullptr) {
+ ch->previousReleaseCallbackId = mPreviousReleaseCallbackId;
+ ch->previousSharedReleaseFences.emplace_back(std::move(futureFenceResult));
+ ch->name = mName;
+ } else if (FlagManager::getInstance().screenshot_fence_preservation()) {
+ // If we didn't get a release callback yet, e.g. some scenarios when capturing screenshots
+ // asynchronously, then make sure we don't drop the fence.
+ mPreviousReleaseFenceAndContinuations.emplace_back(std::move(futureFenceResult),
+ std::move(continuation));
+ std::vector<FenceAndContinuation> mergedFences;
+ sp<Fence> prevFence = nullptr;
+ // For a layer that's frequently screenshotted, try to merge fences to make sure we don't
+ // grow unbounded.
+ for (const auto& futureAndContinuation : mPreviousReleaseFenceAndContinuations) {
+ auto result = futureAndContinuation.future.wait_for(0s);
+ if (result != std::future_status::ready) {
+ mergedFences.emplace_back(futureAndContinuation);
+ continue;
+ }
+
+ mergeFence(getDebugName(),
+ futureAndContinuation.chain().get().value_or(Fence::NO_FENCE), prevFence);
+ }
+ if (prevFence != nullptr) {
+ mergedFences.emplace_back(ftl::yield(FenceResult(std::move(prevFence))).share());
+ }
+
+ mPreviousReleaseFenceAndContinuations.swap(mergedFences);
+ }
+
+ if (mBufferInfo.mBuffer) {
+ mPreviouslyPresentedLayerStacks.push_back(layerStack);
+ }
+
+ if (mDrawingState.frameNumber > 0) {
+ mDrawingState.previousFrameNumber = mDrawingState.frameNumber;
+ }
+}
+
void Layer::releasePendingBuffer(nsecs_t dequeueReadyTime) {
for (const auto& handle : mDrawingState.callbackHandles) {
handle->bufferReleaseChannel = mBufferReleaseChannel;
@@ -1117,13 +1165,22 @@ bool Layer::setTransactionCompletedListeners(const std::vector<sp<CallbackHandle
handle->acquireTimeOrFence = mCallbackHandleAcquireTimeOrFence;
handle->frameNumber = mDrawingState.frameNumber;
handle->previousFrameNumber = mDrawingState.previousFrameNumber;
- if (mPreviousReleaseBufferEndpoint == handle->listener) {
+ if (FlagManager::getInstance().ce_fence_promise() &&
+ mPreviousReleaseBufferEndpoint == handle->listener) {
// Add fence from previous screenshot now so that it can be dispatched to the
// client.
for (auto& [_, future] : mAdditionalPreviousReleaseFences) {
handle->previousReleaseFences.emplace_back(std::move(future));
}
mAdditionalPreviousReleaseFences.clear();
+ } else if (FlagManager::getInstance().screenshot_fence_preservation() &&
+ mPreviousReleaseBufferEndpoint == handle->listener) {
+ // Add fences from previous screenshots now so that they can be dispatched to the
+ // client.
+ for (const auto& futureAndContinution : mPreviousReleaseFenceAndContinuations) {
+ handle->previousSharedReleaseFences.emplace_back(futureAndContinution.chain());
+ }
+ mPreviousReleaseFenceAndContinuations.clear();
}
// Store so latched time and release fence can be set
mDrawingState.callbackHandles.push_back(handle);
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index c234a75693..c4ffe1ef2d 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -261,6 +261,8 @@ public:
bool fenceHasSignaled() const;
void onPreComposition(nsecs_t refreshStartTime);
+ void onLayerDisplayed(ftl::SharedFuture<FenceResult>, ui::LayerStack layerStack,
+ std::function<FenceResult(FenceResult)>&& continuation = nullptr);
// Tracks mLastClientCompositionFence and gets the callback handle for this layer.
sp<CallbackHandle> findCallbackHandle();
@@ -389,6 +391,20 @@ public:
// from the layer.
std::vector<ui::LayerStack> mPreviouslyPresentedLayerStacks;
+ struct FenceAndContinuation {
+ ftl::SharedFuture<FenceResult> future;
+ std::function<FenceResult(FenceResult)> continuation;
+
+ ftl::SharedFuture<FenceResult> chain() const {
+ if (continuation) {
+ return ftl::Future(future).then(continuation).share();
+ } else {
+ return future;
+ }
+ }
+ };
+ std::vector<FenceAndContinuation> mPreviousReleaseFenceAndContinuations;
+
// Release fences for buffers that have not yet received a release
// callback. A release callback may not be given when capturing
// screenshots asynchronously. There may be no buffer update for the
diff --git a/services/surfaceflinger/LayerFE.cpp b/services/surfaceflinger/LayerFE.cpp
index fea7671af2..de64b271f5 100644
--- a/services/surfaceflinger/LayerFE.cpp
+++ b/services/surfaceflinger/LayerFE.cpp
@@ -26,6 +26,7 @@
#include "LayerFE.h"
#include "SurfaceFlinger.h"
+#include "common/FlagManager.h"
#include "ui/FenceResult.h"
namespace android {
@@ -82,7 +83,8 @@ LayerFE::~LayerFE() {
// Ensures that no promise is left unfulfilled before the LayerFE is destroyed.
// An unfulfilled promise could occur when a screenshot is attempted, but the
// render area is invalid and there is no memory for the capture result.
- if (mReleaseFencePromiseStatus == ReleaseFencePromiseStatus::INITIALIZED) {
+ if (FlagManager::getInstance().ce_fence_promise() &&
+ mReleaseFencePromiseStatus == ReleaseFencePromiseStatus::INITIALIZED) {
setReleaseFence(Fence::NO_FENCE);
}
}
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 011fd9e20a..06c2f26a6d 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -355,7 +355,7 @@ void RegionSamplingThread::captureSample() {
FenceResult fenceResult;
if (FlagManager::getInstance().single_hop_screenshot() &&
- mFlinger.mRenderEngine->isThreaded()) {
+ FlagManager::getInstance().ce_fence_promise() && mFlinger.mRenderEngine->isThreaded()) {
std::vector<sp<LayerFE>> layerFEs;
auto displayState = mFlinger.getSnapshotsFromMainThread(renderAreaBuilder,
getLayerSnapshotsFn, layerFEs);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 067a8bafe0..47a3c2c2bf 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2820,6 +2820,16 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
compositionengine::Feature::kSnapshotLayerMetadata);
refreshArgs.bufferIdsToUncache = std::move(mBufferIdsToUncache);
+
+ if (!FlagManager::getInstance().ce_fence_promise()) {
+ refreshArgs.layersWithQueuedFrames.reserve(mLayersWithQueuedFrames.size());
+ for (auto& [layer, _] : mLayersWithQueuedFrames) {
+ if (const auto& layerFE = layer->getCompositionEngineLayerFE(
+ {static_cast<uint32_t>(layer->sequence)}))
+ refreshArgs.layersWithQueuedFrames.push_back(layerFE);
+ }
+ }
+
refreshArgs.outputColorSetting = mDisplayColorSetting;
refreshArgs.forceOutputColorMode = mForceColorMode;
@@ -2883,38 +2893,54 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
layer->onPreComposition(refreshArgs.refreshStartTime);
}
- for (auto& [layer, layerFE] : layers) {
- attachReleaseFenceFutureToLayer(layer, layerFE,
- layerFE->mSnapshot->outputFilter.layerStack);
- }
-
- refreshArgs.layersWithQueuedFrames.reserve(mLayersWithQueuedFrames.size());
- for (auto& [layer, _] : mLayersWithQueuedFrames) {
- if (const auto& layerFE =
- layer->getCompositionEngineLayerFE({static_cast<uint32_t>(layer->sequence)})) {
- refreshArgs.layersWithQueuedFrames.push_back(layerFE);
- // Some layers are not displayed and do not yet have a future release fence
- if (layerFE->getReleaseFencePromiseStatus() ==
- LayerFE::ReleaseFencePromiseStatus::UNINITIALIZED ||
- layerFE->getReleaseFencePromiseStatus() ==
- LayerFE::ReleaseFencePromiseStatus::FULFILLED) {
- // layerStack is invalid because layer is not on a display
- attachReleaseFenceFutureToLayer(layer.get(), layerFE.get(),
- ui::INVALID_LAYER_STACK);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ for (auto& [layer, layerFE] : layers) {
+ attachReleaseFenceFutureToLayer(layer, layerFE,
+ layerFE->mSnapshot->outputFilter.layerStack);
+ }
+
+ refreshArgs.layersWithQueuedFrames.reserve(mLayersWithQueuedFrames.size());
+ for (auto& [layer, _] : mLayersWithQueuedFrames) {
+ if (const auto& layerFE = layer->getCompositionEngineLayerFE(
+ {static_cast<uint32_t>(layer->sequence)})) {
+ refreshArgs.layersWithQueuedFrames.push_back(layerFE);
+ // Some layers are not displayed and do not yet have a future release fence
+ if (layerFE->getReleaseFencePromiseStatus() ==
+ LayerFE::ReleaseFencePromiseStatus::UNINITIALIZED ||
+ layerFE->getReleaseFencePromiseStatus() ==
+ LayerFE::ReleaseFencePromiseStatus::FULFILLED) {
+ // layerStack is invalid because layer is not on a display
+ attachReleaseFenceFutureToLayer(layer.get(), layerFE.get(),
+ ui::INVALID_LAYER_STACK);
+ }
}
}
- }
- mCompositionEngine->present(refreshArgs);
- moveSnapshotsFromCompositionArgs(refreshArgs, layers);
+ mCompositionEngine->present(refreshArgs);
+ moveSnapshotsFromCompositionArgs(refreshArgs, layers);
- for (auto& [layer, layerFE] : layers) {
- CompositionResult compositionResult{layerFE->stealCompositionResult()};
- if (compositionResult.lastClientCompositionFence) {
- layer->setWasClientComposed(compositionResult.lastClientCompositionFence);
+ for (auto& [layer, layerFE] : layers) {
+ CompositionResult compositionResult{layerFE->stealCompositionResult()};
+ if (compositionResult.lastClientCompositionFence) {
+ layer->setWasClientComposed(compositionResult.lastClientCompositionFence);
+ }
}
- if (com_android_graphics_libgui_flags_apply_picture_profiles()) {
- mActivePictureUpdater.onLayerComposed(*layer, *layerFE, compositionResult);
+
+ } else {
+ mCompositionEngine->present(refreshArgs);
+ moveSnapshotsFromCompositionArgs(refreshArgs, layers);
+
+ for (auto [layer, layerFE] : layers) {
+ CompositionResult compositionResult{layerFE->stealCompositionResult()};
+ for (auto& [releaseFence, layerStack] : compositionResult.releaseFences) {
+ layer->onLayerDisplayed(std::move(releaseFence), layerStack);
+ }
+ if (compositionResult.lastClientCompositionFence) {
+ layer->setWasClientComposed(compositionResult.lastClientCompositionFence);
+ }
+ if (com_android_graphics_libgui_flags_apply_picture_profiles()) {
+ mActivePictureUpdater.onLayerComposed(*layer, *layerFE, compositionResult);
+ }
}
}
@@ -3196,8 +3222,13 @@ void SurfaceFlinger::onCompositionPresented(PhysicalDisplayId pacesetterId,
auto optDisplay = layerStackToDisplay.get(layerStack);
if (optDisplay && !optDisplay->get()->isVirtual()) {
auto fence = getHwComposer().getPresentFence(optDisplay->get()->getPhysicalId());
- layer->prepareReleaseCallbacks(ftl::yield<FenceResult>(fence),
- ui::INVALID_LAYER_STACK);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ layer->prepareReleaseCallbacks(ftl::yield<FenceResult>(fence),
+ ui::INVALID_LAYER_STACK);
+ } else {
+ layer->onLayerDisplayed(ftl::yield<FenceResult>(fence).share(),
+ ui::INVALID_LAYER_STACK);
+ }
}
}
layer->releasePendingBuffer(presentTime.ns());
@@ -7382,7 +7413,8 @@ void SurfaceFlinger::captureScreenCommon(RenderAreaBuilderVariant renderAreaBuil
return;
}
- if (FlagManager::getInstance().single_hop_screenshot() && mRenderEngine->isThreaded()) {
+ if (FlagManager::getInstance().single_hop_screenshot() &&
+ FlagManager::getInstance().ce_fence_promise() && mRenderEngine->isThreaded()) {
std::vector<sp<LayerFE>> layerFEs;
auto displayState =
getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layerFEs);
@@ -7623,8 +7655,10 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshotLegacy(
auto takeScreenshotFn = [=, this, renderAreaBuilder = std::move(renderAreaBuilder)]() REQUIRES(
kMainThreadContext) mutable -> ftl::SharedFuture<FenceResult> {
auto layers = getLayerSnapshotsFn();
- for (auto& [layer, layerFE] : layers) {
- attachReleaseFenceFutureToLayer(layer, layerFE.get(), ui::INVALID_LAYER_STACK);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ for (auto& [layer, layerFE] : layers) {
+ attachReleaseFenceFutureToLayer(layer, layerFE.get(), ui::INVALID_LAYER_STACK);
+ }
}
auto displayState = getDisplayStateFromRenderAreaBuilder(renderAreaBuilder);
@@ -7821,13 +7855,36 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
// TODO(b/196334700) Once we use RenderEngineThreaded everywhere we can always defer the call
// to CompositionEngine::present.
ftl::SharedFuture<FenceResult> presentFuture;
- if (FlagManager::getInstance().single_hop_screenshot() && mRenderEngine->isThreaded()) {
+ if (FlagManager::getInstance().single_hop_screenshot() &&
+ FlagManager::getInstance().ce_fence_promise() && mRenderEngine->isThreaded()) {
presentFuture = ftl::yield(present()).share();
} else {
presentFuture = mRenderEngine->isThreaded() ? ftl::defer(std::move(present)).share()
: ftl::yield(present()).share();
}
+ if (!FlagManager::getInstance().ce_fence_promise()) {
+ for (auto& [layer, layerFE] : layers) {
+ layer->onLayerDisplayed(presentFuture, ui::INVALID_LAYER_STACK,
+ [layerFE = std::move(layerFE)](FenceResult) {
+ if (FlagManager::getInstance()
+ .screenshot_fence_preservation()) {
+ const auto compositionResult =
+ layerFE->stealCompositionResult();
+ const auto& fences = compositionResult.releaseFences;
+ // CompositionEngine may choose to cull layers that
+ // aren't visible, so pass a non-fence.
+ return fences.empty() ? Fence::NO_FENCE
+ : fences.back().first.get();
+ } else {
+ return layerFE->stealCompositionResult()
+ .releaseFences.back()
+ .first.get();
+ }
+ });
+ }
+ }
+
return presentFuture;
}
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.cpp b/services/surfaceflinger/TransactionCallbackInvoker.cpp
index b22ec66819..cc79acbbf5 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.cpp
+++ b/services/surfaceflinger/TransactionCallbackInvoker.cpp
@@ -28,6 +28,7 @@
#include "Utils/FenceUtils.h"
#include <binder/IInterface.h>
+#include <common/FlagManager.h>
#include <common/trace.h>
#include <utils/RefBase.h>
@@ -126,8 +127,14 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
if (surfaceControl) {
sp<Fence> prevFence = nullptr;
- for (auto& future : handle->previousReleaseFences) {
- mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ for (auto& future : handle->previousReleaseFences) {
+ mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+ }
+ } else {
+ for (const auto& future : handle->previousSharedReleaseFences) {
+ mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+ }
}
handle->previousReleaseFence = prevFence;
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.h b/services/surfaceflinger/TransactionCallbackInvoker.h
index 178ddbbe79..9c7bb0d588 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.h
+++ b/services/surfaceflinger/TransactionCallbackInvoker.h
@@ -43,6 +43,7 @@ public:
std::string name;
sp<Fence> previousReleaseFence;
std::vector<ftl::Future<FenceResult>> previousReleaseFences;
+ std::vector<ftl::SharedFuture<FenceResult>> previousSharedReleaseFences;
std::variant<nsecs_t, sp<Fence>> acquireTimeOrFence = -1;
nsecs_t latchTime = -1;
std::optional<uint32_t> transformHint = std::nullopt;
diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp
index 5c417ba748..b86e815b57 100644
--- a/services/surfaceflinger/common/FlagManager.cpp
+++ b/services/surfaceflinger/common/FlagManager.cpp
@@ -167,6 +167,8 @@ void FlagManager::dump(std::string& result) const {
DUMP_ACONFIG_FLAG(begone_bright_hlg);
DUMP_ACONFIG_FLAG(window_blur_kawase2);
DUMP_ACONFIG_FLAG(single_hop_screenshot);
+ DUMP_ACONFIG_FLAG(screenshot_fence_preservation);
+ DUMP_ACONFIG_FLAG(ce_fence_promise);
#undef DUMP_ACONFIG_FLAG
#undef DUMP_LEGACY_SERVER_FLAG
@@ -268,6 +270,8 @@ FLAG_MANAGER_ACONFIG_FLAG(deprecate_frame_tracker, "");
FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, "");
FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg");
FLAG_MANAGER_ACONFIG_FLAG(window_blur_kawase2, "");
+FLAG_MANAGER_ACONFIG_FLAG(screenshot_fence_preservation, "debug.sf.screenshot_fence_preservation");
+FLAG_MANAGER_ACONFIG_FLAG(ce_fence_promise, "");
/// Trunk stable server (R/W) flags ///
FLAG_MANAGER_ACONFIG_FLAG(refresh_rate_overlay_on_external_display, "")
diff --git a/services/surfaceflinger/common/include/common/FlagManager.h b/services/surfaceflinger/common/include/common/FlagManager.h
index 15284ba0ee..4766f6be38 100644
--- a/services/surfaceflinger/common/include/common/FlagManager.h
+++ b/services/surfaceflinger/common/include/common/FlagManager.h
@@ -74,6 +74,7 @@ public:
bool fp16_client_target() const;
bool game_default_frame_rate() const;
bool enable_layer_command_batching() const;
+ bool screenshot_fence_preservation() const;
bool vulkan_renderengine() const;
bool vrr_bugfix_24q4() const;
bool vrr_bugfix_dropped_frame() const;
@@ -82,6 +83,7 @@ public:
bool dont_skip_on_early_ro() const;
bool no_vsyncs_on_screen_off() const;
bool protected_if_client() const;
+ bool ce_fence_promise() const;
bool idle_screen_refresh_rate_timeout() const;
bool graphite_renderengine() const;
bool filter_frames_before_trace_starts() const;
diff --git a/services/surfaceflinger/tests/TransactionTestHarnesses.h b/services/surfaceflinger/tests/TransactionTestHarnesses.h
index c95c875746..5899c7e8b6 100644
--- a/services/surfaceflinger/tests/TransactionTestHarnesses.h
+++ b/services/surfaceflinger/tests/TransactionTestHarnesses.h
@@ -17,6 +17,7 @@
#define ANDROID_TRANSACTION_TEST_HARNESSES
#include <com_android_graphics_libgui_flags.h>
+#include <common/FlagManager.h>
#include <ui/DisplayState.h>
#include "LayerTransactionTest.h"
@@ -95,8 +96,12 @@ public:
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
t.setDisplayProjection(vDisplay, displayState.orientation,
Rect(displayState.layerStackSpaceRect), Rect(resolution));
- t.setDisplayLayerStack(vDisplay, layerStack);
- t.setLayerStack(mirrorSc, layerStack);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ t.setDisplayLayerStack(vDisplay, layerStack);
+ t.setLayerStack(mirrorSc, layerStack);
+ } else {
+ t.setDisplayLayerStack(vDisplay, ui::DEFAULT_LAYER_STACK);
+ }
t.apply();
SurfaceComposerClient::Transaction().apply(true);
@@ -116,8 +121,10 @@ public:
// CompositionEngine::present may attempt to be called on the same
// display multiple times. The layerStack is set to invalid here so
// that the display is ignored if that scenario occurs.
- t.setLayerStack(mirrorSc, ui::INVALID_LAYER_STACK);
- t.apply(true);
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ t.setLayerStack(mirrorSc, ui::INVALID_LAYER_STACK);
+ t.apply(true);
+ }
SurfaceComposerClient::destroyVirtualDisplay(vDisplay);
return sc;
}
--
2.48.1

View file

@ -1,97 +0,0 @@
From 76923ab930a6fee15aa477bea3638e09fe7b604a Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:25:10 -0400
Subject: [PATCH 7/7] Revert "Remove dead code from LayerFE"
This reverts commit 330571240ff3d44fdbecbe513309d73ba82404e6.
Change-Id: If3af99ec76a8c595dcd1ea22965f2d126d74a315
---
.../CompositionEngine/include/compositionengine/LayerFE.h | 3 +++
.../include/compositionengine/mock/LayerFE.h | 3 +++
services/surfaceflinger/LayerFE.cpp | 6 ++++++
services/surfaceflinger/LayerFE.h | 3 +++
4 files changed, 15 insertions(+)
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
index cda4edc216..8199c929e5 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
@@ -148,6 +148,9 @@ public:
virtual std::optional<LayerSettings> prepareClientComposition(
ClientCompositionTargetSettings&) const = 0;
+ // Called after the layer is displayed to update the presentation fence
+ virtual void onLayerDisplayed(ftl::SharedFuture<FenceResult>, ui::LayerStack layerStack) = 0;
+
// Initializes a promise for a buffer release fence and provides the future for that
// fence. This should only be called when a promise has not yet been created, or
// after the previous promise has already been fulfilled. Attempting to call this
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
index 272fa3eef7..a236ebf180 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/LayerFE.h
@@ -50,6 +50,9 @@ public:
std::optional<compositionengine::LayerFE::LayerSettings>(
compositionengine::LayerFE::ClientCompositionTargetSettings&));
+ MOCK_METHOD(void, onLayerDisplayed, (ftl::SharedFuture<FenceResult>, ui::LayerStack),
+ (override));
+
MOCK_METHOD0(createReleaseFenceFuture, ftl::Future<FenceResult>());
MOCK_METHOD1(setReleaseFence, void(const FenceResult&));
MOCK_METHOD0(getReleaseFencePromiseStatus, LayerFE::ReleaseFencePromiseStatus());
diff --git a/services/surfaceflinger/LayerFE.cpp b/services/surfaceflinger/LayerFE.cpp
index de64b271f5..012aa32c30 100644
--- a/services/surfaceflinger/LayerFE.cpp
+++ b/services/surfaceflinger/LayerFE.cpp
@@ -28,6 +28,7 @@
#include "SurfaceFlinger.h"
#include "common/FlagManager.h"
#include "ui/FenceResult.h"
+#include "ui/LayerStack.h"
namespace android {
@@ -355,6 +356,11 @@ CompositionResult LayerFE::stealCompositionResult() {
return result;
}
+void LayerFE::onLayerDisplayed(ftl::SharedFuture<FenceResult> futureFenceResult,
+ ui::LayerStack layerStack) {
+ mCompositionResult.releaseFences.emplace_back(std::move(futureFenceResult), layerStack);
+}
+
const char* LayerFE::getDebugName() const {
return mName.c_str();
}
diff --git a/services/surfaceflinger/LayerFE.h b/services/surfaceflinger/LayerFE.h
index 9483aebafa..ce6d27a91a 100644
--- a/services/surfaceflinger/LayerFE.h
+++ b/services/surfaceflinger/LayerFE.h
@@ -25,12 +25,14 @@
#include "compositionengine/LayerFE.h"
#include "compositionengine/LayerFECompositionState.h"
#include "renderengine/LayerSettings.h"
+#include "ui/LayerStack.h"
#include <ftl/future.h>
namespace android {
struct CompositionResult {
+ std::vector<std::pair<ftl::SharedFuture<FenceResult>, ui::LayerStack>> releaseFences;
sp<Fence> lastClientCompositionFence = nullptr;
bool wasPictureProfileCommitted = false;
// TODO(b/337330263): Why does LayerFE coming from SF have a null composition state?
@@ -46,6 +48,7 @@ public:
// compositionengine::LayerFE overrides
const compositionengine::LayerFECompositionState* getCompositionState() const override;
bool onPreComposition(bool updatingOutputGeometryThisFrame) override;
+ void onLayerDisplayed(ftl::SharedFuture<FenceResult>, ui::LayerStack) override;
const char* getDebugName() const override;
int32_t getSequence() const override;
bool hasRoundedCorners() const override;
--
2.48.1

View file

@ -1,24 +0,0 @@
From 6acc862452fd91732f63afa4a3829d0e249355e0 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:55:53 -0400
Subject: [PATCH 1/2] Stop using resource processor
---
Android.bp | 1 +
1 file changed, 1 insertion(+)
diff --git a/Android.bp b/Android.bp
index 0b368c8e..a2dff379 100644
--- a/Android.bp
+++ b/Android.bp
@@ -5,6 +5,7 @@
android_app {
name: "org.lineageos.platform-res",
+ use_resource_processor: false,
sdk_version: "core_platform",
certificate: "platform",
--
2.48.1

View file

@ -1,133 +0,0 @@
From 6cf57340bf1d906438a112942763c12eb35feb51 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:56:06 -0400
Subject: [PATCH 2/2] Add spninfo / schema
---
lib/SpnInfo.xsd | 47 +++++++++++++++++++++++++++++++++++++
lib/schema/current.txt | 40 +++++++++++++++++++++++++++++++
lib/schema/last_current.txt | 0
lib/schema/last_removed.txt | 0
lib/schema/removed.txt | 1 +
5 files changed, 88 insertions(+)
create mode 100644 lib/SpnInfo.xsd
create mode 100644 lib/schema/current.txt
create mode 100644 lib/schema/last_current.txt
create mode 100644 lib/schema/last_removed.txt
create mode 100644 lib/schema/removed.txt
diff --git a/lib/SpnInfo.xsd b/lib/SpnInfo.xsd
new file mode 100644
index 00000000..d30630dc
--- /dev/null
+++ b/lib/SpnInfo.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<xs:schema version="2.0"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="sensitivePNS">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="sensitivePN" maxOccurs="unbounded" type="sensitivePN" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="sensitivePN">
+ <xs:sequence>
+ <xs:element name="item" maxOccurs="unbounded" type="item" />
+ </xs:sequence>
+ <xs:attribute name="network" type="xs:string" use="required" />
+ </xs:complexType>
+
+ <xs:complexType name="item">
+ <xs:sequence>
+ <xs:element name="number" type="xs:string" />
+ <xs:element name="name" minOccurs="0" type="xs:string" />
+ <xs:element name="categories" minOccurs="0" type="xs:string" />
+ <xs:element name="languages" minOccurs="0" type="xs:string" />
+ <xs:element name="organization" minOccurs="0" type="xs:string" />
+ <xs:element name="website" minOccurs="0" type="xs:anyURI" />
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
diff --git a/lib/schema/current.txt b/lib/schema/current.txt
new file mode 100644
index 00000000..13e52c67
--- /dev/null
+++ b/lib/schema/current.txt
@@ -0,0 +1,40 @@
+// Signature format: 2.0
+package org.lineageos.lib.phone.spn {
+
+ public class Item {
+ ctor public Item();
+ method public String getCategories();
+ method public String getLanguages();
+ method public String getName();
+ method public String getNumber();
+ method public String getOrganization();
+ method public String getWebsite();
+ method public void setCategories(String);
+ method public void setLanguages(String);
+ method public void setName(String);
+ method public void setNumber(String);
+ method public void setOrganization(String);
+ method public void setWebsite(String);
+ }
+
+ public class SensitivePN {
+ ctor public SensitivePN();
+ method public java.util.List<org.lineageos.lib.phone.spn.Item> getItem();
+ method public String getNetwork();
+ method public void setNetwork(String);
+ }
+
+ public class SensitivePNS {
+ ctor public SensitivePNS();
+ method public java.util.List<org.lineageos.lib.phone.spn.SensitivePN> getSensitivePN();
+ }
+
+ public class XmlParser {
+ ctor public XmlParser();
+ method public static org.lineageos.lib.phone.spn.SensitivePNS read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+}
+
diff --git a/lib/schema/last_current.txt b/lib/schema/last_current.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/schema/last_removed.txt b/lib/schema/last_removed.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/lib/schema/removed.txt b/lib/schema/removed.txt
new file mode 100644
index 00000000..d802177e
--- /dev/null
+++ b/lib/schema/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
--
2.48.1

View file

@ -1,7 +1,7 @@
From 4a576ac73698b2232c51a4b6b3c9a21845801136 Mon Sep 17 00:00:00 2001 From b60353d34c0eef8a6291c11e671a22298b3d6d99 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Sun, 6 Oct 2024 14:22:49 -0400 Date: Sun, 6 Oct 2024 14:22:49 -0400
Subject: [PATCH 1/3] Downgrade target_sdk_version to 34 for now Subject: [PATCH 1/2] Downgrade target_sdk_version to 34 for now
--- ---
Android.bp | 1 + Android.bp | 1 +
@ -20,5 +20,5 @@ index 388f4c00c..498e7c8f0 100644
srcs: [ srcs: [
"java/**/I*.aidl", "java/**/I*.aidl",
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 080c04159988f202694f087f442e3e32f18d4625 Mon Sep 17 00:00:00 2001 From da7c7a335475dc61375b470b1aa6cb425ed54514 Mon Sep 17 00:00:00 2001
From: Jihoon Kang <jihoonkang@google.com> From: Jihoon Kang <jihoonkang@google.com>
Date: Fri, 30 Aug 2024 00:29:34 +0000 Date: Fri, 30 Aug 2024 00:29:34 +0000
Subject: [PATCH 2/3] Make java_sdk_library dependencies explicit Subject: [PATCH 2/2] Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module modules should specify the submodule of java_sdk_library that the module
actually depends on actually depends on
@ -27,5 +27,5 @@ index 498e7c8f0..299c1a6e7 100644
optimize: { optimize: {
proguard_flags_files: [ proguard_flags_files: [
-- --
2.48.1 2.44.0

View file

@ -1,24 +0,0 @@
From fa83fab06f1bd59551b926a224e0cf4cdfcb86da Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 16 Mar 2025 13:51:15 -0400
Subject: [PATCH 3/3] Opt-out from the resource processor (for now)
---
Android.bp | 1 +
1 file changed, 1 insertion(+)
diff --git a/Android.bp b/Android.bp
index 299c1a6e7..b35b8913e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -9,6 +9,7 @@ package {
android_app {
name: "Dialer",
+ use_resource_processor: false,
aaptflags: [
"--auto-add-overlay",
"--extra-packages com.android.contacts.common",
--
2.48.1

View file

@ -1,4 +1,4 @@
From 09d183a632ab5ba6ef0f1f76765fc94ef24035f4 Mon Sep 17 00:00:00 2001 From 88275c8b0d207286b34284ad69090b29b705c4c1 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Mon, 11 Oct 2021 20:48:44 -0700 Date: Mon, 11 Oct 2021 20:48:44 -0700
Subject: [PATCH 1/3] Expose themed icon setting in ThemePicker Subject: [PATCH 1/3] Expose themed icon setting in ThemePicker
@ -24,7 +24,7 @@ index 517bd6d..89291c1 100644
</application> </application>
diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml
index 80d8154..813ef75 100644 index c6e2d8c..1d7405e 100644
--- a/quickstep/AndroidManifest-launcher.xml --- a/quickstep/AndroidManifest-launcher.xml
+++ b/quickstep/AndroidManifest-launcher.xml +++ b/quickstep/AndroidManifest-launcher.xml
@@ -65,6 +65,9 @@ @@ -65,6 +65,9 @@
@ -38,5 +38,5 @@ index 80d8154..813ef75 100644
</application> </application>
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From c2cafe53a8b6acf97dc9a634ada0d4ab53b5fd9f Mon Sep 17 00:00:00 2001 From 8f504046ec34c16fbd8a1d2da8294ab84e3817fa Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Fri, 7 Jul 2023 18:13:32 -0400 Date: Fri, 7 Jul 2023 18:13:32 -0400
Subject: [PATCH 2/3] Disable QSB in BuildConfig Subject: [PATCH 2/3] Disable QSB in BuildConfig
@ -22,5 +22,5 @@ index 6d4f56d..2630ec1 100644
/** /**
* Flag to state if the widget on the top of the first screen should be shown. * Flag to state if the widget on the top of the first screen should be shown.
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From de7b698be0f1e01b337672d919854e3a28b8685f Mon Sep 17 00:00:00 2001 From 38d5e4a3a7bc358e77e7f9e2e8d2f4d1dfaed0b5 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 23:17:59 +0100 Date: Fri, 1 Nov 2019 23:17:59 +0100
Subject: [PATCH 3/3] Properly expose GridCustomizationsProvider Subject: [PATCH 3/3] Properly expose GridCustomizationsProvider
@ -24,5 +24,5 @@ index 80d2eac..53bdfff 100644
<!-- <!--
The settings activity. To extend point settings_fragment_name to appropriate fragment class The settings activity. To extend point settings_fragment_name to appropriate fragment class
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From c8463140729b40cca3cb143561d652fa06c6d628 Mon Sep 17 00:00:00 2001 From 824c2a99f9d139d523265e64c8628b3171a7b017 Mon Sep 17 00:00:00 2001
From: Oliver Scott <olivercscott@gmail.com> From: Oliver Scott <olivercscott@gmail.com>
Date: Thu, 8 Jul 2021 10:40:49 -0400 Date: Thu, 8 Jul 2021 10:40:49 -0400
Subject: [PATCH 2/2] Global VPN feature [2/2] Subject: [PATCH 1/2] Global VPN feature [2/2]
* Create a global VPN toggle for VPNs in the system user. It is only * Create a global VPN toggle for VPNs in the system user. It is only
enabled when no VPN is active in any user. enabled when no VPN is active in any user.
@ -14,13 +14,13 @@ Change-Id: If4a552b8f59bc15f53c324afa93a67e086b9c5a9
3 files changed, 59 insertions(+), 1 deletion(-) 3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/res/values/strings.xml b/res/values/strings.xml diff --git a/res/values/strings.xml b/res/values/strings.xml
index 730c258..0feb0f6 100644 index 7e363e6..cd3a83d 100644
--- a/res/values/strings.xml --- a/res/values/strings.xml
+++ b/res/values/strings.xml +++ b/res/values/strings.xml
@@ -13910,4 +13910,10 @@ @@ -13670,4 +13670,10 @@
<string name="search_gesture_feature_title">Circle to Search</string>
<!-- Summary text for press and hold nav handle OR home button to invoke Circle to Search. [CHAR LIMIT=NONE] --> <!-- Text for Search bar of Settings home screen [CHAR LIMIT=34] -->
<string name="search_gesture_feature_summary">Touch and hold the Home button or the navigation handle to search using the content on your screen.</string> <string name="homepage_search">Search Settings</string>
+ +
+ <!-- VPN app management screen, global VPN --> + <!-- VPN app management screen, global VPN -->
+ <string name="global_vpn_title">Global VPN</string> + <string name="global_vpn_title">Global VPN</string>
@ -176,5 +176,5 @@ index 00c8f59..c4f447f 100644
private static final String TAG = "CannotConnect"; private static final String TAG = "CannotConnect";
private static final String ARG_VPN_LABEL = "label"; private static final String ARG_VPN_LABEL = "label";
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 2002ea94d153575b5178bd4365a897f6cb468134 Mon Sep 17 00:00:00 2001 From bddf947575bc2ceebddbfcf120b0b8a6a1a967aa Mon Sep 17 00:00:00 2001
From: Asher Simonds <dayanhammer@gmail.com> From: Asher Simonds <dayanhammer@gmail.com>
Date: Sun, 3 Apr 2022 12:18:21 +0200 Date: Sun, 3 Apr 2022 12:18:21 +0200
Subject: [PATCH 1/2] Settings: Bring in the new icon Subject: [PATCH 2/2] Settings: Bring in the new icon
* Part of the new iconset made by Asher Simonds * Part of the new iconset made by Asher Simonds
@ -1618,5 +1618,5 @@ index 0e2e6bc..21a1525 100644
.putExtra(Intent.EXTRA_SHORTCUT_NAME, info.getShortLabel()); .putExtra(Intent.EXTRA_SHORTCUT_NAME, info.getShortLabel());
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From bc50b3024c266f307ce804ef1887062cf1f34944 Mon Sep 17 00:00:00 2001 From 7ef009b2434c5cf9f7d4ec9f114336d6a43d888f Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 21:14:29 +0100 Date: Fri, 1 Nov 2019 21:14:29 +0100
Subject: [PATCH 1/4] Add wallpaper privapp whitelist Subject: [PATCH 1/4] Add wallpaper privapp whitelist
@ -61,5 +61,5 @@ index 0000000..e3f3b65
+ </privapp-permissions> + </privapp-permissions>
+</permissions> +</permissions>
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From b255f705538f7e55d445c60c1a12f60dd309df1d Mon Sep 17 00:00:00 2001 From 0e064d23f1b0dc300651d9d680927ecb26aa9013 Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com> From: LuK1337 <priv.luk@gmail.com>
Date: Tue, 15 Sep 2020 03:27:19 +0200 Date: Tue, 15 Sep 2020 03:27:19 +0200
Subject: [PATCH 2/4] Add wallpaper default permissions Subject: [PATCH 2/4] Add wallpaper default permissions
@ -82,5 +82,5 @@ index 0000000..41b23ce
+ </exception> + </exception>
+</exceptions> +</exceptions>
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From 623014b94ae4bb08328684bb077b05973ab858eb Mon Sep 17 00:00:00 2001 From 4c72c9bf019b1da8aa0888d1f4f22cc026aa87bf Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 23:17:08 +0100 Date: Fri, 1 Nov 2019 23:17:08 +0100
Subject: [PATCH 3/4] Specify we read and write launcher settings Subject: [PATCH 3/4] Specify we read and write launcher settings
@ -23,5 +23,5 @@ index f89ff6e..95f5b0e 100755
tools:replace="android:icon,android:name" tools:replace="android:icon,android:name"
android:extractNativeLibs="false" android:extractNativeLibs="false"
-- --
2.48.1 2.44.0

View file

@ -1,4 +1,4 @@
From 5880006d7be5eeb3fff8a6d9154ae16e2e6ffac7 Mon Sep 17 00:00:00 2001 From 30d9a5682d8ae85d7f621b6509f7445fc70bae70 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 22:40:58 -0700 Date: Tue, 5 Oct 2021 22:40:58 -0700
Subject: [PATCH 4/4] Add permission for launcher preview rendering Subject: [PATCH 4/4] Add permission for launcher preview rendering
@ -33,5 +33,5 @@ index e3f3b65..47133be 100644
</privapp-permissions> </privapp-permissions>
</permissions> </permissions>
-- --
2.48.1 2.44.0

View file

@ -1,7 +1,7 @@
From 29c09f59e76930a00cefd474c96eb40e63a475f5 Mon Sep 17 00:00:00 2001 From 3aa174edd50a176986ab15f91bcb87b7cec160fa Mon Sep 17 00:00:00 2001
From: DerTeufel <dominik-kassel@gmx.de> From: DerTeufel <dominik-kassel@gmx.de>
Date: Wed, 4 Jan 2023 21:39:37 +0100 Date: Wed, 4 Jan 2023 21:39:37 +0100
Subject: [PATCH 2/2] Don't crash on status:UNSUPPORTED_REMOTE_OR_LMP_FEATURE Subject: [PATCH 1/2] Don't crash on status:UNSUPPORTED_REMOTE_OR_LMP_FEATURE
especially 'opcode:0x811 (SNIFF_SUBRATING)' which is the only one I had observed especially 'opcode:0x811 (SNIFF_SUBRATING)' which is the only one I had observed
@ -11,22 +11,22 @@ Change-Id: Ic57d6631185370cbfdeafdac00801c6ca27fb755
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc
index 1311815633..7b913888b2 100644 index 70a5f43b56..07d5d25a5c 100644
--- a/system/gd/hci/hci_layer.cc --- a/system/gd/hci/hci_layer.cc
+++ b/system/gd/hci/hci_layer.cc +++ b/system/gd/hci/hci_layer.cc
@@ -238,8 +238,10 @@ struct HciLayer::impl { @@ -216,8 +216,10 @@ struct HciLayer::impl {
using WaitingFor = CommandQueueEntry::WaitingFor;
WaitingFor waiting_for = command_queue_.front().waiting_for_; bool is_vendor_specific = static_cast<int>(op_code) & (0x3f << 10);
CommandStatusView status_view = CommandStatusView::Create(event); CommandStatusView status_view = CommandStatusView::Create(event);
- if (is_vendor_specific && (is_status && waiting_for == WaitingFor::COMPLETE) && - if (is_vendor_specific && (is_status && !command_queue_.front().waiting_for_status_) &&
- (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNKNOWN_HCI_COMMAND)) { - (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNKNOWN_HCI_COMMAND)) {
+ if ((is_vendor_specific && (is_status && waiting_for == WaitingFor::COMPLETE) && + if ((is_vendor_specific && (is_status && !command_queue_.front().waiting_for_status_) &&
+ (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNKNOWN_HCI_COMMAND)) || + (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNKNOWN_HCI_COMMAND)) ||
+ ((is_status && waiting_for == WaitingFor::COMPLETE) && + ((is_status && !command_queue_.front().waiting_for_status_) &&
+ (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNSUPPORTED_REMOTE_OR_LMP_FEATURE))) { + (status_view.IsValid() && status_view.GetStatus() == ErrorCode::UNSUPPORTED_REMOTE_OR_LMP_FEATURE))) {
// If this is a command status of a vendor specific command, and command complete is expected, // If this is a command status of a vendor specific command, and command complete is expected,
// we can't treat this as hard failure since we have no way of probing this lack of support at // we can't treat this as hard failure since we have no way of probing this lack of support at
// earlier time. Instead we let the command complete handler handle a empty Command Complete // earlier time. Instead we let the command complete handler handle a empty Command Complete
-- --
2.48.1 2.44.0

View file

@ -1,86 +1,19 @@
From 73a87c7bcc594cc3da4b9c2394cda066d36bb557 Mon Sep 17 00:00:00 2001 From 5949d86e40befe38ef57fc0fbbf18d2fe464332b Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 15:45:18 -0400 Date: Wed, 24 Aug 2022 15:45:18 -0400
Subject: [PATCH 1/2] audio_hal_interface: Optionally use sysbta HAL Subject: [PATCH 2/2] audio_hal_interface: Optionally use sysbta HAL
Required to support sysbta, our system-side bt audio implementation. Required to support sysbta, our system-side bt audio implementation.
Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860 Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860
--- ---
.../aidl/a2dp/client_interface_aidl.cc | 8 ++++----
.../aidl/a2dp/client_interface_aidl.h | 7 +++++++
.../audio_hal_interface/aidl/client_interface_aidl.cc | 8 ++++---- .../audio_hal_interface/aidl/client_interface_aidl.cc | 8 ++++----
.../audio_hal_interface/aidl/client_interface_aidl.h | 7 +++++++ .../audio_hal_interface/aidl/client_interface_aidl.h | 7 +++++++
system/audio_hal_interface/hal_version_manager.cc | 11 +++++++++-- system/audio_hal_interface/hal_version_manager.cc | 11 +++++++++--
5 files changed, 31 insertions(+), 10 deletions(-) 3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.cc b/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.cc
index f022ec3ea2..283beb22fa 100644
--- a/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.cc
+++ b/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.cc
@@ -58,7 +58,7 @@ BluetoothAudioClientInterface::~BluetoothAudioClientInterface() {
bool BluetoothAudioClientInterface::IsValid() const { return provider_ != nullptr; }
bool BluetoothAudioClientInterface::is_aidl_available() {
- return AServiceManager_isDeclared(kDefaultAudioProviderFactoryInterface.c_str());
+ return AServiceManager_isDeclared(audioProviderFactoryInterface().c_str());
}
std::vector<AudioCapabilities> BluetoothAudioClientInterface::GetAudioCapabilities() const {
@@ -72,7 +72,7 @@ std::vector<AudioCapabilities> BluetoothAudioClientInterface::GetAudioCapabiliti
return capabilities;
}
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder(
- AServiceManager_waitForService(kDefaultAudioProviderFactoryInterface.c_str())));
+ AServiceManager_waitForService(audioProviderFactoryInterface().c_str())));
if (provider_factory == nullptr) {
log::error("can't get capability from unknown factory");
@@ -97,7 +97,7 @@ BluetoothAudioClientInterface::GetProviderInfo(
if (provider_factory == nullptr) {
provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder(
- AServiceManager_waitForService(kDefaultAudioProviderFactoryInterface.c_str())));
+ AServiceManager_waitForService(audioProviderFactoryInterface().c_str())));
}
if (provider_factory == nullptr) {
@@ -173,7 +173,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
// re-registered, so we need to re-fetch the service.
for (int retry_no = 0; retry_no < kFetchAudioProviderRetryNumber; ++retry_no) {
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder(
- AServiceManager_waitForService(kDefaultAudioProviderFactoryInterface.c_str())));
+ AServiceManager_waitForService(audioProviderFactoryInterface().c_str())));
if (provider_factory == nullptr) {
log::error("can't get capability from unknown factory");
diff --git a/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.h b/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.h
index a45ff946f2..4c99832e1b 100644
--- a/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.h
+++ b/system/audio_hal_interface/aidl/a2dp/client_interface_aidl.h
@@ -28,6 +28,7 @@
#include "bta/le_audio/broadcaster/broadcaster_types.h"
#include "bta/le_audio/le_audio_types.h"
#include "transport_instance.h"
+#include "osi/include/properties.h"
// Keep after audio_aidl_interfaces.h because of <base/logging.h>
// conflicting definitions.
@@ -156,6 +157,12 @@ protected:
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
static inline const std::string kDefaultAudioProviderFactoryInterface =
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
+ static inline const std::string kSystemAudioProviderFactoryInterface =
+ std::string() + IBluetoothAudioProviderFactory::descriptor + "/sysbta";
+ static inline const std::string audioProviderFactoryInterface() {
+ return osi_property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)
+ ? kSystemAudioProviderFactoryInterface : kDefaultAudioProviderFactoryInterface;
+ }
private:
IBluetoothTransportInstance* transport_;
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc
index 176b355eeb..9d8ddd2cac 100644 index 15a20be5b9..412a1ab888 100644
--- a/system/audio_hal_interface/aidl/client_interface_aidl.cc --- a/system/audio_hal_interface/aidl/client_interface_aidl.cc
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc +++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc
@@ -69,7 +69,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(IBluetoothTransport @@ -69,7 +69,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(IBluetoothTransport
@ -110,7 +43,7 @@ index 176b355eeb..9d8ddd2cac 100644
} }
if (provider_factory == nullptr) { if (provider_factory == nullptr) {
@@ -140,7 +140,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() { @@ -184,7 +184,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
// re-registered, so we need to re-fetch the service. // re-registered, so we need to re-fetch the service.
for (int retry_no = 0; retry_no < kFetchAudioProviderRetryNumber; ++retry_no) { for (int retry_no = 0; retry_no < kFetchAudioProviderRetryNumber; ++retry_no) {
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder( auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder(
@ -120,7 +53,7 @@ index 176b355eeb..9d8ddd2cac 100644
if (provider_factory == nullptr) { if (provider_factory == nullptr) {
log::error("can't get capability from unknown factory"); log::error("can't get capability from unknown factory");
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h
index a3c60384ab..ee5901e32a 100644 index b5bb309ab2..e73009ba69 100644
--- a/system/audio_hal_interface/aidl/client_interface_aidl.h --- a/system/audio_hal_interface/aidl/client_interface_aidl.h
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.h +++ b/system/audio_hal_interface/aidl/client_interface_aidl.h
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
@ -131,7 +64,7 @@ index a3c60384ab..ee5901e32a 100644
namespace bluetooth { namespace bluetooth {
namespace audio { namespace audio {
@@ -150,6 +151,12 @@ protected: @@ -163,6 +164,12 @@ protected:
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default"; // "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
static inline const std::string kDefaultAudioProviderFactoryInterface = static inline const std::string kDefaultAudioProviderFactoryInterface =
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default"; std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
@ -145,7 +78,7 @@ index a3c60384ab..ee5901e32a 100644
private: private:
IBluetoothTransportInstance* transport_; IBluetoothTransportInstance* transport_;
diff --git a/system/audio_hal_interface/hal_version_manager.cc b/system/audio_hal_interface/hal_version_manager.cc diff --git a/system/audio_hal_interface/hal_version_manager.cc b/system/audio_hal_interface/hal_version_manager.cc
index f9843df858..3931bc6a8d 100644 index 19c48c58da..b19da332c0 100644
--- a/system/audio_hal_interface/hal_version_manager.cc --- a/system/audio_hal_interface/hal_version_manager.cc
+++ b/system/audio_hal_interface/hal_version_manager.cc +++ b/system/audio_hal_interface/hal_version_manager.cc
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
@ -156,7 +89,7 @@ index f9843df858..3931bc6a8d 100644
#include <memory> #include <memory>
@@ -32,6 +33,12 @@ using ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProviderFactor @@ -33,6 +34,12 @@ using ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProviderFactor
static const std::string kDefaultAudioProviderFactoryInterface = static const std::string kDefaultAudioProviderFactoryInterface =
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default"; std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
@ -169,7 +102,7 @@ index f9843df858..3931bc6a8d 100644
std::string toString(BluetoothAudioHalTransport transport) { std::string toString(BluetoothAudioHalTransport transport) {
switch (transport) { switch (transport) {
@@ -72,7 +79,7 @@ BluetoothAudioHalVersion GetAidlInterfaceVersion() { @@ -73,7 +80,7 @@ BluetoothAudioHalVersion GetAidlInterfaceVersion() {
static auto aidl_version = []() -> BluetoothAudioHalVersion { static auto aidl_version = []() -> BluetoothAudioHalVersion {
int version = 0; int version = 0;
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder( auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(::ndk::SpAIBinder(
@ -178,7 +111,7 @@ index f9843df858..3931bc6a8d 100644
if (provider_factory == nullptr) { if (provider_factory == nullptr) {
log::error("getInterfaceVersion: Can't get aidl version from unknown factory"); log::error("getInterfaceVersion: Can't get aidl version from unknown factory");
@@ -137,7 +144,7 @@ android::sp<IBluetoothAudioProvidersFactory_2_0> HalVersionManager::GetProviders @@ -138,7 +145,7 @@ android::sp<IBluetoothAudioProvidersFactory_2_0> HalVersionManager::GetProviders
HalVersionManager::HalVersionManager() { HalVersionManager::HalVersionManager() {
hal_transport_ = BluetoothAudioHalTransport::UNKNOWN; hal_transport_ = BluetoothAudioHalTransport::UNKNOWN;
@ -188,5 +121,5 @@ index f9843df858..3931bc6a8d 100644
hal_transport_ = BluetoothAudioHalTransport::AIDL; hal_transport_ = BluetoothAudioHalTransport::AIDL;
return; return;
-- --
2.48.1 2.44.0