Merge changes from topic "check display id update" into qt-dev
* changes: Unify context in ViewRoot Add test API getDisplayId for cts test
This commit is contained in:
committed by
Android (Google) Code Review
commit
0819556982
@@ -3391,6 +3391,7 @@ package android.view.contentcapture {
|
|||||||
package android.view.inputmethod {
|
package android.view.inputmethod {
|
||||||
|
|
||||||
public final class InputMethodManager {
|
public final class InputMethodManager {
|
||||||
|
method public int getDisplayId();
|
||||||
method public boolean isInputMethodPickerShown();
|
method public boolean isInputMethodPickerShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,6 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private InputMethodManager getImm() {
|
private InputMethodManager getImm() {
|
||||||
return mController.getViewRoot().mDisplayContext.getSystemService(InputMethodManager.class);
|
return mController.getViewRoot().mContext.getSystemService(InputMethodManager.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,13 +283,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
@GuardedBy("mWindowCallbacks")
|
@GuardedBy("mWindowCallbacks")
|
||||||
final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>();
|
final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>();
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
final Context mContext;
|
public final Context mContext;
|
||||||
/**
|
|
||||||
* TODO(b/116349163): Check if we can merge this into {@link #mContext}.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Context mDisplayContext;
|
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
final IWindowSession mWindowSession;
|
final IWindowSession mWindowSession;
|
||||||
@@ -595,7 +589,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
public ViewRootImpl(Context context, Display display) {
|
public ViewRootImpl(Context context, Display display) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDisplayContext = context.createDisplayContext(display);
|
|
||||||
mWindowSession = WindowManagerGlobal.getWindowSession();
|
mWindowSession = WindowManagerGlobal.getWindowSession();
|
||||||
mDisplay = display;
|
mDisplay = display;
|
||||||
mBasePackageName = context.getBasePackageName();
|
mBasePackageName = context.getBasePackageName();
|
||||||
@@ -1379,7 +1372,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
} else {
|
} else {
|
||||||
mDisplay = preferredDisplay;
|
mDisplay = preferredDisplay;
|
||||||
}
|
}
|
||||||
mDisplayContext = mContext.createDisplayContext(mDisplay);
|
mContext.updateDisplay(mDisplay.getDisplayId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void pokeDrawLockIfNeeded() {
|
void pokeDrawLockIfNeeded() {
|
||||||
@@ -2725,7 +2718,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
.mayUseInputMethod(mWindowAttributes.flags);
|
.mayUseInputMethod(mWindowAttributes.flags);
|
||||||
if (imTarget != mLastWasImTarget) {
|
if (imTarget != mLastWasImTarget) {
|
||||||
mLastWasImTarget = imTarget;
|
mLastWasImTarget = imTarget;
|
||||||
InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class);
|
InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
|
||||||
if (imm != null && imTarget) {
|
if (imm != null && imTarget) {
|
||||||
imm.onPreWindowFocus(mView, hasWindowFocus);
|
imm.onPreWindowFocus(mView, hasWindowFocus);
|
||||||
imm.onPostWindowFocus(mView, mView.findFocus(),
|
imm.onPostWindowFocus(mView, mView.findFocus(),
|
||||||
@@ -2859,7 +2852,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mLastWasImTarget = WindowManager.LayoutParams
|
mLastWasImTarget = WindowManager.LayoutParams
|
||||||
.mayUseInputMethod(mWindowAttributes.flags);
|
.mayUseInputMethod(mWindowAttributes.flags);
|
||||||
|
|
||||||
InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class);
|
InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
|
||||||
if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) {
|
if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) {
|
||||||
imm.onPreWindowFocus(mView, hasWindowFocus);
|
imm.onPreWindowFocus(mView, hasWindowFocus);
|
||||||
}
|
}
|
||||||
@@ -4564,8 +4557,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
enqueueInputEvent(event, null, 0, true);
|
enqueueInputEvent(event, null, 0, true);
|
||||||
} break;
|
} break;
|
||||||
case MSG_CHECK_FOCUS: {
|
case MSG_CHECK_FOCUS: {
|
||||||
InputMethodManager imm =
|
InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
|
||||||
mDisplayContext.getSystemService(InputMethodManager.class);
|
|
||||||
if (imm != null) {
|
if (imm != null) {
|
||||||
imm.checkFocus();
|
imm.checkFocus();
|
||||||
}
|
}
|
||||||
@@ -5110,7 +5102,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
@Override
|
@Override
|
||||||
protected int onProcess(QueuedInputEvent q) {
|
protected int onProcess(QueuedInputEvent q) {
|
||||||
if (mLastWasImTarget && !isInLocalFocusMode()) {
|
if (mLastWasImTarget && !isInLocalFocusMode()) {
|
||||||
InputMethodManager imm = mDisplayContext.getSystemService(InputMethodManager.class);
|
InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
|
||||||
if (imm != null) {
|
if (imm != null) {
|
||||||
final InputEvent event = q.mEvent;
|
final InputEvent event = q.mEvent;
|
||||||
if (DEBUG_IMF) Log.v(mTag, "Sending input event to IME: " + event);
|
if (DEBUG_IMF) Log.v(mTag, "Sending input event to IME: " + event);
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ public final class InputMethodManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final InputMethodManager fallbackImm =
|
final InputMethodManager fallbackImm =
|
||||||
viewRootImpl.mDisplayContext.getSystemService(InputMethodManager.class);
|
viewRootImpl.mContext.getSystemService(InputMethodManager.class);
|
||||||
if (fallbackImm == null) {
|
if (fallbackImm == null) {
|
||||||
Log.e(TAG, "b/117267690: Failed to get non-null fallback IMM. view=" + view);
|
Log.e(TAG, "b/117267690: Failed to get non-null fallback IMM. view=" + view);
|
||||||
return null;
|
return null;
|
||||||
@@ -2887,6 +2887,16 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>This is used for CTS test only. Do not use this method outside of CTS package.<p/>
|
||||||
|
* @return the ID of this display which this {@link InputMethodManager} resides
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public int getDisplayId() {
|
||||||
|
return mDisplayId;
|
||||||
|
}
|
||||||
|
|
||||||
void doDump(FileDescriptor fd, PrintWriter fout, String[] args) {
|
void doDump(FileDescriptor fd, PrintWriter fout, String[] args) {
|
||||||
final Printer p = new PrintWriterPrinter(fout);
|
final Printer p = new PrintWriterPrinter(fout);
|
||||||
p.println("Input method client state for " + this + ":");
|
p.println("Input method client state for " + this + ":");
|
||||||
|
|||||||
Reference in New Issue
Block a user