Moving some calls off the UI thread

This saves ~5ms in onNewIntent

Bug: 67305604
Change-Id: Ic97727b1c526e50bd3c8a1d8f511e1d7fd5e05e7
This commit is contained in:
Sunny Goyal
2017-10-02 12:45:10 -07:00
parent ec21a599f4
commit 326403e958
6 changed files with 105 additions and 39 deletions

View File

@@ -15,16 +15,13 @@
*/
package com.android.launcher3.allapps.search;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@@ -50,7 +47,6 @@ public class AllAppsSearchBarController
protected String mQuery;
protected SearchAlgorithm mSearchAlgorithm;
protected InputMethodManager mInputMethodManager;
public void setVisibility(int visibility) {
mInput.setVisibility(visibility);
@@ -68,10 +64,6 @@ public class AllAppsSearchBarController
mInput.addTextChangedListener(this);
mInput.setOnEditorActionListener(this);
mInput.setOnBackKeyListener(this);
mInputMethodManager = (InputMethodManager)
mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
mSearchAlgorithm = searchAlgorithm;
}
@@ -137,22 +129,9 @@ public class AllAppsSearchBarController
* Resets the search bar state.
*/
public void reset() {
unfocusSearchField();
mCb.clearSearchResult();
mInput.setText("");
mInput.reset();
mQuery = null;
hideKeyboard();
}
protected void hideKeyboard() {
mInputMethodManager.hideSoftInputFromWindow(mInput.getWindowToken(), 0);
}
protected void unfocusSearchField() {
View nextFocus = mInput.focusSearch(View.FOCUS_DOWN);
if (nextFocus != null) {
nextFocus.requestFocus();
}
}
/**