From d9123e2571826967e7ddbcecb59b94367ee094fd Mon Sep 17 00:00:00 2001
From: Chavi Weingarten <chaviw@google.com>
Date: Fri, 27 Oct 2023 14:59:26 +0000
Subject: [PATCH] Allow multiple calls and names to filter in
 SurfaceControlRegistry

The call and names are matched via string contains so the different calls can be
comma separated, whitespace, or purely concatenated.

Example:
adb shell setprop persist.wm.debug.sc.tx.log_match_call setWindowCrop,setAlpha
adb shell setprop persist.wm.debug.sc.tx.log_match_name launcher,sysui

Test: add multiple call in property
Bug: 308093559
Change-Id: I90c3cf3a86ee7cddc21f6f6b8233f636116d1058
---
 core/java/android/view/SurfaceControlRegistry.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/java/android/view/SurfaceControlRegistry.java b/core/java/android/view/SurfaceControlRegistry.java
index 52be8f6a76fd4..127d4a70a5641 100644
--- a/core/java/android/view/SurfaceControlRegistry.java
+++ b/core/java/android/view/SurfaceControlRegistry.java
@@ -337,13 +337,13 @@ public class SurfaceControlRegistry {
     @VisibleForTesting
     public final boolean matchesForCallStackDebugging(@Nullable String name, @NonNull String call) {
         final boolean matchCall = !sCallStackDebuggingMatchCall.isEmpty();
-        if (matchCall && !call.toLowerCase().contains(sCallStackDebuggingMatchCall)) {
+        if (matchCall && !sCallStackDebuggingMatchCall.contains(call.toLowerCase())) {
             // Skip if target call doesn't match requested caller
             return false;
         }
         final boolean matchName = !sCallStackDebuggingMatchName.isEmpty();
         if (matchName && (name == null
-                || !name.toLowerCase().contains(sCallStackDebuggingMatchName))) {
+                || !sCallStackDebuggingMatchName.contains(name.toLowerCase()))) {
             // Skip if target surface doesn't match requested surface
             return false;
         }
-- 
GitLab