From d7bb5198c8090e4c5a0af4c96fac6509572b1ff1 Mon Sep 17 00:00:00 2001 From: Josep del Rio Date: Wed, 26 Jul 2023 10:03:12 +0000 Subject: [PATCH] Make InputDevice getAssociatedDisplayId part of the test API While investigating test flakiness, a case where input events could be dispatched before an input device is associated to a display has been identified. The issue is that this association is asynchronous, so we need a way to ensure that the change has gone through. A way to do this is to monitor the input device associated display through the API, but at the moment it was hidden, so this CL will make it available to tests. Bug: 288321659 Test: No functional changes Change-Id: I6b9535c160683f7865e766f80fad00dfa4ae52ad --- core/api/test-current.txt | 1 + core/java/android/view/InputDevice.java | 1 + 2 files changed, 2 insertions(+) diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 050667b166bc9..525f9ec793efc 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3526,6 +3526,7 @@ package android.view { public final class InputDevice implements android.os.Parcelable { method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void disable(); method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void enable(); + method public int getAssociatedDisplayId(); method @NonNull public android.hardware.input.InputDeviceIdentifier getIdentifier(); method @Nullable public String getKeyboardLanguageTag(); method @Nullable public String getKeyboardLayoutType(); diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 8b23f19f1067b..f81dc5a585934 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -1319,6 +1319,7 @@ public final class InputDevice implements Parcelable { } /** @hide */ + @TestApi public int getAssociatedDisplayId() { return mAssociatedDisplayId; }