diff options
| author | 2024-03-20 22:42:57 +0000 | |
|---|---|---|
| committer | 2024-03-20 23:08:43 +0000 | |
| commit | f4f4c6833685dd5fa8a5d7ae1944321e6d7bf227 (patch) | |
| tree | 6d15b13321a5864ac50cefd847a1508a740fd428 | |
| parent | 1836f6d45cc995ea79c6b40827cd1bcbc9a8e5d2 (diff) | |
Set ActivityManager to set the test callerId as the currentUserId
System headless surfaces, like auto, don't have user 0 as the current
user. In auto, test caller will be the driver, a secondary user. Setting
mock ActivityManagerInternal to set the callingUserId as the
currentUserId fix this test for auto and other headless surfaces.
Fix: 325464049
Test: atest FrameworksInputMethodSystemServerTests:com.android.server.inputmethod.InputMethodManagerServiceWindowGainedFocusTest#startInputOrWindowGainedFocus_forwardNavigation
Change-Id: I954caeb2f2bd1b9af9c7e774cd0e5ecf32f55e72
| -rw-r--r-- | services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java index b9c5b36f9775..b4cf79941c33 100644 --- a/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +++ b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java @@ -203,6 +203,7 @@ public class InputMethodManagerServiceTestBase { .thenReturn(new int[] {0}); when(mMockUserManagerInternal.getUserIds()).thenReturn(new int[] {0}); when(mMockActivityManagerInternal.isSystemReady()).thenReturn(true); + when(mMockActivityManagerInternal.getCurrentUserId()).thenReturn(mCallingUserId); when(mMockPackageManagerInternal.getPackageUid(anyString(), anyLong(), anyInt())) .thenReturn(Binder.getCallingUid()); when(mMockPackageManagerInternal.isSameApp(anyString(), anyLong(), anyInt(), anyInt())) |