From 57e50b106c0ccaf4ec8a3e724f9b1fc491d98be2 Mon Sep 17 00:00:00 2001 From: Antonio Kantek Date: Sat, 11 May 2024 03:40:49 +0000 Subject: Inline IMMS#getCurIntentLocked This CL represents an internal refactoring and shouldn't introduce any observable breakage. Bug: 325515685 Test: atest FrameworksInputMethodSystemServerTests Test: atest CtsInputMethodTestCases Test: atest FrameworksServicesTests Test: atest --host FrameworksInputMethodSystemServerTestsRavenwood Change-Id: Ic51859ed5ac46e24f890baa5f9351fed5f3d1c54 --- .../inputmethod/InputMethodManagerService.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 598be11b2a1a..691145c500d9 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -561,16 +561,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @MultiUserUnawareField boolean mInFullscreenMode; - /** - * The Intent used to connect to the current input method. - */ - @GuardedBy("ImfLock.class") - @Nullable - private Intent getCurIntentLocked() { - final var userData = mUserDataRepository.getOrCreate(mCurrentUserId); - return userData.mBindingController.getCurIntent(); - } - /** * The token we have made for the currently active input method, to * identify it in the future. @@ -3812,10 +3802,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (mCurrentUserId != UserHandle.getUserId(uid)) { return false; } - if (getCurIntentLocked() != null && InputMethodUtils.checkIfPackageBelongsToUid( - mPackageManagerInternal, - uid, - getCurIntentLocked().getComponent().getPackageName())) { + final var userData = mUserDataRepository.getOrCreate(mCurrentUserId); + final var curIntent = userData.mBindingController.getCurIntent(); + if (curIntent != null && InputMethodUtils.checkIfPackageBelongsToUid( + mPackageManagerInternal, uid, curIntent.getComponent().getPackageName())) { return true; } return false; @@ -5904,7 +5894,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. p.println(" mCurToken=" + getCurTokenLocked()); p.println(" mCurTokenDisplayId=" + mCurTokenDisplayId); p.println(" mCurHostInputToken=" + mAutofillController.getCurHostInputToken()); - p.println(" mCurIntent=" + getCurIntentLocked()); + p.println(" mCurIntent=" + userData.mBindingController.getCurIntent()); method = getCurMethodLocked(); p.println(" mCurMethod=" + getCurMethodLocked()); p.println(" mEnabledSession=" + mEnabledSession); -- cgit v1.2.3-59-g8ed1b