Merge "Fixed Handler Leak on DistanceClassifier" am: 0836d630a5 am: cb7b52ecde

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

Change-Id: I0da91020cb1e34626a742ed8bfcc7c71fa0db903
This commit is contained in:
Treehugger Robot
2020-11-24 18:04:43 +00:00
committed by Automerger Merge Worker

View File

@@ -112,7 +112,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) {
@@ -120,6 +119,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);
} }