Loading core/java/android/view/ImeInsetsSourceConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -173,6 +173,6 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { } private InputMethodManager getImm() { return mController.getViewRoot().mContext.getSystemService(InputMethodManager.class); return mController.getViewRoot().mDisplayContext.getSystemService(InputMethodManager.class); } } core/java/android/view/ViewRootImpl.java +14 −6 Original line number Diff line number Diff line Loading @@ -283,7 +283,13 @@ public final class ViewRootImpl implements ViewParent, @GuardedBy("mWindowCallbacks") final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>(); @UnsupportedAppUsage public final Context mContext; final Context mContext; /** * TODO(b/116349163): Check if we can merge this into {@link #mContext}. * @hide */ @NonNull public Context mDisplayContext; @UnsupportedAppUsage final IWindowSession mWindowSession; Loading Loading @@ -589,6 +595,7 @@ public final class ViewRootImpl implements ViewParent, public ViewRootImpl(Context context, Display display) { mContext = context; mDisplayContext = context.createDisplayContext(display); mWindowSession = WindowManagerGlobal.getWindowSession(); mDisplay = display; mBasePackageName = context.getBasePackageName(); Loading Loading @@ -1372,7 +1379,7 @@ public final class ViewRootImpl implements ViewParent, } else { mDisplay = preferredDisplay; } mContext.updateDisplay(mDisplay.getDisplayId()); mDisplayContext = mContext.createDisplayContext(mDisplay); } void pokeDrawLockIfNeeded() { Loading Loading @@ -2718,7 +2725,7 @@ public final class ViewRootImpl implements ViewParent, .mayUseInputMethod(mWindowAttributes.flags); if (imTarget != mLastWasImTarget) { mLastWasImTarget = imTarget; InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null && imTarget) { imm.onPreWindowFocus(mView, hasWindowFocus); imm.onPostWindowFocus(mView, mView.findFocus(), Loading Loading @@ -2848,7 +2855,7 @@ public final class ViewRootImpl implements ViewParent, mLastWasImTarget = WindowManager.LayoutParams .mayUseInputMethod(mWindowAttributes.flags); InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onPreWindowFocus(mView, hasWindowFocus); } Loading Loading @@ -4553,7 +4560,8 @@ public final class ViewRootImpl implements ViewParent, enqueueInputEvent(event, null, 0, true); } break; case MSG_CHECK_FOCUS: { InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null) { imm.checkFocus(); } Loading Loading @@ -5098,7 +5106,7 @@ public final class ViewRootImpl implements ViewParent, @Override protected int onProcess(QueuedInputEvent q) { if (mLastWasImTarget && !isInLocalFocusMode()) { InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null) { final InputEvent event = q.mEvent; if (DEBUG_IMF) Log.v(mTag, "Sending input event to IME: " + event); Loading core/java/android/view/inputmethod/InputMethodManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,7 @@ public final class InputMethodManager { return null; } final InputMethodManager fallbackImm = viewRootImpl.mContext.getSystemService(InputMethodManager.class); viewRootImpl.mDisplayContext.getSystemService(InputMethodManager.class); if (fallbackImm == null) { Log.e(TAG, "b/117267690: Failed to get non-null fallback IMM. view=" + view); return null; Loading Loading
core/java/android/view/ImeInsetsSourceConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -173,6 +173,6 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { } private InputMethodManager getImm() { return mController.getViewRoot().mContext.getSystemService(InputMethodManager.class); return mController.getViewRoot().mDisplayContext.getSystemService(InputMethodManager.class); } }
core/java/android/view/ViewRootImpl.java +14 −6 Original line number Diff line number Diff line Loading @@ -283,7 +283,13 @@ public final class ViewRootImpl implements ViewParent, @GuardedBy("mWindowCallbacks") final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>(); @UnsupportedAppUsage public final Context mContext; final Context mContext; /** * TODO(b/116349163): Check if we can merge this into {@link #mContext}. * @hide */ @NonNull public Context mDisplayContext; @UnsupportedAppUsage final IWindowSession mWindowSession; Loading Loading @@ -589,6 +595,7 @@ public final class ViewRootImpl implements ViewParent, public ViewRootImpl(Context context, Display display) { mContext = context; mDisplayContext = context.createDisplayContext(display); mWindowSession = WindowManagerGlobal.getWindowSession(); mDisplay = display; mBasePackageName = context.getBasePackageName(); Loading Loading @@ -1372,7 +1379,7 @@ public final class ViewRootImpl implements ViewParent, } else { mDisplay = preferredDisplay; } mContext.updateDisplay(mDisplay.getDisplayId()); mDisplayContext = mContext.createDisplayContext(mDisplay); } void pokeDrawLockIfNeeded() { Loading Loading @@ -2718,7 +2725,7 @@ public final class ViewRootImpl implements ViewParent, .mayUseInputMethod(mWindowAttributes.flags); if (imTarget != mLastWasImTarget) { mLastWasImTarget = imTarget; InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null && imTarget) { imm.onPreWindowFocus(mView, hasWindowFocus); imm.onPostWindowFocus(mView, mView.findFocus(), Loading Loading @@ -2848,7 +2855,7 @@ public final class ViewRootImpl implements ViewParent, mLastWasImTarget = WindowManager.LayoutParams .mayUseInputMethod(mWindowAttributes.flags); InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onPreWindowFocus(mView, hasWindowFocus); } Loading Loading @@ -4553,7 +4560,8 @@ public final class ViewRootImpl implements ViewParent, enqueueInputEvent(event, null, 0, true); } break; case MSG_CHECK_FOCUS: { InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null) { imm.checkFocus(); } Loading Loading @@ -5098,7 +5106,7 @@ public final class ViewRootImpl implements ViewParent, @Override protected int onProcess(QueuedInputEvent q) { if (mLastWasImTarget && !isInLocalFocusMode()) { InputMethodManager imm = mContext.getSystemService(InputMethodManager.class); InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class); if (imm != null) { final InputEvent event = q.mEvent; if (DEBUG_IMF) Log.v(mTag, "Sending input event to IME: " + event); Loading
core/java/android/view/inputmethod/InputMethodManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,7 @@ public final class InputMethodManager { return null; } final InputMethodManager fallbackImm = viewRootImpl.mContext.getSystemService(InputMethodManager.class); viewRootImpl.mDisplayContext.getSystemService(InputMethodManager.class); if (fallbackImm == null) { Log.e(TAG, "b/117267690: Failed to get non-null fallback IMM. view=" + view); return null; Loading