Merge "Fix 5615747 Don't leak remote control client death handlers" into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
538dc6acfd
@ -3062,6 +3062,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
if ((mRcClientDeathHandler != null) && (mRcClientDeathHandler.mCb != null)) {
|
if ((mRcClientDeathHandler != null) && (mRcClientDeathHandler.mCb != null)) {
|
||||||
try {
|
try {
|
||||||
mRcClientDeathHandler.mCb.unlinkToDeath(mRcClientDeathHandler, 0);
|
mRcClientDeathHandler.mCb.unlinkToDeath(mRcClientDeathHandler, 0);
|
||||||
|
mRcClientDeathHandler = null;
|
||||||
} catch (java.util.NoSuchElementException e) {
|
} catch (java.util.NoSuchElementException e) {
|
||||||
// not much we can do here
|
// not much we can do here
|
||||||
Log.e(TAG, "Encountered " + e + " in unlinkToRcClientDeath()");
|
Log.e(TAG, "Encountered " + e + " in unlinkToRcClientDeath()");
|
||||||
@ -3069,6 +3070,12 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void finalize() throws Throwable {
|
||||||
|
unlinkToRcClientDeath();// unlink exception handled inside method
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3115,6 +3122,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
if (packageName.equalsIgnoreCase(rcse.mReceiverComponent.getPackageName())) {
|
if (packageName.equalsIgnoreCase(rcse.mReceiverComponent.getPackageName())) {
|
||||||
// a stack entry is from the package being removed, remove it from the stack
|
// a stack entry is from the package being removed, remove it from the stack
|
||||||
stackIterator.remove();
|
stackIterator.remove();
|
||||||
|
rcse.unlinkToRcClientDeath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mRCStack.empty()) {
|
if (mRCStack.empty()) {
|
||||||
@ -3195,6 +3203,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
RemoteControlStackEntry rcse = (RemoteControlStackEntry)stackIterator.next();
|
RemoteControlStackEntry rcse = (RemoteControlStackEntry)stackIterator.next();
|
||||||
if(rcse.mMediaIntent.equals(pi)) {
|
if(rcse.mMediaIntent.equals(pi)) {
|
||||||
stackIterator.remove();
|
stackIterator.remove();
|
||||||
|
rcse.unlinkToRcClientDeath();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3456,7 +3465,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
rcse.mCallingPackageName = callingPackageName;
|
rcse.mCallingPackageName = callingPackageName;
|
||||||
rcse.mCallingUid = Binder.getCallingUid();
|
rcse.mCallingUid = Binder.getCallingUid();
|
||||||
if (rcClient == null) {
|
if (rcClient == null) {
|
||||||
rcse.mRcClientDeathHandler = null;
|
// here rcse.mRcClientDeathHandler is null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3512,7 +3521,6 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
rcse.unlinkToRcClientDeath();
|
rcse.unlinkToRcClientDeath();
|
||||||
// reset the client-related fields
|
// reset the client-related fields
|
||||||
rcse.mRcClient = null;
|
rcse.mRcClient = null;
|
||||||
rcse.mRcClientDeathHandler = null;
|
|
||||||
rcse.mCallingPackageName = null;
|
rcse.mCallingPackageName = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user