Snap for 7533212 from 4847512d42a73623bbb2b9dca7f4063f58fcd462 to sc-release
Change-Id: I9fd184d3fbc87cac41e49ca187dfe4cf844181a3
diff --git a/car-ui-lib/car-rotary-lib/src/main/java/com/android/car/ui/utils/ViewUtils.java b/car-ui-lib/car-rotary-lib/src/main/java/com/android/car/ui/utils/ViewUtils.java
index 15e1a57..fb8b4ab 100644
--- a/car-ui-lib/car-rotary-lib/src/main/java/com/android/car/ui/utils/ViewUtils.java
+++ b/car-ui-lib/car-rotary-lib/src/main/java/com/android/car/ui/utils/ViewUtils.java
@@ -133,6 +133,27 @@
void removeOnLayoutCompleteListener(@Nullable Runnable runnable);
}
+ /**
+ * Hides the focus by searching the view tree for the {@link FocusParkingView}
+ * and focusing on it.
+ *
+ * @param root the root view to search from
+ * @return true if the FocusParkingView was successfully found and focused
+ * or if it was already focused
+ */
+ public static boolean hideFocus(@NonNull View root) {
+ FocusParkingView fpv = (FocusParkingView) depthFirstSearch(root,
+ /* targetPredicate= */ v -> v instanceof FocusParkingView,
+ /* skipPredicate= */ null);
+ if (fpv == null) {
+ return false;
+ }
+ if (fpv.isFocused()) {
+ return true;
+ }
+ return fpv.performAccessibilityAction(ACTION_FOCUS, /* arguments= */ null);
+ }
+
/** Gets the ancestor FocusArea of the {@code view}, if any. Returns null if not found. */
@Nullable
public static FocusArea getAncestorFocusArea(@NonNull View view) {
diff --git a/car-ui-lib/lint-baseline.xml b/car-ui-lib/lint-baseline.xml
deleted file mode 100644
index 1689f30..0000000
--- a/car-ui-lib/lint-baseline.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
-
- <issue
- id="NewApi"
- message="Call requires API level R (current min is 28): `android.view.SurfaceControlViewHost#relayout`"
- errorLine1=" mSurfaceControlViewHost.relayout(width, height);"
- errorLine2=" ~~~~~~~~">
- <location
- file="packages/apps/Car/libs/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/toolbar/SearchView.java"
- line="561"
- column="41"/>
- </issue>
-
-</issues>