summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-12-01 19:10:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-12-01 19:10:15 +0000
commita0b6a8dbd89b4fdc4e63f8c9bea07665d7582360 (patch)
tree153cfaf86883910517be2660d5ba3742321b45a6 /core/java/android/inputmethodservice/InputMethodService.java
parentab130fd9054089faffaccda655f2edd9ee6ea601 (diff)
parent7db4dd9abbd8f0caa7c84e784e54e8603b53e8c1 (diff)
Merge changes I48be0250,I58634142
* changes: Measure IMF latency 5/n Measure IMF latency 4/n
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 4a5d831cd705..67e75d205f97 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -585,10 +585,12 @@ public class InputMethodService extends AbstractInputMethodService {
Log.w(TAG, "The token has already registered, ignore this initialization.");
return;
}
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initializeInternal");
mPrivOps.set(privilegedOperations);
InputMethodPrivilegedOperationsRegistry.put(token, mPrivOps);
updateInputMethodDisplay(displayId);
attachToken(token);
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -642,6 +644,7 @@ public class InputMethodService extends AbstractInputMethodService {
@MainThread
@Override
public void bindInput(InputBinding binding) {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.bindInput");
mInputBinding = binding;
mInputConnection = binding.getConnection();
if (DEBUG) Log.v(TAG, "bindInput(): binding=" + binding
@@ -649,6 +652,7 @@ public class InputMethodService extends AbstractInputMethodService {
reportFullscreenMode();
initialize();
onBindInput();
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -686,7 +690,9 @@ public class InputMethodService extends AbstractInputMethodService {
@Override
public void restartInput(InputConnection ic, EditorInfo attribute) {
if (DEBUG) Log.v(TAG, "restartInput(): editor=" + attribute);
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.restartInput");
doStartInput(ic, attribute, true);
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -1253,6 +1259,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
@Override public void onCreate() {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.onCreate");
mTheme = Resources.selectSystemTheme(mTheme,
getApplicationInfo().targetSdkVersion,
android.R.style.Theme_InputMethod,
@@ -1273,6 +1280,7 @@ public class InputMethodService extends AbstractInputMethodService {
// in non-default display.
mInflater = (LayoutInflater)getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initSoftInputWindow");
mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState,
WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false);
mWindow.getWindow().getAttributes().setFitInsetsTypes(statusBars() | navigationBars());
@@ -1294,10 +1302,12 @@ public class InputMethodService extends AbstractInputMethodService {
initViews();
mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT);
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
mInlineSuggestionSessionController = new InlineSuggestionSessionController(
this::onCreateInlineSuggestionsRequest, this::getHostInputToken,
this::onInlineSuggestionsResponse);
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -1318,6 +1328,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
void initViews() {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initViews");
mInitialized = false;
mViewsCreated = false;
mShowInputRequested = false;
@@ -1352,6 +1363,7 @@ public class InputMethodService extends AbstractInputMethodService {
mCandidatesVisibility = getCandidatesHiddenVisibility();
mCandidatesFrame.setVisibility(mCandidatesVisibility);
mInputFrame.setVisibility(View.GONE);
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
@Override public void onDestroy() {
@@ -1393,6 +1405,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
private void resetStateForNewConfiguration() {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.resetStateForNewConfiguration");
boolean visible = mDecorViewVisible;
int showFlags = mShowInputFlags;
boolean showingInput = mShowInputRequested;
@@ -1428,6 +1441,7 @@ public class InputMethodService extends AbstractInputMethodService {
boolean showing = onEvaluateInputViewShown();
setImeWindowStatus(IME_ACTIVE | (showing ? IME_VISIBLE : 0), mBackDisposition);
}
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -1589,6 +1603,7 @@ public class InputMethodService extends AbstractInputMethodService {
* is currently running in fullscreen mode.
*/
public void updateFullscreenMode() {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.updateFullscreenMode");
boolean isFullscreen = mShowInputRequested && onEvaluateFullscreenMode();
boolean changed = mLastShowInputRequested != mShowInputRequested;
if (mIsFullscreen != isFullscreen || !mFullscreenApplied) {
@@ -1627,6 +1642,7 @@ public class InputMethodService extends AbstractInputMethodService {
onConfigureWindow(mWindow.getWindow(), isFullscreen, !mShowInputRequested);
mLastShowInputRequested = mShowInputRequested;
}
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -1755,6 +1771,7 @@ public class InputMethodService extends AbstractInputMethodService {
* @param outInsets Fill in with the current UI insets.
*/
public void onComputeInsets(Insets outInsets) {
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.onComputeInsets");
int[] loc = mTmpLocation;
if (mInputFrame.getVisibility() == View.VISIBLE) {
mInputFrame.getLocationInWindow(loc);
@@ -1775,6 +1792,7 @@ public class InputMethodService extends AbstractInputMethodService {
outInsets.visibleTopInsets = loc[1];
outInsets.touchableInsets = Insets.TOUCHABLE_INSETS_VISIBLE;
outInsets.touchableRegion.setEmpty();
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
/**
@@ -2165,7 +2183,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
ImeTracing.getInstance().triggerServiceDump("InputMethodService#showWindow", this);
-
+ Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.showWindow");
mDecorViewWasVisible = mDecorViewVisible;
mInShowWindow = true;
final int previousImeWindowStatus =
@@ -2189,6 +2207,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
mDecorViewWasVisible = true;
mInShowWindow = false;
+ Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}