aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2019-07-01 21:00:09 +0000
committerXin Li <delphij@google.com>2019-07-01 21:00:09 +0000
commit7c33185b41d774123ab565fa8b6d7afac44c1b18 (patch)
treec1d7ddd47896f4047d307169973e794f2941b029 /java/src/com/android/inputmethod/latin/LatinIME.java
parente4c638b34727c03a1adfba594d95e3f469c56a34 (diff)
parent751578eb61b47ba3e85054dd57c1df3e4b94f1fb (diff)
downloadlatinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.tar.gz
latinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.tar.xz
latinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.zip
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master
Bug: 134405016 Change-Id: If86628b9fc81ba5a599ae42e2901066c6bccf173
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 00ed52cad..4b6ab7e27 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -21,6 +21,7 @@ import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROP
import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE_COMPAT;
import android.Manifest.permission;
+import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -1781,6 +1782,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
};
+ /**
+ * Starts {@link android.app.Activity} on the same display where the IME is shown.
+ *
+ * @param intent {@link Intent} to be used to start {@link android.app.Activity}.
+ */
+ private void startActivityOnTheSameDisplay(Intent intent) {
+ // Note that WindowManager#getDefaultDisplay() returns the display ID associated with the
+ // Context from which the WindowManager instance was obtained. Therefore the following code
+ // returns the display ID for the window where the IME is shown.
+ final int currentDisplayId = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
+ .getDefaultDisplay().getDisplayId();
+
+ startActivity(intent,
+ ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle());
+ }
+
void launchSettings(final String extraEntryValue) {
mInputLogic.commitTyped(mSettings.getCurrent(), LastComposedWord.NOT_A_SEPARATOR);
requestHideSelf(0);
@@ -1795,7 +1812,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false);
intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY, extraEntryValue);
- startActivity(intent);
+ startActivityOnTheSameDisplay(intent);
}
private void showSubtypeSelectorAndSettings() {
@@ -1819,7 +1836,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Intent.EXTRA_TITLE, languageSelectionTitle);
- startActivity(intent);
+ startActivityOnTheSameDisplay(intent);
break;
case 1:
launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA);