Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7bb68be authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed Handler Leak on DistanceClassifier" am: 0836d630 am: cb7b52ec am: 5d1de5cb

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1508138

Change-Id: Ifd953cb7d6e37a2a3b54528352777a202803249f
parents 7c976c67 5d1de5cb
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -113,7 +113,6 @@ class DistanceClassifier extends FalsingClassifier {


    private DistanceVectors calculateDistances() {
    private DistanceVectors calculateDistances() {
        // This code assumes that there will be no missed DOWN or UP events.
        // This code assumes that there will be no missed DOWN or UP events.
        VelocityTracker velocityTracker = VelocityTracker.obtain();
        List<MotionEvent> motionEvents = getRecentMotionEvents();
        List<MotionEvent> motionEvents = getRecentMotionEvents();


        if (motionEvents.size() < 3) {
        if (motionEvents.size() < 3) {
@@ -121,6 +120,8 @@ class DistanceClassifier extends FalsingClassifier {
            return new DistanceVectors(0, 0, 0, 0);
            return new DistanceVectors(0, 0, 0, 0);
        }
        }


        VelocityTracker velocityTracker = VelocityTracker.obtain();

        for (MotionEvent motionEvent : motionEvents) {
        for (MotionEvent motionEvent : motionEvents) {
            velocityTracker.addMovement(motionEvent);
            velocityTracker.addMovement(motionEvent);
        }
        }