[OneSearch] Add direct_match to SearchAttributes.
Captures if user acted on a search result that is not directly matched with search query, but instead related/suggested result.
Bug: 199495917
Test: Manual - http://gpaste/5167163338915840
Change-Id: Ib38244b1a82c502f551e8eb24dd14c14d8b375f2
diff --git a/quickstep/protos_overrides/launcher_atom_extension.proto b/quickstep/protos_overrides/launcher_atom_extension.proto
index 1195669..ff050ea 100644
--- a/quickstep/protos_overrides/launcher_atom_extension.proto
+++ b/quickstep/protos_overrides/launcher_atom_extension.proto
@@ -39,5 +39,8 @@
// True if results are based on spell corrected query
optional bool corrected_query = 1;
+
+ // True if the item's title/content is a direct match to the search query, false otherwise.
+ optional bool direct_match = 2;
}
}
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index 09f7888..ad52a66 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -94,6 +94,7 @@
* Flags for converting SearchAttribute to integer value.
*/
private static final int SEARCH_ATTRIBUTES_CORRECTED_QUERY = 1;
+ private static final int SEARCH_ATTRIBUTES_DIRECT_MATCH = 1 << 1;
public static final CopyOnWriteArrayList<StatsLogConsumer> LOGS_CONSUMER =
new CopyOnWriteArrayList<>();
@@ -584,6 +585,9 @@
if (searchAttributes.getCorrectedQuery()) {
response = response | SEARCH_ATTRIBUTES_CORRECTED_QUERY;
}
+ if (searchAttributes.getDirectMatch()) {
+ response = response | SEARCH_ATTRIBUTES_DIRECT_MATCH;
+ }
return response;
}