android: Check input hint with immediate next work info only

Make input hint checks in message_pump_android only when next_work_info
is immediate. The benefit is to save one call to HasInput() when the
loop is about to break anyway.

Currently InputHintChecker::HasInput() is disabled behind the experiment
YieldWithInputHint (always returns false). Therefore there is no harm
this change can cause.

Side note: There is another early loop break (using the
yield_to_native), which belongs to another experiment. It does so the
same way as this change proposes.

The idea was kindly provided by mthiesse@.

Bug: 326417367
Change-Id: I98291a9a20d218abe4b9abe4130dda34560744ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5654430
Reviewed-by: Michael Thiessen <[email protected]>
Commit-Queue: Egor Pasko <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1320511}
diff --git a/base/message_loop/message_pump_android.cc b/base/message_loop/message_pump_android.cc
index bdbbd84..b3df4a3 100644
--- a/base/message_loop/message_pump_android.cc
+++ b/base/message_loop/message_pump_android.cc
@@ -221,7 +221,8 @@
     // hint false negatives" happen, for example, during initialization, in
     // multi-window cases, or when a previous value is cached to throttle
     // polling the input channel.
-    if (is_type_ui_ && android::InputHintChecker::HasInput()) {
+    if (is_type_ui_ && next_work_info.is_immediate() &&
+        android::InputHintChecker::HasInput()) {
       ScheduleWork();
       return;
     }