Loading core/java/android/provider/DeviceConfig.java +14 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,20 @@ public final class DeviceConfig { String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive"; /** * The minimum duration between gesture exclusion logging for a given window in * milliseconds. * * Events that happen in-between will be silently dropped. * * A non-positive value disables logging. * * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER * @hide */ String KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS = "system_gesture_exclusion_log_debounce_millis"; /** * Key for controlling which packages are explicitly blocked from running at refresh rates * higher than 60hz. Loading core/java/android/view/ISystemGestureExclusionListener.aidl +9 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,14 @@ oneway interface ISystemGestureExclusionListener { * Called when the system gesture exclusion for the given display changed. * @param displayId the display whose system gesture exclusion changed * @param systemGestureExclusion a {@code Region} where the app would like priority over the * system gestures, in display coordinates. * system gestures, in display coordinates. Certain restrictions * might be applied such that apps don't get all the exclusions * they request. * @param systemGestureExclusionUnrestricted a {@code Region} where the app would like priority * over the system gestures, in display coordinates, without * any restrictions applied. Null if no restrictions have been * applied. */ void onSystemGestureExclusionChanged(int displayId, in Region systemGestureExclusion); void onSystemGestureExclusionChanged(int displayId, in Region systemGestureExclusion, in Region systemGestureExclusionUnrestricted); } No newline at end of file core/java/com/android/internal/widget/PointerLocationView.java +35 −2 Original line number Diff line number Diff line Loading @@ -53,6 +53,12 @@ public class PointerLocationView extends View implements InputDeviceListener, // to plot alongside the default one. Useful for testing and comparison purposes. private static final String ALT_STRATEGY_PROPERY_KEY = "debug.velocitytracker.alt"; /** * If set to a positive value between 1-255, shows an overlay with the approved (red) and * rejected (blue) exclusions. */ private static final String GESTURE_EXCLUSION_PROP = "debug.pointerlocation.showexclusion"; public static class PointerState { // Trace of previous points. private float[] mTraceX = new float[32]; Loading Loading @@ -138,8 +144,10 @@ public class PointerLocationView extends View implements InputDeviceListener, private final PointerCoords mTempCoords = new PointerCoords(); private final Region mSystemGestureExclusion = new Region(); private final Region mSystemGestureExclusionRejected = new Region(); private final Path mSystemGestureExclusionPath = new Path(); private final Paint mSystemGestureExclusionPaint; private final Paint mSystemGestureExclusionRejectedPaint; private final VelocityTracker mVelocity; private final VelocityTracker mAltVelocity; Loading Loading @@ -190,6 +198,10 @@ public class PointerLocationView extends View implements InputDeviceListener, mSystemGestureExclusionPaint.setARGB(25, 255, 0, 0); mSystemGestureExclusionPaint.setStyle(Paint.Style.FILL_AND_STROKE); mSystemGestureExclusionRejectedPaint = new Paint(); mSystemGestureExclusionRejectedPaint.setARGB(25, 0, 0, 255); mSystemGestureExclusionRejectedPaint.setStyle(Paint.Style.FILL_AND_STROKE); PointerState ps = new PointerState(); mPointers.add(ps); mActivePointerId = 0; Loading Loading @@ -263,6 +275,12 @@ public class PointerLocationView extends View implements InputDeviceListener, canvas.drawPath(mSystemGestureExclusionPath, mSystemGestureExclusionPaint); } if (!mSystemGestureExclusionRejected.isEmpty()) { mSystemGestureExclusionPath.reset(); mSystemGestureExclusionRejected.getBoundaryPath(mSystemGestureExclusionPath); canvas.drawPath(mSystemGestureExclusionPath, mSystemGestureExclusionRejectedPaint); } // Labels if (mActivePointerId >= 0) { final PointerState ps = mPointers.get(mActivePointerId); Loading Loading @@ -754,6 +772,9 @@ public class PointerLocationView extends View implements InputDeviceListener, } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } final int alpha = systemGestureExclusionOpacity(); mSystemGestureExclusionPaint.setAlpha(alpha); mSystemGestureExclusionRejectedPaint.setAlpha(alpha); } else { mSystemGestureExclusion.setEmpty(); } Loading Loading @@ -805,7 +826,12 @@ public class PointerLocationView extends View implements InputDeviceListener, } private static boolean shouldShowSystemGestureExclusion() { return SystemProperties.getBoolean("debug.pointerlocation.showexclusion", false); return systemGestureExclusionOpacity() > 0; } private static int systemGestureExclusionOpacity() { int x = SystemProperties.getInt(GESTURE_EXCLUSION_PROP, 0); return x >= 0 && x <= 255 ? x : 0; } // HACK Loading Loading @@ -928,12 +954,19 @@ public class PointerLocationView extends View implements InputDeviceListener, private ISystemGestureExclusionListener mSystemGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion, Region systemGestureExclusionUnrestricted) { Region exclusion = Region.obtain(systemGestureExclusion); Region rejected = Region.obtain(); if (systemGestureExclusionUnrestricted != null) { rejected.set(systemGestureExclusionUnrestricted); rejected.op(exclusion, Region.Op.DIFFERENCE); } Handler handler = getHandler(); if (handler != null) { handler.post(() -> { mSystemGestureExclusion.set(exclusion); mSystemGestureExclusionRejected.set(rejected); exclusion.recycle(); invalidate(); }); Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/SystemGestureExclusionListenerCompat.java +23 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,11 @@ public abstract class SystemGestureExclusionListenerCompat { new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { Region systemGestureExclusion, Region unrestrictedOrNull) { if (displayId == mDisplayId) { onExclusionChanged(systemGestureExclusion); Region unrestricted = (unrestrictedOrNull == null) ? systemGestureExclusion : unrestrictedOrNull; onExclusionChanged(systemGestureExclusion, unrestricted); } } }; Loading @@ -47,10 +49,28 @@ public abstract class SystemGestureExclusionListenerCompat { } /** * Called when the exclusion region has changed * Called when the exclusion region has changed. * * TODO: remove, once all subclasses have migrated to * {@link #onExclusionChanged(Region, Region)}. */ public abstract void onExclusionChanged(Region systemGestureExclusion); /** * Called when the exclusion region has changed. * * @param systemGestureExclusion the system gesture exclusion to be applied * @param systemGestureExclusionUnrestricted what would be the system gesture exclusion, if * there were no restrictions being applied. For logging purposes only. * */ public void onExclusionChanged(Region systemGestureExclusion, Region systemGestureExclusionUnrestricted) { // TODO: make abstract, once all subclasses have migrated away from // onExclusionChanged(Region) onExclusionChanged(systemGestureExclusion); } /** * Registers the listener for getting exclusion rect changes. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class EdgeBackGestureHandler implements DisplayListener { new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { Region systemGestureExclusion, Region unrestrictedOrNull) { if (displayId == mDisplayId) { mMainExecutor.execute(() -> mExcludeRegion.set(systemGestureExclusion)); } Loading Loading
core/java/android/provider/DeviceConfig.java +14 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,20 @@ public final class DeviceConfig { String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive"; /** * The minimum duration between gesture exclusion logging for a given window in * milliseconds. * * Events that happen in-between will be silently dropped. * * A non-positive value disables logging. * * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER * @hide */ String KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS = "system_gesture_exclusion_log_debounce_millis"; /** * Key for controlling which packages are explicitly blocked from running at refresh rates * higher than 60hz. Loading
core/java/android/view/ISystemGestureExclusionListener.aidl +9 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,14 @@ oneway interface ISystemGestureExclusionListener { * Called when the system gesture exclusion for the given display changed. * @param displayId the display whose system gesture exclusion changed * @param systemGestureExclusion a {@code Region} where the app would like priority over the * system gestures, in display coordinates. * system gestures, in display coordinates. Certain restrictions * might be applied such that apps don't get all the exclusions * they request. * @param systemGestureExclusionUnrestricted a {@code Region} where the app would like priority * over the system gestures, in display coordinates, without * any restrictions applied. Null if no restrictions have been * applied. */ void onSystemGestureExclusionChanged(int displayId, in Region systemGestureExclusion); void onSystemGestureExclusionChanged(int displayId, in Region systemGestureExclusion, in Region systemGestureExclusionUnrestricted); } No newline at end of file
core/java/com/android/internal/widget/PointerLocationView.java +35 −2 Original line number Diff line number Diff line Loading @@ -53,6 +53,12 @@ public class PointerLocationView extends View implements InputDeviceListener, // to plot alongside the default one. Useful for testing and comparison purposes. private static final String ALT_STRATEGY_PROPERY_KEY = "debug.velocitytracker.alt"; /** * If set to a positive value between 1-255, shows an overlay with the approved (red) and * rejected (blue) exclusions. */ private static final String GESTURE_EXCLUSION_PROP = "debug.pointerlocation.showexclusion"; public static class PointerState { // Trace of previous points. private float[] mTraceX = new float[32]; Loading Loading @@ -138,8 +144,10 @@ public class PointerLocationView extends View implements InputDeviceListener, private final PointerCoords mTempCoords = new PointerCoords(); private final Region mSystemGestureExclusion = new Region(); private final Region mSystemGestureExclusionRejected = new Region(); private final Path mSystemGestureExclusionPath = new Path(); private final Paint mSystemGestureExclusionPaint; private final Paint mSystemGestureExclusionRejectedPaint; private final VelocityTracker mVelocity; private final VelocityTracker mAltVelocity; Loading Loading @@ -190,6 +198,10 @@ public class PointerLocationView extends View implements InputDeviceListener, mSystemGestureExclusionPaint.setARGB(25, 255, 0, 0); mSystemGestureExclusionPaint.setStyle(Paint.Style.FILL_AND_STROKE); mSystemGestureExclusionRejectedPaint = new Paint(); mSystemGestureExclusionRejectedPaint.setARGB(25, 0, 0, 255); mSystemGestureExclusionRejectedPaint.setStyle(Paint.Style.FILL_AND_STROKE); PointerState ps = new PointerState(); mPointers.add(ps); mActivePointerId = 0; Loading Loading @@ -263,6 +275,12 @@ public class PointerLocationView extends View implements InputDeviceListener, canvas.drawPath(mSystemGestureExclusionPath, mSystemGestureExclusionPaint); } if (!mSystemGestureExclusionRejected.isEmpty()) { mSystemGestureExclusionPath.reset(); mSystemGestureExclusionRejected.getBoundaryPath(mSystemGestureExclusionPath); canvas.drawPath(mSystemGestureExclusionPath, mSystemGestureExclusionRejectedPaint); } // Labels if (mActivePointerId >= 0) { final PointerState ps = mPointers.get(mActivePointerId); Loading Loading @@ -754,6 +772,9 @@ public class PointerLocationView extends View implements InputDeviceListener, } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } final int alpha = systemGestureExclusionOpacity(); mSystemGestureExclusionPaint.setAlpha(alpha); mSystemGestureExclusionRejectedPaint.setAlpha(alpha); } else { mSystemGestureExclusion.setEmpty(); } Loading Loading @@ -805,7 +826,12 @@ public class PointerLocationView extends View implements InputDeviceListener, } private static boolean shouldShowSystemGestureExclusion() { return SystemProperties.getBoolean("debug.pointerlocation.showexclusion", false); return systemGestureExclusionOpacity() > 0; } private static int systemGestureExclusionOpacity() { int x = SystemProperties.getInt(GESTURE_EXCLUSION_PROP, 0); return x >= 0 && x <= 255 ? x : 0; } // HACK Loading Loading @@ -928,12 +954,19 @@ public class PointerLocationView extends View implements InputDeviceListener, private ISystemGestureExclusionListener mSystemGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion, Region systemGestureExclusionUnrestricted) { Region exclusion = Region.obtain(systemGestureExclusion); Region rejected = Region.obtain(); if (systemGestureExclusionUnrestricted != null) { rejected.set(systemGestureExclusionUnrestricted); rejected.op(exclusion, Region.Op.DIFFERENCE); } Handler handler = getHandler(); if (handler != null) { handler.post(() -> { mSystemGestureExclusion.set(exclusion); mSystemGestureExclusionRejected.set(rejected); exclusion.recycle(); invalidate(); }); Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/SystemGestureExclusionListenerCompat.java +23 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,11 @@ public abstract class SystemGestureExclusionListenerCompat { new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { Region systemGestureExclusion, Region unrestrictedOrNull) { if (displayId == mDisplayId) { onExclusionChanged(systemGestureExclusion); Region unrestricted = (unrestrictedOrNull == null) ? systemGestureExclusion : unrestrictedOrNull; onExclusionChanged(systemGestureExclusion, unrestricted); } } }; Loading @@ -47,10 +49,28 @@ public abstract class SystemGestureExclusionListenerCompat { } /** * Called when the exclusion region has changed * Called when the exclusion region has changed. * * TODO: remove, once all subclasses have migrated to * {@link #onExclusionChanged(Region, Region)}. */ public abstract void onExclusionChanged(Region systemGestureExclusion); /** * Called when the exclusion region has changed. * * @param systemGestureExclusion the system gesture exclusion to be applied * @param systemGestureExclusionUnrestricted what would be the system gesture exclusion, if * there were no restrictions being applied. For logging purposes only. * */ public void onExclusionChanged(Region systemGestureExclusion, Region systemGestureExclusionUnrestricted) { // TODO: make abstract, once all subclasses have migrated away from // onExclusionChanged(Region) onExclusionChanged(systemGestureExclusion); } /** * Registers the listener for getting exclusion rect changes. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class EdgeBackGestureHandler implements DisplayListener { new ISystemGestureExclusionListener.Stub() { @Override public void onSystemGestureExclusionChanged(int displayId, Region systemGestureExclusion) { Region systemGestureExclusion, Region unrestrictedOrNull) { if (displayId == mDisplayId) { mMainExecutor.execute(() -> mExcludeRegion.set(systemGestureExclusion)); } Loading