Merge "Remove StartInputFlags.FIRST_WINDOW_FOCUS_GAIN"

This commit is contained in:
TreeHugger Robot
2019-10-29 23:51:56 +00:00
committed by Android (Google) Code Review
4 changed files with 6 additions and 28 deletions

View File

@@ -439,7 +439,6 @@ public final class ViewRootImpl implements ViewParent,
boolean mReportNextDraw;
boolean mFullRedrawNeeded;
boolean mNewSurfaceNeeded;
boolean mHasHadWindowFocus;
boolean mLastWasImTarget;
boolean mForceNextWindowRelayout;
CountDownLatch mWindowDrawCountDown;
@@ -2123,11 +2122,6 @@ public final class ViewRootImpl implements ViewParent,
endDragResizing();
destroyHardwareResources();
}
if (viewVisibility == View.GONE) {
// After making a window gone, we will count it as being
// shown for the first time the next time it gets focus.
mHasHadWindowFocus = false;
}
}
// Non-visible windows can't hold accessibility focus.
@@ -2823,8 +2817,7 @@ public final class ViewRootImpl implements ViewParent,
if (imm != null && imTarget) {
imm.onPreWindowFocus(mView, hasWindowFocus);
imm.onPostWindowFocus(mView, mView.findFocus(),
mWindowAttributes.softInputMode,
!mHasHadWindowFocus, mWindowAttributes.flags);
mWindowAttributes.softInputMode, mWindowAttributes.flags);
}
}
}
@@ -3017,8 +3010,7 @@ public final class ViewRootImpl implements ViewParent,
if (hasWindowFocus) {
if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) {
imm.onPostWindowFocus(mView, mView.findFocus(),
mWindowAttributes.softInputMode,
!mHasHadWindowFocus, mWindowAttributes.flags);
mWindowAttributes.softInputMode, mWindowAttributes.flags);
}
// Clear the forward bit. We can just do this directly, since
// the window manager doesn't care about it.
@@ -3028,7 +3020,6 @@ public final class ViewRootImpl implements ViewParent,
.softInputMode &=
~WindowManager.LayoutParams
.SOFT_INPUT_IS_FORWARD_NAVIGATION;
mHasHadWindowFocus = true;
// Refocusing a window that has a focused view should fire a
// focus event for the view since the global focused view changed.

View File

@@ -358,7 +358,7 @@ public final class InputMethodManager {
boolean mActive = false;
/**
* {@code true} if next {@link #onPostWindowFocus(View, View, int, boolean, int)} needs to
* {@code true} if next {@link #onPostWindowFocus(View, View, int, int)} needs to
* restart input.
*/
boolean mRestartOnNextWindowFocus = true;
@@ -1925,13 +1925,12 @@ public final class InputMethodManager {
* @hide
*/
public void onPostWindowFocus(View rootView, View focusedView,
@SoftInputModeFlags int softInputMode, boolean first, int windowFlags) {
@SoftInputModeFlags int softInputMode, int windowFlags) {
boolean forceNewFocus = false;
synchronized (mH) {
if (DEBUG) Log.v(TAG, "onWindowFocus: " + focusedView
+ " softInputMode=" + InputMethodDebug.softInputModeToString(softInputMode)
+ " first=" + first + " flags=#"
+ Integer.toHexString(windowFlags));
+ " flags=#" + Integer.toHexString(windowFlags));
if (mRestartOnNextWindowFocus) {
if (DEBUG) Log.v(TAG, "Restarting due to mRestartOnNextWindowFocus");
mRestartOnNextWindowFocus = false;
@@ -1947,9 +1946,6 @@ public final class InputMethodManager {
startInputFlags |= StartInputFlags.IS_TEXT_EDITOR;
}
}
if (first) {
startInputFlags |= StartInputFlags.FIRST_WINDOW_FOCUS_GAIN;
}
if (checkFocusNoStartInput(forceNewFocus)) {
// We need to restart input on the current focus view. This

View File

@@ -168,9 +168,6 @@ public final class InputMethodDebug {
if ((startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0) {
joiner.add("IS_TEXT_EDITOR");
}
if ((startInputFlags & StartInputFlags.FIRST_WINDOW_FOCUS_GAIN) != 0) {
joiner.add("FIRST_WINDOW_FOCUS_GAIN");
}
if ((startInputFlags & StartInputFlags.INITIAL_CONNECTION) != 0) {
joiner.add("INITIAL_CONNECTION");
}

View File

@@ -30,7 +30,6 @@ import java.lang.annotation.Retention;
@IntDef(flag = true, value = {
StartInputFlags.VIEW_HAS_FOCUS,
StartInputFlags.IS_TEXT_EDITOR,
StartInputFlags.FIRST_WINDOW_FOCUS_GAIN,
StartInputFlags.INITIAL_CONNECTION})
public @interface StartInputFlags {
/**
@@ -43,14 +42,9 @@ public @interface StartInputFlags {
*/
int IS_TEXT_EDITOR = 2;
/**
* This is the first time the window has gotten focus.
*/
int FIRST_WINDOW_FOCUS_GAIN = 4;
/**
* An internal concept to distinguish "start" and "restart". This concept doesn't look well
* documented hence we probably need to revisit this though.
*/
int INITIAL_CONNECTION = 8;
int INITIAL_CONNECTION = 4;
}