summaryrefslogtreecommitdiff
path: root/core/java/android/widget/AutoCompleteTextView.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2018-09-17 16:47:08 -0700
committerYohei Yukawa <yukawa@google.com>2018-09-17 16:47:08 -0700
commit484d4afc92cc1a1d58b601f7ad14d63781231b55 (patch)
tree64e2b7464aeac7829f9ec4f86f9898081771e2d3 /core/java/android/widget/AutoCompleteTextView.java
parent7db3ae4f31861edaf1641051530efbbf163907b2 (diff)
Always use Context.getSystemService() to get IMM
This is a preparation to deprecate the following two methods. * InputMethodManager#getInstance() * InputMethodManager#peekInstance() Since we soon need to stop relying on the current per-process InputMethodManager singleton model to fully support multi-display, those two methods really need to be deprecated. With this CL, framework code no longer depends on InputMethodManager#peekInstance(), which is also marked as deprecated in this CL. InputMethodManager#getInstance() is a bit tricky because it also works as a constructor of such a per-process singleton instance. Remaining two call-sites of this method will be migrated in a subsequent CL. This is a mechanical refactoring, which in theory should have no observable logical behavior difference. There could be a small performance regression, but it is basically not avoidable to correctly support multi-display scenarios. Bug: 115891476 Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases Test: atest CtsWidgetTestCases:android.widget.cts.EditTextTest Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest Test: atest FrameworksCoreTests:com.android.internal.inputmethod Test: atest FrameworksServicesTests:com.android.server.textservices Change-Id: I5db31491f3d47d3ad4a621e956995135c72e007b
Diffstat (limited to 'core/java/android/widget/AutoCompleteTextView.java')
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index cbd624eec7d6..7d6564fd91fb 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -1158,7 +1158,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
* <p>Closes the drop down if present on screen.</p>
*/
public void dismissDropDown() {
- InputMethodManager imm = InputMethodManager.peekInstance();
+ InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
if (imm != null) {
imm.displayCompletions(this, null);
}
@@ -1247,7 +1247,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
private void buildImeCompletions() {
final ListAdapter adapter = mAdapter;
if (adapter != null) {
- InputMethodManager imm = InputMethodManager.peekInstance();
+ InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
if (imm != null) {
final int count = Math.min(adapter.getCount(), 20);
CompletionInfo[] completions = new CompletionInfo[count];