Merge "Allow gestural nav to trigger the transient bars when swiping on side edges" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
486be51f6f
@@ -3270,6 +3270,10 @@
|
||||
<!-- Controls whether the navigation bar lets through taps. -->
|
||||
<bool name="config_navBarTapThrough">false</bool>
|
||||
|
||||
<!-- Controls whether the side edge gestures can always trigger the transient nav bar to
|
||||
show. -->
|
||||
<bool name="config_navBarAlwaysShowOnSideEdgeGesture">false</bool>
|
||||
|
||||
<!-- Controls the size of the back gesture inset. -->
|
||||
<dimen name="config_backGestureInset">0dp</dimen>
|
||||
|
||||
|
||||
@@ -2869,6 +2869,7 @@
|
||||
<java-symbol type="integer" name="config_navBarInteractionMode" />
|
||||
<java-symbol type="bool" name="config_navBarCanMove" />
|
||||
<java-symbol type="bool" name="config_navBarTapThrough" />
|
||||
<java-symbol type="bool" name="config_navBarAlwaysShowOnSideEdgeGesture" />
|
||||
<java-symbol type="bool" name="config_navBarNeedsScrim" />
|
||||
<java-symbol type="dimen" name="config_backGestureInset" />
|
||||
<java-symbol type="color" name="system_bar_background_semi_transparent" />
|
||||
|
||||
@@ -37,4 +37,8 @@
|
||||
{@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
|
||||
<bool name="config_navBarNeedsScrim">false</bool>
|
||||
|
||||
<!-- Controls whether the side edge gestures can always trigger the transient nav bar to
|
||||
show. -->
|
||||
<bool name="config_navBarAlwaysShowOnSideEdgeGesture">true</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -124,6 +124,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.hardware.power.V1_0.PowerHint;
|
||||
import android.os.Handler;
|
||||
@@ -230,7 +231,6 @@ public class DisplayPolicy {
|
||||
private int mBottomGestureAdditionalInset;
|
||||
@Px
|
||||
private int mSideGestureInset;
|
||||
private boolean mNavigationBarLetsThroughTaps;
|
||||
|
||||
private StatusBarManagerInternal getStatusBarManagerInternal() {
|
||||
synchronized (mServiceAcquireLock) {
|
||||
@@ -252,6 +252,8 @@ public class DisplayPolicy {
|
||||
private volatile boolean mHasNavigationBar;
|
||||
// Can the navigation bar ever move to the side?
|
||||
private volatile boolean mNavigationBarCanMove;
|
||||
private volatile boolean mNavigationBarLetsThroughTaps;
|
||||
private volatile boolean mNavigationBarAlwaysShowOnSideGesture;
|
||||
|
||||
// Written by vr manager thread, only read in this class.
|
||||
private volatile boolean mPersistentVrModeEnabled;
|
||||
@@ -463,22 +465,31 @@ public class DisplayPolicy {
|
||||
|
||||
@Override
|
||||
public void onSwipeFromBottom() {
|
||||
if (mNavigationBar != null
|
||||
&& mNavigationBarPosition == NAV_BAR_BOTTOM) {
|
||||
if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_BOTTOM) {
|
||||
requestTransientBars(mNavigationBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwipeFromRight() {
|
||||
if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_RIGHT) {
|
||||
final Region excludedRegion =
|
||||
mDisplayContent.calculateSystemGestureExclusion();
|
||||
final boolean sideAllowed = mNavigationBarAlwaysShowOnSideGesture
|
||||
|| mNavigationBarPosition == NAV_BAR_RIGHT;
|
||||
if (mNavigationBar != null && sideAllowed
|
||||
&& !mSystemGestures.currentGestureStartedInRegion(excludedRegion)) {
|
||||
requestTransientBars(mNavigationBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwipeFromLeft() {
|
||||
if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_LEFT) {
|
||||
final Region excludedRegion =
|
||||
mDisplayContent.calculateSystemGestureExclusion();
|
||||
final boolean sideAllowed = mNavigationBarAlwaysShowOnSideGesture
|
||||
|| mNavigationBarPosition == NAV_BAR_LEFT;
|
||||
if (mNavigationBar != null && sideAllowed
|
||||
&& !mSystemGestures.currentGestureStartedInRegion(excludedRegion)) {
|
||||
requestTransientBars(mNavigationBar);
|
||||
}
|
||||
}
|
||||
@@ -2696,6 +2707,8 @@ public class DisplayPolicy {
|
||||
mNavBarOpacityMode = res.getInteger(R.integer.config_navBarOpacityMode);
|
||||
mSideGestureInset = res.getDimensionPixelSize(R.dimen.config_backGestureInset);
|
||||
mNavigationBarLetsThroughTaps = res.getBoolean(R.bool.config_navBarTapThrough);
|
||||
mNavigationBarAlwaysShowOnSideGesture =
|
||||
res.getBoolean(R.bool.config_navBarAlwaysShowOnSideEdgeGesture);
|
||||
|
||||
// This should calculate how much above the frame we accept gestures.
|
||||
mBottomGestureAdditionalInset = Math.max(0,
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.wm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.display.DisplayManagerGlobal;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
@@ -201,6 +202,10 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean currentGestureStartedInRegion(Region r) {
|
||||
return r.contains((int) mDownX[0], (int) mDownY[0]);
|
||||
}
|
||||
|
||||
private int findIndex(int pointerId) {
|
||||
for (int i = 0; i < mDownPointers; i++) {
|
||||
if (mDownPointerId[i] == pointerId) {
|
||||
|
||||
Reference in New Issue
Block a user