Skip to content

Commit 55cdacb

Browse files
sganovAndroid Git Automerger
authored andcommitted
am 0bfdd7c: am e9f24a4: Merge "Fix memory leaks in the accessibility layer." into ics-mr1
* commit '0bfdd7c2927fb683b89fdd52befe643e8e069e77': Fix memory leaks in the accessibility layer.
2 parents 4da2f66 + 0bfdd7c commit 55cdacb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

core/java/android/view/accessibility/AccessibilityInteractionClient.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public final class AccessibilityInteractionClient
9393

9494
private final Rect mTempBounds = new Rect();
9595

96-
private final SparseArray<IAccessibilityServiceConnection> mConnectionCache =
96+
// The connection cache is shared between all interrogating threads.
97+
private static final SparseArray<IAccessibilityServiceConnection> sConnectionCache =
9798
new SparseArray<IAccessibilityServiceConnection>();
9899

99100
/**
@@ -539,8 +540,8 @@ private Message getSameProcessMessageAndClear() {
539540
* @return The cached connection if such.
540541
*/
541542
public IAccessibilityServiceConnection getConnection(int connectionId) {
542-
synchronized (mConnectionCache) {
543-
return mConnectionCache.get(connectionId);
543+
synchronized (sConnectionCache) {
544+
return sConnectionCache.get(connectionId);
544545
}
545546
}
546547

@@ -551,8 +552,8 @@ public IAccessibilityServiceConnection getConnection(int connectionId) {
551552
* @param connection The connection.
552553
*/
553554
public void addConnection(int connectionId, IAccessibilityServiceConnection connection) {
554-
synchronized (mConnectionCache) {
555-
mConnectionCache.put(connectionId, connection);
555+
synchronized (sConnectionCache) {
556+
sConnectionCache.put(connectionId, connection);
556557
}
557558
}
558559

@@ -562,8 +563,8 @@ public void addConnection(int connectionId, IAccessibilityServiceConnection conn
562563
* @param connectionId The connection id.
563564
*/
564565
public void removeConnection(int connectionId) {
565-
synchronized (mConnectionCache) {
566-
mConnectionCache.remove(connectionId);
566+
synchronized (sConnectionCache) {
567+
sConnectionCache.remove(connectionId);
567568
}
568569
}
569570
}

0 commit comments

Comments
 (0)