diff options
author | Kyrylo Mikos <kiril.mik.os@gmail.com> | 2013-11-14 23:20:25 +0200 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-25 21:49:34 -0700 |
commit | 04e1696c81b9796b45a5f3abcbc6748ff2199ab6 (patch) | |
tree | 7bfc06a31c5d90b5814ce845f5d1e9346c437df9 /services/java | |
parent | dc41433a7555945bf0b617c65db1b75258aedc86 (diff) | |
download | frameworks_base-04e1696c81b9796b45a5f3abcbc6748ff2199ab6.zip frameworks_base-04e1696c81b9796b45a5f3abcbc6748ff2199ab6.tar.gz frameworks_base-04e1696c81b9796b45a5f3abcbc6748ff2199ab6.tar.bz2 |
PhoneWindowManager: add ability to use EdgeGestureService for system gestures.
Update: Default to enabled
Conflicts:
core/java/android/provider/Settings.java
services/core/java/com/android/server/policy/policy/impl/PhoneWindowManager.java
Change-Id: Id4e2c0d82f771cd1c20e9196fb6db347494cca69
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/gesture/EdgeGestureService.java | 7 | ||||
-rw-r--r-- | services/java/com/android/server/gesture/EdgeGestureTracker.java | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/services/java/com/android/server/gesture/EdgeGestureService.java b/services/java/com/android/server/gesture/EdgeGestureService.java index 4ff2a5b..c023294 100644 --- a/services/java/com/android/server/gesture/EdgeGestureService.java +++ b/services/java/com/android/server/gesture/EdgeGestureService.java @@ -20,6 +20,7 @@ import static com.android.internal.util.gesture.EdgeServiceConstants.SENSITIVITY import static com.android.internal.util.gesture.EdgeServiceConstants.SENSITIVITY_MASK; import static com.android.internal.util.gesture.EdgeServiceConstants.SENSITIVITY_NONE; import static com.android.internal.util.gesture.EdgeServiceConstants.SENSITIVITY_SHIFT; +import static com.android.internal.util.gesture.EdgeServiceConstants.LONG_LIVING; import android.Manifest; import android.content.Context; @@ -94,6 +95,7 @@ public class EdgeGestureService extends IEdgeGestureService.Stub { private void updateFlags(int flags) { this.positions = flags & POSITION_MASK; this.sensitivity = (flags & SENSITIVITY_MASK) >> SENSITIVITY_SHIFT; + this.longLiving = (flags & LONG_LIVING) != 0; } private boolean eligibleForActivation(int positionFlag) { @@ -165,6 +167,7 @@ public class EdgeGestureService extends IEdgeGestureService.Stub { public int positions; public int sensitivity; public final IEdgeGestureActivationListener listener; + public boolean longLiving = false; } private final List<EdgeGestureActivationListenerRecord> mEdgeGestureActivationListener = new ArrayList<EdgeGestureActivationListenerRecord>(); @@ -202,6 +205,7 @@ public class EdgeGestureService extends IEdgeGestureService.Stub { synchronized(mLock) { mGlobalPositions = 0; mGlobalSensitivity = SENSITIVITY_NONE; + boolean someLongLiving = false; int activePositions = 0; for (EdgeGestureActivationListenerRecord temp : mEdgeGestureActivationListener) { mGlobalPositions |= temp.positions; @@ -211,6 +215,7 @@ public class EdgeGestureService extends IEdgeGestureService.Stub { if (temp.sensitivity != SENSITIVITY_NONE) { mGlobalSensitivity = Math.max(mGlobalSensitivity, temp.sensitivity); } + someLongLiving |= temp.longLiving; } boolean havePositions = mGlobalPositions != 0; mGlobalPositions &= ~activePositions; @@ -221,7 +226,7 @@ public class EdgeGestureService extends IEdgeGestureService.Stub { if (mInputFilter == null && havePositions) { enforceMonitoringLocked(); - } else if (mInputFilter != null && !havePositions) { + } else if (mInputFilter != null && !havePositions && !someLongLiving) { shutdownMonitoringLocked(); } } diff --git a/services/java/com/android/server/gesture/EdgeGestureTracker.java b/services/java/com/android/server/gesture/EdgeGestureTracker.java index add5e5c..17cd95e 100644 --- a/services/java/com/android/server/gesture/EdgeGestureTracker.java +++ b/services/java/com/android/server/gesture/EdgeGestureTracker.java @@ -22,6 +22,7 @@ import android.view.Display; import android.view.MotionEvent; import com.android.internal.util.gesture.EdgeGesturePosition; +import com.android.internal.util.gesture.EdgeServiceConstants; /** * A simple {@link MotionEvent} tracker class. The main aim of this tracker is to @@ -109,6 +110,7 @@ public class EdgeGestureTracker { } public boolean start(MotionEvent motionEvent, int positions, int sensitivity) { + final boolean unrestricted = (positions & EdgeServiceConstants.UNRESTRICTED) != 0; final int x = (int) motionEvent.getX(); final float fx = motionEvent.getX() / mDisplayWidth; final int y = (int) motionEvent.getY(); @@ -118,25 +120,25 @@ public class EdgeGestureTracker { setSensitivity(sensitivity); if ((positions & EdgeGesturePosition.LEFT.FLAG) != 0) { - if (x < mThickness && fy > 0.1f && fy < 0.9f) { + if (x < mThickness && (unrestricted || (fy > 0.1f && fy < 0.9f))) { startWithPosition(motionEvent, EdgeGesturePosition.LEFT); return true; } } if ((positions & EdgeGesturePosition.BOTTOM.FLAG) != 0) { - if (y > mDisplayHeight - mThickness && fx > 0.1f && fx < 0.9f) { + if (y > mDisplayHeight - mThickness && (unrestricted || (fx > 0.1f && fx < 0.9f))) { startWithPosition(motionEvent, EdgeGesturePosition.BOTTOM); return true; } } if ((positions & EdgeGesturePosition.RIGHT.FLAG) != 0) { - if (x > mDisplayWidth - mThickness && fy > 0.1f && fy < 0.9f) { + if (x > mDisplayWidth - mThickness && (unrestricted || (fy > 0.1f && fy < 0.9f))) { startWithPosition(motionEvent, EdgeGesturePosition.RIGHT); return true; } } if ((positions & EdgeGesturePosition.TOP.FLAG) != 0) { - if (y < mThickness && fx > 0.1f && fx < 0.9f) { + if (y < mThickness && (unrestricted || (fx > 0.1f && fx < 0.9f))) { startWithPosition(motionEvent, EdgeGesturePosition.TOP); return true; } |