diff options
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 487b15c03292..1f81a6418962 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -235,6 +235,7 @@ import com.android.internal.policy.PhoneFallbackEventHandler; import com.android.internal.view.BaseSurfaceHolder; import com.android.internal.view.RootViewSurfaceTaker; import com.android.internal.view.SurfaceCallbackHelper; +import com.android.modules.expresslog.Counter; import com.android.window.flags.Flags; import java.io.IOException; @@ -9704,6 +9705,9 @@ public final class ViewRootImpl implements ViewParent, } else { q.mReceiver.finishInputEvent(q.mEvent, handled); } + if (q.mEvent instanceof KeyEvent) { + logHandledSystemKey((KeyEvent) q.mEvent, handled); + } } else { q.mEvent.recycleIfNeededAfterDispatch(); } @@ -9711,6 +9715,19 @@ public final class ViewRootImpl implements ViewParent, recycleQueuedInputEvent(q); } + private void logHandledSystemKey(KeyEvent event, boolean handled) { + final int keyCode = event.getKeyCode(); + if (keyCode != KeyEvent.KEYCODE_STEM_PRIMARY) { + return; + } + if (event.isDown() && event.getRepeatCount() == 0 && handled) { + // Initial DOWN event is handled. Log the stem primary key press. + Counter.logIncrementWithUid( + "input.value_app_handled_stem_primary_key_gestures_count", + Process.myUid()); + } + } + static boolean isTerminalInputEvent(InputEvent event) { if (event instanceof KeyEvent) { final KeyEvent keyEvent = (KeyEvent)event; |