Snap for 5434517 from 842411f93909f60b1ca1cdf67cad2e7994576f9e to qt-release
Change-Id: Id7f166132719cabb4de1df4d06cb630b4a6ee8a7
diff --git a/actions/test_data/actions_suggestions_test.default.model b/actions/test_data/actions_suggestions_test.default.model
index 524f71f..cdff8c2 100644
--- a/actions/test_data/actions_suggestions_test.default.model
+++ b/actions/test_data/actions_suggestions_test.default.model
Binary files differ
diff --git a/actions/test_data/actions_suggestions_test.model b/actions/test_data/actions_suggestions_test.model
index ffe2a83..a83a72b 100644
--- a/actions/test_data/actions_suggestions_test.model
+++ b/actions/test_data/actions_suggestions_test.model
Binary files differ
diff --git a/java/com/google/android/textclassifier/RemoteActionTemplate.java b/java/com/google/android/textclassifier/RemoteActionTemplate.java
index eae9fad..308d809 100644
--- a/java/com/google/android/textclassifier/RemoteActionTemplate.java
+++ b/java/com/google/android/textclassifier/RemoteActionTemplate.java
@@ -31,6 +31,13 @@
/** Description shown for the action (see: RemoteAction.getContentDescription). */
public final String description;
+ /**
+ * Description shown for the action (see: RemoteAction.getContentDescription) when app name is
+ * available. Caller is expected to replace the placeholder by the name of the app that is going
+ * to handle the action.
+ */
+ public final String descriptionWithAppName;
+
/** The action to set on the Intent (see: Intent.setAction). */
public final String action;
@@ -59,6 +66,7 @@
String titleWithoutEntity,
String titleWithEntity,
String description,
+ String descriptionWithAppName,
String action,
String data,
String type,
@@ -70,6 +78,7 @@
this.titleWithoutEntity = titleWithoutEntity;
this.titleWithEntity = titleWithEntity;
this.description = description;
+ this.descriptionWithAppName = descriptionWithAppName;
this.action = action;
this.data = data;
this.type = type;
diff --git a/models/actions_suggestions.en.model b/models/actions_suggestions.en.model
index ffe2a83..a83a72b 100644
--- a/models/actions_suggestions.en.model
+++ b/models/actions_suggestions.en.model
Binary files differ
diff --git a/models/actions_suggestions.universal.model b/models/actions_suggestions.universal.model
index 524f71f..cdff8c2 100644
--- a/models/actions_suggestions.universal.model
+++ b/models/actions_suggestions.universal.model
Binary files differ
diff --git a/utils/intents/intent-generator.cc b/utils/intents/intent-generator.cc
index bf36f1f..f882515 100644
--- a/utils/intents/intent-generator.cc
+++ b/utils/intents/intent-generator.cc
@@ -548,6 +548,8 @@
result.title_with_entity = ReadString(/*index=*/-1).ToString();
} else if (key.Equals("description")) {
result.description = ReadString(/*index=*/-1).ToString();
+ } else if (key.Equals("description_with_app_name")) {
+ result.description_with_app_name = ReadString(/*index=*/-1).ToString();
} else if (key.Equals("action")) {
result.action = ReadString(/*index=*/-1).ToString();
} else if (key.Equals("data")) {
diff --git a/utils/intents/intent-generator.h b/utils/intents/intent-generator.h
index 87ea811..9177adb 100644
--- a/utils/intents/intent-generator.h
+++ b/utils/intents/intent-generator.h
@@ -33,6 +33,11 @@
// Description shown for the action (see: RemoteAction.getContentDescription).
Optional<std::string> description;
+ // Description shown for the action (see: RemoteAction.getContentDescription)
+ // when app name is available. Caller is expected to replace the placeholder
+ // by the name of the app that is going to handle the action.
+ Optional<std::string> description_with_app_name;
+
// The action to set on the Intent (see: Intent.setAction).
Optional<std::string> action;
diff --git a/utils/intents/jni.cc b/utils/intents/jni.cc
index dffa5fc..d6274b1 100644
--- a/utils/intents/jni.cc
+++ b/utils/intents/jni.cc
@@ -50,8 +50,8 @@
TC3_GET_METHOD(
remote_action_template_class_, remote_action_template_init_, "<init>",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/"
- "String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;[Ljava/"
- "lang/String;Ljava/lang/String;[L" TC3_PACKAGE_PATH
+ "String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/"
+ "Integer;[Ljava/lang/String;Ljava/lang/String;[L" TC3_PACKAGE_PATH
TC3_NAMED_VARIANT_CLASS_NAME_STR ";Ljava/lang/Integer;)V");
TC3_GET_CLASS(named_variant_class_,
@@ -189,6 +189,8 @@
const jstring title_with_entity =
AsUTF8String(remote_action.title_with_entity);
const jstring description = AsUTF8String(remote_action.description);
+ const jstring description_with_app_name =
+ AsUTF8String(remote_action.description_with_app_name);
const jstring action = AsUTF8String(remote_action.action);
const jstring data = AsUTF8String(remote_action.data);
const jstring type = AsUTF8String(remote_action.type);
@@ -200,8 +202,9 @@
ScopedLocalRef<jobject> result(
jni_cache_->GetEnv()->NewObject(
remote_action_template_class_.get(), remote_action_template_init_,
- title_without_entity, title_with_entity, description, action, data,
- type, flags, category, package, extra, request_code),
+ title_without_entity, title_with_entity, description,
+ description_with_app_name, action, data, type, flags, category,
+ package, extra, request_code),
jni_cache_->GetEnv());
if (result == nullptr) {
return nullptr;