diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2015-06-04 02:20:36 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-04 02:21:09 +0000 |
| commit | b3876474399ae22ccfc8f04d7f9ab577517db370 (patch) | |
| tree | 0a821dfc7ab49470e85b00d0bc99a7f62a75db4c /services/accessibility/java/com/android | |
| parent | b7c3e931cd2ef332f05a2bb78e7036d53aeab18c (diff) | |
| parent | 386a824384a0d5795a38d10d1d2c18e4e50f8c30 (diff) | |
| download | frameworks_base-b3876474399ae22ccfc8f04d7f9ab577517db370.zip frameworks_base-b3876474399ae22ccfc8f04d7f9ab577517db370.tar.gz frameworks_base-b3876474399ae22ccfc8f04d7f9ab577517db370.tar.bz2 | |
Merge "Make node retrieval methods in AccessibilityManagerService use separate Region instances to make them thread safe." into mnc-dev
Diffstat (limited to 'services/accessibility/java/com/android')
| -rw-r--r-- | services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index d4c3194..7bcbcfb 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -166,8 +166,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private final List<AccessibilityServiceInfo> mEnabledServicesForFeedbackTempList = new ArrayList<>(); - private final Region mTempRegion = new Region(); - private final Rect mTempRect = new Rect(); private final Rect mTempRect1 = new Rect(); @@ -2241,7 +2239,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { throws RemoteException { final int resolvedWindowId; IAccessibilityInteractionConnection connection = null; - Region partialInteractiveRegion = mTempRegion; + Region partialInteractiveRegion = Region.obtain(); synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below @@ -2265,6 +2263,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked( resolvedWindowId, partialInteractiveRegion)) { + partialInteractiveRegion.recycle(); partialInteractiveRegion = null; } } @@ -2282,6 +2281,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } finally { Binder.restoreCallingIdentity(identityToken); + // Recycle if passed to another process. + if (partialInteractiveRegion != null && Binder.isProxy(connection)) { + partialInteractiveRegion.recycle(); + } } return false; } @@ -2293,7 +2296,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { throws RemoteException { final int resolvedWindowId; IAccessibilityInteractionConnection connection = null; - Region partialInteractiveRegion = mTempRegion; + Region partialInteractiveRegion = Region.obtain(); synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below @@ -2317,6 +2320,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked( resolvedWindowId, partialInteractiveRegion)) { + partialInteractiveRegion.recycle(); partialInteractiveRegion = null; } } @@ -2334,6 +2338,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } finally { Binder.restoreCallingIdentity(identityToken); + // Recycle if passed to another process. + if (partialInteractiveRegion != null && Binder.isProxy(connection)) { + partialInteractiveRegion.recycle(); + } } return false; } @@ -2345,7 +2353,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { long interrogatingTid) throws RemoteException { final int resolvedWindowId; IAccessibilityInteractionConnection connection = null; - Region partialInteractiveRegion = mTempRegion; + Region partialInteractiveRegion = Region.obtain(); synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below @@ -2369,6 +2377,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked( resolvedWindowId, partialInteractiveRegion)) { + partialInteractiveRegion.recycle(); partialInteractiveRegion = null; } } @@ -2386,6 +2395,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } finally { Binder.restoreCallingIdentity(identityToken); + // Recycle if passed to another process. + if (partialInteractiveRegion != null && Binder.isProxy(connection)) { + partialInteractiveRegion.recycle(); + } } return false; } @@ -2397,7 +2410,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { throws RemoteException { final int resolvedWindowId; IAccessibilityInteractionConnection connection = null; - Region partialInteractiveRegion = mTempRegion; + Region partialInteractiveRegion = Region.obtain(); synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below @@ -2422,6 +2435,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked( resolvedWindowId, partialInteractiveRegion)) { + partialInteractiveRegion.recycle(); partialInteractiveRegion = null; } } @@ -2439,6 +2453,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } finally { Binder.restoreCallingIdentity(identityToken); + // Recycle if passed to another process. + if (partialInteractiveRegion != null && Binder.isProxy(connection)) { + partialInteractiveRegion.recycle(); + } } return false; } @@ -2450,7 +2468,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { throws RemoteException { final int resolvedWindowId; IAccessibilityInteractionConnection connection = null; - Region partialInteractiveRegion = mTempRegion; + Region partialInteractiveRegion = Region.obtain(); synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below @@ -2474,6 +2492,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked( resolvedWindowId, partialInteractiveRegion)) { + partialInteractiveRegion.recycle(); partialInteractiveRegion = null; } } @@ -2491,6 +2510,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } finally { Binder.restoreCallingIdentity(identityToken); + // Recycle if passed to another process. + if (partialInteractiveRegion != null && Binder.isProxy(connection)) { + partialInteractiveRegion.recycle(); + } } return false; } |
