diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-02 15:23:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-02 15:23:56 -0700 |
commit | 0d0012ef1617170701b9cd7492ef04ac47bfb5ca (patch) | |
tree | 01b85c97f37b1356b723187578157e4f443de4c8 | |
parent | 1c502a4624859289c1000af6be8bea1aacee41bd (diff) | |
parent | 54af78a3f7064e04d7ebd64c985d4149f9f7b05c (diff) | |
download | frameworks_base-0d0012ef1617170701b9cd7492ef04ac47bfb5ca.zip frameworks_base-0d0012ef1617170701b9cd7492ef04ac47bfb5ca.tar.gz frameworks_base-0d0012ef1617170701b9cd7492ef04ac47bfb5ca.tar.bz2 |
am 54af78a3: Merge change 5950 into donut
Merge commit '54af78a3f7064e04d7ebd64c985d4149f9f7b05c'
* commit '54af78a3f7064e04d7ebd64c985d4149f9f7b05c':
Fix memory leaks in system_server
8 files changed, 41 insertions, 6 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 62dc651..5ee29ac 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3981,7 +3981,10 @@ public final class ActivityThread { ProviderRecord pr = mProviderMap.get(name); if (pr.mProvider.asBinder() == provider.asBinder()) { Log.i(TAG, "Removing dead content provider: " + name); - mProviderMap.remove(name); + ProviderRecord removed = mProviderMap.remove(name); + if (removed != null) { + removed.mProvider.asBinder().unlinkToDeath(removed, 0); + } } } } @@ -3990,7 +3993,10 @@ public final class ActivityThread { ProviderRecord pr = mProviderMap.get(name); if (pr.mProvider.asBinder() == provider.asBinder()) { Log.i(TAG, "Removing dead content provider: " + name); - mProviderMap.remove(name); + ProviderRecord removed = mProviderMap.remove(name); + if (removed != null) { + removed.mProvider.asBinder().unlinkToDeath(removed, 0); + } } } diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 883e5f5..3f0c234 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -616,6 +616,9 @@ public class GpsLocationProvider extends ILocationProvider.Stub { synchronized(mListeners) { mListeners.remove(this); } + if (mListener != null) { + mListener.asBinder().unlinkToDeath(this, 0); + } } } diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index bd7088c..4ae424a 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -53,6 +53,12 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { } } + public void unlinkProvider() { + if (mProvider != null) { + mProvider.asBinder().unlinkToDeath(this, 0); + } + } + public String getName() { return mName; } @@ -255,5 +261,6 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { public void binderDied() { Log.w(TAG, "Location Provider " + mName + " died"); mDead = true; + mProvider.asBinder().unlinkToDeath(this, 0); } } diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index fc37290..0f5b3fd 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -507,6 +507,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run private void removeProvider(LocationProviderProxy provider) { mProviders.remove(provider); + provider.unlinkProvider(); mProvidersByName.remove(provider.getName()); } diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index c5ea5fa..79d78ad 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -709,7 +709,10 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage p.awakeOnSet = true; } } else { - mPokeLocks.remove(token); + PokeLock rLock = mPokeLocks.remove(token); + if (rLock != null) { + token.unlinkToDeath(rLock, 0); + } } int oldPokey = mPokey; diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index e91798b..4984b19 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -1883,7 +1883,9 @@ public class WifiService extends IWifiManager.Stub { private WifiLock removeLock(IBinder binder) { int index = findLockByBinder(binder); if (index >= 0) { - return mList.remove(index); + WifiLock ret = mList.remove(index); + ret.unlinkDeathRecipient(); + return ret; } else { return null; } @@ -1995,6 +1997,10 @@ public class WifiService extends IWifiManager.Stub { binderDied(); } } + + void unlinkDeathRecipient() { + mBinder.unlinkToDeath(this, 0); + } } private class Multicaster extends DeathRecipient { @@ -2062,7 +2068,10 @@ public class WifiService extends IWifiManager.Stub { private void removeMulticasterLocked(int i, int uid) { - mMulticasters.remove(i); + Multicaster removed = mMulticasters.remove(i); + if (removed != null) { + removed.unlinkDeathRecipient(); + } if (mMulticasters.size() == 0) { WifiNative.startPacketFiltering(); } diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 8c3f61e..89ca90e 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -3414,7 +3414,10 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo synchronized (mWindowMap) { for (int i=0; i<mRotationWatchers.size(); i++) { if (watcherBinder == mRotationWatchers.get(i).asBinder()) { - mRotationWatchers.remove(i); + IRotationWatcher removed = mRotationWatchers.remove(i); + if (removed != null) { + removed.asBinder().unlinkToDeath(this, 0); + } i--; } } @@ -5491,6 +5494,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } catch (RemoteException e) { } synchronized(mWindowMap) { + mClient.asBinder().unlinkToDeath(this, 0); mClientDead = true; killSessionLocked(); } diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java index 48cbace..b44168a 100644 --- a/services/java/com/android/server/status/StatusBarService.java +++ b/services/java/com/android/server/status/StatusBarService.java @@ -119,6 +119,7 @@ public class StatusBarService extends IStatusBar.Stub public void binderDied() { Log.i(TAG, "binder died for pkg=" + pkg); disable(0, token, pkg); + token.unlinkToDeath(this, 0); } } @@ -494,6 +495,7 @@ public class StatusBarService extends IStatusBar.Stub if (what == 0 || !token.isBinderAlive()) { if (tok != null) { mDisableRecords.remove(i); + tok.token.unlinkToDeath(tok, 0); } } else { if (tok == null) { |