Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17322214 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Always use Context.getSystemService() to get IMM"

parents 5ad85210 484d4afc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ public class SuggestionSpan extends CharacterStyle implements ParcelableSpan {
            intent.putExtra(SuggestionSpan.SUGGESTION_SPAN_PICKED_HASHCODE, hashCode());
            context.sendBroadcast(intent);
        } else {
            InputMethodManager imm = InputMethodManager.peekInstance();
            InputMethodManager imm = context.getSystemService(InputMethodManager.class);
            if (imm != null) {
                imm.notifySuggestionPicked(this, original, index);
            }
+5 −5
Original line number Diff line number Diff line
@@ -7315,7 +7315,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // Here we check whether we still need the default focus highlight, and switch it on/off.
        switchDefaultFocusHighlight();
        InputMethodManager imm = InputMethodManager.peekInstance();
        InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
        if (!gainFocus) {
            if (isPressed()) {
                setPressed(false);
@@ -12476,7 +12476,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        mPrivateFlags3 &= ~PFLAG3_TEMPORARY_DETACH;
        onFinishTemporaryDetach();
        if (hasWindowFocus() && hasFocus()) {
            InputMethodManager.getInstance().focusIn(this);
            getContext().getSystemService(InputMethodManager.class).focusIn(this);
        }
        notifyEnterOrExitForAutoFillIfNeeded(true);
    }
@@ -12867,7 +12867,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *        focus, false otherwise.
     */
    public void onWindowFocusChanged(boolean hasWindowFocus) {
        InputMethodManager imm = InputMethodManager.peekInstance();
        InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
        if (!hasWindowFocus) {
            if (isPressed()) {
                setPressed(false);
@@ -17932,7 +17932,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        rebuildOutline();
        if (isFocused()) {
            InputMethodManager imm = InputMethodManager.peekInstance();
            InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
            if (imm != null) {
                imm.focusIn(this);
            }
@@ -18515,7 +18515,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        onDetachedFromWindow();
        onDetachedFromWindowInternal();
        InputMethodManager imm = InputMethodManager.peekInstance();
        InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);
        if (imm != null) {
            imm.onViewDetachedFromWindow(this);
        }
+4 −4
Original line number Diff line number Diff line
@@ -2579,7 +2579,7 @@ public final class ViewRootImpl implements ViewParent,
                    .mayUseInputMethod(mWindowAttributes.flags);
            if (imTarget != mLastWasImTarget) {
                mLastWasImTarget = imTarget;
                InputMethodManager imm = InputMethodManager.peekInstance();
                InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
                if (imm != null && imTarget) {
                    imm.onPreWindowFocus(mView, hasWindowFocus);
                    imm.onPostWindowFocus(mView, mView.findFocus(),
@@ -2695,7 +2695,7 @@ public final class ViewRootImpl implements ViewParent,
            mLastWasImTarget = WindowManager.LayoutParams
                    .mayUseInputMethod(mWindowAttributes.flags);

            InputMethodManager imm = InputMethodManager.peekInstance();
            InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
            if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) {
                imm.onPreWindowFocus(mView, hasWindowFocus);
            }
@@ -4329,7 +4329,7 @@ public final class ViewRootImpl implements ViewParent,
                    enqueueInputEvent(event, null, 0, true);
                } break;
                case MSG_CHECK_FOCUS: {
                    InputMethodManager imm = InputMethodManager.peekInstance();
                    InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
                    if (imm != null) {
                        imm.checkFocus();
                    }
@@ -4871,7 +4871,7 @@ public final class ViewRootImpl implements ViewParent,
        @Override
        protected int onProcess(QueuedInputEvent q) {
            if (mLastWasImTarget && !isInLocalFocusMode()) {
                InputMethodManager imm = InputMethodManager.peekInstance();
                InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
                if (imm != null) {
                    final InputEvent event = q.mEvent;
                    if (DEBUG_IMF) Log.v(mTag, "Sending input event to IME: " + event);
+1 −1
Original line number Diff line number Diff line
@@ -468,7 +468,7 @@ public final class WindowManagerGlobal {
        View view = root.getView();

        if (view != null) {
            InputMethodManager imm = InputMethodManager.getInstance();
            InputMethodManager imm = view.getContext().getSystemService(InputMethodManager.class);
            if (imm != null) {
                imm.windowDismissed(mViews.get(index).getWindowToken());
            }
+4 −2
Original line number Diff line number Diff line
@@ -665,10 +665,12 @@ public final class InputMethodManager {
    }

    /**
     * Private optimization: retrieve the global InputMethodManager instance,
     * if it exists.
     * Private optimization: retrieve the global InputMethodManager instance, if it exists.
     * @hide
     * @deprecated Use {@link Context#getSystemService(Class)} instead. This method cannot fully
     *             support multi-display scenario.
     */
    @Deprecated
    @UnsupportedAppUsage
    public static InputMethodManager peekInstance() {
        return sInstance;
Loading