Allow applications to set the title of the subtype enabler
Bug: 5058105

Change-Id: Ie2a476dfcfc9e4849c098d6126e0b2dd98db03df
diff --git a/java/com/android/inputmethodcommon/InputMethodSettingsImpl.java b/java/com/android/inputmethodcommon/InputMethodSettingsImpl.java
index bdd21cf..5e7decc 100644
--- a/java/com/android/inputmethodcommon/InputMethodSettingsImpl.java
+++ b/java/com/android/inputmethodcommon/InputMethodSettingsImpl.java
@@ -61,9 +61,13 @@
                 .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                     @Override
                     public boolean onPreferenceClick(Preference preference) {
+                        final CharSequence title = getSubtypeEnablerTitle(context);
                         final Intent intent =
                                 new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
                         intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, imi.getId());
+                        if (!TextUtils.isEmpty(title)) {
+                            intent.putExtra(Intent.EXTRA_TITLE, title);
+                        }
                         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                 | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
                                 | Intent.FLAG_ACTIVITY_CLEAR_TOP);
@@ -164,6 +168,14 @@
         updateSubtypeEnabler();
     }
 
+    private CharSequence getSubtypeEnablerTitle(Context context) {
+        if (mSubtypeEnablerTitleRes != 0) {
+            return context.getString(mSubtypeEnablerTitleRes);
+        } else {
+            return mSubtypeEnablerTitle;
+        }
+    }
+
     private void updateSubtypeEnabler() {
         if (mSubtypeEnablerPreference != null) {
             if (mSubtypeEnablerTitleRes != 0) {