Add support for named surfaces filters
Test: N/A
Change-Id: I0cc7385df06ad889845b78310360a66265a7af11
diff --git a/tools/winscope/src/TransactionsView.vue b/tools/winscope/src/TransactionsView.vue
index e15afe0..c5f9996 100644
--- a/tools/winscope/src/TransactionsView.vue
+++ b/tools/winscope/src/TransactionsView.vue
@@ -110,8 +110,24 @@
if (this.filters.length > 0) {
filteredData = filteredData.filter(
- this.filterTransactions(transaction =>
- this.filters.includes("" + transaction.obj.id)));
+ this.filterTransactions(transaction => {
+ for (const filter of this.filters) {
+ if (isNaN(filter) && transaction.obj?.name?.includes(filter)) {
+ // If filter isn't a number then check if the transaction's
+ // target surface's name matches the filter — if so keep it.
+ return true;
+ }
+ if (filter == transaction.obj.id) {
+ // If filteter is a number then check if the filter matches
+ // the transaction's target surface id — if so keep it.
+ return true;
+ }
+ }
+
+ // Exclude transaction if it fails to match filter.
+ return false;
+ })
+ );
}
if (this.selectedProperty) {