From 5ca3547d8ecbf5e3f285613e6f81ab129c80d380 Mon Sep 17 00:00:00 2001 From: danielwbhuang Date: Thu, 6 Apr 2023 17:53:24 +0800 Subject: [PATCH] Force keeping BottomSheetBehavior to STATE_EXPANDED The shortcuts list in the new keyboard shortcuts UI cannot be scrolled down easily, so we should keeping BottomSheetBehavior to STATE_EXPANDED. Demo:https://screencast.googleplex.com/cast/NTExMzkyNTMxNTA2NzkwNHxhZTgwZjFkNC02ZA Bug: 277139155 Test: manual Change-Id: Ic6e6fdd27eaa1577a1977e398bb2e76218f94aca --- .../statusbar/KeyboardShortcutListSearch.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java index c84894fc81ee2..06f43f1eeaa58 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java @@ -841,6 +841,19 @@ public final class KeyboardShortcutListSearch { BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet); behavior.setState(BottomSheetBehavior.STATE_EXPANDED); behavior.setSkipCollapsed(true); + behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { + @Override + public void onStateChanged(@NonNull View bottomSheet, int newState) { + if (newState == BottomSheetBehavior.STATE_DRAGGING) { + behavior.setState(BottomSheetBehavior.STATE_EXPANDED); + } + } + + @Override + public void onSlide(@NonNull View bottomSheet, float slideOffset) { + // Do nothing. + } + }); mKeyboardShortcutsBottomSheetDialog.setCanceledOnTouchOutside(true); Window keyboardShortcutsWindow = mKeyboardShortcutsBottomSheetDialog.getWindow();