Add g/setScore and g/setEntityTypes to TextClassifierEvent

1. Add get/setScore, so we can see how do scores affect the CTR and
eventually tune the threshold based on it.

2. Convert get/setEntity to get/setEntityTypes.
   Some events like TYPE_ACTIONS_GENERATED and TYPE_ACTIONS_SHOWN
   will need to have a list of entity types. Also, as TRON does not
   support a field of list type. And thus workaround this by having
   3 separate fields in TRON.

4. The result id of action is too easy to clash now as only messages
   are taking into account. Use timestamp and the person object as
   the input to the hash now.

5. Changes in TRON:
   a) We will put conversation_action / language detection, etc to
      category. And we will put the views to subtype.
   b) As suggested by the TRON team, we should not reuse existing fields
   in the clients directly. But we should rather introduce new fields,
   and map them to existing fields in the server. So, TRON team could
   suppress just the new logging if it goes wrong and not affect
   existing loggings.

Test: atest TextClassifierEventTest.java
Tests: atest TextClassifierEventTronLoggerTest.java

BUG: 120803809

Change-Id: I2e71436b323a200beec57ea7c1a8bcc96c9c552f
diff --git a/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java b/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
index 77cb4cd..fdc34b3 100644
--- a/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
+++ b/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
@@ -103,10 +103,9 @@
         final String modelName = String.format(
                 Locale.US, "%s_v%d", localesJoiner.toString(), modelVersion);
         final int hash = Objects.hash(
-                messages.stream()
-                        .map(ConversationActions.Message::getText)
-                        .collect(Collectors.toList()),
-                context.getPackageName());
+                messages.stream().mapToInt(ActionsSuggestionsHelper::hashMessage),
+                context.getPackageName(),
+                System.currentTimeMillis());
         return SelectionSessionLogger.SignatureParser.createSignature(
                 SelectionSessionLogger.CLASSIFIER_ID, modelName, hash);
     }
@@ -128,4 +127,8 @@
             return result;
         }
     }
+
+    private static int hashMessage(ConversationActions.Message message) {
+        return Objects.hash(message.getAuthor(), message.getText(), message.getReferenceTime());
+    }
 }