diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java index 0512305e71a20..7cebad6256389 100644 --- a/core/java/android/inputmethodservice/IInputMethodWrapper.java +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -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)); diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 78cc71a782a59..ed7491dae0603 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -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); diff --git a/core/java/android/view/ImeInsetsSourceConsumer.java b/core/java/android/view/ImeInsetsSourceConsumer.java index dd1a19458e1d5..5780d4f69f9eb 100644 --- a/core/java/android/view/ImeInsetsSourceConsumer.java +++ b/core/java/android/view/ImeInsetsSourceConsumer.java @@ -16,7 +16,6 @@ package android.view; -import static android.view.ImeInsetsSourceConsumerProto.FOCUSED_EDITOR; import static android.view.ImeInsetsSourceConsumerProto.INSETS_SOURCE_CONSUMER; import static android.view.ImeInsetsSourceConsumerProto.IS_REQUESTED_VISIBLE_AWAITING_CONTROL; import static android.view.InsetsController.AnimationType; @@ -25,16 +24,10 @@ import static android.view.InsetsState.ITYPE_IME; import android.annotation.Nullable; import android.inputmethodservice.InputMethodService; import android.os.IBinder; -import android.os.Parcel; -import android.text.TextUtils; import android.util.proto.ProtoOutputStream; import android.view.SurfaceControl.Transaction; -import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; -import com.android.internal.annotations.VisibleForTesting; - -import java.util.Arrays; import java.util.function.Supplier; /** @@ -42,13 +35,6 @@ import java.util.function.Supplier; * @hide */ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { - private EditorInfo mFocusedEditor; - private EditorInfo mPreRenderedEditor; - /** - * Determines if IME would be shown next time IME is pre-rendered for currently focused - * editor {@link #mFocusedEditor} if {@link #isServedEditorRendered} is {@code true}. - */ - private boolean mShowOnNextImeRender; /** * Tracks whether we have an outstanding request from the IME to show, but weren't able to @@ -62,23 +48,6 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { super(ITYPE_IME, state, transactionSupplier, controller); } - public void onPreRendered(EditorInfo info) { - mPreRenderedEditor = info; - if (mShowOnNextImeRender) { - mShowOnNextImeRender = false; - if (isServedEditorRendered()) { - applyImeVisibility(true /* setVisible */); - } - } - } - - public void onServedEditorChanged(EditorInfo info) { - if (isFallbackOrEmptyEditor(info)) { - mShowOnNextImeRender = false; - } - mFocusedEditor = info; - } - public void applyImeVisibility(boolean setVisible) { mController.applyImeVisibility(setVisible); } @@ -170,73 +139,10 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { } } - private boolean isFallbackOrEmptyEditor(EditorInfo info) { - // TODO(b/123044812): Handle fallback input gracefully in IME Insets API - return info == null || (info.fieldId <= 0 && info.inputType <= 0); - } - - private boolean isServedEditorRendered() { - if (mFocusedEditor == null || mPreRenderedEditor == null - || isFallbackOrEmptyEditor(mFocusedEditor) - || isFallbackOrEmptyEditor(mPreRenderedEditor)) { - // No view is focused or ready. - return false; - } - return areEditorsSimilar(mFocusedEditor, mPreRenderedEditor); - } - - @VisibleForTesting - public static boolean areEditorsSimilar(EditorInfo info1, EditorInfo info2) { - // We don't need to compare EditorInfo.fieldId (View#id) since that shouldn't change - // IME views. - boolean areOptionsSimilar = - info1.imeOptions == info2.imeOptions - && info1.inputType == info2.inputType - && TextUtils.equals(info1.packageName, info2.packageName); - areOptionsSimilar &= info1.privateImeOptions != null - ? info1.privateImeOptions.equals(info2.privateImeOptions) : true; - - if (!areOptionsSimilar) { - return false; - } - - // compare bundle extras. - if ((info1.extras == null && info2.extras == null) || info1.extras == info2.extras) { - return true; - } - if ((info1.extras == null && info2.extras != null) - || (info1.extras == null && info2.extras != null)) { - return false; - } - if (info1.extras.hashCode() == info2.extras.hashCode() - || info1.extras.equals(info1)) { - return true; - } - if (info1.extras.size() != info2.extras.size()) { - return false; - } - if (info1.extras.toString().equals(info2.extras.toString())) { - return true; - } - - // Compare bytes - Parcel parcel1 = Parcel.obtain(); - info1.extras.writeToParcel(parcel1, 0); - parcel1.setDataPosition(0); - Parcel parcel2 = Parcel.obtain(); - info2.extras.writeToParcel(parcel2, 0); - parcel2.setDataPosition(0); - - return Arrays.equals(parcel1.createByteArray(), parcel2.createByteArray()); - } - @Override public void dumpDebug(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); super.dumpDebug(proto, INSETS_SOURCE_CONSUMER); - if (mFocusedEditor != null) { - mFocusedEditor.dumpDebug(proto, FOCUSED_EDITOR); - } proto.write(IS_REQUESTED_VISIBLE_AWAITING_CONTROL, mIsRequestedVisibleAwaitingControl); proto.end(token); } diff --git a/core/java/android/view/inputmethod/InputMethod.java b/core/java/android/view/inputmethod/InputMethod.java index f44ab3ac2ed19..de4554b9e6249 100644 --- a/core/java/android/view/inputmethod/InputMethod.java +++ b/core/java/android/view/inputmethod/InputMethod.java @@ -243,7 +243,7 @@ public interface InputMethod { @MainThread default void dispatchStartInputWithToken(@Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo, boolean restarting, - @NonNull IBinder startInputToken, boolean shouldPreRenderIme) { + @NonNull IBinder startInputToken) { if (restarting) { restartInput(inputConnection, editorInfo); } else { diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 5785999e26726..8814b33d2f7d0 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -489,7 +489,6 @@ public final class InputMethodManager { static final int MSG_TIMEOUT_INPUT_EVENT = 6; static final int MSG_FLUSH_INPUT_EVENT = 7; static final int MSG_REPORT_FULLSCREEN_MODE = 10; - static final int MSG_REPORT_PRE_RENDERED = 15; static final int MSG_APPLY_IME_VISIBILITY = 20; static final int MSG_UPDATE_ACTIVITY_VIEW_TO_SCREEN_MATRIX = 30; @@ -584,17 +583,6 @@ public final class InputMethodManager { mServedConnecting = true; servedView = getServedViewLocked(); } - if (servedView != null && servedView.getHandler() != null) { - // Make sure View checks should be on the UI thread. - servedView.getHandler().post(() -> { - if (!servedView.onCheckIsTextEditor()) { - // servedView has changed and it's not editable. - synchronized (mH) { - maybeCallServedViewChangedLocked(null); - } - } - }); - } return startInputInner(startInputReason, focusedView != null ? focusedView.getWindowToken() : null, startInputFlags, softInputMode, windowFlags); @@ -919,15 +907,6 @@ public final class InputMethodManager { } return; } - case MSG_REPORT_PRE_RENDERED: { - synchronized (mH) { - if (mImeInsetsConsumer != null) { - mImeInsetsConsumer.onPreRendered((EditorInfo) msg.obj); - } - } - return; - - } case MSG_APPLY_IME_VISIBILITY: { synchronized (mH) { if (mImeInsetsConsumer != null) { @@ -1099,12 +1078,6 @@ public final class InputMethodManager { .sendToTarget(); } - @Override - public void reportPreRendered(EditorInfo info) { - mH.obtainMessage(MSG_REPORT_PRE_RENDERED, 0, 0, info) - .sendToTarget(); - } - @Override public void applyImeVisibility(boolean setVisible) { mH.obtainMessage(MSG_APPLY_IME_VISIBILITY, setVisible ? 1 : 0, 0) @@ -1981,7 +1954,7 @@ public final class InputMethodManager { // Hook 'em up and let 'er rip. mCurrentTextBoxAttribute = tba; - maybeCallServedViewChangedLocked(tba); + mServedConnecting = false; if (mServedInputConnectionWrapper != null) { mServedInputConnectionWrapper.deactivate(); @@ -3141,12 +3114,6 @@ public final class InputMethodManager { } } - private void maybeCallServedViewChangedLocked(EditorInfo tba) { - if (mImeInsetsConsumer != null) { - mImeInsetsConsumer.onServedEditorChanged(tba); - } - } - /** *

This is used for CTS test only. Do not use this method outside of CTS package.

* @return the ID of this display which this {@link InputMethodManager} resides diff --git a/core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl b/core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl index 9a226860831ae..f0e26cf4bbcfc 100644 --- a/core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl +++ b/core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl @@ -17,7 +17,6 @@ package com.android.internal.inputmethod; import android.net.Uri; -import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.IInputContentUriToken; @@ -40,6 +39,5 @@ interface IInputMethodPrivilegedOperations { boolean switchToNextInputMethod(boolean onlyCurrentIme); boolean shouldOfferSwitchingToNextInputMethod(); void notifyUserAction(); - void reportPreRendered(in EditorInfo info); void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible); } diff --git a/core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java b/core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java index 9b1299ebe54cf..d6730e8b0bdb7 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java +++ b/core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java @@ -24,7 +24,6 @@ import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.view.View; -import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; import com.android.internal.annotations.GuardedBy; @@ -350,24 +349,6 @@ public final class InputMethodPrivilegedOperations { } } - /** - * Calls {@link IInputMethodPrivilegedOperations#reportPreRendered(info)}. - * - * @param info {@link EditorInfo} of the currently rendered {@link TextView}. - */ - @AnyThread - public void reportPreRendered(EditorInfo info) { - final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull(); - if (ops == null) { - return; - } - try { - ops.reportPreRendered(info); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - /** * Calls {@link IInputMethodPrivilegedOperations#applyImeVisibility(IBinder, boolean)}. * diff --git a/core/java/com/android/internal/view/IInputMethod.aidl b/core/java/com/android/internal/view/IInputMethod.aidl index 40e4f4d6ad12e..c336373539844 100644 --- a/core/java/com/android/internal/view/IInputMethod.aidl +++ b/core/java/com/android/internal/view/IInputMethod.aidl @@ -45,7 +45,7 @@ oneway interface IInputMethod { void unbindInput(); void startInput(in IBinder startInputToken, in IInputContext inputContext, int missingMethods, - in EditorInfo attribute, boolean restarting, boolean preRenderImeViews); + in EditorInfo attribute, boolean restarting); void createSession(in InputChannel channel, IInputSessionCallback callback); diff --git a/core/java/com/android/internal/view/IInputMethodClient.aidl b/core/java/com/android/internal/view/IInputMethodClient.aidl index c9443b0021332..1145f51832061 100644 --- a/core/java/com/android/internal/view/IInputMethodClient.aidl +++ b/core/java/com/android/internal/view/IInputMethodClient.aidl @@ -16,8 +16,6 @@ package com.android.internal.view; -import android.view.inputmethod.EditorInfo; - import com.android.internal.view.InputBindResult; /** @@ -30,7 +28,6 @@ oneway interface IInputMethodClient { void setActive(boolean active, boolean fullscreen); void scheduleStartInputIfNecessary(boolean fullscreen); void reportFullscreenMode(boolean fullscreen); - void reportPreRendered(in EditorInfo info); void applyImeVisibility(boolean setVisible); void updateActivityViewToScreenMatrix(int bindSequence, in float[] matrixValues); void setImeTraceEnabled(boolean enabled); diff --git a/core/proto/android/inputmethodservice/inputmethodservice.proto b/core/proto/android/inputmethodservice/inputmethodservice.proto index 3b4ebb5d73e79..e5d1713616953 100644 --- a/core/proto/android/inputmethodservice/inputmethodservice.proto +++ b/core/proto/android/inputmethodservice/inputmethodservice.proto @@ -39,8 +39,8 @@ message InputMethodServiceProto { optional .android.view.inputmethod.EditorInfoProto input_editor_info = 13; optional bool show_input_requested = 14; optional bool last_show_input_requested = 15; - optional bool can_pre_render = 16; - optional bool is_pre_rendered = 17; + reserved 16; // can_pre_render + reserved 17; // is_pre_rendered optional int32 show_input_flags = 18; optional int32 candidates_visibility = 19; optional bool fullscreen_applied = 20; diff --git a/core/proto/android/view/imeinsetssourceconsumer.proto b/core/proto/android/view/imeinsetssourceconsumer.proto index 5bee81bdc7cd5..1b9aff989cc86 100644 --- a/core/proto/android/view/imeinsetssourceconsumer.proto +++ b/core/proto/android/view/imeinsetssourceconsumer.proto @@ -28,6 +28,6 @@ option java_multiple_files = true; */ message ImeInsetsSourceConsumerProto { optional InsetsSourceConsumerProto insets_source_consumer = 1; - optional .android.view.inputmethod.EditorInfoProto focused_editor = 2; + reserved 2; // focused_editor = 2 optional bool is_requested_visible_awaiting_control = 3; } \ No newline at end of file diff --git a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java index a5b7c6156109a..db838e81eb288 100644 --- a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java +++ b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java @@ -17,7 +17,6 @@ package android.view; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; -import static android.view.ImeInsetsSourceConsumer.areEditorsSimilar; import static android.view.InsetsState.ITYPE_IME; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; @@ -33,11 +32,9 @@ import android.content.Context; import android.graphics.Insets; import android.graphics.Point; import android.graphics.Rect; -import android.os.Bundle; import android.platform.test.annotations.Presubmit; import android.view.WindowManager.BadTokenException; import android.view.WindowManager.LayoutParams; -import android.view.inputmethod.EditorInfo; import android.widget.TextView; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -50,8 +47,6 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Spy; -import java.util.ArrayList; - /** * Test {@link InsetsSourceConsumer} with IME type. * @@ -133,50 +128,4 @@ public class ImeInsetsSourceConsumerTest { eq(WindowInsets.Type.ime()), eq(false) /* show */, eq(true) /* fromIme */); }); } - - @Test - public void testAreEditorsSimilar() { - EditorInfo info1 = new EditorInfo(); - info1.privateImeOptions = "dummy"; - EditorInfo info2 = new EditorInfo(); - - assertFalse(areEditorsSimilar(info1, info2)); - - info1.privateImeOptions = null; - assertTrue(areEditorsSimilar(info1, info2)); - - info1.inputType = info2.inputType = 3; - info1.imeOptions = info2.imeOptions = 0x4; - info1.packageName = info2.packageName = "dummy.package"; - assertTrue(areEditorsSimilar(info1, info2)); - - Bundle extras1 = new Bundle(); - extras1.putByteArray("key1", "value1".getBytes()); - extras1.putChar("key2", 'c'); - Bundle extras2 = new Bundle(); - extras2.putByteArray("key1", "value1".getBytes()); - extras2.putChar("key2", 'c'); - info1.extras = extras1; - info2.extras = extras2; - assertTrue(areEditorsSimilar(info1, info2)); - - Bundle extraBundle = new Bundle(); - ArrayList list = new ArrayList<>(); - list.add(2); - list.add(5); - extraBundle.putByteArray("key1", "value1".getBytes()); - extraBundle.putChar("key2", 'c'); - extraBundle.putIntegerArrayList("key3", list); - - extras1.putAll(extraBundle); - extras2.putAll(extraBundle); - assertTrue(areEditorsSimilar(info1, info2)); - - extras2.putChar("key2", 'd'); - assertFalse(areEditorsSimilar(info1, info2)); - - extras2.putChar("key2", 'c'); - extras2.putInt("key4", 1); - assertFalse(areEditorsSimilar(info1, info2)); - } } diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 9947ecd42e313..de4bccb35cd3a 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -234,7 +234,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub static final int MSG_SET_ACTIVE = 3020; static final int MSG_SET_INTERACTIVE = 3030; static final int MSG_REPORT_FULLSCREEN_MODE = 3045; - static final int MSG_REPORT_PRE_RENDERED = 3060; static final int MSG_APPLY_IME_VISIBILITY = 3070; static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000; @@ -317,8 +316,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub private static final class DebugFlags { static final DebugFlag FLAG_OPTIMIZE_START_INPUT = new DebugFlag("debug.optimize_startinput", false); - static final DebugFlag FLAG_PRE_RENDER_IME_VIEWS = - new DebugFlag("persist.pre_render_ime_views", false); } @UserIdInt @@ -448,10 +445,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final ClientDeathRecipient clientDeathRecipient; boolean sessionRequested; - // Determines if IMEs should be pre-rendered. - // DebugFlag can be flipped anytime. This flag is kept per-client to maintain behavior - // through the life of the current client. - boolean shouldPreRenderIme; SessionState curSession; @Override @@ -3440,14 +3433,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return InputBindResult.USER_SWITCHING; } - // Main feature flag that overrides other conditions and forces IME preRendering. - if (DEBUG) { - Slog.v(TAG, "IME PreRendering main flag: " - + DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.value() + ", LowRam: " + mIsLowRam); - } - // pre-rendering not supported on low-ram devices. - cs.shouldPreRenderIme = DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.value() && !mIsLowRam; - final boolean sameWindowFocused = mCurFocusedWindow == windowToken; final boolean isTextEditor = (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0; final boolean startInputByWinGainedFocus = @@ -4140,19 +4125,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } - @BinderThread - private void reportPreRendered(IBinder token, EditorInfo info) { - synchronized (mMethodMap) { - if (!calledWithValidTokenLocked(token)) { - return; - } - if (mCurClient != null && mCurClient.client != null) { - executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO( - MSG_REPORT_PRE_RENDERED, info, mCurClient)); - } - } - } - @BinderThread private void applyImeVisibility(IBinder token, IBinder windowToken, boolean setVisible) { synchronized (mMethodMap) { @@ -4430,7 +4402,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub try { setEnabledSessionInMainThread(session); session.method.startInput(startInputToken, inputContext, missingMethods, - editorInfo, restarting, session.client.shouldPreRenderIme); + editorInfo, restarting); } catch (RemoteException e) { } args.recycle(); @@ -4488,20 +4460,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return true; } - case MSG_REPORT_PRE_RENDERED: { - args = (SomeArgs) msg.obj; - final EditorInfo info = (EditorInfo) args.arg1; - final ClientState clientState = (ClientState) args.arg2; - try { - clientState.client.reportPreRendered(info); - } catch (RemoteException e) { - Slog.w(TAG, "Got RemoteException sending " - + "reportPreRendered(" + info + ") notification to pid=" - + clientState.pid + " uid=" + clientState.uid); - } - args.recycle(); - return true; - } case MSG_APPLY_IME_VISIBILITY: { final boolean setVisible = msg.arg1 != 0; final ClientState clientState = (ClientState) msg.obj; @@ -5347,7 +5305,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @ShellCommandResult private int refreshDebugProperties() { DebugFlags.FLAG_OPTIMIZE_START_INPUT.refresh(); - DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.refresh(); return ShellCommandResult.SUCCESS; } @@ -5820,12 +5777,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mImms.notifyUserAction(mToken); } - @BinderThread - @Override - public void reportPreRendered(EditorInfo info) { - mImms.reportPreRendered(mToken, info); - } - @BinderThread @Override public void applyImeVisibility(IBinder windowToken, boolean setVisible) {