Fix focus nav of AllApps when Searching.

- Do not focus the Icon in Small Icon Result Rows
- Use FocusIndicatorHelper when focusing search result icons

Flag: NONE
Bug: 296844600
Fix: 310173226
Test: Test: TaplKeyboardFocusTest
Change-Id: Icfc82ae41ffc8ef7c7ad42950f98f3d2dc805795
This commit is contained in:
Pat Manning committed 2023-11-10 16:48:21 +00:00
1 parent 7d56e6ea23
commit e7cb65009e
2 files changed
+45 -1

No files matched your search

@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowInsets;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -76,4 +78,39 @@ public class TaplKeyboardFocusTest extends AbstractLauncherUiTest {
allApps.unfreeze();
}
}
@Test
public void testAllAppsExitSearchAndFocusSearchResults() {
final HomeAllApps allApps = mLauncher.goHome().switchToAllApps();
assertTrue("Launcher internal state is not All Apps",
isInState(() -> LauncherState.ALL_APPS));
allApps.freeze();
try {
executeOnLauncher(launcher -> launcher.getAppsView().getSearchView().requestFocus());
waitForLauncherCondition("Search view does not have focus.",
launcher -> launcher.getAppsView().getSearchView().hasFocus());
mLauncher.pressAndHoldKeyCode(KeyEvent.KEYCODE_C, 0);
waitForLauncherCondition("Search view not active.",
launcher -> launcher.getAppsView().getActiveRecyclerView()
instanceof SearchRecyclerView);
mLauncher.unpressKeyCode(KeyEvent.KEYCODE_C, 0);
executeOnLauncher(launcher -> launcher.getAppsView().getSearchUiManager().getEditText()
.hideKeyboard(/* clearFocus= */ false));
waitForLauncherCondition("Keyboard still visible.", launcher -> {
View root = launcher.getDragLayer();
WindowInsets insets = root.getRootWindowInsets();
return insets != null && !insets.isVisible(WindowInsets.Type.ime());
});
mLauncher.pressAndHoldKeyCode(KeyEvent.KEYCODE_DPAD_DOWN, 0);
mLauncher.unpressKeyCode(KeyEvent.KEYCODE_DPAD_DOWN, 0);
waitForLauncherCondition("No focused child", launcher ->
launcher.getAppsView().getActiveRecyclerView().getApps().getFocusedChild()
!= null);
} finally {
allApps.unfreeze();
}
}
}