OSDN Git Service

Catch IAE from unbind onServiceDisconnected()
authorBernardo Rufino <brufino@google.com>
Thu, 5 Apr 2018 10:03:39 +0000 (11:03 +0100)
committerBernardo Rufino <brufino@google.com>
Thu, 5 Apr 2018 10:14:01 +0000 (10:14 +0000)
We still don't know the underlying cause of this, but we shouldn't crash
the system_server. Catching for now.

Bug: 74940472
Bug: 77574274
Test: m -j RunFrameworksServicesRoboTests
Change-Id: I36fc2e65f8766f6b8fd68104d8830b72668d84eb

services/backup/java/com/android/server/backup/transport/TransportClient.java

index fa881a9..e4dcb25 100644 (file)
@@ -439,8 +439,17 @@ public class TransportClient {
         synchronized (mStateLock) {
             log(Priority.ERROR, "Service disconnected: client UNUSABLE");
             setStateLocked(State.UNUSABLE, null);
-            // After unbindService() no calls back to mConnection
-            mContext.unbindService(mConnection);
+            try {
+                // After unbindService() no calls back to mConnection
+                mContext.unbindService(mConnection);
+            } catch (IllegalArgumentException e) {
+                // TODO: Investigate why this is happening
+                // We're UNUSABLE, so any calls to mConnection will be no-op, so it's safe to
+                // swallow this one
+                log(
+                        Priority.WARN,
+                        "Exception trying to unbind onServiceDisconnected(): " + e.getMessage());
+            }
         }
     }