diff options
author | Alan Viverette <alanv@google.com> | 2013-10-07 15:10:29 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2013-10-07 15:12:57 -0700 |
commit | 5a0f4eccfb1e1774c4aac825bf39bcc4f5fc00e0 (patch) | |
tree | 5a668bfc1c85c46a86ce619ba7745933baa29d85 /policy | |
parent | c37a5ab54e5e3ad3bb816d7c9e2b923af6f74f73 (diff) | |
download | frameworks_base-5a0f4eccfb1e1774c4aac825bf39bcc4f5fc00e0.zip frameworks_base-5a0f4eccfb1e1774c4aac825bf39bcc4f5fc00e0.tar.gz frameworks_base-5a0f4eccfb1e1774c4aac825bf39bcc4f5fc00e0.tar.bz2 |
Ignore certain WindowManager flags when touch exploration is enabled
Specifically, ignore any flags that alter the visibility of the navigation
bar and transparency.
BUG: 11082573
Change-Id: I17264dc55a1c6c3cb9b9cf92d5121799cecee5b8
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index dd4f3d1..3468425 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -293,6 +293,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mOrientationSensorEnabled = false; int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; boolean mHasSoftInput = false; + boolean mTouchExplorationEnabled = false; int mPointerLocationMode = 0; // guarded by mLock @@ -1073,14 +1074,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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"))) { @@ -1100,6 +1093,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { !"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; @@ -2580,7 +2581,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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; @@ -2697,6 +2698,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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 @@ -2717,7 +2719,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // 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) { @@ -3063,7 +3065,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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) { @@ -3201,7 +3203,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { = 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 @@ -5088,6 +5090,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { vis = (vis & ~flags) | (oldVis & flags); } + if (!isTranslucentNavigationAllowed()) { + vis &= ~View.NAVIGATION_BAR_TRANSLUCENT; + } + // update status bar boolean transientAllowed = (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0; @@ -5138,6 +5144,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { && (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 @@ -5181,6 +5195,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } @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) { |