boolean mOrientationSensorEnabled = false;
int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
boolean mHasSoftInput = false;
+ boolean mTouchExplorationEnabled = false;
int mPointerLocationMode = 0; // guarded by mLock
mHasNavigationBar = true;
}
- if (mHasNavigationBar) {
- // The navigation bar is at the right in landscape; it seems always
- // useful to hide it for showing a video.
- mCanHideNavigationBar = true;
- } else {
- mCanHideNavigationBar = false;
- }
-
// For demo purposes, allow the rotation of the HDMI display to be controlled.
// By default, HDMI locks rotation to landscape.
if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
!"true".equals(SystemProperties.get("config.override_forced_orient"));
}
+ /**
+ * @return whether the navigation bar can be hidden, e.g. the device has a
+ * navigation bar and touch exploration is not enabled
+ */
+ private boolean canHideNavigationBar() {
+ return mHasNavigationBar && !mTouchExplorationEnabled;
+ }
+
@Override
public boolean isDefaultOrientationForced() {
return mForceDefaultOrientation;
if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR))
== (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
int availRight, availBottom;
- if (mCanHideNavigationBar &&
+ if (canHideNavigationBar() &&
(systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
availRight = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth;
availBottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight;
boolean navTranslucent = (sysui & View.NAVIGATION_BAR_TRANSLUCENT) != 0;
boolean transientAllowed = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
navTranslucent &= !transientAllowed; // transient trumps translucent
+ navTranslucent &= isTranslucentNavigationAllowed();
// When the navigation bar isn't visible, we put up a fake
// input window to catch all touch events. This way we can
// For purposes of positioning and showing the nav bar, if we have
// decided that it can't be hidden (because of the screen aspect ratio),
// then take that into account.
- navVisible |= !mCanHideNavigationBar;
+ navVisible |= !canHideNavigationBar();
boolean updateSysUiVisibility = false;
if (mNavigationBar != null) {
pf.right = df.right = of.right = mOverscanScreenLeft + mOverscanScreenWidth;
pf.bottom = df.bottom = of.bottom = mOverscanScreenTop
+ mOverscanScreenHeight;
- } else if (mCanHideNavigationBar
+ } else if (canHideNavigationBar()
&& (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
&& attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW
&& attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {
= mOverscanScreenLeft + mOverscanScreenWidth;
pf.bottom = df.bottom = of.bottom = cf.bottom
= mOverscanScreenTop + mOverscanScreenHeight;
- } else if (mCanHideNavigationBar
+ } else if (canHideNavigationBar()
&& (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
&& (attrs.type == TYPE_TOAST
|| (attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW
vis = (vis & ~flags) | (oldVis & flags);
}
+ if (!isTranslucentNavigationAllowed()) {
+ vis &= ~View.NAVIGATION_BAR_TRANSLUCENT;
+ }
+
// update status bar
boolean transientAllowed =
(vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
&& (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
}
+ /**
+ * @return whether the navigation bar can be made translucent, e.g. touch
+ * exploration is not enabled
+ */
+ private boolean isTranslucentNavigationAllowed() {
+ return !mTouchExplorationEnabled;
+ }
+
// Use this instead of checking config_showNavigationBar so that it can be consistently
// overridden by qemu.hw.mainkeys in the emulator.
@Override
}
@Override
+ public void setTouchExplorationEnabled(boolean enabled) {
+ mTouchExplorationEnabled = enabled;
+ }
+
+ @Override
public boolean isTopLevelWindow(int windowType) {
if (windowType >= WindowManager.LayoutParams.FIRST_SUB_WINDOW
&& windowType <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {