Merge "Fix flaky test WindowInputTestsi#testTrustedOverlapWindow" into sc-v2-dev am: 651343388f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16544958 Change-Id: I4001fabda75da2bfc2da66eb7692cc021078e549
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package android.view;
|
||||
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
/**
|
||||
@@ -27,6 +28,13 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
|
||||
private Choreographer mChoreographer;
|
||||
private boolean mBatchingEnabled;
|
||||
private boolean mBatchedInputScheduled;
|
||||
private final Handler mHandler;
|
||||
private final Runnable mConsumeBatchedInputEvents = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
consumeBatchedInputEvents(-1);
|
||||
}
|
||||
};
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public BatchedInputEventReceiver(
|
||||
@@ -34,6 +42,7 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
|
||||
super(inputChannel, looper);
|
||||
mChoreographer = choreographer;
|
||||
mBatchingEnabled = true;
|
||||
mHandler = new Handler(looper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,10 +66,15 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
|
||||
* @hide
|
||||
*/
|
||||
public void setBatchingEnabled(boolean batchingEnabled) {
|
||||
if (mBatchingEnabled == batchingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mBatchingEnabled = batchingEnabled;
|
||||
mHandler.removeCallbacks(mConsumeBatchedInputEvents);
|
||||
if (!batchingEnabled) {
|
||||
unscheduleBatchedInput();
|
||||
consumeBatchedInputEvents(-1);
|
||||
mHandler.post(mConsumeBatchedInputEvents);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user