Dispatch newDisplayLayout in updateDisplayLayout() directly

Empty DisplayLayout do not contain navigation bar height

Bug : Cold boot and set 3 Button NavBar Mode, observe
one handed mode can not trigger

Recovery step : Rotate once and the gesture become activate

Fixes: 183951120
Test: create forest and flash ROM, set NavBar 3 Button Mode.
Test: atest WMShellUnitTests
Change-Id: I930216719f77d0e15d46790e02b788ce9cd80e98
This commit is contained in:
Bill Lin
2021-03-30 01:07:28 +08:00
parent b6521e0a8b
commit 894696d61e
2 changed files with 4 additions and 4 deletions

View File

@@ -403,9 +403,9 @@ public class OneHandedController implements RemoteCallable<OneHandedController>
}
private void updateDisplayLayout(int displayId) {
mDisplayAreaOrganizer.setDisplayLayout(
mDisplayController.getDisplayLayout(displayId));
mGestureHandler.onDisplayChanged(mDisplayAreaOrganizer.getDisplayLayout());
final DisplayLayout newDisplayLayout = mDisplayController.getDisplayLayout(displayId);
mDisplayAreaOrganizer.setDisplayLayout(newDisplayLayout);
mGestureHandler.onDisplayChanged(newDisplayLayout);
}
private ContentObserver getObserver(Runnable onChangeRunnable) {

View File

@@ -63,7 +63,7 @@ public class OneHandedGestureHandler implements OneHandedTransitionCallback {
private boolean mIsEnabled;
private int mNavGestureHeight;
private boolean mIsThreeButtonModeEnabled;
private int mRotation;
private int mRotation = Surface.ROTATION_0;
@VisibleForTesting
InputMonitor mInputMonitor;