Only clear focus in touch mode

When not in touch mode, Android will focus the first focusable view when
focus is cleared. This causes focus to move to the top when scrolling
via rotary. Prevent this by making the call to clearFocus() conditional
on being in touch mode. There's no need to clear focus when using rotary
because the IME is dismissed as soon as focus moves to the list of
contacts.

Test: search and scroll through matching contacts via rotary
Bug: 175334372
Change-Id: I35c3b6a2a2037a885ce82099c41a83a9d48e28fd
diff --git a/src/com/android/car/dialer/ui/search/ContactResultsFragment.java b/src/com/android/car/dialer/ui/search/ContactResultsFragment.java
index 1cdd5e4..252fbc1 100644
--- a/src/com/android/car/dialer/ui/search/ContactResultsFragment.java
+++ b/src/com/android/car/dialer/ui/search/ContactResultsFragment.java
@@ -111,9 +111,9 @@
             @Override
             public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                 if (dy != 0) {
-                    // Clear the focus to dismiss the keyboard.
+                    // Clear the focus to dismiss the keyboard in touch mode.
                     View focusedView = getActivity().getCurrentFocus();
-                    if (focusedView != null) {
+                    if (focusedView != null && focusedView.isInTouchMode()) {
                         focusedView.clearFocus();
                     }
                 }