diff options
author | You Kim <you.kim72@gmail.com> | 2016-04-07 15:55:23 +0900 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-04-19 09:49:11 -0700 |
commit | 9c027641f054560c71969911974db21666948e99 (patch) | |
tree | 8055fee2b64f6a8ba11f3a39ca64bb191faa1fc3 | |
parent | 302e70c928c7ab04859f3d1132033d387a524658 (diff) | |
download | android_packages_services_Telecomm-9c027641f054560c71969911974db21666948e99.tar.gz android_packages_services_Telecomm-9c027641f054560c71969911974db21666948e99.tar.bz2 android_packages_services_Telecomm-9c027641f054560c71969911974db21666948e99.zip |
Incorrect cache key in ConnectionServiceRepository
Pair of commponentName and userHandle is correct cache key.
ConnectionService can be leaked after unbind.
Change-Id: Ib2896917fd28ba45c5371aa7c6b2eb3a0c867eb8
-rw-r--r-- | src/com/android/server/telecom/ConnectionServiceRepository.java | 4 | ||||
-rw-r--r-- | src/com/android/server/telecom/ServiceBinder.java | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/server/telecom/ConnectionServiceRepository.java b/src/com/android/server/telecom/ConnectionServiceRepository.java index a587b59c..caaee1c5 100644 --- a/src/com/android/server/telecom/ConnectionServiceRepository.java +++ b/src/com/android/server/telecom/ConnectionServiceRepository.java @@ -41,7 +41,9 @@ final class ConnectionServiceRepository { @Override public void onUnbind(ConnectionServiceWrapper service) { synchronized (mLock) { - mServiceCache.remove(service.getComponentName()); + Pair<ComponentName, UserHandle> cacheKey = Pair.create( + service.getComponentName(), service.getUserHandle()); + mServiceCache.remove(cacheKey); } } }; diff --git a/src/com/android/server/telecom/ServiceBinder.java b/src/com/android/server/telecom/ServiceBinder.java index 2e63512d..5431376f 100644 --- a/src/com/android/server/telecom/ServiceBinder.java +++ b/src/com/android/server/telecom/ServiceBinder.java @@ -167,7 +167,7 @@ abstract class ServiceBinder { private ServiceConnection mServiceConnection; /** {@link UserHandle} to use for binding, to support work profiles and multi-user. */ - private UserHandle mUserHandle; + private final UserHandle mUserHandle; /** The binder provided by {@link ServiceConnection#onServiceConnected} */ private IBinder mBinder; @@ -253,6 +253,10 @@ abstract class ServiceBinder { return mComponentName; } + final UserHandle getUserHandle() { + return mUserHandle; + } + final boolean isServiceValid(String actionName) { if (mBinder == null) { Log.w(this, "%s invoked while service is unbound", actionName); |