Refill all the dispatcher views when updating rotation

- Due to a change in ordering, the button dispatcher list is not complete
  until after inflation and the nav bar controller notifies the view of
  the current nav mode.  When this happens and the rotation button is
  updated, also update the list of views in the dispatcher list.

Bug: 229708157
Test: Enabled 3 button, kill SysUI, rotate and verify button shows
Change-Id: I20171f31cc485eb41a0def841e4b89b761bb63f2
This commit is contained in:
Winson Chung
2022-05-10 06:01:14 +00:00
parent 827c5557cd
commit 446df44b6e
2 changed files with 7 additions and 1 deletions

View File

@@ -168,6 +168,7 @@ public class NavigationBarInflaterView extends FrameLayout
public void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
mButtonDispatchers = buttonDispatchers;
clearDispatcherViews();
for (int i = 0; i < buttonDispatchers.size(); i++) {
initiallyFill(buttonDispatchers.valueAt(i));
}
@@ -454,12 +455,16 @@ public class NavigationBarInflaterView extends FrameLayout
}
}
private void clearViews() {
private void clearDispatcherViews() {
if (mButtonDispatchers != null) {
for (int i = 0; i < mButtonDispatchers.size(); i++) {
mButtonDispatchers.valueAt(i).clear();
}
}
}
private void clearViews() {
clearDispatcherViews();
clearAllChildren(mHorizontal.findViewById(R.id.nav_buttons));
clearAllChildren(mVertical.findViewById(R.id.nav_buttons));
}

View File

@@ -538,6 +538,7 @@ public class NavigationBarView extends FrameLayout {
mRotationButtonController.setRotationButton(mRotationContextButton,
mRotationButtonListener);
}
mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers);
}
public KeyButtonDrawable getBackDrawable() {