OSDN Git Service

Remove a redundant synchronized block
authorYohei Yukawa <yukawa@google.com>
Fri, 23 Jun 2017 05:30:45 +0000 (22:30 -0700)
committerYohei Yukawa <yukawa@google.com>
Fri, 23 Jun 2017 05:30:45 +0000 (22:30 -0700)
This CL removes a redundant synchronized block, which was accidentally
added in the previous CL [1] that simplified
TextServicesManagerService (TSMS) by using RemoteCallbackList<E>.

Since SpellCheckerBindGroup#removeListener() internally acquires the
lock on TSMS#mSpellCheckerMap, there is no need to acquire the same
lock in the caller.

This CL is just a mechanical clean-up. No behavior change is intended.

 [1]: I38942765ed6bec6713757b1d5f325e7a633c2ba7
      f982e75a262db16e60fd3565638d399315dba761

Bug: 35102403
Test: compile
Change-Id: I6d47e8cb6e301286bcb26922b74ee7cac2c5c1c5

services/core/java/com/android/server/TextServicesManagerService.java

index 21aeee2..098b43c 100644 (file)
@@ -1024,7 +1024,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
         }
     }
 
-    private final class InternalDeathRecipients extends
+    private static final class InternalDeathRecipients extends
             RemoteCallbackList<ISpellCheckerSessionListener> {
         private final SpellCheckerBindGroup mGroup;
 
@@ -1034,11 +1034,8 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
 
         @Override
         public void onCallbackDied(ISpellCheckerSessionListener listener) {
-            synchronized(mSpellCheckerMap) {
-                mGroup.removeListener(listener);
-            }
+            mGroup.removeListener(listener);
         }
-
     }
 
     private static final class ISpellCheckerServiceCallbackBinder