summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wenhui Yang <wenhuiy@google.com> 2024-07-11 18:02:22 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-07-11 18:02:22 +0000
commitb450cf1a75427c75e07439eb5c2c2fdbe86c93d8 (patch)
tree4e7a835ae403564b680d1449ba0b068cdad8efa5
parent03d4729847ff69109a0c6a392e3308752d42f505 (diff)
parent8c86d3e8da25dcb25a9e9f103435e9d647a3d281 (diff)
Merge "Allow SurfaceControlRegistry to be able to update at runtime" into main
-rw-r--r--core/java/android/view/SurfaceControlRegistry.java32
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/docs/debugging.md6
2 files changed, 26 insertions, 12 deletions
diff --git a/core/java/android/view/SurfaceControlRegistry.java b/core/java/android/view/SurfaceControlRegistry.java
index 117b200d054e..a806bd226c36 100644
--- a/core/java/android/view/SurfaceControlRegistry.java
+++ b/core/java/android/view/SurfaceControlRegistry.java
@@ -295,16 +295,7 @@ public class SurfaceControlRegistry {
}
sCallStackDebuggingInitialized = true;
- sCallStackDebuggingMatchCall =
- SystemProperties.get("persist.wm.debug.sc.tx.log_match_call", null)
- .toLowerCase();
- sCallStackDebuggingMatchName =
- SystemProperties.get("persist.wm.debug.sc.tx.log_match_name", null)
- .toLowerCase();
- sLogAllTxCallsOnApply = sCallStackDebuggingMatchCall.contains("apply");
- // Only enable stack debugging if any of the match filters are set
- sCallStackDebuggingEnabled = !sCallStackDebuggingMatchCall.isEmpty()
- || !sCallStackDebuggingMatchName.isEmpty();
+ updateCallStackDebuggingParams();
if (sCallStackDebuggingEnabled) {
Log.d(TAG, "Enabling transaction call stack debugging:"
+ " matchCall=" + sCallStackDebuggingMatchCall
@@ -325,6 +316,11 @@ public class SurfaceControlRegistry {
final void checkCallStackDebugging(@NonNull String call,
@Nullable SurfaceControl.Transaction tx, @Nullable SurfaceControl sc,
@Nullable String details) {
+
+ if (sCallStackDebuggingInitialized && sCallStackDebuggingEnabled) {
+ updateCallStackDebuggingParams();
+ }
+
if (!sCallStackDebuggingEnabled) {
return;
}
@@ -356,6 +352,22 @@ public class SurfaceControlRegistry {
}
/**
+ * Updates the call stack debugging params from the system properties.
+ */
+ private static void updateCallStackDebuggingParams() {
+ sCallStackDebuggingMatchCall =
+ SystemProperties.get("persist.wm.debug.sc.tx.log_match_call", null)
+ .toLowerCase();
+ sCallStackDebuggingMatchName =
+ SystemProperties.get("persist.wm.debug.sc.tx.log_match_name", null)
+ .toLowerCase();
+ sLogAllTxCallsOnApply = sCallStackDebuggingMatchCall.contains("apply");
+ // Only enable stack debugging if any of the match filters are set
+ sCallStackDebuggingEnabled = !sCallStackDebuggingMatchCall.isEmpty()
+ || !sCallStackDebuggingMatchName.isEmpty();
+ }
+
+ /**
* Tests whether the given surface control name/method call matches the filters set for the
* call stack debugging.
*/
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/docs/debugging.md b/libs/WindowManager/Shell/src/com/android/wm/shell/docs/debugging.md
index 3572d161f5b9..84f6af4125b8 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/docs/debugging.md
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/docs/debugging.md
@@ -68,7 +68,7 @@ adb shell dumpsys SurfaceFlinger
## Tracing global SurfaceControl transaction updates
While Winscope traces are very useful, it sometimes doesn't give you enough information about which
-part of the code is initiating the transaction updates. In such cases, it can be helpful to get
+part of the code is initiating the transaction updates. In such cases, it can be helpful to get
stack traces when specific surface transaction calls are made, which is possible by enabling the
following system properties for example:
```shell
@@ -81,9 +81,11 @@ adb logcat -s "SurfaceControlRegistry"
# Disabling logging
adb shell setprop persist.wm.debug.sc.tx.log_match_call \"\"
adb shell setprop persist.wm.debug.sc.tx.log_match_name \"\"
-adb reboot
```
+A reboot is required to enable the logging. Once enabled, reboot is not needed to update the
+properties.
+
It is not necessary to set both `log_match_call` and `log_match_name`, but note logs can be quite
noisy if unfiltered.