Skip to content

Commit

Permalink
Fixed for Deadlock in IMMS Proxy Service.
Browse files Browse the repository at this point in the history
Observed deadlock while switching user.

Updating imms service locking scenerio.

Tests: Switch user few times. there is no dead lock issue.

Tracked-On: OAM-122779
Signed-off-by: Ankit Agrawal <[email protected]>
  • Loading branch information
ankithbti52509 committed Sep 20, 2024
1 parent 3b87e8e commit 4e41e50
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 4ddc5c17a8d84a1b05fee583574c09a9dd2cfdd4 Mon Sep 17 00:00:00 2001
From: Ankit Agrawal <[email protected]>
Date: Fri, 20 Sep 2024 07:06:01 +0530
Subject: [PATCH] Fixed for Deadlock in IMMS Proxy Service.

Observed deadlock while switching user.

Updating imms service locking scenerio.

Tests: Switch user few times. there is no dead lock issue.

Tracked-On: OAM-122779
Signed-off-by: Ankit Agrawal <[email protected]>
---
.../server/inputmethod/InputMethodManagerServiceProxy.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/builtInServices/src_imms/com/android/server/inputmethod/InputMethodManagerServiceProxy.java b/builtInServices/src_imms/com/android/server/inputmethod/InputMethodManagerServiceProxy.java
index e7bb329..94a3548 100644
--- a/builtInServices/src_imms/com/android/server/inputmethod/InputMethodManagerServiceProxy.java
+++ b/builtInServices/src_imms/com/android/server/inputmethod/InputMethodManagerServiceProxy.java
@@ -126,7 +126,12 @@ public final class InputMethodManagerServiceProxy extends IInputMethodManager.St
if ((imms = mServicesForUser.get(userId)) != null) {
return imms;
}
- imms = new CarInputMethodManagerService(mContext, sExecutor);
+ } finally {
+ mRwLock.writeLock().unlock();
+ }
+ imms = new CarInputMethodManagerService(mContext, sExecutor);
+ try {
+ mRwLock.writeLock().lock();
mServicesForUser.set(userId, imms);
InputMethodManagerInternal localService = imms.getInputMethodManagerInternal();
mLocalServicesForUser.set(userId, localService);
--
2.34.1

0 comments on commit 4e41e50

Please sign in to comment.