am 4ae25d3b: am ca31da91: am 9d1dc789: b/17135753. Make sure to free ServiceConnection. automerge: 8c65e50
* commit '4ae25d3b4510f3c02709090fb0c6ddf64730ddad': b/17135753. Make sure to free ServiceConnection.
This commit is contained in:
commit
32c3580aee
|
@ -114,19 +114,24 @@ public abstract class ServiceProxy {
|
||||||
try {
|
try {
|
||||||
mTask.run();
|
mTask.run();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
LogUtils.e(mTag, e, "RemoteException thrown running mTask!");
|
||||||
try {
|
} finally {
|
||||||
// Each ServiceProxy handles just one task, so we unbind after we're
|
// Make sure that we unbind the mConnection even on exceptions in the
|
||||||
// done with our work.
|
// task provided by the subclass.
|
||||||
mContext.unbindService(mConnection);
|
try {
|
||||||
} catch (RuntimeException e) {
|
// Each ServiceProxy handles just one task, so we unbind after we're
|
||||||
// The exceptions that are thrown here look like IllegalStateException,
|
// done with our work.
|
||||||
// IllegalArgumentException and RuntimeException. Catching RuntimeException
|
mContext.unbindService(mConnection);
|
||||||
// which get them all. Reasons for these exceptions include services that
|
} catch (RuntimeException e) {
|
||||||
// have already been stopped or unbound. This can happen if the user ended
|
// The exceptions that are thrown here look like IllegalStateException,
|
||||||
// the activity that was using the service. This is harmless, but we've got
|
// IllegalArgumentException and RuntimeException. Catching
|
||||||
// to catch it.
|
// RuntimeException which get them all. Reasons for these exceptions
|
||||||
LogUtils.e(mTag, e, "RuntimeException when trying to unbind from service");
|
// include services that have already been stopped or unbound. This can
|
||||||
|
// happen if the user ended the activity that was using the service.
|
||||||
|
// This is harmless, but we've got to catch it.
|
||||||
|
LogUtils.e(mTag, e,
|
||||||
|
"RuntimeException when trying to unbind from service");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mTaskCompleted = true;
|
mTaskCompleted = true;
|
||||||
synchronized(mConnection) {
|
synchronized(mConnection) {
|
||||||
|
|
Loading…
Reference in New Issue