From 5435b07ed4504522a0f6a614710f95d5d5c83865 Mon Sep 17 00:00:00 2001 From: thiruram Date: Tue, 1 Jun 2021 15:49:01 -0700 Subject: [PATCH] [AA+] Fixing missing logs forr keyboard close interactions. Bug: 178562918 Test: Manual Change-Id: Id5a7fc3d8ded675c6a64de7416fade74ae2bacd1 --- src/com/android/launcher3/allapps/AllAppsRecyclerView.java | 7 ++++--- src/com/android/launcher3/util/UiThreadHelper.java | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index c6c9c9b72b..d536c3afeb 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -21,6 +21,7 @@ import static android.view.View.MeasureSpec.makeMeasureSpec; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_VERTICAL_SWIPE_END; +import static com.android.launcher3.util.UiThreadHelper.hideKeyboardAsync; import android.content.Context; import android.content.res.Resources; @@ -31,7 +32,6 @@ import android.util.Log; import android.util.SparseIntArray; import android.view.MotionEvent; import android.view.View; -import android.view.WindowInsets; import androidx.recyclerview.widget.RecyclerView; @@ -41,6 +41,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.logging.StatsLogManager; +import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.RecyclerViewFastScroller; import java.util.ArrayList; @@ -189,8 +190,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView { case SCROLL_STATE_DRAGGING: mgr.logger().sendToInteractionJankMonitor( LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this); - requestFocus(); - getWindowInsetsController().hide(WindowInsets.Type.ime()); + hideKeyboardAsync(ActivityContext.lookupContext(getContext()), + getApplicationWindowToken()); break; case SCROLL_STATE_IDLE: mgr.logger().sendToInteractionJankMonitor( diff --git a/src/com/android/launcher3/util/UiThreadHelper.java b/src/com/android/launcher3/util/UiThreadHelper.java index 947f96fe56..b9387a87a3 100644 --- a/src/com/android/launcher3/util/UiThreadHelper.java +++ b/src/com/android/launcher3/util/UiThreadHelper.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.util; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.annotation.SuppressLint; @@ -27,6 +28,7 @@ import android.view.View; import android.view.WindowInsets; import android.view.inputmethod.InputMethodManager; +import com.android.launcher3.Launcher; import com.android.launcher3.Utilities; import com.android.launcher3.views.ActivityContext; @@ -57,6 +59,8 @@ public class UiThreadHelper { Message.obtain(HANDLER.get(root.getContext()), MSG_HIDE_KEYBOARD, token).sendToTarget(); + Launcher.cast(activityContext).getStatsLogManager().logger().log( + LAUNCHER_ALLAPPS_KEYBOARD_CLOSED); } public static void setOrientationAsync(Activity activity, int orientation) {