Merge changes from topic "revert-20313761-IME tracking - hide-HZXGDCCPOZ"

* changes:
  Revert "Input latency & reliability tracking"
  Revert "Input latency & reliability tracking - hide flow"
This commit is contained in:
Pascal Mütschard
2022-11-10 13:22:35 +00:00
committed by Android (Google) Code Review
44 changed files with 266 additions and 1185 deletions

View File

@@ -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.
*
* <p>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

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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");

View File

@@ -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

View File

@@ -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() {

View File

@@ -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 */);

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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<Token> CREATOR = new Creator<>() {
@Override
public Token createFromParcel(Parcel source) {
IBinder binder = source.readStrongBinder();
String tag = source.readString8();
return new Token(binder, tag);
}
@Override
public Token[] newArray(int size) {
return new Token[size];
}
};
}
/**
* Utilities for mapping phases and origins IntDef values to their names.
*
* Note: This is held in a separate class so that it only gets initialized when actually needed.
*/
class Debug {
private static final Map<Integer, String> sOrigins =
getFieldMapping(ImeTracker.class, "ORIGIN_");
private static final Map<Integer, String> sPhases =
getFieldMapping(ImeTracker.class, "PHASE_");
public static String originToString(int origin) {
return sOrigins.getOrDefault(origin, "ORIGIN_" + origin);
}
public static String phaseToString(int phase) {
return sPhases.getOrDefault(phase, "PHASE_" + phase);
}
private static Map<Integer, String> getFieldMapping(Class<?> cls, String fieldPrefix) {
return Arrays.stream(cls.getDeclaredFields())
.filter(field -> field.getName().startsWith(fieldPrefix))
.collect(Collectors.toMap(Debug::getFieldValue, Field::getName));
}
private static int getFieldValue(Field field) {
try {
return field.getInt(null);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -300,12 +300,11 @@ public interface InputMethod {
* @param showInputToken an opaque {@link android.os.Binder} token to identify which API call
* of {@link InputMethodManager#showSoftInput(View, int)} is associated with
* this callback.
* @param statsToken the token tracking the current IME show request or {@code null} otherwise.
* @hide
*/
@MainThread
default public void showSoftInputWithToken(int flags, ResultReceiver resultReceiver,
IBinder showInputToken, @Nullable ImeTracker.Token statsToken) {
IBinder showInputToken) {
showSoftInput(flags, resultReceiver);
}
@@ -339,12 +338,11 @@ public interface InputMethod {
* @param hideInputToken an opaque {@link android.os.Binder} token to identify which API call
* of {@link InputMethodManager#hideSoftInputFromWindow(IBinder, int)}} is associated
* with this callback.
* @param statsToken the token tracking the current IME hide request or {@code null} otherwise.
* @hide
*/
@MainThread
public void hideSoftInputWithToken(int flags, ResultReceiver resultReceiver,
IBinder hideInputToken, @Nullable ImeTracker.Token statsToken);
IBinder hideInputToken);
/**
* Request that any soft input part of the input method be hidden from the user.
@@ -371,7 +369,7 @@ public interface InputMethod {
/**
* Checks if IME is ready to start stylus handwriting session.
* If yes, {@link #startStylusHandwriting(int, InputChannel, List)} is called.
* If yes, {@link #startStylusHandwriting(InputChannel, List)} is called.
* @param requestId
* @hide
*/

View File

@@ -2001,10 +2001,6 @@ public final class InputMethodManager {
private boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver,
@SoftInputShowHideReason int reason) {
final ImeTracker.Token statsToken = new ImeTracker.Token();
ImeTracker.get().onRequestShow(statsToken, ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT,
reason);
ImeTracing.getInstance().triggerClientDump("InputMethodManager#showSoftInput", this,
null /* icProto */);
// Re-dispatch if there is a context mismatch.
@@ -2016,13 +2012,10 @@ public final class InputMethodManager {
checkFocus();
synchronized (mH) {
if (!hasServedByInputMethodLocked(view)) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
Log.w(TAG, "Ignoring showSoftInput() as view=" + view + " is not served.");
return false;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
// Makes sure to call ImeInsetsSourceConsumer#onShowRequested on the UI thread.
// TODO(b/229426865): call WindowInsetsController#show instead.
mH.executeOrSendMessage(Message.obtain(mH, MSG_ON_SHOW_REQUESTED));
@@ -2031,7 +2024,6 @@ public final class InputMethodManager {
return IInputMethodManagerGlobalInvoker.showSoftInput(
mClient,
view.getWindowToken(),
statsToken,
flags,
mCurRootView.getLastClickToolType(),
resultReceiver,
@@ -2051,28 +2043,19 @@ public final class InputMethodManager {
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499)
public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) {
synchronized (mH) {
final ImeTracker.Token statsToken = new ImeTracker.Token();
ImeTracker.get().onRequestShow(statsToken, ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT,
SoftInputShowHideReason.SHOW_SOFT_INPUT);
Log.w(TAG, "showSoftInputUnchecked() is a hidden method, which will be"
+ " removed soon. If you are using androidx.appcompat.widget.SearchView,"
+ " please update to version 26.0 or newer version.");
if (mCurRootView == null || mCurRootView.getView() == null) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
Log.w(TAG, "No current root view, ignoring showSoftInputUnchecked()");
return;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
// Makes sure to call ImeInsetsSourceConsumer#onShowRequested on the UI thread.
// TODO(b/229426865): call WindowInsetsController#show instead.
mH.executeOrSendMessage(Message.obtain(mH, MSG_ON_SHOW_REQUESTED));
IInputMethodManagerGlobalInvoker.showSoftInput(
mClient,
mCurRootView.getView().getWindowToken(),
statsToken,
flags,
mCurRootView.getLastClickToolType(),
resultReceiver,
@@ -2142,24 +2125,17 @@ public final class InputMethodManager {
private boolean hideSoftInputFromWindow(IBinder windowToken, int flags,
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
final ImeTracker.Token statsToken = new ImeTracker.Token();
ImeTracker.get().onRequestHide(statsToken, ImeTracker.ORIGIN_CLIENT_HIDE_SOFT_INPUT,
reason);
ImeTracing.getInstance().triggerClientDump("InputMethodManager#hideSoftInputFromWindow",
this, null /* icProto */);
checkFocus();
synchronized (mH) {
final View servedView = getServedViewLocked();
if (servedView == null || servedView.getWindowToken() != windowToken) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
return false;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
return IInputMethodManagerGlobalInvoker.hideSoftInput(mClient, windowToken, statsToken,
flags, resultReceiver, reason);
return IInputMethodManagerGlobalInvoker.hideSoftInput(mClient, windowToken, flags,
resultReceiver, reason);
}
}
@@ -2787,23 +2763,14 @@ public final class InputMethodManager {
@UnsupportedAppUsage
void closeCurrentInput() {
final ImeTracker.Token statsToken = new ImeTracker.Token();
ImeTracker.get().onRequestHide(statsToken, ImeTracker.ORIGIN_CLIENT_HIDE_SOFT_INPUT,
SoftInputShowHideReason.HIDE_SOFT_INPUT);
synchronized (mH) {
if (mCurRootView == null || mCurRootView.getView() == null) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
Log.w(TAG, "No current root view, ignoring closeCurrentInput()");
return;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
IInputMethodManagerGlobalInvoker.hideSoftInput(
mClient,
mCurRootView.getView().getWindowToken(),
statsToken,
HIDE_NOT_ALWAYS,
null,
SoftInputShowHideReason.HIDE_SOFT_INPUT);
@@ -2872,24 +2839,15 @@ public final class InputMethodManager {
* @hide
*/
public void notifyImeHidden(IBinder windowToken) {
final ImeTracker.Token statsToken = new ImeTracker.Token();
ImeTracker.get().onRequestHide(statsToken, ImeTracker.ORIGIN_CLIENT_HIDE_SOFT_INPUT,
SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API);
ImeTracing.getInstance().triggerClientDump("InputMethodManager#notifyImeHidden", this,
null /* icProto */);
synchronized (mH) {
if (!isImeSessionAvailableLocked() || mCurRootView == null
|| mCurRootView.getWindowToken() != windowToken) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
return;
if (isImeSessionAvailableLocked() && mCurRootView != null
&& mCurRootView.getWindowToken() == windowToken) {
IInputMethodManagerGlobalInvoker.hideSoftInput(mClient, windowToken, 0 /* flags */,
null /* resultReceiver */,
SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API);
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);
IInputMethodManagerGlobalInvoker.hideSoftInput(mClient, windowToken, statsToken,
0 /* flags */, null /* resultReceiver */,
SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API);
}
}
@@ -4009,7 +3967,7 @@ public final class InputMethodManager {
/**
* As reported by {@link InputBindResult}. This value is determined by
* {@link com.android.internal.R.styleable#InputMethod_suppressesSpellChecker}.
* {@link com.android.internal.R.styleable#InputMethod_suppressesSpellChecking}.
*/
final boolean mIsInputMethodSuppressingSpellChecker;

View File

@@ -21,7 +21,6 @@ import android.os.ResultReceiver;
import android.view.InputChannel;
import android.view.MotionEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputMethodSubtype;
import android.window.ImeOnBackInvokedDispatcher;
@@ -70,11 +69,9 @@ oneway interface IInputMethod {
void setSessionEnabled(IInputMethodSession session, boolean enabled);
void showSoftInput(in IBinder showInputToken, in @nullable ImeTracker.Token statsToken,
int flags, in ResultReceiver resultReceiver);
void showSoftInput(in IBinder showInputToken, int flags, in ResultReceiver resultReceiver);
void hideSoftInput(in IBinder hideInputToken, in @nullable ImeTracker.Token statsToken,
int flags, in ResultReceiver resultReceiver);
void hideSoftInput(in IBinder hideInputToken, int flags, in ResultReceiver resultReceiver);
void updateEditorToolType(int toolType);

View File

@@ -17,7 +17,6 @@
package com.android.internal.inputmethod;
import android.net.Uri;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.infra.AndroidFuture;
@@ -42,8 +41,7 @@ oneway interface IInputMethodPrivilegedOperations {
void switchToNextInputMethod(boolean onlyCurrentIme, in AndroidFuture future /* T=Boolean */);
void shouldOfferSwitchingToNextInputMethod(in AndroidFuture future /* T=Boolean */);
void notifyUserActionAsync();
void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible,
in @nullable ImeTracker.Token statsToken);
void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible);
void onStylusHandwritingReady(int requestId, int pid);
void resetStylusHandwriting(int requestId);
}

View File

@@ -25,7 +25,6 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.annotations.GuardedBy;
@@ -101,7 +100,7 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatusAsync(int, int)}.
* Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatusAsync(int, int}.
*
* @param vis visibility flags
* @param backDisposition disposition flags
@@ -251,7 +250,7 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, int, AndroidFuture)}
* Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)}
*
* @param flags additional operating flags
* @param reason the reason to hide soft input
@@ -317,7 +316,7 @@ public final class InputMethodPrivilegedOperations {
/**
* Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean,
* AndroidFuture)}
* IBooleanResultCallback)}
*
* @param onlyCurrentIme {@code true} to switch to a {@link InputMethodSubtype} within the same
* IME
@@ -376,25 +375,22 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#applyImeVisibilityAsync(IBinder, boolean,
* ImeTracker.Token)}.
* Calls {@link IInputMethodPrivilegedOperations#applyImeVisibilityAsync(IBinder, boolean)}.
*
* @param showOrHideInputToken placeholder token that maps to window requesting
* {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} or
* {@link android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow(IBinder,
* int)}
* {@link android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow
* (IBinder, int)}
* @param setVisible {@code true} to set IME visible, else hidden.
* @param statsToken the token tracking the current IME request or {@code null} otherwise.
*/
@AnyThread
public void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible,
@Nullable ImeTracker.Token statsToken) {
public void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible) {
final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
if (ops == null) {
return;
}
try {
ops.applyImeVisibilityAsync(showOrHideInputToken, setVisible, statsToken);
ops.applyImeVisibilityAsync(showOrHideInputToken, setVisible);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -16,7 +16,6 @@
package com.android.internal.view;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.input.InputManager;
import android.os.Bundle;
@@ -32,7 +31,6 @@ import android.view.InsetsState;
import android.view.PointerIcon;
import android.view.ScrollCaptureResponse;
import android.view.WindowInsets.Type.InsetsType;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import com.android.internal.os.IResultReceiver;
@@ -68,13 +66,11 @@ public class BaseIWindow extends IWindow.Stub {
}
@Override
public void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void showInsets(@InsetsType int types, boolean fromIme) {
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void hideInsets(@InsetsType int types, boolean fromIme) {
}
@Override

View File

@@ -17,7 +17,6 @@
package com.android.internal.view;
import android.os.ResultReceiver;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.EditorInfo;
@@ -55,12 +54,11 @@ interface IInputMethodManager {
+ "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
InputMethodSubtype getLastInputMethodSubtype(int userId);
boolean showSoftInput(in IInputMethodClient client, @nullable IBinder windowToken,
in @nullable ImeTracker.Token statsToken, int flags, int lastClickToolType,
in @nullable ResultReceiver resultReceiver, int reason);
boolean hideSoftInput(in IInputMethodClient client, @nullable IBinder windowToken,
in @nullable ImeTracker.Token statsToken, int flags,
boolean showSoftInput(in IInputMethodClient client, @nullable IBinder windowToken, int flags,
int lastClickToolType, in @nullable ResultReceiver resultReceiver, int reason);
boolean hideSoftInput(in IInputMethodClient client, @nullable IBinder windowToken, int flags,
in @nullable ResultReceiver resultReceiver, int reason);
// If windowToken is null, this just does startInput(). Otherwise this reports that a window
// has gained focus, and if 'editorInfo' is non-null then also does startInput.
// @NonNull

View File

@@ -24,7 +24,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -99,12 +98,12 @@ public class ImeInsetsSourceConsumerTest {
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
// test if setVisibility can show IME
mImeConsumer.onWindowFocusGained(true);
mController.show(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.show(WindowInsets.Type.ime(), true /* fromIme */);
mController.cancelExistingAnimations();
assertTrue((mController.getRequestedVisibleTypes() & WindowInsets.Type.ime()) != 0);
// test if setVisibility can hide IME
mController.hide(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.hide(WindowInsets.Type.ime(), true /* fromIme */);
mController.cancelExistingAnimations();
assertFalse((mController.getRequestedVisibleTypes() & WindowInsets.Type.ime()) != 0);
});
@@ -118,7 +117,7 @@ public class ImeInsetsSourceConsumerTest {
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
// Request IME visible before control is available.
mImeConsumer.onWindowFocusGained(true);
mController.show(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.show(WindowInsets.Type.ime(), true /* fromIme */);
// set control and verify visibility is applied.
InsetsSourceControl control =
@@ -126,11 +125,9 @@ public class ImeInsetsSourceConsumerTest {
mController.onControlsChanged(new InsetsSourceControl[] { control });
// IME show animation should be triggered when control becomes available.
verify(mController).applyAnimation(
eq(WindowInsets.Type.ime()), eq(true) /* show */, eq(true) /* fromIme */,
any() /* statsToken */);
eq(WindowInsets.Type.ime()), eq(true) /* show */, eq(true) /* fromIme */);
verify(mController, never()).applyAnimation(
eq(WindowInsets.Type.ime()), eq(false) /* show */, eq(true) /* fromIme */,
any() /* statsToken */);
eq(WindowInsets.Type.ime()), eq(false) /* show */, eq(true) /* fromIme */);
});
}
@@ -156,8 +153,7 @@ public class ImeInsetsSourceConsumerTest {
mImeConsumer.onWindowFocusGained(hasWindowFocus);
final boolean imeVisible = hasWindowFocus && hasViewFocus;
if (imeVisible) {
mController.show(WindowInsets.Type.ime(), true /* fromIme */,
null /* statsToken */);
mController.show(WindowInsets.Type.ime(), true /* fromIme */);
}
// set control and verify visibility is applied.
@@ -173,21 +169,20 @@ public class ImeInsetsSourceConsumerTest {
verify(control).getAndClearSkipAnimationOnce();
verify(mController).applyAnimation(eq(WindowInsets.Type.ime()),
eq(true) /* show */, eq(false) /* fromIme */,
eq(expectSkipAnim) /* skipAnim */, null /* statsToken */);
eq(expectSkipAnim) /* skipAnim */);
}
// If previously hasViewFocus is false, verify when requesting the IME visible next
// time will not skip animation.
if (!hasViewFocus) {
mController.show(WindowInsets.Type.ime(), true /* fromIme */,
null /* statsToken */);
mController.show(WindowInsets.Type.ime(), true);
mController.onControlsChanged(new InsetsSourceControl[]{ control });
// Verify IME show animation should be triggered when control becomes available and
// the animation will be skipped by getAndClearSkipAnimationOnce invoked.
verify(control).getAndClearSkipAnimationOnce();
verify(mController).applyAnimation(eq(WindowInsets.Type.ime()),
eq(true) /* show */, eq(true) /* fromIme */,
eq(false) /* skipAnim */, null /* statsToken */);
eq(false) /* skipAnim */);
}
});
}

View File

@@ -109,8 +109,7 @@ public class InsetsAnimationControlImplTest {
mController = new InsetsAnimationControlImpl(controls,
new Rect(0, 0, 500, 500), mInsetsState, mMockListener, systemBars(),
mMockController, 10 /* durationMs */, new LinearInterpolator(),
0 /* animationType */, 0 /* layoutInsetsDuringAnimation */, null /* translator */,
null /* statsToken */);
0 /* animationType */, 0 /* layoutInsetsDuringAnimation */, null /* translator */);
mController.setReadyDispatched(true);
}

View File

@@ -248,7 +248,7 @@ public class InsetsControllerTest {
mController.setSystemDrivenInsetsAnimationLoggingListener(loggingListener);
mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained(true);
// since there is no focused view, forcefully make IME visible.
mController.show(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
verify(loggingListener).onReady(notNull(), anyInt());
});
}
@@ -260,14 +260,14 @@ public class InsetsControllerTest {
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained(true);
// since there is no focused view, forcefully make IME visible.
mController.show(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
mController.show(all());
// quickly jump to final state by cancelling it.
mController.cancelExistingAnimations();
final @InsetsType int types = navigationBars() | statusBars() | ime();
assertEquals(types, mController.getRequestedVisibleTypes() & types);
mController.hide(ime(), true /* fromIme */, null /* statsToken */);
mController.hide(ime(), true /* fromIme */);
mController.hide(all());
mController.cancelExistingAnimations();
assertEquals(0, mController.getRequestedVisibleTypes() & types);
@@ -282,10 +282,10 @@ public class InsetsControllerTest {
mController.onControlsChanged(new InsetsSourceControl[] { ime });
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained(true);
mController.show(WindowInsets.Type.ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
mController.cancelExistingAnimations();
assertTrue(isRequestedVisible(mController, ime()));
mController.hide(ime(), true /* fromIme */, null /* statsToken */);
mController.hide(ime(), true /* fromIme */);
mController.cancelExistingAnimations();
assertFalse(isRequestedVisible(mController, ime()));
mController.getSourceConsumer(ITYPE_IME).onWindowFocusLost();
@@ -452,7 +452,7 @@ public class InsetsControllerTest {
assertFalse(mController.getState().getSource(ITYPE_IME).isVisible());
// Pretend IME is calling
mController.show(ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
// Gaining control shortly after
mController.onControlsChanged(createSingletonControl(ITYPE_IME));
@@ -476,7 +476,7 @@ public class InsetsControllerTest {
mController.onControlsChanged(createSingletonControl(ITYPE_IME));
// Pretend IME is calling
mController.show(ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
assertEquals(ANIMATION_TYPE_SHOW, mController.getAnimationType(ime()));
mController.cancelExistingAnimations();
@@ -554,7 +554,7 @@ public class InsetsControllerTest {
verify(listener, never()).onReady(any(), anyInt());
// Pretend that IME is calling.
mController.show(ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true);
// Ready gets deferred until next predraw
mViewRoot.getView().getViewTreeObserver().dispatchOnPreDraw();
@@ -638,7 +638,7 @@ public class InsetsControllerTest {
mController.onControlsChanged(createSingletonControl(ITYPE_IME));
// Pretend IME is calling
mController.show(ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
InsetsState copy = new InsetsState(mController.getState(), true /* copySources */);
copy.getSource(ITYPE_IME).setFrame(0, 1, 2, 3);
@@ -845,7 +845,7 @@ public class InsetsControllerTest {
// Showing invisible ime should only causes insets change once.
clearInvocations(mTestHost);
mController.show(ime(), true /* fromIme */, null /* statsToken */);
mController.show(ime(), true /* fromIme */);
verify(mTestHost, times(1)).notifyInsetsChanged();
// Sending the same insets state should not cause insets change.

View File

@@ -20,7 +20,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.res.Configuration;
import android.graphics.Point;
@@ -39,7 +38,6 @@ import android.view.WindowInsets;
import android.view.WindowInsets.Type.InsetsType;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodManagerGlobal;
import androidx.annotation.VisibleForTesting;
@@ -114,7 +112,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
if (mDisplayController.getDisplayLayout(displayId).rotation()
!= pd.mRotation && isImeShowing(displayId)) {
pd.startAnimation(true, false /* forceRestart */, null /* statsToken */);
pd.startAnimation(true, false /* forceRestart */);
}
}
@@ -246,7 +244,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
mInsetsState.set(insetsState, true /* copySources */);
if (mImeShowing && !newFrame.equals(oldFrame) && newSource.isVisible()) {
if (DEBUG) Slog.d(TAG, "insetsChanged when IME showing, restart animation");
startAnimation(mImeShowing, true /* forceRestart */, null /* statsToken */);
startAnimation(mImeShowing, true /* forceRestart */);
}
}
@@ -282,7 +280,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
!haveSameLeash(mImeSourceControl, imeSourceControl);
if (mAnimation != null) {
if (positionChanged) {
startAnimation(mImeShowing, true /* forceRestart */, null /* statsToken */);
startAnimation(mImeShowing, true /* forceRestart */);
}
} else {
if (leashChanged) {
@@ -314,23 +312,21 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
@Override
public void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void showInsets(int types, boolean fromIme) {
if ((types & WindowInsets.Type.ime()) == 0) {
return;
}
if (DEBUG) Slog.d(TAG, "Got showInsets for ime");
startAnimation(true /* show */, false /* forceRestart */, statsToken);
startAnimation(true /* show */, false /* forceRestart */);
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void hideInsets(int types, boolean fromIme) {
if ((types & WindowInsets.Type.ime()) == 0) {
return;
}
if (DEBUG) Slog.d(TAG, "Got hideInsets for ime");
startAnimation(false /* show */, false /* forceRestart */, statsToken);
startAnimation(false /* show */, false /* forceRestart */);
}
@Override
@@ -371,11 +367,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
.navBarFrameHeight();
}
private void startAnimation(final boolean show, final boolean forceRestart,
@Nullable ImeTracker.Token statsToken) {
private void startAnimation(final boolean show, final boolean forceRestart) {
final InsetsSource imeSource = mInsetsState.getSource(InsetsState.ITYPE_IME);
if (imeSource == null || mImeSourceControl == null) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_WM_ANIMATION_CREATE);
return;
}
final Rect newFrame = imeSource.getFrame();
@@ -396,9 +390,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
+ (mAnimationDirection == DIRECTION_SHOW ? "SHOW"
: (mAnimationDirection == DIRECTION_HIDE ? "HIDE" : "NONE")));
}
if ((!forceRestart && (mAnimationDirection == DIRECTION_SHOW && show))
if (!forceRestart && (mAnimationDirection == DIRECTION_SHOW && show)
|| (mAnimationDirection == DIRECTION_HIDE && !show)) {
ImeTracker.get().onCancelled(statsToken, ImeTracker.PHASE_WM_ANIMATION_CREATE);
return;
}
boolean seek = false;
@@ -442,11 +435,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
mTransactionPool.release(t);
});
mAnimation.setInterpolator(INTERPOLATOR);
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_WM_ANIMATION_CREATE);
mAnimation.addListener(new AnimatorListenerAdapter() {
private boolean mCancelled = false;
@Nullable
private final ImeTracker.Token mStatsToken = statsToken;
@Override
public void onAnimationStart(Animator animation) {
@@ -465,8 +455,6 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
: 1.f;
t.setAlpha(mImeSourceControl.getLeash(), alpha);
if (mAnimationDirection == DIRECTION_SHOW) {
ImeTracker.get().onProgress(mStatsToken,
ImeTracker.PHASE_WM_ANIMATION_RUNNING);
t.show(mImeSourceControl.getLeash());
}
t.apply();
@@ -488,16 +476,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
dispatchEndPositioning(mDisplayId, mCancelled, t);
if (mAnimationDirection == DIRECTION_HIDE && !mCancelled) {
ImeTracker.get().onProgress(mStatsToken,
ImeTracker.PHASE_WM_ANIMATION_RUNNING);
t.hide(mImeSourceControl.getLeash());
removeImeSurface();
ImeTracker.get().onHidden(mStatsToken);
} else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
ImeTracker.get().onShown(mStatsToken);
} else if (mCancelled) {
ImeTracker.get().onCancelled(mStatsToken,
ImeTracker.PHASE_WM_ANIMATION_RUNNING);
}
t.apply();
mTransactionPool.release(t);

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.common;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.os.RemoteException;
import android.util.Slog;
@@ -26,7 +25,6 @@ import android.view.IWindowManager;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.WindowInsets.Type.InsetsType;
import android.view.inputmethod.ImeTracker;
import androidx.annotation.BinderThread;
@@ -158,29 +156,23 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
}
}
private void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
private void showInsets(int types, boolean fromIme) {
CopyOnWriteArrayList<OnInsetsChangedListener> listeners = mListeners.get(mDisplayId);
if (listeners == null) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROLLER);
return;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROLLER);
for (OnInsetsChangedListener listener : listeners) {
listener.showInsets(types, fromIme, statsToken);
listener.showInsets(types, fromIme);
}
}
private void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
private void hideInsets(int types, boolean fromIme) {
CopyOnWriteArrayList<OnInsetsChangedListener> listeners = mListeners.get(mDisplayId);
if (listeners == null) {
ImeTracker.get().onFailed(statsToken, ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROLLER);
return;
}
ImeTracker.get().onProgress(statsToken, ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROLLER);
for (OnInsetsChangedListener listener : listeners) {
listener.hideInsets(types, fromIme, statsToken);
listener.hideInsets(types, fromIme);
}
}
@@ -222,18 +214,16 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
}
@Override
public void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) throws RemoteException {
public void showInsets(int types, boolean fromIme) throws RemoteException {
mMainExecutor.execute(() -> {
PerDisplay.this.showInsets(types, fromIme, statsToken);
PerDisplay.this.showInsets(types, fromIme);
});
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) throws RemoteException {
public void hideInsets(int types, boolean fromIme) throws RemoteException {
mMainExecutor.execute(() -> {
PerDisplay.this.hideInsets(types, fromIme, statsToken);
PerDisplay.this.hideInsets(types, fromIme);
});
}
}
@@ -273,21 +263,15 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
*
* @param types {@link 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.
*/
default void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {}
default void showInsets(@InsetsType int types, boolean fromIme) {}
/**
* Called when a set of insets source window should be hidden by policy.
*
* @param types {@link 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.
*/
default void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {}
default void hideInsets(@InsetsType int types, boolean fromIme) {}
}
}

View File

@@ -19,7 +19,6 @@ package com.android.wm.shell.common;
import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Region;
@@ -47,7 +46,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.WindowlessWindowManager;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import com.android.internal.os.IResultReceiver;
@@ -353,10 +351,10 @@ public class SystemWindows {
InsetsSourceControl[] activeControls) {}
@Override
public void showInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken) {}
public void showInsets(int types, boolean fromIme) {}
@Override
public void hideInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken) {}
public void hideInsets(int types, boolean fromIme) {}
@Override
public void moved(int newX, int newY) {}

View File

@@ -97,13 +97,13 @@ public class DisplayImeControllerTest extends ShellTestCase {
@Test
public void showInsets_schedulesNoWorkOnExecutor() {
mPerDisplay.showInsets(ime(), true /* fromIme */, null /* statsToken */);
mPerDisplay.showInsets(ime(), true);
verifyZeroInteractions(mExecutor);
}
@Test
public void hideInsets_schedulesNoWorkOnExecutor() {
mPerDisplay.hideInsets(ime(), true /* fromIme */, null /* statsToken */);
mPerDisplay.hideInsets(ime(), true);
verifyZeroInteractions(mExecutor);
}

View File

@@ -25,7 +25,6 @@ import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.os.RemoteException;
import android.util.SparseArray;
@@ -34,7 +33,6 @@ import android.view.IWindowManager;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.WindowInsets;
import android.view.inputmethod.ImeTracker;
import androidx.test.filters.SmallTest;
@@ -113,10 +111,8 @@ public class DisplayInsetsControllerTest extends ShellTestCase {
WindowInsets.Type.defaultVisible());
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsChanged(null);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsControlChanged(null, null);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).showInsets(0, false,
null /* statsToken */);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).hideInsets(0, false,
null /* statsToken */);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).showInsets(0, false);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).hideInsets(0, false);
mExecutor.flushAll();
assertTrue(defaultListener.topFocusedWindowChangedCount == 1);
@@ -135,10 +131,8 @@ public class DisplayInsetsControllerTest extends ShellTestCase {
WindowInsets.Type.defaultVisible());
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsChanged(null);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsControlChanged(null, null);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).showInsets(0, false,
null /* statsToken */);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).hideInsets(0, false,
null /* statsToken */);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).showInsets(0, false);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).hideInsets(0, false);
mExecutor.flushAll();
assertTrue(defaultListener.topFocusedWindowChangedCount == 1);
@@ -197,12 +191,12 @@ public class DisplayInsetsControllerTest extends ShellTestCase {
}
@Override
public void showInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken) {
public void showInsets(int types, boolean fromIme) {
showInsetsCount++;
}
@Override
public void hideInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken) {
public void hideInsets(int types, boolean fromIme) {
hideInsetsCount++;
}
}

View File

@@ -28,7 +28,6 @@ import android.util.Slog;
import android.view.InputChannel;
import android.view.MotionEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputMethodSubtype;
import android.window.ImeOnBackInvokedDispatcher;
@@ -199,10 +198,9 @@ final class IInputMethodInvoker {
// TODO(b/192412909): Convert this back to void method
@AnyThread
boolean showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken, int flags,
ResultReceiver resultReceiver) {
boolean showSoftInput(IBinder showInputToken, int flags, ResultReceiver resultReceiver) {
try {
mTarget.showSoftInput(showInputToken, statsToken, flags, resultReceiver);
mTarget.showSoftInput(showInputToken, flags, resultReceiver);
} catch (RemoteException e) {
logRemoteException(e);
return false;
@@ -212,10 +210,9 @@ final class IInputMethodInvoker {
// TODO(b/192412909): Convert this back to void method
@AnyThread
boolean hideSoftInput(IBinder hideInputToken, @Nullable ImeTracker.Token statsToken, int flags,
ResultReceiver resultReceiver) {
boolean hideSoftInput(IBinder hideInputToken, int flags, ResultReceiver resultReceiver) {
try {
mTarget.hideSoftInput(hideInputToken, statsToken, flags, resultReceiver);
mTarget.hideSoftInput(hideInputToken, flags, resultReceiver);
} catch (RemoteException e) {
logRemoteException(e);
return false;

View File

@@ -129,7 +129,6 @@ import android.view.WindowManager.DisplayImePolicy;
import android.view.WindowManager.LayoutParams;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethod;
@@ -152,7 +151,6 @@ import com.android.internal.inputmethod.DirectBootAwareness;
import com.android.internal.inputmethod.IAccessibilityInputMethodSession;
import com.android.internal.inputmethod.IInlineSuggestionsRequestCallback;
import com.android.internal.inputmethod.IInputContentUriToken;
import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.IInputMethodClient;
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
import com.android.internal.inputmethod.IInputMethodSession;
@@ -643,10 +641,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
*/
private boolean mInputShown;
/** The token tracking the current IME request or {@code null} otherwise. */
@Nullable
private ImeTracker.Token mCurStatsToken;
/**
* {@code true} if the current input method is in fullscreen mode.
*/
@@ -766,7 +760,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
* <dd>
* If this bit is ON, some of IME view, e.g. software input, candidate view, is visible.
* </dd>
* <dt>{@link InputMethodService#IME_INVISIBLE}</dt>
* dt>{@link InputMethodService#IME_INVISIBLE}</dt>
* <dd> If this bit is ON, IME is ready with views from last EditorInfo but is
* currently invisible.
* </dd>
@@ -790,7 +784,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
/**
* Internal state snapshot when
* {@link IInputMethod#startInput(IInputMethod.StartInputParams)} is about to be called.
* {@link com.android.internal.view.IInputMethod#startInput(IBinder, IRemoteInputConnection, EditorInfo,
* boolean)} is about to be called.
*
* <p>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<InputMethodInfo> nextEnabledImes;
if (userId == mSettings.getCurrentUserId()) {
hideCurrentInputLocked(mCurFocusedWindow, null /* statsToken */,
0 /* flags */, null /* resultReceiver */,
hideCurrentInputLocked(mCurFocusedWindow, 0, null,
SoftInputShowHideReason.HIDE_RESET_SHELL_COMMAND);
mBindingController.unbindCurrentMethod();
// Reset the current IME
@@ -6688,9 +6597,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
@BinderThread
@Override
public void applyImeVisibilityAsync(IBinder windowToken, boolean setVisible,
@Nullable ImeTracker.Token statsToken) {
mImms.applyImeVisibility(mToken, windowToken, setVisible, statsToken);
public void applyImeVisibilityAsync(IBinder windowToken, boolean setVisible) {
mImms.applyImeVisibility(mToken, windowToken, setVisible);
}
@BinderThread

View File

@@ -230,7 +230,6 @@ import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowManager;
import android.view.WindowManager.DisplayImePolicy;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import android.view.inputmethod.ImeTracker;
import android.window.DisplayWindowPolicyController;
import android.window.IDisplayAreaOrganizer;
import android.window.ScreenCapture;
@@ -455,7 +454,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
/**
* Compat metrics computed based on {@link #mDisplayMetrics}.
* @see #updateDisplayAndOrientation(Configuration)
* @see #updateDisplayAndOrientation(int, Configuration)
*/
private final DisplayMetrics mCompatDisplayMetrics = new DisplayMetrics();
@@ -5032,7 +5031,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
* layer has been assigned since), to facilitate assigning the layer from the IME target, or
* fall back if there is no target.
* - the container doesn't always participate in window traversal, according to
* {@link #skipImeWindowsDuringTraversal(DisplayContent)}
* {@link #skipImeWindowsDuringTraversal()}
*/
private static class ImeContainer extends DisplayArea.Tokens {
boolean mNeedsLayer = false;
@@ -6713,35 +6712,25 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
mRemoteInsetsController.insetsControlChanged(stateController.getRawInsetsState(),
stateController.getControlsForDispatch(this));
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver inset control state change", e);
Slog.w(TAG, "Failed to deliver inset state change", e);
}
}
@Override
public void showInsets(@WindowInsets.Type.InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void showInsets(@WindowInsets.Type.InsetsType int types, boolean fromIme) {
try {
ImeTracker.get().onProgress(statsToken,
ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_SHOW_INSETS);
mRemoteInsetsController.showInsets(types, fromIme, statsToken);
mRemoteInsetsController.showInsets(types, fromIme);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver showInsets", e);
ImeTracker.get().onFailed(statsToken,
ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_SHOW_INSETS);
}
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void hideInsets(@InsetsType int types, boolean fromIme) {
try {
ImeTracker.get().onProgress(statsToken,
ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_HIDE_INSETS);
mRemoteInsetsController.hideInsets(types, fromIme, statsToken);
mRemoteInsetsController.hideInsets(types, fromIme);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver hideInsets", e);
ImeTracker.get().onFailed(statsToken,
ImeTracker.PHASE_WM_REMOTE_INSETS_CONTROL_TARGET_HIDE_INSETS);
Slog.w(TAG, "Failed to deliver showInsets", e);
}
}

View File

@@ -2049,8 +2049,7 @@ public class DisplayPolicy {
// Don't show status bar when swiping on already visible navigation bar.
// But restore the position of navigation bar if it has been moved by the control
// target.
controlTarget.showInsets(Type.navigationBars(), false /* fromIme */,
null /* statsToken */);
controlTarget.showInsets(Type.navigationBars(), false);
return;
}
@@ -2058,12 +2057,10 @@ public class DisplayPolicy {
// Show transient bars if they are hidden; restore position if they are visible.
mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_SWIPE,
isGestureOnSystemBar);
controlTarget.showInsets(restorePositionTypes, false /* fromIme */,
null /* statsToken */);
controlTarget.showInsets(restorePositionTypes, false);
} else {
// Restore visibilities and positions of system bars.
controlTarget.showInsets(Type.statusBars() | Type.navigationBars(),
false /* fromIme */, null /* statsToken */);
controlTarget.showInsets(Type.statusBars() | Type.navigationBars(), false);
// To further allow the pull-down-from-the-top gesture to pull down the notification
// shade as a consistent motion, we reroute the touch events here from the currently
// touched window to the status bar after making it visible.

View File

@@ -33,11 +33,9 @@ import android.graphics.Rect;
import android.os.Trace;
import android.util.proto.ProtoOutputStream;
import android.view.InsetsSource;
import android.view.InsetsSourceConsumer;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.WindowInsets;
import android.view.inputmethod.ImeTracker;
import android.window.TaskSnapshot;
import com.android.internal.annotations.VisibleForTesting;
@@ -51,9 +49,6 @@ import java.io.PrintWriter;
*/
final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider {
/** The token tracking the current IME request or {@code null} otherwise. */
@Nullable
private ImeTracker.Token mImeRequesterStatsToken;
private InsetsControlTarget mImeRequester;
private Runnable mShowImeRunner;
private boolean mIsImeLayoutDrawn;
@@ -167,20 +162,14 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider
}
/**
* Called from {@link WindowManagerInternal#showImePostLayout}
* when {@link android.inputmethodservice.InputMethodService} requests to show IME
* on {@param imeTarget}.
* Called from {@link WindowManagerInternal#showImePostLayout} when {@link InputMethodService}
* requests to show IME on {@param imeTarget}.
*
* @param imeTarget imeTarget on which IME show request is coming from.
* @param statsToken the token tracking the current IME show request or {@code null} otherwise.
* @param imeTarget imeTarget on which IME request is coming from.
*/
void scheduleShowImePostLayout(InsetsControlTarget imeTarget,
@Nullable ImeTracker.Token statsToken) {
void scheduleShowImePostLayout(InsetsControlTarget imeTarget) {
boolean targetChanged = isTargetChangedWithinActivity(imeTarget);
mImeRequester = imeTarget;
// There was still a stats token, so that request presumably failed.
ImeTracker.get().onFailed(mImeRequesterStatsToken, ImeTracker.PHASE_WM_SHOW_IME_RUNNER);
mImeRequesterStatsToken = statsToken;
if (targetChanged) {
// target changed, check if new target can show IME.
ProtoLog.d(WM_DEBUG_IME, "IME target changed within ActivityRecord");
@@ -194,20 +183,15 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider
ProtoLog.d(WM_DEBUG_IME, "Schedule IME show for %s", mImeRequester.getWindow() == null
? mImeRequester : mImeRequester.getWindow().getName());
mShowImeRunner = () -> {
ImeTracker.get().onProgress(mImeRequesterStatsToken,
ImeTracker.PHASE_WM_SHOW_IME_RUNNER);
ProtoLog.d(WM_DEBUG_IME, "Run showImeRunner");
// Target should still be the same.
if (isReadyToShowIme()) {
ImeTracker.get().onProgress(mImeRequesterStatsToken,
ImeTracker.PHASE_WM_SHOW_IME_READY);
final InsetsControlTarget target = mDisplayContent.getImeTarget(IME_TARGET_CONTROL);
ProtoLog.i(WM_DEBUG_IME, "call showInsets(ime) on %s",
target.getWindow() != null ? target.getWindow().getName() : "");
setImeShowing(true);
target.showInsets(WindowInsets.Type.ime(), true /* fromIme */,
mImeRequesterStatsToken);
target.showInsets(WindowInsets.Type.ime(), true /* fromIme */);
Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, "WMS.showImePostLayout", 0);
if (target != mImeRequester && mImeRequester != null) {
ProtoLog.w(WM_DEBUG_IME,
@@ -215,12 +199,7 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider
(mImeRequester.getWindow() != null
? mImeRequester.getWindow().getName() : ""));
}
} else {
ImeTracker.get().onFailed(mImeRequesterStatsToken,
ImeTracker.PHASE_WM_SHOW_IME_READY);
}
// Clear token here so we don't report an error in abortShowImePostLayout().
mImeRequesterStatsToken = null;
abortShowImePostLayout();
};
mDisplayContent.mWmService.requestTraversal();
@@ -255,8 +234,6 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider
mImeRequester = null;
mIsImeLayoutDrawn = false;
mShowImeRunner = null;
ImeTracker.get().onCancelled(mImeRequesterStatsToken, ImeTracker.PHASE_WM_SHOW_IME_RUNNER);
mImeRequesterStatsToken = null;
}
@VisibleForTesting

View File

@@ -16,11 +16,9 @@
package com.android.server.wm;
import android.annotation.Nullable;
import android.inputmethodservice.InputMethodService;
import android.view.WindowInsets;
import android.view.WindowInsets.Type.InsetsType;
import android.view.inputmethod.ImeTracker;
/**
* Generalization of an object that can control insets state.
@@ -59,10 +57,8 @@ interface InsetsControlTarget {
*
* @param types to specify which types of insets source window should be shown.
* @param fromIme {@code true} if IME show request originated from {@link InputMethodService}.
* @param statsToken the token tracking the current IME show request or {@code null} otherwise.
*/
default void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
default void showInsets(@InsetsType int types, boolean fromIme) {
}
/**
@@ -70,10 +66,8 @@ interface InsetsControlTarget {
*
* @param types to specify which types of insets source window should be hidden.
* @param fromIme {@code true} if IME hide request originated from {@link InputMethodService}.
* @param statsToken the token tracking the current IME hide request or {@code null} otherwise.
*/
default void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
default void hideInsets(@InsetsType int types, boolean fromIme) {
}
/**

View File

@@ -799,7 +799,7 @@ class InsetsPolicy {
show ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE, show
? LAYOUT_INSETS_DURING_ANIMATION_SHOWN
: LAYOUT_INSETS_DURING_ANIMATION_HIDDEN,
null /* translator */, null /* statsToken */);
null /* translator */);
SurfaceAnimationThread.getHandler().post(
() -> mListener.onReady(mAnimationControl, typesReady));
}

View File

@@ -43,7 +43,6 @@ import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.WindowInfo;
import android.view.WindowManager.DisplayImePolicy;
import android.view.inputmethod.ImeTracker;
import com.android.internal.policy.KeyInterceptionInfo;
import com.android.server.input.InputManagerService;
@@ -730,20 +729,16 @@ public abstract class WindowManagerInternal {
* Show IME on imeTargetWindow once IME has finished layout.
*
* @param imeTargetWindowToken token of the (IME target) window on which IME should be shown.
* @param statsToken the token tracking the current IME show request or {@code null} otherwise.
*/
public abstract void showImePostLayout(IBinder imeTargetWindowToken,
@Nullable ImeTracker.Token statsToken);
public abstract void showImePostLayout(IBinder imeTargetWindowToken);
/**
* Hide IME using imeTargetWindow when requested.
*
* @param imeTargetWindowToken token of the (IME target) window on which IME should be hidden.
* @param displayId the id of the display the IME is on.
* @param statsToken the token tracking the current IME hide request or {@code null} otherwise.
*/
public abstract void hideIme(IBinder imeTargetWindowToken, int displayId,
@Nullable ImeTracker.Token statsToken);
public abstract void hideIme(IBinder imeTargetWindowToken, int displayId);
/**
* Tell window manager about a package that should be running with a restricted range of

View File

@@ -292,7 +292,6 @@ import android.view.WindowManagerGlobal;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import android.view.displayhash.DisplayHash;
import android.view.displayhash.VerifiedDisplayHash;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import android.window.ITaskFpsCallback;
import android.window.ScreenCapture;
@@ -8015,8 +8014,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
@Override
public void showImePostLayout(IBinder imeTargetWindowToken,
@Nullable ImeTracker.Token statsToken) {
public void showImePostLayout(IBinder imeTargetWindowToken) {
synchronized (mGlobalLock) {
InputTarget imeTarget = getInputTargetFromWindowTokenLocked(imeTargetWindowToken);
if (imeTarget == null) {
@@ -8025,18 +8023,17 @@ public class WindowManagerService extends IWindowManager.Stub
Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, "WMS.showImePostLayout", 0);
final InsetsControlTarget controlTarget = imeTarget.getImeControlTarget();
imeTarget = controlTarget.getWindow();
// If InsetsControlTarget doesn't have a window, it's using remoteControlTarget
// which is controlled by default display
// If InsetsControlTarget doesn't have a window, its using remoteControlTarget which
// is controlled by default display
final DisplayContent dc = imeTarget != null
? imeTarget.getDisplayContent() : getDefaultDisplayContentLocked();
dc.getInsetsStateController().getImeSourceProvider()
.scheduleShowImePostLayout(controlTarget, statsToken);
.scheduleShowImePostLayout(controlTarget);
}
}
@Override
public void hideIme(IBinder imeTargetWindowToken, int displayId,
@Nullable ImeTracker.Token statsToken) {
public void hideIme(IBinder imeTargetWindowToken, int displayId) {
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "WMS.hideIme");
synchronized (mGlobalLock) {
WindowState imeTarget = mWindowMap.get(imeTargetWindowToken);
@@ -8052,15 +8049,10 @@ public class WindowManagerService extends IWindowManager.Stub
dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
}
if (dc != null && dc.getImeTarget(IME_TARGET_CONTROL) != null) {
ImeTracker.get().onProgress(statsToken,
ImeTracker.PHASE_WM_HAS_IME_INSETS_CONTROL_TARGET);
ProtoLog.d(WM_DEBUG_IME, "hideIme Control target: %s ",
dc.getImeTarget(IME_TARGET_CONTROL));
dc.getImeTarget(IME_TARGET_CONTROL).hideInsets(WindowInsets.Type.ime(),
true /* fromIme */, statsToken);
} else {
ImeTracker.get().onFailed(statsToken,
ImeTracker.PHASE_WM_HAS_IME_INSETS_CONTROL_TARGET);
dc.getImeTarget(IME_TARGET_CONTROL).hideInsets(
WindowInsets.Type.ime(), true /* fromIme */);
}
if (dc != null) {
dc.getInsetsStateController().getImeSourceProvider().setImeShowing(false);

View File

@@ -249,7 +249,6 @@ import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import android.window.OnBackInvokedCallbackInfo;
@@ -4016,7 +4015,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mClient.insetsControlChanged(getCompatInsetsState(),
stateController.getControlsForDispatch(this));
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver inset control state change to w=" + this, e);
Slog.w(TAG, "Failed to deliver inset state change to w=" + this, e);
}
}
@@ -4026,30 +4025,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
@Override
public void showInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void showInsets(@InsetsType int types, boolean fromIme) {
try {
ImeTracker.get().onProgress(statsToken,
ImeTracker.PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_SHOW_INSETS);
mClient.showInsets(types, fromIme, statsToken);
mClient.showInsets(types, fromIme);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver showInsets", e);
ImeTracker.get().onFailed(statsToken,
ImeTracker.PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_SHOW_INSETS);
}
}
@Override
public void hideInsets(@InsetsType int types, boolean fromIme,
@Nullable ImeTracker.Token statsToken) {
public void hideInsets(@InsetsType int types, boolean fromIme) {
try {
ImeTracker.get().onProgress(statsToken,
ImeTracker.PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_HIDE_INSETS);
mClient.hideInsets(types, fromIme, statsToken);
mClient.hideInsets(types, fromIme);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver hideInsets", e);
ImeTracker.get().onFailed(statsToken,
ImeTracker.PHASE_WM_WINDOW_INSETS_CONTROL_TARGET_HIDE_INSETS);
Slog.w(TAG, "Failed to deliver showInsets", e);
}
}

View File

@@ -244,7 +244,7 @@ public class InputMethodManagerServiceTestBase {
.setCurrentMethodVisible();
}
verify(mMockInputMethod, times(showSoftInput ? 1 : 0))
.showSoftInput(any(), any(), anyInt(), any());
.showSoftInput(any(), anyInt(), any());
}
protected void verifyHideSoftInput(boolean setNotVisible, boolean hideSoftInput)
@@ -254,6 +254,6 @@ public class InputMethodManagerServiceTestBase {
.setCurrentMethodNotVisible();
}
verify(mMockInputMethod, times(hideSoftInput ? 1 : 0))
.hideSoftInput(any(), any(), anyInt(), any());
.hideSoftInput(any(), anyInt(), any());
}
}

View File

@@ -45,7 +45,6 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
@@ -376,10 +375,10 @@ public class DisplayPolicyTests extends WindowTestsBase {
displayPolicy.setCanSystemBarsBeShownByUser(false);
displayPolicy.requestTransientBars(windowState, true);
verify(controlTarget, never()).showInsets(anyInt(), anyBoolean(), any() /* statsToken */);
verify(controlTarget, never()).showInsets(anyInt(), anyBoolean());
displayPolicy.setCanSystemBarsBeShownByUser(true);
displayPolicy.requestTransientBars(windowState, true);
verify(controlTarget).showInsets(anyInt(), anyBoolean(), any() /* statsToken */);
verify(controlTarget).showInsets(anyInt(), anyBoolean());
}
}

View File

@@ -55,7 +55,7 @@ public class ImeInsetsSourceProviderTest extends WindowTestsBase {
mDisplayContent.setImeControlTarget(popup);
mDisplayContent.setImeLayeringTarget(appWin);
popup.mAttrs.format = PixelFormat.TRANSPARENT;
mImeProvider.scheduleShowImePostLayout(appWin, null /* statsToken */);
mImeProvider.scheduleShowImePostLayout(appWin);
assertTrue(mImeProvider.isReadyToShowIme());
}
@@ -64,7 +64,7 @@ public class ImeInsetsSourceProviderTest extends WindowTestsBase {
WindowState target = createWindow(null, TYPE_APPLICATION, "app");
mDisplayContent.setImeLayeringTarget(target);
mDisplayContent.updateImeInputAndControlTarget(target);
mImeProvider.scheduleShowImePostLayout(target, null /* statsToken */);
mImeProvider.scheduleShowImePostLayout(target);
assertTrue(mImeProvider.isReadyToShowIme());
}
@@ -78,7 +78,7 @@ public class ImeInsetsSourceProviderTest extends WindowTestsBase {
mDisplayContent.setImeLayeringTarget(target);
mDisplayContent.setImeControlTarget(target);
mImeProvider.scheduleShowImePostLayout(target, null /* statsToken */);
mImeProvider.scheduleShowImePostLayout(target);
assertFalse(mImeProvider.isImeShowing());
mImeProvider.checkShowImePostLayout();
assertTrue(mImeProvider.isImeShowing());

View File

@@ -16,7 +16,6 @@
package com.android.server.wm;
import android.annotation.Nullable;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -27,7 +26,6 @@ import android.view.IWindow;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.ScrollCaptureResponse;
import android.view.inputmethod.ImeTracker;
import android.window.ClientWindowFrames;
import com.android.internal.os.IResultReceiver;
@@ -119,12 +117,10 @@ public class TestIWindow extends IWindow.Stub {
}
@Override
public void showInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken)
throws RemoteException {
public void showInsets(int types, boolean fromIme) throws RemoteException {
}
@Override
public void hideInsets(int types, boolean fromIme, @Nullable ImeTracker.Token statsToken)
throws RemoteException {
public void hideInsets(int types, boolean fromIme) throws RemoteException {
}
}

View File

@@ -1000,7 +1000,7 @@ public class WindowStateTests extends WindowTestsBase {
mDisplayContent.setImeLayeringTarget(app);
mDisplayContent.setImeInputTarget(app);
assertTrue(mDisplayContent.shouldImeAttachedToApp());
controller.getImeSourceProvider().scheduleShowImePostLayout(app, null /* statsToken */);
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
controller.getImeSourceProvider().getSource().setVisible(true);
controller.updateAboveInsetsState(false);
@@ -1037,7 +1037,7 @@ public class WindowStateTests extends WindowTestsBase {
mDisplayContent.setImeLayeringTarget(app);
mDisplayContent.setImeInputTarget(app);
assertTrue(mDisplayContent.shouldImeAttachedToApp());
controller.getImeSourceProvider().scheduleShowImePostLayout(app, null /* statsToken */);
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
controller.getImeSourceProvider().getSource().setVisible(true);
controller.updateAboveInsetsState(false);

View File

@@ -100,7 +100,6 @@ import android.view.SurfaceControl.Transaction;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager.DisplayImePolicy;
import android.view.inputmethod.ImeTracker;
import android.window.ITransitionPlayer;
import android.window.ScreenCapture;
import android.window.StartingWindowInfo;
@@ -849,13 +848,11 @@ class WindowTestsBase extends SystemServiceTestsBase {
}
@Override
public void showInsets(int i, boolean b, @Nullable ImeTracker.Token t)
throws RemoteException {
public void showInsets(int i, boolean b) throws RemoteException {
}
@Override
public void hideInsets(int i, boolean b, @Nullable ImeTracker.Token t)
throws RemoteException {
public void hideInsets(int i, boolean b) throws RemoteException {
}
@Override