Move floating rotation button handling to Launcher

Moves handling of floating rotation button when navigation
bar is not created to the launcher. This button was not
showing when taskbar is visible as it was initialized in
navigation bar (which is not created for large screens).

Bug: 200103245
Test: rotate phone when autorotate disabled on inner screen
Test: showing rotate suggestion when gesture nav enabled/disabled
Change-Id: I13dd555bcd811f1524be7ab9ad51b2b012b3b749
This commit is contained in:
Nick Chameyev
2021-10-21 15:31:51 +01:00
parent e6a04336eb
commit 0288d2e8bb
11 changed files with 81 additions and 594 deletions

View File

@@ -94,6 +94,7 @@ public class TaskbarStashController {
private final SharedPreferences mPrefs;
private final int mStashedHeight;
private final int mUnstashedHeight;
private final SystemUiProxy mSystemUiProxy;
// Initialized in init.
private TaskbarControllers mControllers;
@@ -127,6 +128,7 @@ public class TaskbarStashController {
mPrefs = Utilities.getPrefs(mActivity);
final Resources resources = mActivity.getResources();
mStashedHeight = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
mUnstashedHeight = mActivity.getDeviceProfile().taskbarSize;
}
@@ -155,8 +157,7 @@ public class TaskbarStashController {
!mActivity.isUserSetupComplete() || sharedState.setupUIVisible);
applyState();
SystemUiProxy.INSTANCE.get(mActivity)
.notifyTaskbarStatus(/* visible */ false, /* stashed */ isStashedInApp());
notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp());
}
/**
@@ -440,8 +441,7 @@ public class TaskbarStashController {
mControllers.uiController.onStashedInAppChanged();
}
if (hasAnyFlag(changedFlags, FLAGS_STASHED_IN_APP | FLAG_IN_APP)) {
SystemUiProxy.INSTANCE.get(mActivity)
.notifyTaskbarStatus(/* visible */ hasAnyFlag(FLAG_IN_APP),
notifyStashChange(/* visible */ hasAnyFlag(FLAG_IN_APP),
/* stashed */ isStashedInApp());
}
if (hasAnyFlag(changedFlags, FLAG_STASHED_IN_APP_MANUAL)) {
@@ -453,6 +453,11 @@ public class TaskbarStashController {
}
}
private void notifyStashChange(boolean visible, boolean stashed) {
mSystemUiProxy.notifyTaskbarStatus(visible, stashed);
mControllers.rotationButtonController.onTaskbarStateChange(visible, stashed);
}
private class StatePropertyHolder {
private final IntPredicate mStashCondition;