diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java index d55367f19a70a..d23fb363df1ca 100644 --- a/core/java/android/inputmethodservice/IInputMethodWrapper.java +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -32,7 +32,6 @@ import android.os.ResultReceiver; import android.util.Log; import android.view.InputChannel; import android.view.MotionEvent; -import android.view.inputmethod.ImeTracker; import android.view.inputmethod.InputBinding; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethod; @@ -94,10 +93,9 @@ class IInputMethodWrapper extends IInputMethod.Stub final int mTargetSdkVersion; /** - * This is not {@code null} only between {@link #bindInput(InputBinding)} and - * {@link #unbindInput()} so that {@link RemoteInputConnection} can query if - * {@link #unbindInput()} has already been called or not, mainly to avoid unnecessary - * blocking operations. + * This is not {@null} only between {@link #bindInput(InputBinding)} and {@link #unbindInput()} + * so that {@link RemoteInputConnection} can query if {@link #unbindInput()} has already been + * called or not, mainly to avoid unnecessary blocking operations. * *
This field must be set and cleared only from the binder thread(s), where the system
* guarantees that {@link #bindInput(InputBinding)},
@@ -221,26 +219,18 @@ class IInputMethodWrapper extends IInputMethod.Stub
return;
case DO_SHOW_SOFT_INPUT: {
final SomeArgs args = (SomeArgs) msg.obj;
- final ImeTracker.Token statsToken = (ImeTracker.Token) args.arg3;
if (isValid(inputMethod, target, "DO_SHOW_SOFT_INPUT")) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
inputMethod.showSoftInputWithToken(
- msg.arg1, (ResultReceiver) args.arg2, (IBinder) args.arg1, statsToken);
- } else {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
+ msg.arg1, (ResultReceiver) args.arg2, (IBinder) args.arg1);
}
args.recycle();
return;
}
case DO_HIDE_SOFT_INPUT: {
final SomeArgs args = (SomeArgs) msg.obj;
- final ImeTracker.Token statsToken = (ImeTracker.Token) args.arg3;
if (isValid(inputMethod, target, "DO_HIDE_SOFT_INPUT")) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
inputMethod.hideSoftInputWithToken(msg.arg1, (ResultReceiver) args.arg2,
- (IBinder) args.arg1, statsToken);
- } else {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
+ (IBinder) args.arg1);
}
args.recycle();
return;
@@ -426,20 +416,16 @@ class IInputMethodWrapper extends IInputMethod.Stub
@BinderThread
@Override
- public void showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken,
- int flags, ResultReceiver resultReceiver) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER);
- mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_SHOW_SOFT_INPUT,
- flags, showInputToken, resultReceiver, statsToken));
+ public void showSoftInput(IBinder showInputToken, int flags, ResultReceiver resultReceiver) {
+ mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_SHOW_SOFT_INPUT,
+ flags, showInputToken, resultReceiver));
}
@BinderThread
@Override
- public void hideSoftInput(IBinder hideInputToken, @Nullable ImeTracker.Token statsToken,
- int flags, ResultReceiver resultReceiver) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER);
- mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_HIDE_SOFT_INPUT,
- flags, hideInputToken, resultReceiver, statsToken));
+ public void hideSoftInput(IBinder hideInputToken, int flags, ResultReceiver resultReceiver) {
+ mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_HIDE_SOFT_INPUT,
+ flags, hideInputToken, resultReceiver));
}
@BinderThread
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index bf4fc4a72fdcf..d902486faceda 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -124,7 +124,6 @@ import android.view.inputmethod.CursorAnchorInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
-import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InlineSuggestionsRequest;
import android.view.inputmethod.InlineSuggestionsResponse;
import android.view.inputmethod.InputBinding;
@@ -670,10 +669,6 @@ public class InputMethodService extends AbstractInputMethodService {
*/
private IBinder mCurHideInputToken;
- /** The token tracking the current IME request or {@code null} otherwise. */
- @Nullable
- private ImeTracker.Token mCurStatsToken;
-
final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> {
onComputeInsets(mTmpInsets);
if (!mViewsCreated) {
@@ -875,12 +870,10 @@ public class InputMethodService extends AbstractInputMethodService {
@MainThread
@Override
public void hideSoftInputWithToken(int flags, ResultReceiver resultReceiver,
- IBinder hideInputToken, @Nullable ImeTracker.Token statsToken) {
+ IBinder hideInputToken) {
mSystemCallingHideSoftInput = true;
mCurHideInputToken = hideInputToken;
- mCurStatsToken = statsToken;
hideSoftInput(flags, resultReceiver);
- mCurStatsToken = null;
mCurHideInputToken = null;
mSystemCallingHideSoftInput = false;
}
@@ -891,7 +884,6 @@ public class InputMethodService extends AbstractInputMethodService {
@MainThread
@Override
public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
- ImeTracker.get().onProgress(mCurStatsToken, ImeTracker.PHASE_IME_HIDE_SOFT_INPUT);
if (DEBUG) Log.v(TAG, "hideSoftInput()");
if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R
&& !mSystemCallingHideSoftInput) {
@@ -926,17 +918,12 @@ public class InputMethodService extends AbstractInputMethodService {
@MainThread
@Override
public void showSoftInputWithToken(int flags, ResultReceiver resultReceiver,
- IBinder showInputToken, @Nullable ImeTracker.Token statsToken) {
+ IBinder showInputToken) {
mSystemCallingShowSoftInput = true;
mCurShowInputToken = showInputToken;
- mCurStatsToken = statsToken;
- try {
- showSoftInput(flags, resultReceiver);
- } finally {
- mCurStatsToken = null;
- mCurShowInputToken = null;
- mSystemCallingShowSoftInput = false;
- }
+ showSoftInput(flags, resultReceiver);
+ mCurShowInputToken = null;
+ mSystemCallingShowSoftInput = false;
}
/**
@@ -945,7 +932,6 @@ public class InputMethodService extends AbstractInputMethodService {
@MainThread
@Override
public void showSoftInput(int flags, ResultReceiver resultReceiver) {
- ImeTracker.get().onProgress(mCurStatsToken, ImeTracker.PHASE_IME_SHOW_SOFT_INPUT);
if (DEBUG) Log.v(TAG, "showSoftInput()");
// TODO(b/148086656): Disallow IME developers from calling InputMethodImpl methods.
if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R
@@ -961,12 +947,7 @@ public class InputMethodService extends AbstractInputMethodService {
null /* icProto */);
final boolean wasVisible = isInputViewShown();
if (dispatchOnShowInputRequested(flags, false)) {
- ImeTracker.get().onProgress(mCurStatsToken,
- ImeTracker.PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE);
showWindow(true);
- } else {
- ImeTracker.get().onFailed(mCurStatsToken,
- ImeTracker.PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE);
}
setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition);
@@ -2942,10 +2923,8 @@ public class InputMethodService extends AbstractInputMethodService {
ImeTracing.getInstance().triggerServiceDump(
"InputMethodService#applyVisibilityInInsetsConsumerIfNecessary", mDumper,
null /* icProto */);
- ImeTracker.get().onProgress(mCurStatsToken,
- ImeTracker.PHASE_IME_APPLY_VISIBILITY_INSETS_CONSUMER);
mPrivOps.applyImeVisibilityAsync(setVisible
- ? mCurShowInputToken : mCurHideInputToken, setVisible, mCurStatsToken);
+ ? mCurShowInputToken : mCurHideInputToken, setVisible);
}
private void finishViews(boolean finishingInput) {
diff --git a/core/java/android/view/IDisplayWindowInsetsController.aidl b/core/java/android/view/IDisplayWindowInsetsController.aidl
index 91270d4160f57..0769f1209a2bb 100644
--- a/core/java/android/view/IDisplayWindowInsetsController.aidl
+++ b/core/java/android/view/IDisplayWindowInsetsController.aidl
@@ -19,7 +19,6 @@ package android.view;
import android.content.ComponentName;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
-import android.view.inputmethod.ImeTracker;
/**
* Singular controller of insets to use when there isn't another obvious controller available.
@@ -49,10 +48,10 @@ oneway interface IDisplayWindowInsetsController {
/**
* @see IWindow#showInsets
*/
- void showInsets(int types, boolean fromIme, in @nullable ImeTracker.Token statsToken);
+ void showInsets(int types, boolean fromIme);
/**
* @see IWindow#hideInsets
*/
- void hideInsets(int types, boolean fromIme, in @nullable ImeTracker.Token statsToken);
+ void hideInsets(int types, boolean fromIme);
}
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 8e16f24b154fe..a8564740c0c89 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -29,7 +29,6 @@ import android.view.InsetsState;
import android.view.IScrollCaptureResponseListener;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import com.android.internal.os.IResultReceiver;
@@ -69,18 +68,16 @@ oneway interface IWindow {
*
* @param types internal insets types (WindowInsets.Type.InsetsType) to show
* @param fromIme true if this request originated from IME (InputMethodService).
- * @param statsToken the token tracking the current IME show request or {@code null} otherwise.
*/
- void showInsets(int types, boolean fromIme, in @nullable ImeTracker.Token statsToken);
+ void showInsets(int types, boolean fromIme);
/**
* Called when a set of insets source window should be hidden by policy.
*
* @param types internal insets types (WindowInsets.Type.InsetsType) to hide
* @param fromIme true if this request originated from IME (InputMethodService).
- * @param statsToken the token tracking the current IME hide request or {@code null} otherwise.
*/
- void hideInsets(int types, boolean fromIme, in @nullable ImeTracker.Token statsToken);
+ void hideInsets(int types, boolean fromIme);
void moved(int newX, int newY);
void dispatchAppVisibility(boolean visible);
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index e775969238a02..27b4d8744452f 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -58,7 +58,6 @@ import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowInsetsAnimation.Bounds;
import android.view.WindowManager.LayoutParams;
import android.view.animation.Interpolator;
-import android.view.inputmethod.ImeTracker;
import com.android.internal.annotations.VisibleForTesting;
@@ -69,7 +68,7 @@ import java.util.Objects;
* Implements {@link WindowInsetsAnimationController}
* @hide
*/
-@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+@VisibleForTesting
public class InsetsAnimationControlImpl implements InternalInsetsAnimationController,
InsetsAnimationControlRunner {
@@ -97,8 +96,6 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
/** @see WindowInsetsAnimationController#hasZeroInsetsIme */
private final boolean mHasZeroInsetsIme;
private final CompatibilityInfo.Translator mTranslator;
- @Nullable
- private final ImeTracker.Token mStatsToken;
private Insets mCurrentInsets;
private Insets mPendingInsets;
private float mPendingFraction;
@@ -117,7 +114,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
@InsetsType int types, InsetsAnimationControlCallbacks controller, long durationMs,
Interpolator interpolator, @AnimationType int animationType,
@LayoutInsetsDuringAnimation int layoutInsetsDuringAnimation,
- CompatibilityInfo.Translator translator, @Nullable ImeTracker.Token statsToken) {
+ CompatibilityInfo.Translator translator) {
mControls = controls;
mListener = listener;
mTypes = types;
@@ -155,7 +152,6 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
mAnimationType = animationType;
mLayoutInsetsDuringAnimation = layoutInsetsDuringAnimation;
mTranslator = translator;
- mStatsToken = statsToken;
mController.startAnimation(this, listener, types, mAnimation,
new Bounds(mHiddenInsets, mShownInsets));
}
@@ -231,11 +227,6 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
return mAnimationType;
}
- @Override
- public ImeTracker.Token getStatsToken() {
- return mStatsToken;
- }
-
@Override
public void setInsetsAndAlpha(Insets insets, float alpha, float fraction) {
setInsetsAndAlpha(insets, alpha, fraction, false /* allowWhenFinished */);
@@ -262,10 +253,10 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
}
}
+ @VisibleForTesting
/**
* @return Whether the finish callback of this animation should be invoked.
*/
- @VisibleForTesting
public boolean applyChangeInsets(@Nullable InsetsState outState) {
if (mCancelled) {
if (DEBUG) Log.d(TAG, "applyChangeInsets canceled");
diff --git a/core/java/android/view/InsetsAnimationControlRunner.java b/core/java/android/view/InsetsAnimationControlRunner.java
index cf40e7e4d308c..291351e0b9d33 100644
--- a/core/java/android/view/InsetsAnimationControlRunner.java
+++ b/core/java/android/view/InsetsAnimationControlRunner.java
@@ -16,12 +16,10 @@
package android.view;
-import android.annotation.Nullable;
import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;
import android.view.InsetsController.AnimationType;
import android.view.WindowInsets.Type.InsetsType;
-import android.view.inputmethod.ImeTracker;
/**
* Interface representing a runner for an insets animation.
@@ -75,12 +73,6 @@ public interface InsetsAnimationControlRunner {
*/
@AnimationType int getAnimationType();
- /**
- * @return The token tracking the current IME request or {@code null} otherwise.
- */
- @Nullable
- ImeTracker.Token getStatsToken();
-
/**
*
* Export the state of classes that implement this interface into a protocol buffer
diff --git a/core/java/android/view/InsetsAnimationThreadControlRunner.java b/core/java/android/view/InsetsAnimationThreadControlRunner.java
index f7b9aa26ad96e..fc97541bd34d4 100644
--- a/core/java/android/view/InsetsAnimationThreadControlRunner.java
+++ b/core/java/android/view/InsetsAnimationThreadControlRunner.java
@@ -34,7 +34,6 @@ import android.view.SyncRtSurfaceTransactionApplier.SurfaceParams;
import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowInsetsAnimation.Bounds;
import android.view.animation.Interpolator;
-import android.view.inputmethod.ImeTracker;
/**
* Insets animation runner that uses {@link InsetsAnimationThread} to run the animation off from the
@@ -113,13 +112,12 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
@InsetsType int types, InsetsAnimationControlCallbacks controller, long durationMs,
Interpolator interpolator, @AnimationType int animationType,
@LayoutInsetsDuringAnimation int layoutInsetsDuringAnimation,
- CompatibilityInfo.Translator translator, Handler mainThreadHandler,
- @Nullable ImeTracker.Token statsToken) {
+ CompatibilityInfo.Translator translator, Handler mainThreadHandler) {
mMainThreadHandler = mainThreadHandler;
mOuterCallbacks = controller;
mControl = new InsetsAnimationControlImpl(controls, frame, state, listener, types,
mCallbacks, durationMs, interpolator, animationType, layoutInsetsDuringAnimation,
- translator, statsToken);
+ translator);
InsetsAnimationThread.getHandler().post(() -> {
if (mControl.isCancelled()) {
return;
@@ -142,11 +140,6 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
mControl.dumpDebug(proto, fieldId);
}
- @Override
- public ImeTracker.Token getStatsToken() {
- return mControl.getStatsToken();
- }
-
@Override
@UiThread
public int getTypes() {
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index fbd82266246b0..35838a39057ed 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -44,7 +44,6 @@ import android.os.CancellationSignal;
import android.os.Handler;
import android.os.IBinder;
import android.os.Trace;
-import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
import android.util.Pair;
@@ -61,7 +60,6 @@ import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.PathInterpolator;
-import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodManager;
import com.android.internal.annotations.VisibleForTesting;
@@ -931,12 +929,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
hideTypes[0] &= ~animatingTypes;
if (showTypes[0] != 0) {
- applyAnimation(showTypes[0], true /* show */, false /* fromIme */,
- null /* statsToken */);
+ applyAnimation(showTypes[0], true /* show */, false /* fromIme */);
}
if (hideTypes[0] != 0) {
- applyAnimation(hideTypes[0], false /* show */, false /* fromIme */,
- null /* statsToken */);
+ applyAnimation(hideTypes[0], false /* show */, false /* fromIme */);
}
if (mControllableTypes != controllableTypes) {
@@ -952,12 +948,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@Override
public void show(@InsetsType int types) {
- show(types, false /* fromIme */, null /* statsToken */);
+ show(types, false /* fromIme */);
}
- @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
- public void show(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
+ @VisibleForTesting
+ public void show(@InsetsType int types, boolean fromIme) {
if ((types & ime()) != 0) {
Log.d(TAG, "show(ime(), fromIme=" + fromIme + ")");
}
@@ -984,7 +979,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
true /* fromIme */, pendingRequest.durationMs, pendingRequest.interpolator,
pendingRequest.animationType,
pendingRequest.layoutInsetsDuringAnimation,
- pendingRequest.useInsetsAnimationThread, statsToken);
+ pendingRequest.useInsetsAnimationThread);
return;
}
@@ -995,9 +990,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
if ((types & type) == 0) {
continue;
}
- @AnimationType final int animationType = getAnimationType(type);
+ final @AnimationType int animationType = getAnimationType(type);
final boolean requestedVisible = (type & mRequestedVisibleTypes) != 0;
- final boolean isImeAnimation = type == ime();
if (requestedVisible && animationType == ANIMATION_TYPE_NONE
|| animationType == ANIMATION_TYPE_SHOW) {
// no-op: already shown or animating in (because window visibility is
@@ -1005,36 +999,25 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
if (DEBUG) Log.d(TAG, String.format(
"show ignored for type: %d animType: %d requestedVisible: %s",
type, animationType, requestedVisible));
- if (isImeAnimation) {
- ImeTracker.get().onCancelled(statsToken,
- ImeTracker.PHASE_CLIENT_APPLY_ANIMATION);
- }
continue;
}
if (fromIme && animationType == ANIMATION_TYPE_USER) {
// App is already controlling the IME, don't cancel it.
- if (isImeAnimation) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_APPLY_ANIMATION);
- }
continue;
}
- if (isImeAnimation) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_APPLY_ANIMATION);
- }
typesReady |= type;
}
if (DEBUG) Log.d(TAG, "show typesReady: " + typesReady);
- applyAnimation(typesReady, true /* show */, fromIme, statsToken);
+ applyAnimation(typesReady, true /* show */, fromIme);
}
@Override
public void hide(@InsetsType int types) {
- hide(types, false /* fromIme */, null /* statsToken */);
+ hide(types, false /* fromIme */);
}
@VisibleForTesting
- public void hide(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
+ public void hide(@InsetsType int types, boolean fromIme) {
if (fromIme) {
ImeTracing.getInstance().triggerClientDump("InsetsController#hide",
mHost.getInputMethodManager(), null /* icProto */);
@@ -1047,25 +1030,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
if ((types & type) == 0) {
continue;
}
- @AnimationType final int animationType = getAnimationType(type);
+ final @AnimationType int animationType = getAnimationType(type);
final boolean requestedVisible = (type & mRequestedVisibleTypes) != 0;
- final boolean isImeAnimation = type == ime();
if (!requestedVisible && animationType == ANIMATION_TYPE_NONE
|| animationType == ANIMATION_TYPE_HIDE) {
- // no-op: already hidden or animating out (because window visibility is
- // applied before starting animation).
- if (isImeAnimation) {
- ImeTracker.get().onCancelled(statsToken,
- ImeTracker.PHASE_CLIENT_APPLY_ANIMATION);
- }
+ // no-op: already hidden or animating out.
continue;
}
- if (isImeAnimation) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_APPLY_ANIMATION);
- }
typesReady |= type;
}
- applyAnimation(typesReady, false /* show */, fromIme, statsToken);
+ applyAnimation(typesReady, false /* show */, fromIme /* fromIme */);
}
@Override
@@ -1094,7 +1068,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
controlAnimationUnchecked(types, cancellationSignal, listener, mFrame, fromIme, durationMs,
interpolator, animationType, getLayoutInsetsDuringAnimationMode(types),
- false /* useInsetsAnimationThread */, null /* statsToken */);
+ false /* useInsetsAnimationThread */);
}
private void controlAnimationUnchecked(@InsetsType int types,
@@ -1103,8 +1077,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
long durationMs, Interpolator interpolator,
@AnimationType int animationType,
@LayoutInsetsDuringAnimation int layoutInsetsDuringAnimation,
- boolean useInsetsAnimationThread, @Nullable ImeTracker.Token statsToken) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_CONTROL_ANIMATION);
+ boolean useInsetsAnimationThread) {
if ((types & mTypesBeingCancelled) != 0) {
throw new IllegalStateException("Cannot start a new insets animation of "
+ Type.toString(types)
@@ -1179,16 +1152,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
? new InsetsAnimationThreadControlRunner(controls,
frame, mState, listener, typesReady, this, durationMs, interpolator,
animationType, layoutInsetsDuringAnimation, mHost.getTranslator(),
- mHost.getHandler(), statsToken)
+ mHost.getHandler())
: new InsetsAnimationControlImpl(controls,
frame, mState, listener, typesReady, this, durationMs, interpolator,
- animationType, layoutInsetsDuringAnimation, mHost.getTranslator(),
- statsToken);
+ animationType, layoutInsetsDuringAnimation, mHost.getTranslator());
if ((typesReady & WindowInsets.Type.ime()) != 0) {
ImeTracing.getInstance().triggerClientDump("InsetsAnimationControlImpl",
mHost.getInputMethodManager(), null /* icProto */);
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING);
mRunningAnimations.add(new RunningAnimation(runner, animationType));
if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: "
+ useInsetsAnimationThread);
@@ -1340,18 +1311,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
// requested visibility.
return;
}
- final ImeTracker.Token statsToken = runner.getStatsToken();
if (shown) {
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_CLIENT_ANIMATION_FINISHED_SHOW);
showDirectly(runner.getTypes(), true /* fromIme */);
- ImeTracker.get().onShown(statsToken);
} else {
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_CLIENT_ANIMATION_FINISHED_HIDE);
hideDirectly(runner.getTypes(), true /* animationFinished */,
runner.getAnimationType(), true /* fromIme */);
- ImeTracker.get().onHidden(statsToken);
}
}
@@ -1375,19 +1339,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
}
private void cancelAnimation(InsetsAnimationControlRunner control, boolean invokeCallback) {
+ if (DEBUG) Log.d(TAG, String.format("cancelAnimation of types: %d, animType: %d, host: %s",
+ control.getTypes(), control.getAnimationType(), mHost.getRootViewTitle()));
if (invokeCallback) {
- ImeTracker.get().onCancelled(control.getStatsToken(),
- ImeTracker.PHASE_CLIENT_ANIMATION_CANCEL);
control.cancel();
- } else {
- // Succeeds if invokeCallback is false (i.e. when called from notifyFinished).
- ImeTracker.get().onProgress(control.getStatsToken(),
- ImeTracker.PHASE_CLIENT_ANIMATION_CANCEL);
- }
- if (DEBUG) {
- Log.d(TAG, TextUtils.formatSimple(
- "cancelAnimation of types: %d, animType: %d, host: %s",
- control.getTypes(), control.getAnimationType(), mHost.getRootViewTitle()));
}
boolean stateChanged = false;
for (int i = mRunningAnimations.size() - 1; i >= 0; i--) {
@@ -1497,8 +1452,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
}
@VisibleForTesting
- public void applyAnimation(@InsetsType final int types, boolean show, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
+ public void applyAnimation(@InsetsType final int types, boolean show, boolean fromIme) {
// TODO(b/166736352): We should only skip the animation of specific types, not all types.
boolean skipAnim = false;
if ((types & ime()) != 0) {
@@ -1511,12 +1465,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
&& consumer.hasViewFocusWhenWindowFocusGain();
}
}
- applyAnimation(types, show, fromIme, skipAnim, statsToken);
+ applyAnimation(types, show, fromIme, skipAnim);
}
@VisibleForTesting
public void applyAnimation(@InsetsType final int types, boolean show, boolean fromIme,
- boolean skipAnim, @Nullable ImeTracker.Token statsToken) {
+ boolean skipAnim) {
if (types == 0) {
// nothing to animate.
if (DEBUG) Log.d(TAG, "applyAnimation, nothing to animate");
@@ -1536,11 +1490,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
listener.getDurationMs(), listener.getInsetsInterpolator(),
show ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE,
show ? LAYOUT_INSETS_DURING_ANIMATION_SHOWN : LAYOUT_INSETS_DURING_ANIMATION_HIDDEN,
- !hasAnimationCallbacks /* useInsetsAnimationThread */, statsToken);
+ !hasAnimationCallbacks /* useInsetsAnimationThread */);
}
- private void hideDirectly(@InsetsType int types, boolean animationFinished,
- @AnimationType int animationType, boolean fromIme) {
+ private void hideDirectly(
+ @InsetsType int types, boolean animationFinished, @AnimationType int animationType,
+ boolean fromIme) {
if ((types & ime()) != 0) {
ImeTracing.getInstance().triggerClientDump("InsetsController#hideDirectly",
mHost.getInputMethodManager(), null /* icProto */);
diff --git a/core/java/android/view/InsetsResizeAnimationRunner.java b/core/java/android/view/InsetsResizeAnimationRunner.java
index 778c677c58bd2..edcfc95fe4e43 100644
--- a/core/java/android/view/InsetsResizeAnimationRunner.java
+++ b/core/java/android/view/InsetsResizeAnimationRunner.java
@@ -37,7 +37,6 @@ import android.view.InsetsState.InternalInsetsType;
import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowInsetsAnimation.Bounds;
import android.view.animation.Interpolator;
-import android.view.inputmethod.ImeTracker;
/**
* Runs a fake animation of resizing insets to produce insets animation callbacks.
@@ -92,12 +91,6 @@ public class InsetsResizeAnimationRunner implements InsetsAnimationControlRunner
return ANIMATION_TYPE_RESIZE;
}
- @Override
- public ImeTracker.Token getStatsToken() {
- // Return null as resizing the IME view is not explicitly tracked.
- return null;
- }
-
@Override
public void cancel() {
if (mCancelled || mFinished) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b088514c6989c..e664ebf4c4849 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -192,7 +192,6 @@ import android.view.autofill.AutofillManager;
import android.view.contentcapture.ContentCaptureManager;
import android.view.contentcapture.ContentCaptureSession;
import android.view.contentcapture.MainContentCaptureSession;
-import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodManager;
import android.widget.Scroller;
import android.window.ClientWindowFrames;
@@ -5650,23 +5649,17 @@ public final class ViewRootImpl implements ViewParent,
break;
}
case MSG_SHOW_INSETS: {
- final ImeTracker.Token statsToken = (ImeTracker.Token) msg.obj;
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_CLIENT_HANDLE_SHOW_INSETS);
if (mView == null) {
Log.e(TAG,
String.format("Calling showInsets(%d,%b) on window that no longer"
+ " has views.", msg.arg1, msg.arg2 == 1));
}
clearLowProfileModeIfNeeded(msg.arg1, msg.arg2 == 1);
- mInsetsController.show(msg.arg1, msg.arg2 == 1, statsToken);
+ mInsetsController.show(msg.arg1, msg.arg2 == 1);
break;
}
case MSG_HIDE_INSETS: {
- final ImeTracker.Token statsToken = (ImeTracker.Token) msg.obj;
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_CLIENT_HANDLE_HIDE_INSETS);
- mInsetsController.hide(msg.arg1, msg.arg2 == 1, statsToken);
+ mInsetsController.hide(msg.arg1, msg.arg2 == 1);
break;
}
case MSG_WINDOW_MOVED:
@@ -8818,14 +8811,12 @@ public final class ViewRootImpl implements ViewParent,
mHandler.obtainMessage(MSG_INSETS_CONTROL_CHANGED, args).sendToTarget();
}
- private void showInsets(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
- mHandler.obtainMessage(MSG_SHOW_INSETS, types, fromIme ? 1 : 0, statsToken).sendToTarget();
+ private void showInsets(@InsetsType int types, boolean fromIme) {
+ mHandler.obtainMessage(MSG_SHOW_INSETS, types, fromIme ? 1 : 0).sendToTarget();
}
- private void hideInsets(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
- mHandler.obtainMessage(MSG_HIDE_INSETS, types, fromIme ? 1 : 0, statsToken).sendToTarget();
+ private void hideInsets(@InsetsType int types, boolean fromIme) {
+ mHandler.obtainMessage(MSG_HIDE_INSETS, types, fromIme ? 1 : 0).sendToTarget();
}
public void dispatchMoved(int newX, int newY) {
@@ -10189,8 +10180,7 @@ public final class ViewRootImpl implements ViewParent,
}
@Override
- public void showInsets(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
+ public void showInsets(@InsetsType int types, boolean fromIme) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (fromIme) {
ImeTracing.getInstance().triggerClientDump("ViewRootImpl.W#showInsets",
@@ -10198,16 +10188,13 @@ public final class ViewRootImpl implements ViewParent,
null /* icProto */);
}
if (viewAncestor != null) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_SHOW_INSETS);
- viewAncestor.showInsets(types, fromIme, statsToken);
- } else {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_SHOW_INSETS);
+ viewAncestor.showInsets(types, fromIme);
}
}
@Override
- public void hideInsets(@InsetsType int types, boolean fromIme,
- @Nullable ImeTracker.Token statsToken) {
+ public void hideInsets(@InsetsType int types, boolean fromIme) {
+
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (fromIme) {
ImeTracing.getInstance().triggerClientDump("ViewRootImpl.W#hideInsets",
@@ -10215,10 +10202,7 @@ public final class ViewRootImpl implements ViewParent,
null /* icProto */);
}
if (viewAncestor != null) {
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_HIDE_INSETS);
- viewAncestor.hideInsets(types, fromIme, statsToken);
- } else {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_HIDE_INSETS);
+ viewAncestor.hideInsets(types, fromIme);
}
}
diff --git a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
index 6eae63afcba7b..a66c67b2e2554 100644
--- a/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
+++ b/core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java
@@ -275,16 +275,15 @@ final class IInputMethodManagerGlobalInvoker {
@AnyThread
static boolean showSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken,
- @Nullable ImeTracker.Token statsToken, int flags, int lastClickToolType,
- @Nullable ResultReceiver resultReceiver,
+ int flags, int lastClickToolType, @Nullable ResultReceiver resultReceiver,
@SoftInputShowHideReason int reason) {
final IInputMethodManager service = getService();
if (service == null) {
return false;
}
try {
- return service.showSoftInput(client, windowToken, statsToken, flags, lastClickToolType,
- resultReceiver, reason);
+ return service.showSoftInput(
+ client, windowToken, flags, lastClickToolType, resultReceiver, reason);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -292,15 +291,14 @@ final class IInputMethodManagerGlobalInvoker {
@AnyThread
static boolean hideSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken,
- @Nullable ImeTracker.Token statsToken, int flags,
- @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
+ int flags, @Nullable ResultReceiver resultReceiver,
+ @SoftInputShowHideReason int reason) {
final IInputMethodManager service = getService();
if (service == null) {
return false;
}
try {
- return service.hideSoftInput(client, windowToken, statsToken, flags, resultReceiver,
- reason);
+ return service.hideSoftInput(client, windowToken, flags, resultReceiver, reason);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/view/inputmethod/ImeTracker.aidl b/core/java/android/view/inputmethod/ImeTracker.aidl
deleted file mode 100644
index 1988f482497d2..0000000000000
--- a/core/java/android/view/inputmethod/ImeTracker.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.view.inputmethod;
-
-parcelable ImeTracker.Token;
diff --git a/core/java/android/view/inputmethod/ImeTracker.java b/core/java/android/view/inputmethod/ImeTracker.java
deleted file mode 100644
index f4ecdff12c7a0..0000000000000
--- a/core/java/android/view/inputmethod/ImeTracker.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.view.inputmethod;
-
-import static android.view.inputmethod.ImeTracker.Debug.originToString;
-import static android.view.inputmethod.ImeTracker.Debug.phaseToString;
-
-import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.app.ActivityThread;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.SystemProperties;
-import android.util.Log;
-
-import com.android.internal.inputmethod.InputMethodDebug;
-import com.android.internal.inputmethod.SoftInputShowHideReason;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Random;
-import java.util.stream.Collectors;
-
-/** @hide */
-public interface ImeTracker {
-
- String TAG = "ImeTracker";
-
- /**
- * The origin of the IME request
- *
- * The name follows the format {@code PHASE_x_...} where {@code x} denotes
- * where the origin is (i.e. {@code PHASE_SERVER_...} occurs in the server).
- */
- @IntDef(prefix = { "ORIGIN_" }, value = {
- ORIGIN_CLIENT_SHOW_SOFT_INPUT,
- ORIGIN_CLIENT_HIDE_SOFT_INPUT,
- ORIGIN_SERVER_START_INPUT,
- ORIGIN_SERVER_HIDE_INPUT
- })
- @Retention(RetentionPolicy.SOURCE)
- @interface Origin {}
-
- /**
- * The IME show request originated in the client.
- */
- int ORIGIN_CLIENT_SHOW_SOFT_INPUT = 0;
-
- /**
- * The IME hide request originated in the client.
- */
- int ORIGIN_CLIENT_HIDE_SOFT_INPUT = 1;
-
- /**
- * The IME show request originated in the server.
- */
- int ORIGIN_SERVER_START_INPUT = 2;
-
- /**
- * The IME hide request originated in the server.
- */
- int ORIGIN_SERVER_HIDE_INPUT = 3;
-
- /**
- * The current phase of the IME request.
- *
- * The name follows the format {@code PHASE_x_...} where {@code x} denotes
- * where the phase is (i.e. {@code PHASE_SERVER_...} occurs in the server).
- */
- @IntDef(prefix = { "PHASE_" }, value = {
- PHASE_CLIENT_VIEW_SERVED,
- PHASE_SERVER_CLIENT_KNOWN,
- PHASE_SERVER_CLIENT_FOCUSED,
- PHASE_SERVER_ACCESSIBILITY,
- PHASE_SERVER_SYSTEM_READY,
- PHASE_SERVER_HIDE_IMPLICIT,
- PHASE_SERVER_HIDE_NOT_ALWAYS,
- PHASE_SERVER_WAIT_IME,
- PHASE_SERVER_HAS_IME,
- PHASE_SERVER_SHOULD_HIDE,
- PHASE_IME_WRAPPER,
- PHASE_IME_WRAPPER_DISPATCH,
- PHASE_IME_SHOW_SOFT_INPUT,
- PHASE_IME_HIDE_SOFT_INPUT,
- PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE,
- PHASE_IME_APPLY_VISIBILITY_INSETS_CONSUMER,
- PHASE_SERVER_APPLY_IME_VISIBILITY,
- PHASE_WM_SHOW_IME_RUNNER,
- PHASE_WM_SHOW_IME_READY,
- PHASE_WM_HAS_IME_INSETS_CONTROL_TARGET,
- PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_SHOW_INSETS,
- PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_HIDE_INSETS,
- PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_SHOW_INSETS,
- PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_HIDE_INSETS,
- PHASE_WM_REMOTE_INSETS_CONTROLLER,
- PHASE_WM_ANIMATION_CREATE,
- PHASE_WM_ANIMATION_RUNNING,
- PHASE_CLIENT_SHOW_INSETS,
- PHASE_CLIENT_HIDE_INSETS,
- PHASE_CLIENT_HANDLE_SHOW_INSETS,
- PHASE_CLIENT_HANDLE_HIDE_INSETS,
- PHASE_CLIENT_APPLY_ANIMATION,
- PHASE_CLIENT_CONTROL_ANIMATION,
- PHASE_CLIENT_ANIMATION_RUNNING,
- PHASE_CLIENT_ANIMATION_CANCEL,
- PHASE_CLIENT_ANIMATION_FINISHED_SHOW,
- PHASE_CLIENT_ANIMATION_FINISHED_HIDE
- })
- @Retention(RetentionPolicy.SOURCE)
- @interface Phase {}
-
- /** The view that requested the IME has been served by the IMM. */
- int PHASE_CLIENT_VIEW_SERVED = 0;
-
- /** The IME client that requested the IME has window manager focus. */
- int PHASE_SERVER_CLIENT_KNOWN = 1;
-
- /** The IME client that requested the IME has IME focus. */
- int PHASE_SERVER_CLIENT_FOCUSED = 2;
-
- /** The IME request complies with the current accessibility settings. */
- int PHASE_SERVER_ACCESSIBILITY = 3;
-
- /** The server is ready to run third party code. */
- int PHASE_SERVER_SYSTEM_READY = 4;
-
- /** Checked the implicit hide request against any explicit show requests. */
- int PHASE_SERVER_HIDE_IMPLICIT = 5;
-
- /** Checked the not-always hide request against any forced show requests. */
- int PHASE_SERVER_HIDE_NOT_ALWAYS = 6;
-
- /** The server is waiting for a connection to the IME. */
- int PHASE_SERVER_WAIT_IME = 7;
-
- /** The server has a connection to the IME. */
- int PHASE_SERVER_HAS_IME = 8;
-
- /** The server decided the IME should be hidden. */
- int PHASE_SERVER_SHOULD_HIDE = 9;
-
- /** Reached the IME wrapper. */
- int PHASE_IME_WRAPPER = 10;
-
- /** Dispatched from the IME wrapper to the IME. */
- int PHASE_IME_WRAPPER_DISPATCH = 11;
-
- /** Reached the IME' showSoftInput method. */
- int PHASE_IME_SHOW_SOFT_INPUT = 12;
-
- /** Reached the IME' hideSoftInput method. */
- int PHASE_IME_HIDE_SOFT_INPUT = 13;
-
- /** The server decided the IME should be shown. */
- int PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE = 14;
-
- /** Requested applying the IME visibility in the insets source consumer. */
- int PHASE_IME_APPLY_VISIBILITY_INSETS_CONSUMER = 15;
-
- /** Applied the IME visibility. */
- int PHASE_SERVER_APPLY_IME_VISIBILITY = 16;
-
- /** Created the show IME runner. */
- int PHASE_WM_SHOW_IME_RUNNER = 17;
-
- /** Ready to show IME. */
- int PHASE_WM_SHOW_IME_READY = 18;
-
- /** The Window Manager has a connection to the IME insets control target. */
- int PHASE_WM_HAS_IME_INSETS_CONTROL_TARGET = 19;
-
- /** Reached the window insets control target's show insets method. */
- int PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_SHOW_INSETS = 20;
-
- /** Reached the window insets control target's hide insets method. */
- int PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_HIDE_INSETS = 21;
-
- /** Reached the remote insets control target's show insets method. */
- int PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_SHOW_INSETS = 22;
-
- /** Reached the remote insets control target's hide insets method. */
- int PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_HIDE_INSETS = 23;
-
- /** Reached the remote insets controller. */
- int PHASE_WM_REMOTE_INSETS_CONTROLLER = 24;
-
- /** Created the IME window insets show animation. */
- int PHASE_WM_ANIMATION_CREATE = 25;
-
- /** Started the IME window insets show animation. */
- int PHASE_WM_ANIMATION_RUNNING = 26;
-
- /** Reached the client's show insets method. */
- int PHASE_CLIENT_SHOW_INSETS = 27;
-
- /** Reached the client's hide insets method. */
- int PHASE_CLIENT_HIDE_INSETS = 28;
-
- /** Handling the IME window insets show request. */
- int PHASE_CLIENT_HANDLE_SHOW_INSETS = 29;
-
- /** Handling the IME window insets hide request. */
- int PHASE_CLIENT_HANDLE_HIDE_INSETS = 30;
-
- /** Applied the IME window insets show animation. */
- int PHASE_CLIENT_APPLY_ANIMATION = 31;
-
- /** Started the IME window insets show animation. */
- int PHASE_CLIENT_CONTROL_ANIMATION = 32;
-
- /** Queued the IME window insets show animation. */
- int PHASE_CLIENT_ANIMATION_RUNNING = 33;
-
- /** Cancelled the IME window insets show animation. */
- int PHASE_CLIENT_ANIMATION_CANCEL = 34;
-
- /** Finished the IME window insets show animation. */
- int PHASE_CLIENT_ANIMATION_FINISHED_SHOW = 35;
-
- /** Finished the IME window insets hide animation. */
- int PHASE_CLIENT_ANIMATION_FINISHED_HIDE = 36;
-
- /**
- * Called when an IME show request is created.
- *
- * @param token the token tracking the current IME show request or {@code null} otherwise.
- * @param origin the origin of the IME show request.
- * @param reason the reason why the IME show request was created.
- */
- void onRequestShow(@Nullable Token token, @Origin int origin,
- @SoftInputShowHideReason int reason);
-
- /**
- * Called when an IME hide request is created.
- *
- * @param token the token tracking the current IME hide request or {@code null} otherwise.
- * @param origin the origin of the IME hide request.
- * @param reason the reason why the IME hide request was created.
- */
- void onRequestHide(@Nullable Token token, @Origin int origin,
- @SoftInputShowHideReason int reason);
-
- /**
- * Called when an IME request progresses to a further phase.
- *
- * @param token the token tracking the current IME request or {@code null} otherwise.
- * @param phase the new phase the IME request reached.
- */
- void onProgress(@Nullable Token token, @Phase int phase);
-
- /**
- * Called when an IME request fails.
- *
- * @param token the token tracking the current IME request or {@code null} otherwise.
- * @param phase the phase the IME request failed at.
- */
- void onFailed(@Nullable Token token, @Phase int phase);
-
- /**
- * Called when an IME request reached a flow that is not yet implemented.
- *
- * @param token the token tracking the current IME request or {@code null} otherwise.
- * @param phase the phase the IME request was currently at.
- */
- void onTodo(@Nullable Token token, @Phase int phase);
-
- /**
- * Called when an IME request is cancelled.
- *
- * @param token the token tracking the current IME request or {@code null} otherwise.
- * @param phase the phase the IME request was cancelled at.
- */
- void onCancelled(@Nullable Token token, @Phase int phase);
-
- /**
- * Called when the IME show request is successful.
- *
- * @param token the token tracking the current IME show request or {@code null} otherwise.
- */
- void onShown(@Nullable Token token);
-
- /**
- * Called when the IME hide request is successful.
- *
- * @param token the token tracking the current IME hide request or {@code null} otherwise.
- */
- void onHidden(@Nullable Token token);
-
- /**
- * Get the singleton instance of this class.
- *
- * @return the singleton instance of this class
- */
- @NonNull
- static ImeTracker get() {
- return SystemProperties.getBoolean("persist.debug.imetracker", false)
- ? LOGGER
- : NOOP_LOGGER;
- }
-
- /** The singleton IME tracker instance. */
- ImeTracker LOGGER = new ImeTracker() {
-
- @Override
- public void onRequestShow(@Nullable Token token, int origin,
- @SoftInputShowHideReason int reason) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onRequestShow at " + originToString(origin)
- + " reason " + InputMethodDebug.softInputDisplayReasonToString(reason));
- }
-
- @Override
- public void onRequestHide(@Nullable Token token, int origin,
- @SoftInputShowHideReason int reason) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onRequestHide at " + originToString(origin)
- + " reason " + InputMethodDebug.softInputDisplayReasonToString(reason));
- }
-
- @Override
- public void onProgress(@Nullable Token token, int phase) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onProgress at " + phaseToString(phase));
- }
-
- @Override
- public void onFailed(@Nullable Token token, int phase) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onFailed at " + phaseToString(phase));
- }
-
- @Override
- public void onTodo(@Nullable Token token, int phase) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onTodo at " + phaseToString(phase));
- }
-
- @Override
- public void onCancelled(@Nullable Token token, int phase) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onCancelled at " + phaseToString(phase));
- }
-
- @Override
- public void onShown(@Nullable Token token) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onShown");
- }
-
- @Override
- public void onHidden(@Nullable Token token) {
- if (token == null) return;
- Log.i(TAG, token.mTag + ": onHidden");
- }
- };
-
- /** The singleton no-op IME tracker instance. */
- ImeTracker NOOP_LOGGER = new ImeTracker() {
-
- @Override
- public void onRequestShow(@Nullable Token token, int origin,
- @SoftInputShowHideReason int reason) {}
-
- @Override
- public void onRequestHide(@Nullable Token token, int origin,
- @SoftInputShowHideReason int reason) {}
-
- @Override
- public void onProgress(@Nullable Token token, int phase) {}
-
- @Override
- public void onFailed(@Nullable Token token, int phase) {}
-
- @Override
- public void onTodo(@Nullable Token token, int phase) {}
-
- @Override
- public void onCancelled(@Nullable Token token, int phase) {}
-
- @Override
- public void onShown(@Nullable Token token) {}
-
- @Override
- public void onHidden(@Nullable Token token) {}
- };
-
- /** A token that tracks the progress of an IME request. */
- class Token implements Parcelable {
-
- private final IBinder mBinder;
- private final String mTag;
-
- public Token() {
- this(ActivityThread.currentProcessName());
- }
-
- public Token(String component) {
- this(new Binder(), component + ":" + Integer.toHexString((new Random().nextInt())));
- }
-
- private Token(IBinder binder, String tag) {
- mBinder = binder;
- mTag = tag;
- }
-
- /** For Parcelable, no special marshalled objects. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeStrongBinder(mBinder);
- dest.writeString8(mTag);
- }
-
- @NonNull
- public static final Creator Calling that IPC endpoint basically means that
* {@link InputMethodService#doStartInput(InputConnection, EditorInfo, boolean)} will be called
@@ -1075,7 +1070,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
/**
* Add a new entry and discard the oldest entry as needed.
- * @param info {@link StartInputInfo} to be added.
+ * @param info {@lin StartInputInfo} to be added.
*/
void addEntry(@NonNull StartInputInfo info) {
final int index = mNextIndex;
@@ -1193,18 +1188,18 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
} else if (accessibilityRequestingNoImeUri.equals(uri)) {
final int accessibilitySoftKeyboardSetting = Settings.Secure.getIntForUser(
mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE, 0 /* def */, mUserId);
+ Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE, 0, mUserId);
mAccessibilityRequestingNoSoftKeyboard =
(accessibilitySoftKeyboardSetting & AccessibilityService.SHOW_MODE_MASK)
== AccessibilityService.SHOW_MODE_HIDDEN;
if (mAccessibilityRequestingNoSoftKeyboard) {
final boolean showRequested = mShowRequested;
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */,
- 0 /* flags */, null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_SETTINGS_ON_CHANGE);
mShowRequested = showRequested;
} else if (mShowRequested) {
- showCurrentInputImplicitLocked(mCurFocusedWindow,
+ showCurrentInputLocked(mCurFocusedWindow,
+ InputMethodManager.SHOW_IMPLICIT, null,
SoftInputShowHideReason.SHOW_SETTINGS_ON_CHANGE);
}
} else {
@@ -1670,8 +1665,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
// Hide soft input before user switch task since switch task may block main handler a while
// and delayed the hideCurrentInputLocked().
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */, SoftInputShowHideReason.HIDE_SWITCH_USER);
+ hideCurrentInputLocked(
+ mCurFocusedWindow, 0, null, SoftInputShowHideReason.HIDE_SWITCH_USER);
final UserSwitchHandlerTask task = new UserSwitchHandlerTask(this, userId,
clientToBeReset);
mUserSwitchHandlerTask = task;
@@ -2226,7 +2221,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
final ClientDeathRecipient deathRecipient = new ClientDeathRecipient(this, client);
try {
- client.asBinder().linkToDeath(deathRecipient, 0 /* flags */);
+ client.asBinder().linkToDeath(deathRecipient, 0);
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
@@ -2251,7 +2246,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
synchronized (ImfLock.class) {
ClientState cs = mClients.remove(client.asBinder());
if (cs != null) {
- client.asBinder().unlinkToDeath(cs.mClientDeathRecipient, 0 /* flags */);
+ client.asBinder().unlinkToDeath(cs.mClientDeathRecipient, 0);
clearClientSessionLocked(cs);
clearClientSessionForAccessibilityLocked(cs);
@@ -2264,8 +2259,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
if (mCurClient == cs) {
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */, SoftInputShowHideReason.HIDE_REMOVE_CLIENT);
+ hideCurrentInputLocked(
+ mCurFocusedWindow, 0, null, SoftInputShowHideReason.HIDE_REMOVE_CLIENT);
if (mBoundToMethod) {
mBoundToMethod = false;
IInputMethodInvoker curMethod = getCurMethodLocked();
@@ -2312,8 +2307,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
mCurClient.mSessionRequestedForAccessibility = false;
mCurClient = null;
mCurVirtualDisplayToScreenMatrix = null;
- ImeTracker.get().onFailed(mCurStatsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
- mCurStatsToken = null;
mMenuController.hideInputMethodMenuLocked();
}
@@ -2386,11 +2379,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
navButtonFlags, mCurImeDispatcher);
if (mShowRequested) {
if (DEBUG) Slog.v(TAG, "Attach new input asks to show input");
- // Re-use current statsToken, if it exists.
- final ImeTracker.Token statsToken = mCurStatsToken;
- mCurStatsToken = null;
- showCurrentInputLocked(mCurFocusedWindow, statsToken, getAppShowFlagsLocked(),
- null /* resultReceiver */, SoftInputShowHideReason.ATTACH_NEW_INPUT);
+ showCurrentInputLocked(mCurFocusedWindow, getAppShowFlagsLocked(), null,
+ SoftInputShowHideReason.ATTACH_NEW_INPUT);
}
String curId = getCurIdLocked();
@@ -2509,8 +2499,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
if (mDisplayIdToShowIme == INVALID_DISPLAY) {
mImeHiddenByDisplayPolicy = true;
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_DISPLAY_IME_POLICY_HIDE);
return InputBindResult.NO_IME;
}
@@ -3273,23 +3262,22 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
@Override
- public boolean showSoftInput(IInputMethodClient client, IBinder windowToken,
- @Nullable ImeTracker.Token statsToken, int flags, int lastClickTooType,
- ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
+ public boolean showSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
+ int lastClickTooType, ResultReceiver resultReceiver,
+ @SoftInputShowHideReason int reason) {
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showSoftInput");
int uid = Binder.getCallingUid();
ImeTracing.getInstance().triggerManagerServiceDump(
"InputMethodManagerService#showSoftInput");
synchronized (ImfLock.class) {
- if (!canInteractWithImeLocked(uid, client, "showSoftInput", statsToken)) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
+ if (!canInteractWithImeLocked(uid, client, "showSoftInput")) {
return false;
}
final long ident = Binder.clearCallingIdentity();
try {
if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
- return showCurrentInputLocked(windowToken, statsToken, flags, lastClickTooType,
- resultReceiver, reason);
+ return showCurrentInputLocked(
+ windowToken, flags, lastClickTooType, resultReceiver, reason);
} finally {
Binder.restoreCallingIdentity(ident);
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
@@ -3306,8 +3294,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
"InputMethodManagerService#startStylusHandwriting");
int uid = Binder.getCallingUid();
synchronized (ImfLock.class) {
- if (!canInteractWithImeLocked(uid, client, "startStylusHandwriting",
- null /* statsToken */)) {
+ if (!canInteractWithImeLocked(uid, client, "startStylusHandwriting")) {
return;
}
if (!hasSupportedStylusLocked()) {
@@ -3362,33 +3349,19 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
@GuardedBy("ImfLock.class")
- boolean showCurrentInputLocked(IBinder windowToken, @Nullable ImeTracker.Token statsToken,
- int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
- return showCurrentInputLocked(windowToken, statsToken, flags,
- MotionEvent.TOOL_TYPE_UNKNOWN, resultReceiver, reason);
+ boolean showCurrentInputLocked(IBinder windowToken, int flags,
+ ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
+ return showCurrentInputLocked(
+ windowToken, flags, MotionEvent.TOOL_TYPE_UNKNOWN, resultReceiver, reason);
}
@GuardedBy("ImfLock.class")
- private boolean showCurrentInputLocked(IBinder windowToken,
- @Nullable ImeTracker.Token statsToken, int flags, int lastClickToolType,
+ private boolean showCurrentInputLocked(IBinder windowToken, int flags, int lastClickToolType,
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
- // Create statsToken is none exists.
- if (statsToken == null) {
- String packageName = null;
- if (mCurEditorInfo != null) {
- packageName = mCurEditorInfo.packageName;
- }
- statsToken = new ImeTracker.Token(packageName);
- ImeTracker.get().onRequestShow(statsToken, ImeTracker.ORIGIN_SERVER_START_INPUT,
- reason);
- }
-
mShowRequested = true;
if (mAccessibilityRequestingNoSoftKeyboard || mImeHiddenByDisplayPolicy) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_ACCESSIBILITY);
return false;
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_ACCESSIBILITY);
if ((flags & InputMethodManager.SHOW_FORCED) != 0) {
mShowExplicitlyRequested = true;
@@ -3398,10 +3371,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
if (!mSystemReady) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_SYSTEM_READY);
return false;
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_SYSTEM_READY);
mBindingController.setCurrentMethodVisible();
final IInputMethodInvoker curMethod = getCurMethodLocked();
@@ -3409,9 +3380,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// create a placeholder token for IMS so that IMS cannot inject windows into client app.
Binder showInputToken = new Binder();
mShowRequestWindowMap.put(showInputToken, windowToken);
- ImeTracker.get().onCancelled(mCurStatsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_HAS_IME);
- mCurStatsToken = null;
final int showFlags = getImeShowFlagsLocked();
if (DEBUG) {
Slog.v(TAG, "Calling " + curMethod + ".showSoftInput(" + showInputToken
@@ -3423,34 +3391,23 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
curMethod.updateEditorToolType(lastClickToolType);
}
// TODO(b/192412909): Check if we can always call onShowHideSoftInputRequested() or not.
- if (curMethod.showSoftInput(showInputToken, statsToken, showFlags, resultReceiver)) {
+ if (curMethod.showSoftInput(showInputToken, showFlags, resultReceiver)) {
onShowHideSoftInputRequested(true /* show */, windowToken, reason);
}
mInputShown = true;
return true;
- } else {
- ImeTracker.get().onCancelled(mCurStatsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
- mCurStatsToken = statsToken;
}
return false;
}
@Override
- public boolean hideSoftInput(IInputMethodClient client, IBinder windowToken,
- @Nullable ImeTracker.Token statsToken, int flags, ResultReceiver resultReceiver,
- @SoftInputShowHideReason int reason) {
+ public boolean hideSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
+ ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
int uid = Binder.getCallingUid();
ImeTracing.getInstance().triggerManagerServiceDump(
"InputMethodManagerService#hideSoftInput");
synchronized (ImfLock.class) {
- if (!canInteractWithImeLocked(uid, client, "hideSoftInput", statsToken)) {
- if (mInputShown) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
- } else {
- ImeTracker.get().onCancelled(statsToken,
- ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
- }
+ if (!canInteractWithImeLocked(uid, client, "hideSoftInput")) {
return false;
}
final long ident = Binder.clearCallingIdentity();
@@ -3458,7 +3415,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideSoftInput");
if (DEBUG) Slog.v(TAG, "Client requesting input be hidden");
return InputMethodManagerService.this.hideCurrentInputLocked(windowToken,
- statsToken, flags, resultReceiver, reason);
+ flags, resultReceiver, reason);
} finally {
Binder.restoreCallingIdentity(ident);
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
@@ -3467,32 +3424,17 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
@GuardedBy("ImfLock.class")
- boolean hideCurrentInputLocked(IBinder windowToken, @Nullable ImeTracker.Token statsToken,
- int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
- // Create statsToken is none exists.
- if (statsToken == null) {
- String packageName = null;
- if (mCurEditorInfo != null) {
- packageName = mCurEditorInfo.packageName;
- }
- statsToken = new ImeTracker.Token(packageName);
- ImeTracker.get().onRequestHide(statsToken, ImeTracker.ORIGIN_SERVER_HIDE_INPUT, reason);
- }
-
+ boolean hideCurrentInputLocked(IBinder windowToken, int flags, ResultReceiver resultReceiver,
+ @SoftInputShowHideReason int reason) {
if ((flags & InputMethodManager.HIDE_IMPLICIT_ONLY) != 0
&& (mShowExplicitlyRequested || mShowForced)) {
if (DEBUG) Slog.v(TAG, "Not hiding: explicit show not cancelled by non-explicit hide");
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_HIDE_IMPLICIT);
return false;
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_HIDE_IMPLICIT);
-
if (mShowForced && (flags & InputMethodManager.HIDE_NOT_ALWAYS) != 0) {
if (DEBUG) Slog.v(TAG, "Not hiding: forced show not cancelled by not-always hide");
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_HIDE_NOT_ALWAYS);
return false;
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_HIDE_NOT_ALWAYS);
// There is a chance that IMM#hideSoftInput() is called in a transient state where
// IMMS#InputShown is already updated to be true whereas IMMS#mImeWindowVis is still waiting
@@ -3503,8 +3445,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// IMMS#InputShown indicates that the software keyboard is shown.
// TODO: Clean up, IMMS#mInputShown, IMMS#mImeWindowVis and mShowRequested.
IInputMethodInvoker curMethod = getCurMethodLocked();
- final boolean shouldHideSoftInput = (curMethod != null)
- && (mInputShown || (mImeWindowVis & InputMethodService.IME_ACTIVE) != 0);
+ final boolean shouldHideSoftInput = (curMethod != null) && (mInputShown
+ || (mImeWindowVis & InputMethodService.IME_ACTIVE) != 0);
boolean res;
if (shouldHideSoftInput) {
final Binder hideInputToken = new Binder();
@@ -3513,20 +3455,17 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// delivered to the IME process as an IPC. Hence the inconsistency between
// IMMS#mInputShown and IMMS#mImeWindowVis should be resolved spontaneously in
// the final state.
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_SHOULD_HIDE);
if (DEBUG) {
Slog.v(TAG, "Calling " + curMethod + ".hideSoftInput(0, " + hideInputToken
+ ", " + resultReceiver + ") for reason: "
+ InputMethodDebug.softInputDisplayReasonToString(reason));
}
// TODO(b/192412909): Check if we can always call onShowHideSoftInputRequested() or not.
- if (curMethod.hideSoftInput(hideInputToken, statsToken, 0 /* flags */,
- resultReceiver)) {
+ if (curMethod.hideSoftInput(hideInputToken, 0 /* flags */, resultReceiver)) {
onShowHideSoftInputRequested(false /* show */, windowToken, reason);
}
res = true;
} else {
- ImeTracker.get().onCancelled(statsToken, ImeTracker.PHASE_SERVER_SHOULD_HIDE);
res = false;
}
mBindingController.setCurrentMethodNotVisible();
@@ -3534,9 +3473,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
mShowRequested = false;
mShowExplicitlyRequested = false;
mShowForced = false;
- // Cancel existing statsToken for show IME as we got a hide request.
- ImeTracker.get().onCancelled(mCurStatsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
- mCurStatsToken = null;
return res;
}
@@ -3694,8 +3630,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
Slog.w(TAG, "If you need to impersonate a foreground user/profile from"
+ " a background user, use EditorInfo.targetInputMethodUser with"
+ " INTERACT_ACROSS_USERS_FULL permission.");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */, SoftInputShowHideReason.HIDE_INVALID_USER);
+ hideCurrentInputLocked(
+ mCurFocusedWindow, 0, null, SoftInputShowHideReason.HIDE_INVALID_USER);
return InputBindResult.INVALID_USER;
}
@@ -3751,7 +3687,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
boolean didStart = false;
InputBindResult res = null;
- // We show the IME when the system allows the IME focused target window to restore the
+ // We shows the IME when the system allows the IME focused target window to restore the
// IME visibility (e.g. switching to the app task when last time the IME is visible).
// Note that we don't restore IME visibility for some cases (e.g. when the soft input
// state is ALWAYS_HIDDEN or STATE_HIDDEN with forward navigation).
@@ -3763,7 +3699,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
res = startInputUncheckedLocked(cs, inputContext, remoteAccessibilityInputConnection,
editorInfo, startInputFlags, startInputReason, unverifiedTargetSdkVersion,
imeDispatcher);
- showCurrentInputImplicitLocked(windowToken,
+ showCurrentInputLocked(windowToken, InputMethodManager.SHOW_IMPLICIT, null,
SoftInputShowHideReason.SHOW_RESTORE_IME_VISIBILITY);
return res;
}
@@ -3776,8 +3712,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// be behind any soft input window, so hide the
// soft input window if it is shown.
if (DEBUG) Slog.v(TAG, "Unspecified window will hide input");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */,
- InputMethodManager.HIDE_NOT_ALWAYS, null /* resultReceiver */,
+ hideCurrentInputLocked(
+ mCurFocusedWindow, InputMethodManager.HIDE_NOT_ALWAYS, null,
SoftInputShowHideReason.HIDE_UNSPECIFIED_WINDOW);
// If focused display changed, we should unbind current method
@@ -3806,7 +3742,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
imeDispatcher);
didStart = true;
}
- showCurrentInputImplicitLocked(windowToken,
+ showCurrentInputLocked(
+ windowToken,
+ InputMethodManager.SHOW_IMPLICIT,
+ null,
SoftInputShowHideReason.SHOW_AUTO_EDITOR_FORWARD_NAV);
}
break;
@@ -3819,16 +3758,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
case LayoutParams.SOFT_INPUT_STATE_HIDDEN:
if ((softInputMode & LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
if (DEBUG) Slog.v(TAG, "Window asks to hide input going forward");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_STATE_HIDDEN_FORWARD_NAV);
}
break;
case LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN:
if (!sameWindowFocused) {
if (DEBUG) Slog.v(TAG, "Window asks to hide input");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_ALWAYS_HIDDEN_STATE);
}
break;
@@ -3844,7 +3781,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
imeDispatcher);
didStart = true;
}
- showCurrentInputImplicitLocked(windowToken,
+ showCurrentInputLocked(windowToken, InputMethodManager.SHOW_IMPLICIT, null,
SoftInputShowHideReason.SHOW_STATE_VISIBLE_FORWARD_NAV);
} else {
Slog.e(TAG, "SOFT_INPUT_STATE_VISIBLE is ignored because"
@@ -3865,7 +3802,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
imeDispatcher);
didStart = true;
}
- showCurrentInputImplicitLocked(windowToken,
+ showCurrentInputLocked(windowToken, InputMethodManager.SHOW_IMPLICIT, null,
SoftInputShowHideReason.SHOW_STATE_ALWAYS_VISIBLE);
}
} else {
@@ -3887,8 +3824,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// an editor upon refocusing a window.
if (startInputByWinGainedFocus) {
if (DEBUG) Slog.v(TAG, "Same window without editor will hide input");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */,
- 0 /* flags */, null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_SAME_WINDOW_FOCUSED_WITHOUT_EDITOR);
}
}
@@ -3902,8 +3838,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// 2) SOFT_INPUT_STATE_VISIBLE state without an editor
// 3) SOFT_INPUT_STATE_ALWAYS_VISIBLE state without an editor
if (DEBUG) Slog.v(TAG, "Window without editor will hide input");
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */,
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_WINDOW_GAINED_FOCUS_WITHOUT_EDITOR);
}
res = startInputUncheckedLocked(cs, inputContext,
@@ -3918,15 +3853,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
@GuardedBy("ImfLock.class")
- private void showCurrentInputImplicitLocked(@NonNull IBinder windowToken,
- @SoftInputShowHideReason int reason) {
- showCurrentInputLocked(windowToken, null /* statsToken */, InputMethodManager.SHOW_IMPLICIT,
- null /* resultReceiver */, reason);
- }
-
- @GuardedBy("ImfLock.class")
- private boolean canInteractWithImeLocked(int uid, IInputMethodClient client, String methodName,
- @Nullable ImeTracker.Token statsToken) {
+ private boolean canInteractWithImeLocked(
+ int uid, IInputMethodClient client, String methodName) {
if (mCurClient == null || client == null
|| mCurClient.mClient.asBinder() != client.asBinder()) {
// We need to check if this is the current client with
@@ -3934,16 +3862,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
// be made before input is started in it.
final ClientState cs = mClients.get(client.asBinder());
if (cs == null) {
- ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_SERVER_CLIENT_KNOWN);
throw new IllegalArgumentException("unknown client " + client.asBinder());
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_CLIENT_KNOWN);
if (!isImeClientFocused(mCurFocusedWindow, cs)) {
Slog.w(TAG, String.format("Ignoring %s of uid %d : %s", methodName, uid, client));
return false;
}
}
- ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_SERVER_CLIENT_FOCUSED);
return true;
}
@@ -4296,7 +4221,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
final int curTokenDisplayId;
synchronized (ImfLock.class) {
if (!canInteractWithImeLocked(callingUid, client,
- "getInputMethodWindowVisibleHeight", null /* statsToken */)) {
+ "getInputMethodWindowVisibleHeight")) {
if (!mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.get(callingUid)) {
EventLog.writeEvent(0x534e4554, "204906124", callingUid, "");
mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.put(callingUid, true);
@@ -4519,8 +4444,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
int uid = Binder.getCallingUid();
synchronized (ImfLock.class) {
- if (!canInteractWithImeLocked(uid, client, "addVirtualStylusIdForTestSession",
- null /* statsToken */)) {
+ if (!canInteractWithImeLocked(uid, client, "addVirtualStylusIdForTestSession")) {
return;
}
final long ident = Binder.clearCallingIdentity();
@@ -4547,8 +4471,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
int uid = Binder.getCallingUid();
synchronized (ImfLock.class) {
- if (!canInteractWithImeLocked(uid, client, "setStylusWindowIdleTimeoutForTest",
- null /* statsToken */)) {
+ if (!canInteractWithImeLocked(uid, client, "setStylusWindowIdleTimeoutForTest")) {
return;
}
final long ident = Binder.clearCallingIdentity();
@@ -4733,8 +4656,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
@BinderThread
- private void applyImeVisibility(IBinder token, IBinder windowToken, boolean setVisible,
- @Nullable ImeTracker.Token statsToken) {
+ private void applyImeVisibility(IBinder token, IBinder windowToken, boolean setVisible) {
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.applyImeVisibility");
synchronized (ImfLock.class) {
if (!calledWithValidTokenLocked(token)) {
@@ -4742,22 +4664,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
if (!setVisible) {
if (mCurClient != null) {
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_SERVER_APPLY_IME_VISIBILITY);
-
mWindowManagerInternal.hideIme(
mHideRequestWindowMap.get(windowToken),
- mCurClient.mSelfReportedDisplayId, statsToken);
- } else {
- ImeTracker.get().onFailed(statsToken,
- ImeTracker.PHASE_SERVER_APPLY_IME_VISIBILITY);
+ mCurClient.mSelfReportedDisplayId);
}
} else {
- ImeTracker.get().onProgress(statsToken,
- ImeTracker.PHASE_SERVER_APPLY_IME_VISIBILITY);
// Send to window manager to show IME after IME layout finishes.
- mWindowManagerInternal.showImePostLayout(mShowRequestWindowMap.get(windowToken),
- statsToken);
+ mWindowManagerInternal.showImePostLayout(mShowRequestWindowMap.get(windowToken));
}
}
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
@@ -4824,8 +4737,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
final long ident = Binder.clearCallingIdentity();
try {
- hideCurrentInputLocked(mLastImeTargetWindow, null /* statsToken */, flags,
- null /* resultReceiver */, reason);
+ hideCurrentInputLocked(mLastImeTargetWindow, flags, null, reason);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -4842,8 +4754,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
}
final long ident = Binder.clearCallingIdentity();
try {
- showCurrentInputLocked(mLastImeTargetWindow, null /* statsToken */, flags,
- null /* resultReceiver */,
+ showCurrentInputLocked(mLastImeTargetWindow, flags, null,
SoftInputShowHideReason.SHOW_SOFT_INPUT_FROM_IME);
} finally {
Binder.restoreCallingIdentity(ident);
@@ -4934,8 +4845,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
case MSG_HIDE_CURRENT_INPUT_METHOD:
synchronized (ImfLock.class) {
final @SoftInputShowHideReason int reason = (int) msg.obj;
- hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */, 0 /* flags */,
- null /* resultReceiver */, reason);
+ hideCurrentInputLocked(mCurFocusedWindow, 0, null, reason);
}
return true;
@@ -6422,8 +6332,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
final String nextIme;
final List