summaryrefslogtreecommitdiffstats
path: root/core/java/android/util
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-11-21 18:41:59 -0800
committerSvetoslav Ganov <svetoslavganov@google.com>2011-11-29 18:51:30 -0800
commitd116d7c78a9c53f30a73bf273bd7618312cf3847 (patch)
treec46c6bdb1abeca54d711b304ab7596569e9aa43c /core/java/android/util
parent50b2042502bc459b40430fe3b3b83d7d61e5daf9 (diff)
downloadframeworks_base-d116d7c78a9c53f30a73bf273bd7618312cf3847.zip
frameworks_base-d116d7c78a9c53f30a73bf273bd7618312cf3847.tar.gz
frameworks_base-d116d7c78a9c53f30a73bf273bd7618312cf3847.tar.bz2
Fixing memory leaks in the accessiiblity layer.
1. AccessibilityInteractionConnections were removed from the AccessiiblityManagerService but their DeathRecipents were not unregistered, thus every removed interaction connection was essentially leaking. Such connection is registered in the system for every ViewRootImpl when accessiiblity is enabled and inregistered when disabled. 2. Every AccessibilityEvent and AccessiilbityEventInfo obtained from a widnow content querying accessibility service had a handle to a binder proxy over which to make queries. Hoewever, holding a proxy to a remote binder prevents the latter from being garbage collected. Therefore, now the events and infos have a connection id insteand and the hindden singleton AccessiiblityInteaction client via which queries are made has a registry with the connections. This class looks up the connection given its id before making an IPC. Now the connection is stored in one place and when an accessibility service is disconnected the system sets the connection to null so the binder object in the system process can be GCed. Note that before this change a bad implemented accessibility service could cache events or infos causing a leak in the system process. This should never happen. 3. SparseArray was not clearing the reference to the last moved element while garbage collecting thus causing a leak. bug:5664337 Change-Id: Id397f614b026d43bd7b57bb7f8186bca5cdfcff9
Diffstat (limited to 'core/java/android/util')
-rw-r--r--core/java/android/util/SparseArray.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java
index 7cf4579..366abd3 100644
--- a/core/java/android/util/SparseArray.java
+++ b/core/java/android/util/SparseArray.java
@@ -134,6 +134,7 @@ public class SparseArray<E> implements Cloneable {
if (i != o) {
keys[o] = keys[i];
values[o] = val;
+ values[i] = null;
}
o++;