Remove preRender input

Cleanup unused pre-render input. We've no plans to enable it.
It adds unnecessary complexity.

Bug: 159201509
Bug: 167948123
Bug: 118599175

Test: atest CtsInputMethodTestCases

Change-Id: I32fe3759b9aeb56c868f9abf42bab124b9b83374
This commit is contained in:
Taran Singh
2020-10-27 16:04:39 -07:00
parent 6a6ce5e698
commit 72de8ead9e
13 changed files with 23 additions and 365 deletions

View File

@@ -213,8 +213,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
ic,
info,
moreArgs.argi1 == 1 /* restarting */,
startInputToken,
moreArgs.argi2 == 1 /* shouldPreRenderIme */);
startInputToken);
args.recycle();
moreArgs.recycle();
return;
@@ -340,14 +339,13 @@ class IInputMethodWrapper extends IInputMethod.Stub
@Override
public void startInput(IBinder startInputToken, IInputContext inputContext,
@InputConnectionInspector.MissingMethodFlags final int missingMethods,
EditorInfo attribute, boolean restarting, boolean shouldPreRenderIme) {
EditorInfo attribute, boolean restarting) {
if (mCancellationGroup == null) {
Log.e(TAG, "startInput must be called after bindInput.");
mCancellationGroup = new CancellationGroup();
}
SomeArgs args = SomeArgs.obtain();
args.argi1 = restarting ? 1 : 0;
args.argi2 = shouldPreRenderIme ? 1 : 0;
args.argi3 = missingMethods;
mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOO(DO_START_INPUT, startInputToken,
inputContext, attribute, mCancellationGroup, args));

View File

@@ -19,7 +19,6 @@ package android.inputmethodservice;
import static android.graphics.Color.TRANSPARENT;
import static android.inputmethodservice.InputMethodServiceProto.CANDIDATES_VIEW_STARTED;
import static android.inputmethodservice.InputMethodServiceProto.CANDIDATES_VISIBILITY;
import static android.inputmethodservice.InputMethodServiceProto.CAN_PRE_RENDER;
import static android.inputmethodservice.InputMethodServiceProto.CONFIGURATION;
import static android.inputmethodservice.InputMethodServiceProto.DECOR_VIEW_VISIBLE;
import static android.inputmethodservice.InputMethodServiceProto.DECOR_VIEW_WAS_VISIBLE;
@@ -33,7 +32,6 @@ import static android.inputmethodservice.InputMethodServiceProto.INPUT_VIEW_STAR
import static android.inputmethodservice.InputMethodServiceProto.IN_SHOW_WINDOW;
import static android.inputmethodservice.InputMethodServiceProto.IS_FULLSCREEN;
import static android.inputmethodservice.InputMethodServiceProto.IS_INPUT_VIEW_SHOWN;
import static android.inputmethodservice.InputMethodServiceProto.IS_PRE_RENDERED;
import static android.inputmethodservice.InputMethodServiceProto.InsetsProto.CONTENT_TOP_INSETS;
import static android.inputmethodservice.InputMethodServiceProto.InsetsProto.TOUCHABLE_INSETS;
import static android.inputmethodservice.InputMethodServiceProto.InsetsProto.TOUCHABLE_REGION;
@@ -420,10 +418,6 @@ public class InputMethodService extends AbstractInputMethodService {
boolean mDecorViewVisible;
boolean mDecorViewWasVisible;
boolean mInShowWindow;
// True if pre-rendering of IME views/window is supported.
boolean mCanPreRender;
// If IME is pre-rendered.
boolean mIsPreRendered;
// IME window visibility.
// Use (mDecorViewVisible && mWindowVisible) to check if IME is visible to the user.
boolean mWindowVisible;
@@ -671,10 +665,8 @@ public class InputMethodService extends AbstractInputMethodService {
@Override
public final void dispatchStartInputWithToken(@Nullable InputConnection inputConnection,
@NonNull EditorInfo editorInfo, boolean restarting,
@NonNull IBinder startInputToken, boolean shouldPreRenderIme) {
@NonNull IBinder startInputToken) {
mPrivOps.reportStartInput(startInputToken);
mCanPreRender = shouldPreRenderIme;
if (DEBUG) Log.v(TAG, "Will Pre-render IME: " + mCanPreRender);
if (restarting) {
restartInput(inputConnection, editorInfo);
@@ -711,22 +703,12 @@ public class InputMethodService extends AbstractInputMethodService {
+ " Use requestHideSelf(int) itself");
return;
}
final boolean wasVisible = mIsPreRendered
? mDecorViewVisible && mWindowVisible : isInputViewShown();
final boolean wasVisible = isInputViewShown();
applyVisibilityInInsetsConsumerIfNecessary(false /* setVisible */);
if (mIsPreRendered) {
if (DEBUG) {
Log.v(TAG, "Making IME window invisible");
}
setImeWindowStatus(IME_ACTIVE | IME_INVISIBLE, mBackDisposition);
onPreRenderedWindowVisibilityChanged(false /* setVisible */);
} else {
mShowInputFlags = 0;
mShowInputRequested = false;
doHideWindow();
}
final boolean isVisible = mIsPreRendered
? mDecorViewVisible && mWindowVisible : isInputViewShown();
mShowInputFlags = 0;
mShowInputRequested = false;
doHideWindow();
final boolean isVisible = isInputViewShown();
final boolean visibilityChanged = isVisible != wasVisible;
if (resultReceiver != null) {
resultReceiver.send(visibilityChanged
@@ -765,23 +747,15 @@ public class InputMethodService extends AbstractInputMethodService {
+ " Use requestShowSelf(int) itself");
return;
}
final boolean wasVisible = mIsPreRendered
? mDecorViewVisible && mWindowVisible : isInputViewShown();
final boolean wasVisible = isInputViewShown();
if (dispatchOnShowInputRequested(flags, false)) {
if (mIsPreRendered) {
if (DEBUG) {
Log.v(TAG, "Making IME window visible");
}
onPreRenderedWindowVisibilityChanged(true /* setVisible */);
} else {
showWindow(true);
}
showWindow(true);
applyVisibilityInInsetsConsumerIfNecessary(true /* setVisible */);
}
// If user uses hard keyboard, IME button should always be shown.
setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition);
final boolean isVisible = mIsPreRendered
? mDecorViewVisible && mWindowVisible : isInputViewShown();
final boolean isVisible = isInputViewShown();
final boolean visibilityChanged = isVisible != wasVisible;
if (resultReceiver != null) {
resultReceiver.send(visibilityChanged
@@ -1788,7 +1762,7 @@ public class InputMethodService extends AbstractInputMethodService {
* applied by {@link #updateInputViewShown()}.
*/
public boolean isInputViewShown() {
return mCanPreRender ? mWindowVisible : mIsInputViewShown && mDecorViewVisible;
return mDecorViewVisible;
}
/**
@@ -2141,10 +2115,9 @@ public class InputMethodService extends AbstractInputMethodService {
mDecorViewWasVisible = mDecorViewVisible;
mInShowWindow = true;
boolean isPreRenderedAndInvisible = mIsPreRendered && !mWindowVisible;
final int previousImeWindowStatus =
(mDecorViewVisible ? IME_ACTIVE : 0) | (isInputViewShown()
? (isPreRenderedAndInvisible ? IME_INVISIBLE : IME_VISIBLE) : 0);
? (!mWindowVisible ? IME_INVISIBLE : IME_VISIBLE) : 0);
startViews(prepareWindow(showInput));
final int nextImeWindowStatus = mapToImeWindowStatus();
if (previousImeWindowStatus != nextImeWindowStatus) {
@@ -2153,14 +2126,7 @@ public class InputMethodService extends AbstractInputMethodService {
// compute visibility
onWindowShown();
mIsPreRendered = mCanPreRender;
if (mIsPreRendered) {
onPreRenderedWindowVisibilityChanged(true /* setVisible */);
} else {
// Pre-rendering not supported.
if (DEBUG) Log.d(TAG, "No pre-rendering supported");
mWindowVisible = true;
}
mWindowVisible = true;
// request draw for the IME surface.
// When IME is not pre-rendered, this will actually show the IME.
@@ -2168,22 +2134,10 @@ public class InputMethodService extends AbstractInputMethodService {
if (DEBUG) Log.v(TAG, "showWindow: draw decorView!");
mWindow.show();
}
maybeNotifyPreRendered();
mDecorViewWasVisible = true;
mInShowWindow = false;
}
/**
* Notify {@link android.view.ImeInsetsSourceConsumer} if IME has been pre-rendered
* for current EditorInfo, when pre-rendering is enabled.
*/
private void maybeNotifyPreRendered() {
if (!mCanPreRender || !mIsPreRendered) {
return;
}
mPrivOps.reportPreRendered(getCurrentInputEditorInfo());
}
private boolean prepareWindow(boolean showInput) {
boolean doShowInput = false;
@@ -2227,16 +2181,6 @@ public class InputMethodService extends AbstractInputMethodService {
if (doShowInput) startExtractingText(false);
}
private void onPreRenderedWindowVisibilityChanged(boolean setVisible) {
mWindowVisible = setVisible;
mShowInputFlags = setVisible ? mShowInputFlags : 0;
mShowInputRequested = setVisible;
mDecorViewVisible = setVisible;
if (setVisible) {
onWindowShown();
}
}
/**
* Applies the IME visibility in {@link android.view.ImeInsetsSourceConsumer}.
*
@@ -2267,7 +2211,6 @@ public class InputMethodService extends AbstractInputMethodService {
public void hideWindow() {
if (DEBUG) Log.v(TAG, "CALL: hideWindow");
mIsPreRendered = false;
mWindowVisible = false;
finishViews(false /* finishingInput */);
if (mDecorViewVisible) {
@@ -2374,32 +2317,6 @@ public class InputMethodService extends AbstractInputMethodService {
mCandidatesViewStarted = true;
onStartCandidatesView(mInputEditorInfo, restarting);
}
} else if (mCanPreRender && mInputEditorInfo != null && mStartedInputConnection != null) {
// Pre-render IME views and window when real EditorInfo is available.
// pre-render IME window and keep it invisible.
if (DEBUG) Log.v(TAG, "Pre-Render IME for " + mInputEditorInfo.fieldName);
if (mInShowWindow) {
Log.w(TAG, "Re-entrance in to showWindow");
return;
}
mDecorViewWasVisible = mDecorViewVisible;
mInShowWindow = true;
startViews(prepareWindow(true /* showInput */));
// compute visibility
mIsPreRendered = true;
onPreRenderedWindowVisibilityChanged(false /* setVisible */);
// request draw for the IME surface.
// When IME is not pre-rendered, this will actually show the IME.
if (DEBUG) Log.v(TAG, "showWindow: draw decorView!");
mWindow.show();
maybeNotifyPreRendered();
mDecorViewWasVisible = true;
mInShowWindow = false;
} else {
mIsPreRendered = false;
}
}
@@ -3299,9 +3216,7 @@ public class InputMethodService extends AbstractInputMethodService {
private int mapToImeWindowStatus() {
return IME_ACTIVE
| (isInputViewShown()
? (mCanPreRender ? (mWindowVisible ? IME_VISIBLE : IME_INVISIBLE)
: IME_VISIBLE) : 0);
| (isInputViewShown() ? IME_VISIBLE : 0);
}
private boolean isAutomotive() {
@@ -3339,8 +3254,6 @@ public class InputMethodService extends AbstractInputMethodService {
p.println(" mShowInputRequested=" + mShowInputRequested
+ " mLastShowInputRequested=" + mLastShowInputRequested
+ " mCanPreRender=" + mCanPreRender
+ " mIsPreRendered=" + mIsPreRendered
+ " mShowInputFlags=0x" + Integer.toHexString(mShowInputFlags));
p.println(" mCandidatesVisibility=" + mCandidatesVisibility
+ " mFullscreenApplied=" + mFullscreenApplied
@@ -3391,8 +3304,6 @@ public class InputMethodService extends AbstractInputMethodService {
}
proto.write(SHOW_INPUT_REQUESTED, mShowInputRequested);
proto.write(LAST_SHOW_INPUT_REQUESTED, mLastShowInputRequested);
proto.write(CAN_PRE_RENDER, mCanPreRender);
proto.write(IS_PRE_RENDERED, mIsPreRendered);
proto.write(SHOW_INPUT_FLAGS, mShowInputFlags);
proto.write(CANDIDATES_VISIBILITY, mCandidatesVisibility);
proto.write(FULLSCREEN_APPLIED, mFullscreenApplied);