summaryrefslogtreecommitdiff
path: root/services/backup/java
diff options
context:
space:
mode:
Diffstat (limited to 'services/backup/java')
-rw-r--r--services/backup/java/com/android/server/backup/transport/TransportConnection.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/services/backup/java/com/android/server/backup/transport/TransportConnection.java b/services/backup/java/com/android/server/backup/transport/TransportConnection.java
index 1009787bebe5..67ebb3e6a1ef 100644
--- a/services/backup/java/com/android/server/backup/transport/TransportConnection.java
+++ b/services/backup/java/com/android/server/backup/transport/TransportConnection.java
@@ -658,11 +658,13 @@ public class TransportConnection {
* This class is a proxy to TransportClient methods that doesn't hold a strong reference to the
* TransportClient, allowing it to be GC'ed. If the reference was lost it logs a message.
*/
- private static class TransportConnectionMonitor implements ServiceConnection {
+ @VisibleForTesting
+ static class TransportConnectionMonitor implements ServiceConnection {
private final Context mContext;
private final WeakReference<TransportConnection> mTransportClientRef;
- private TransportConnectionMonitor(Context context,
+ @VisibleForTesting
+ TransportConnectionMonitor(Context context,
TransportConnection transportConnection) {
mContext = context;
mTransportClientRef = new WeakReference<>(transportConnection);
@@ -704,7 +706,13 @@ public class TransportConnection {
/** @see TransportConnection#finalize() */
private void referenceLost(String caller) {
- mContext.unbindService(this);
+ try {
+ mContext.unbindService(this);
+ } catch (IllegalArgumentException e) {
+ TransportUtils.log(Priority.WARN, TAG,
+ caller + " called but unbindService failed: " + e.getMessage());
+ return;
+ }
TransportUtils.log(
Priority.INFO,
TAG,