Add WINDOW_GAINED_FOCUS to IntDef annotation

This CL adds the missing WINDOW_GAINED_FOCUS annotation to the
StartInputFlags IntDef declaration to avoid compiler warnings such as
the one in IMMS#startInputOrWindowGainedFocusInternalLocked.

Also, this CL replaces decimals with bit-shift expressions as per AOSP
style guide.

Test: make
Bug: 205676419
Change-Id: I51fe293149d6f7fab5790d13764449d62cbdb668
This commit is contained in:
Nikolas Havrikov
2021-11-10 17:16:30 +01:00
parent c1eed6d9ce
commit 4a93fae0d6

View File

@@ -30,7 +30,9 @@ import java.lang.annotation.Retention;
@IntDef(flag = true, value = {
StartInputFlags.VIEW_HAS_FOCUS,
StartInputFlags.IS_TEXT_EDITOR,
StartInputFlags.INITIAL_CONNECTION})
StartInputFlags.INITIAL_CONNECTION,
StartInputFlags.WINDOW_GAINED_FOCUS,
})
public @interface StartInputFlags {
/**
* There is a focused view in the focused window.
@@ -40,17 +42,17 @@ public @interface StartInputFlags {
/**
* The focused view is a text editor.
*/
int IS_TEXT_EDITOR = 2;
int IS_TEXT_EDITOR = 1 << 1;
/**
* 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 = 4;
int INITIAL_CONNECTION = 1 << 2;
/**
* The start input happens when the window gained focus to call
* {@code android.view.inputmethod.InputMethodManager#startInputAsyncOnWindowFocusGain}.
*/
int WINDOW_GAINED_FOCUS = 8;
int WINDOW_GAINED_FOCUS = 1 << 3;
}