Landscape 3 button nav on taskbar phone supported

* TODO: Seascape bar positioning, add tests

Change-Id: I542be2f2f682d8c8a9cdd9bb6c667c44ca167f3e
This commit is contained in:
Vinit Nayak
2022-09-27 23:48:15 +00:00
parent 3ecceb8680
commit 831a4f0e1d
17 changed files with 992 additions and 140 deletions

View File

@@ -153,6 +153,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
mIsNavBarForceVisible = settingsCache.getValue(
Settings.Secure.getUriFor(Settings.Secure.NAV_BAR_KIDS_MODE), 0);
// TODO(b/244231596) For shared Taskbar window, update this value in init() instead so
// to get correct value when recreating the taskbar
mIsNavBarKidsMode = settingsCache.getValue(
Settings.Secure.getUriFor(Settings.Secure.NAV_BAR_KIDS_MODE), 0);
@@ -273,9 +276,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
* @param type The window type to pass to the created WindowManager.LayoutParams.
*/
public WindowManager.LayoutParams createDefaultWindowLayoutParams(int type) {
DeviceProfile deviceProfile = getDeviceProfile();
// Taskbar is on the logical bottom of the screen
boolean isVerticalBarLayout = TaskbarManager.isPhoneMode(deviceProfile) &&
deviceProfile.isLandscape;
WindowManager.LayoutParams windowLayoutParams = new WindowManager.LayoutParams(
MATCH_PARENT,
mLastRequestedNonFullscreenHeight,
isVerticalBarLayout ? mLastRequestedNonFullscreenHeight : MATCH_PARENT,
isVerticalBarLayout ? MATCH_PARENT : mLastRequestedNonFullscreenHeight,
type,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_SLIPPERY
@@ -283,7 +290,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
PixelFormat.TRANSLUCENT);
windowLayoutParams.setTitle(WINDOW_TITLE);
windowLayoutParams.packageName = getPackageName();
windowLayoutParams.gravity = Gravity.BOTTOM;
windowLayoutParams.gravity = !isVerticalBarLayout ?
Gravity.BOTTOM :
Gravity.END; // TODO(b/230394142): seascape
windowLayoutParams.setFitInsetsTypes(0);
windowLayoutParams.receiveInsetsIgnoringZOrder = true;
windowLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
@@ -800,7 +810,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
return mIsUserSetupComplete;
}
protected boolean isNavBarKidsModeActive() {
public boolean isNavBarKidsModeActive() {
return mIsNavBarKidsMode && isThreeButtonNav();
}