Loading packages/SystemUI/docs/falsing.md +4 −4 Original line number Diff line number Diff line Loading @@ -143,10 +143,10 @@ are ready to act on the owner's action, and then query the `FalsingManager`. The will update its belief in pocket dialing based only on the last call made, so multiple calls per gesture are not well defined. The `FalsingManager` does not update its belief in pocket-dialing until a new gesture starts. That is to say, if the owner makes a bad tap on your feature, the belief in pocket dialing will not incorporate this new data until the following gesture begins. The `FalsingManager` does not update its belief in pocket-dialing until after a gesture completes. That is to say, if the owner makes a bad tap on your feature, the "belief" in pocket dialing will not incorporate this new data after processing on the final `ACTION_UP` or `ACTION_CANCEL` event occurs. If you expect a mix of taps, double taps, and swipes on your feature, segment them accordingly. Figure out which `FalsingManager` method you need to call first, rather than relying Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingCollector.java +13 −1 Original line number Diff line number Diff line Loading @@ -112,9 +112,21 @@ public interface FalsingCollector { /** */ void onBouncerHidden(); /** */ /** * Call this to record a MotionEvent in the {@link com.android.systemui.plugins.FalsingManager}. * * Be sure to call {@link #onMotionEventComplete()} after the rest of SystemUI is done with the * MotionEvent. */ void onTouchEvent(MotionEvent ev); /** * Call this once SystemUI has completed all processing of a given MotionEvent. * * See {@link #onTouchEvent(MotionEvent)}. */ void onMotionEventComplete(); /** */ void avoidGesture(); Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java +4 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,10 @@ public class FalsingCollectorFake implements FalsingCollector { public void onTouchEvent(MotionEvent ev) { } @Override public void onMotionEventComplete() { } @Override public void avoidGesture() { } Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,11 @@ class FalsingCollectorImpl implements FalsingCollector { } } @Override public void onMotionEventComplete() { mFalsingDataProvider.onMotionEventComplete(); } @Override public void avoidGesture() { mAvoidGesture = true; Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingDataProvider.java +12 −1 Original line number Diff line number Diff line Loading @@ -81,8 +81,8 @@ public class FalsingDataProvider { } if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) { // Ensure prior gesture was completed. May be a no-op. completePriorGesture(); mRecentMotionEvents = new TimeLimitedMotionEventBuffer(MOTION_EVENT_AGE_MS); } mRecentMotionEvents.addAll(motionEvents); Loading @@ -100,12 +100,23 @@ public class FalsingDataProvider { mDirty = true; } void onMotionEventComplete() { if (mRecentMotionEvents.isEmpty()) { return; } int action = mRecentMotionEvents.get(mRecentMotionEvents.size() - 1).getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { completePriorGesture(); } } private void completePriorGesture() { if (!mRecentMotionEvents.isEmpty()) { mGestureFinalizedListeners.forEach(listener -> listener.onGestureFinalized( mRecentMotionEvents.get(mRecentMotionEvents.size() - 1).getEventTime())); mPriorMotionEvents = mRecentMotionEvents; mRecentMotionEvents = new TimeLimitedMotionEventBuffer(MOTION_EVENT_AGE_MS); } } Loading Loading
packages/SystemUI/docs/falsing.md +4 −4 Original line number Diff line number Diff line Loading @@ -143,10 +143,10 @@ are ready to act on the owner's action, and then query the `FalsingManager`. The will update its belief in pocket dialing based only on the last call made, so multiple calls per gesture are not well defined. The `FalsingManager` does not update its belief in pocket-dialing until a new gesture starts. That is to say, if the owner makes a bad tap on your feature, the belief in pocket dialing will not incorporate this new data until the following gesture begins. The `FalsingManager` does not update its belief in pocket-dialing until after a gesture completes. That is to say, if the owner makes a bad tap on your feature, the "belief" in pocket dialing will not incorporate this new data after processing on the final `ACTION_UP` or `ACTION_CANCEL` event occurs. If you expect a mix of taps, double taps, and swipes on your feature, segment them accordingly. Figure out which `FalsingManager` method you need to call first, rather than relying Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingCollector.java +13 −1 Original line number Diff line number Diff line Loading @@ -112,9 +112,21 @@ public interface FalsingCollector { /** */ void onBouncerHidden(); /** */ /** * Call this to record a MotionEvent in the {@link com.android.systemui.plugins.FalsingManager}. * * Be sure to call {@link #onMotionEventComplete()} after the rest of SystemUI is done with the * MotionEvent. */ void onTouchEvent(MotionEvent ev); /** * Call this once SystemUI has completed all processing of a given MotionEvent. * * See {@link #onTouchEvent(MotionEvent)}. */ void onMotionEventComplete(); /** */ void avoidGesture(); Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java +4 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,10 @@ public class FalsingCollectorFake implements FalsingCollector { public void onTouchEvent(MotionEvent ev) { } @Override public void onMotionEventComplete() { } @Override public void avoidGesture() { } Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,11 @@ class FalsingCollectorImpl implements FalsingCollector { } } @Override public void onMotionEventComplete() { mFalsingDataProvider.onMotionEventComplete(); } @Override public void avoidGesture() { mAvoidGesture = true; Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingDataProvider.java +12 −1 Original line number Diff line number Diff line Loading @@ -81,8 +81,8 @@ public class FalsingDataProvider { } if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) { // Ensure prior gesture was completed. May be a no-op. completePriorGesture(); mRecentMotionEvents = new TimeLimitedMotionEventBuffer(MOTION_EVENT_AGE_MS); } mRecentMotionEvents.addAll(motionEvents); Loading @@ -100,12 +100,23 @@ public class FalsingDataProvider { mDirty = true; } void onMotionEventComplete() { if (mRecentMotionEvents.isEmpty()) { return; } int action = mRecentMotionEvents.get(mRecentMotionEvents.size() - 1).getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { completePriorGesture(); } } private void completePriorGesture() { if (!mRecentMotionEvents.isEmpty()) { mGestureFinalizedListeners.forEach(listener -> listener.onGestureFinalized( mRecentMotionEvents.get(mRecentMotionEvents.size() - 1).getEventTime())); mPriorMotionEvents = mRecentMotionEvents; mRecentMotionEvents = new TimeLimitedMotionEventBuffer(MOTION_EVENT_AGE_MS); } } Loading