diff options
author | Alan Viverette <alanv@google.com> | 2013-10-07 18:05:09 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2013-10-07 18:05:09 -0700 |
commit | 516f953a82896a9b431ad87cb457277c62c75162 (patch) | |
tree | cf24ddb3d8d0d8403f16b4a70f624a7e20ad1dca | |
parent | f90299dfbcbae11415e81b78081f816b15f5b7a4 (diff) | |
parent | e4ccb864e8b16d31c158f7cd3bab7e6d8e346d3e (diff) | |
download | frameworks_base-516f953a82896a9b431ad87cb457277c62c75162.zip frameworks_base-516f953a82896a9b431ad87cb457277c62c75162.tar.gz frameworks_base-516f953a82896a9b431ad87cb457277c62c75162.tar.bz2 |
resolved conflicts for merge of e4ccb864 to master
Change-Id: I50c41c712c4eb4f68b22777efb2e5d5370536b22
5 files changed, 55 insertions, 12 deletions
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index fd45866..9d4af00 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -274,4 +274,11 @@ interface IWindowManager * @return The magnification spec if such or null. */ MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken); + + /** + * Sets the current touch exploration state. + * + * @param enabled Whether touch exploration is enabled. + */ + void setTouchExplorationEnabled(boolean enabled); } diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index c295ed0..ec09bc9 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -1198,4 +1198,11 @@ public interface WindowManagerPolicy { * @return True if the window is a top level one. */ public boolean isTopLevelWindow(int windowType); + + /** + * Sets the current touch exploration state. + * + * @param enabled Whether touch exploration is enabled. + */ + public void setTouchExplorationEnabled(boolean enabled); } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 59779dc..fd567f8 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -296,6 +296,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 @@ -1078,14 +1079,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"))) { @@ -1105,6 +1098,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; @@ -2585,7 +2586,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; @@ -2702,6 +2703,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 @@ -2722,7 +2724,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) { @@ -3068,7 +3070,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) { @@ -3206,7 +3208,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 @@ -5096,6 +5098,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; @@ -5146,6 +5152,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 @@ -5189,6 +5203,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) { diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index b1c625f..5e10d26 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -1586,6 +1586,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { Settings.Secure.TOUCH_EXPLORATION_ENABLED, enabled ? 1 : 0, userState.mUserId); } + try { + mWindowManagerService.setTouchExplorationEnabled(enabled); + } catch (RemoteException e) { + e.printStackTrace(); + } } private boolean canRequestAndRequestsTouchExplorationLocked(Service service) { diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 0e0d098..e089ca6 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -5206,6 +5206,11 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.setInputFilter(filter); } + @Override + public void setTouchExplorationEnabled(boolean enabled) { + mPolicy.setTouchExplorationEnabled(enabled); + } + public void setCurrentUser(final int newUserId) { synchronized (mWindowMap) { int oldUserId = mCurrentUserId; |