Support trackpad tapl tests in 3-button mode
Currently we have logic to only enable input monitor when a trackpad is connected. Tapl tests need to have infrastructure to override that logic Bug: 335146977 Test: presubmit Change-Id: Ib7f80c828760f8b5abd7ed2788b246e47fca6e34
This commit is contained in:
1 parent
a27409e8b2
commit
acb4a3d1e8
5 files changed
+48
-4
No files matched your search
@@ -85,6 +85,7 @@ import androidx.annotation.BinderThread;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.ConstantItem;
|
||||
@@ -399,6 +400,25 @@ public class TouchInteractionService extends Service {
|
||||
return tis.mTaskbarManager;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void injectFakeTrackpadForTesting() {
|
||||
TouchInteractionService tis = mTis.get();
|
||||
if (tis == null) return;
|
||||
tis.mTrackpadsConnected.add(1000);
|
||||
tis.initInputMonitor("tapl testing");
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void ejectFakeTrackpadForTesting() {
|
||||
TouchInteractionService tis = mTis.get();
|
||||
if (tis == null) return;
|
||||
tis.mTrackpadsConnected.clear();
|
||||
// This method destroys the current input monitor if set up, and only init a new one
|
||||
// in 3-button mode if {@code mTrackpadsConnected} is not empty. So in other words,
|
||||
// it will destroy the input monitor.
|
||||
tis.initInputMonitor("tapl testing");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether a predictive back-to-home animation is in progress in the device state
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user