From 4a93fae0d60faa00e01b0ddaa5701ed88103c2a4 Mon Sep 17 00:00:00 2001 From: Nikolas Havrikov Date: Wed, 10 Nov 2021 17:16:30 +0100 Subject: [PATCH] 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 --- .../android/internal/inputmethod/StartInputFlags.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/inputmethod/StartInputFlags.java b/core/java/com/android/internal/inputmethod/StartInputFlags.java index ac83987ef12c4..dd4ff672c0618 100644 --- a/core/java/com/android/internal/inputmethod/StartInputFlags.java +++ b/core/java/com/android/internal/inputmethod/StartInputFlags.java @@ -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; }