Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb80b31b authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android Git Automerger
Browse files

am 87597d9c: am 538dc6ac: Merge "Fix 5615747 Don\'t leak remote control client...

am 87597d9c: am 538dc6ac: Merge "Fix 5615747 Don\'t leak remote control client death handlers" into ics-mr1

* commit '87597d9c':
  Fix 5615747 Don't leak remote control client death handlers
parents 7c4dee75 87597d9c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -3056,6 +3056,7 @@ public class AudioService extends IAudioService.Stub {
            if ((mRcClientDeathHandler != null) && (mRcClientDeathHandler.mCb != null)) {
                try {
                    mRcClientDeathHandler.mCb.unlinkToDeath(mRcClientDeathHandler, 0);
                    mRcClientDeathHandler = null;
                } catch (java.util.NoSuchElementException e) {
                    // not much we can do here
                    Log.e(TAG, "Encountered " + e + " in unlinkToRcClientDeath()");
@@ -3063,6 +3064,12 @@ public class AudioService extends IAudioService.Stub {
                }
            }
        }

        @Override
        protected void finalize() throws Throwable {
            unlinkToRcClientDeath();// unlink exception handled inside method
            super.finalize();
        }
    }

    /**
@@ -3109,6 +3116,7 @@ public class AudioService extends IAudioService.Stub {
                    if (packageName.equalsIgnoreCase(rcse.mReceiverComponent.getPackageName())) {
                        // a stack entry is from the package being removed, remove it from the stack
                        stackIterator.remove();
                        rcse.unlinkToRcClientDeath();
                    }
                }
                if (mRCStack.empty()) {
@@ -3189,6 +3197,7 @@ public class AudioService extends IAudioService.Stub {
            RemoteControlStackEntry rcse = (RemoteControlStackEntry)stackIterator.next();
            if(rcse.mMediaIntent.equals(pi)) {
                stackIterator.remove();
                rcse.unlinkToRcClientDeath();
                break;
            }
        }
@@ -3450,7 +3459,7 @@ public class AudioService extends IAudioService.Stub {
                        rcse.mCallingPackageName = callingPackageName;
                        rcse.mCallingUid = Binder.getCallingUid();
                        if (rcClient == null) {
                            rcse.mRcClientDeathHandler = null;
                            // here rcse.mRcClientDeathHandler is null;
                            break;
                        }

@@ -3506,7 +3515,6 @@ public class AudioService extends IAudioService.Stub {
                        rcse.unlinkToRcClientDeath();
                        // reset the client-related fields
                        rcse.mRcClient = null;
                        rcse.mRcClientDeathHandler = null;
                        rcse.mCallingPackageName = null;
                    }
                }